CY8CKIT-062-WIFI-BT BSP
Functions

General Description

Functions

void SDIO_Init (stc_sdio_irq_cb_t *pfuCb)
 
en_sdio_result_t SDIO_SendCommandAndWait (stc_sdio_cmd_t *pstcCmd)
 
void SDIO_EnableIntClock (void)
 
void SDIO_DisableIntClock (void)
 
void SDIO_EnableSdClk (void)
 
void SDIO_DisableSdClk (void)
 
void SDIO_SetSdClkFrequency (uint32_t u32SdClkFreqHz)
 
void SDIO_Reset (void)
 
void SDIO_EnableChipInt (void)
 
void SDIO_DisableChipInt (void)
 
void SDIO_Free (void)
 
void SDIO_SendCommand (stc_sdio_cmd_config_t *pstcCmdConfig)
 
en_sdio_result_t SDIO_GetResponse (uint8_t bCmdIndexCheck, uint8_t bCmdCrcCheck, uint8_t u8CmdIdx, uint32_t *pu32Response, uint8_t *pu8ResponseBuf)
 
void SDIO_InitDataTransfer (stc_sdio_data_config_t *pstcDataConfig)
 
en_sdio_result_t SDIO_CheckForEvent (en_sdio_event_t enEventType)
 
uint8_t SDIO_CalculateCrc7 (uint8_t *pu8Data, uint8_t pu8Size)
 
void SDIO_SetBlockSize (uint8_t u8ByteCount)
 
void SDIO_SetNumBlocks (uint8_t u8BlockCount)
 
void SDIO_SetupDMA (void)
 
void SDIO_IRQ (void)
 
void SDIO_READ_DMA_IRQ (void)
 
void SDIO_WRITE_DMA_IRQ (void)
 
void SDIO_Crc7Init (void)
 
cy_en_syspm_status_t SDIO_DeepSleepCallback (cy_stc_syspm_callback_params_t *params, cy_en_syspm_callback_mode_t mode)
 

Function Documentation

◆ SDIO_Init()

void SDIO_Init ( stc_sdio_irq_cb_t *  pfuCb)

Initializes the SDIO hardware

Parameters
pfuCbPointer to structure that holds pointers to callback function see stc_sdio_irq_cb_t.
Note
Sets SD Clock Frequency to 400 kHz

◆ SDIO_SendCommandAndWait()

en_sdio_result_t SDIO_SendCommandAndWait ( stc_sdio_cmd_t *  pstcCmd)

This function sends a command on the command channel and waits for that command to finish before returning. If a Command 53 is issued this function will handle all of the data transfer and wait to return until it is done.

Parameters
pstcCmdPointer command configuration structure see stc_sdio_cmd_t.
Returns
en_sdio_result_t

◆ SDIO_EnableIntClock()

void SDIO_EnableIntClock ( void  )

Enable Internal clock for the block

◆ SDIO_DisableIntClock()

void SDIO_DisableIntClock ( void  )

Enable Disable clock for the block

◆ SDIO_EnableSdClk()

void SDIO_EnableSdClk ( void  )

Enable SD Clock out to pin

◆ SDIO_DisableSdClk()

void SDIO_DisableSdClk ( void  )

Disable SD Clock out to the pin

◆ SDIO_SetSdClkFrequency()

void SDIO_SetSdClkFrequency ( uint32_t  u32SdClkFreqHz)

Sets the frequency of the SD Clock

Parameters
u32SdClkFreqHzFrequency of SD Clock in Hz.
Note
Only an integer divider is used, so the desired frequency may not be meet

◆ SDIO_Reset()

void SDIO_Reset ( void  )

Reset the SDIO interface

◆ SDIO_EnableChipInt()

void SDIO_EnableChipInt ( void  )

Enables the SDIO Chip Int by setting the mask bit

◆ SDIO_DisableChipInt()

void SDIO_DisableChipInt ( void  )

Enables the SDIO Chip Int by setting the mask bit

◆ SDIO_Free()

void SDIO_Free ( void  )

Frees any system resources that were allocated by the SDIO driver.

◆ SDIO_SendCommand()

void SDIO_SendCommand ( stc_sdio_cmd_config_t *  pstcCmdConfig)

Send an SDIO command, don't wait for it to finish.

Parameters
pstcCmdConfigCommand configuration structure. See stc_sdio_cmd_config_t.

◆ SDIO_GetResponse()

en_sdio_result_t SDIO_GetResponse ( uint8_t  bCmdIndexCheck,
uint8_t  bCmdCrcCheck,
uint8_t  u8cmdIdx,
uint32_t *  pu32Response,
uint8_t *  pu8ResponseBuf 
)

Takes a 6 byte response buffer, and extracts the 32 bit response, also checks for index errors, CRC errors, and end bit errors.

Parameters
bCmdIndexCheckIf True check for index errors
bCmdCrcCheckIf True check for CRC errors
u8cmdIdxCommand index, used for checking the index error
pu32Responselocation to store 32 bit response
pu8ResponseBufbuffer that holds the 6 bytes of response data
Returns
en_sdio_result_t

◆ SDIO_InitDataTransfer()

void SDIO_InitDataTransfer ( stc_sdio_data_config_t *  pstcDataConfig)

Configure the data channel for a data transfer. For a write this doesn't start the write, that must be done separately after the response is received.

Parameters
pstcDataConfigData configuration structure. See stc_sdio_data_config_t

◆ SDIO_CheckForEvent()

en_sdio_result_t SDIO_CheckForEvent ( en_sdio_event_t  enEventType)

Checks to see if a specific event has occurred such a command complete or transfer complete.

Parameters
enEventTypeThe type of event to check for. See en_sdio_event_t.
Returns
en_sdio_result_t

◆ SDIO_CalculateCrc7()

uint8_t SDIO_CalculateCrc7 ( uint8_t *  pu8Data,
uint8_t  u8Size 
)

Calculate the 7 bit CRC for the command channel

Parameters
pu8DataData to calculate CRC on
u8SizeNumber of bytes to calculate CRC on
Returns
CRC
Note
This code was copied from http://www.barrgroup.com/Embedded-Systems/How-To/CRC-Calculation-C-Code

◆ SDIO_SetBlockSize()

void SDIO_SetBlockSize ( uint8_t  u8ByteCount)

Sets the size of each block

Parameters
u8ByteCountSize of the block

◆ SDIO_SetNumBlocks()

void SDIO_SetNumBlocks ( uint8_t  u8BlockCount)

Sets the number of blocks to send

Parameters
u8BlockCountSize of the block

◆ SDIO_SetupDMA()

void SDIO_SetupDMA ( void  )

Configures the DMA for the SDIO block

◆ SDIO_IRQ()

void SDIO_IRQ ( void  )

SDIO interrupt, checks for events, and calls callbacks

◆ SDIO_READ_DMA_IRQ()

void SDIO_READ_DMA_IRQ ( void  )

SDIO DMA Read interrupt, checks counts and toggles to other descriptor if needed

◆ SDIO_WRITE_DMA_IRQ()

void SDIO_WRITE_DMA_IRQ ( void  )

SDIO DMA Write interrupt, checks counts and toggles to other descriptor if needed

◆ SDIO_Crc7Init()

void SDIO_Crc7Init ( void  )

Initialize 7-bit CRC Table

Note
This code was copied from http://www.barrgroup.com/Embedded-Systems/How-To/CRC-Calculation-C-Code

◆ SDIO_DeepSleepCallback()

cy_en_syspm_status_t SDIO_DeepSleepCallback ( cy_stc_syspm_callback_params_t *  params,
cy_en_syspm_callback_mode_t  mode 
)

Callback executed during Deep Sleep entry/exit

Parameters
paramsPointer to structure that holds callback parameters for this driver.
modeThe state transition mode that is currently happening.
Note
Saves/Restores SDIO UDB registers
Returns
CY_SYSPM_SUCCESS if the transition was successful, otherwise CY_SYSPM_FAIL