Functions | |
cy_en_sd_host_status_t | Cy_SD_Host_Init (SDHC_Type *base, const cy_stc_sd_host_init_config_t *config, cy_stc_sd_host_context_t *context) |
Initializes the SD host module. More... | |
void | Cy_SD_Host_DeInit (SDHC_Type *base) |
Restores the SD Host block registers back to default. More... | |
void | Cy_SD_Host_Enable (SDHC_Type *base) |
Enables the SD host block. More... | |
void | Cy_SD_Host_Disable (SDHC_Type *base) |
Disables the SD host block. More... | |
__STATIC_INLINE void | Cy_SD_Host_EnableSdClk (SDHC_Type *base) |
Enables the SD clock (SD host drives the SDCLK line). More... | |
__STATIC_INLINE void | Cy_SD_Host_DisableSdClk (SDHC_Type *base) |
Disables the SD clock (The SD Host doesn't drive the SDCLK line). More... | |
cy_en_sd_host_status_t | Cy_SD_Host_SetSdClkDiv (SDHC_Type *base, uint16_t clkDiv) |
Changes the speed of the SD bus. More... | |
bool | Cy_SD_Host_IsWpSet (SDHC_Type const *base) |
Returns the state of the write protect switch on the SD card. More... | |
cy_en_sd_host_status_t | Cy_SD_Host_SetHostBusWidth (SDHC_Type *base, cy_en_sd_host_bus_width_t width) |
Only changes the bus width on the host side. More... | |
cy_en_sd_host_status_t | Cy_SD_Host_SetBusWidth (SDHC_Type *base, cy_en_sd_host_bus_width_t width, cy_stc_sd_host_context_t const *context) |
Sends out the SD bus width changing command. More... | |
cy_en_sd_host_status_t | Cy_SD_Host_SetHostSpeedMode (SDHC_Type *base, cy_en_sd_host_bus_speed_mode_t speedMode) |
Only updates the host register to indicate bus speed mode. More... | |
cy_en_sd_host_status_t | Cy_SD_Host_SetBusSpeedMode (SDHC_Type *base, cy_en_sd_host_bus_speed_mode_t speedMode, cy_stc_sd_host_context_t const *context) |
Negotiates with the card to change the bus speed mode of the card and the host. More... | |
cy_en_sd_host_status_t | Cy_SD_Host_SelBusVoltage (SDHC_Type *base, bool enable18VSignal, cy_stc_sd_host_context_t *context) |
Negotiates with the SD card to change the bus signaling level to 1.8V. More... | |
void | Cy_SD_Host_EnableCardVoltage (SDHC_Type *base) |
Sets the card_if_pwr_en pin high. More... | |
void | Cy_SD_Host_DisableCardVoltage (SDHC_Type *base) |
Sets the card_if_pwr_en pin low. More... | |
cy_en_sd_host_status_t | Cy_SD_Host_GetResponse (SDHC_Type const *base, uint32_t *responsePtr, bool largeResponse) |
This function reads the response register from the last completed command. More... | |
cy_en_sd_host_status_t | Cy_SD_Host_SendCommand (SDHC_Type *base, cy_stc_sd_host_cmd_config_t const *config) |
Starts sending a command on the SD bus. More... | |
cy_en_sd_host_status_t | Cy_SD_Host_InitDataTransfer (SDHC_Type *base, cy_stc_sd_host_data_config_t const *dataConfig) |
Initializes the SD block for a data transfer. More... | |
__STATIC_INLINE uint32_t | Cy_SD_Host_BufferRead (SDHC_Type const *base) |
Reads 32-bits of data from the read buffer. More... | |
__STATIC_INLINE cy_en_sd_host_status_t | Cy_SD_Host_BufferWrite (SDHC_Type *base, uint32_t data) |
Writes 32-bits of data into the write buffer. More... | |
void | Cy_SD_Host_ChangeIoVoltage (SDHC_Type *base, cy_en_sd_host_io_voltage_t ioVoltage) |
Changes the logic level on the sd_io_volt_sel line. More... | |
__STATIC_INLINE void | Cy_SD_Host_StopAtBlockGap (SDHC_Type *base) |
Commands SD host to stop transmitting at the next block gap. More... | |
__STATIC_INLINE void | Cy_SD_Host_ContinueFromBlockGap (SDHC_Type *base) |
Commands SD host to continue transmitting after stopping at the block gap. More... | |
__STATIC_INLINE uint32_t | Cy_SD_Host_GetAutoCmdErrStatus (SDHC_Type const *base) |
Gets the SD host error status of the auto command. More... | |
__STATIC_INLINE cy_en_sd_host_status_t | Cy_SD_Host_EnableAutoCmd23 (SDHC_Type *base) |
If the card supports AutoCmd23 call this function to enable it in the host. More... | |
__STATIC_INLINE void | Cy_SD_Host_DisableAutoCmd23 (SDHC_Type *base) |
Removes support for AutoCmd23 if it was previously set. More... | |
__STATIC_INLINE cy_en_sd_host_status_t | Cy_SD_Host_EnableAsyncInterrupt (SDHC_Type *base) |
Enables the Asynchronous Interrupt for SDIO cards. More... | |
__STATIC_INLINE void | Cy_SD_Host_DisableAsyncInterrupt (SDHC_Type *base) |
Removes the support for the Asynchronous Interrupt if it was previously set. More... | |
__STATIC_INLINE uint32_t | Cy_SD_Host_GetAdmaErrorStatus (SDHC_Type const *base) |
Returns the ADMA Error Status register. More... | |
__STATIC_INLINE void | Cy_SD_Host_EMMC_Reset (SDHC_Type *base) |
Resets the eMMC card. More... | |
cy_en_sd_host_status_t | Cy_SD_Host_AbortTransfer (SDHC_Type *base, cy_stc_sd_host_context_t const *context) |
Calling this function causes abortion of the currently executing command with data. More... | |
cy_en_sd_host_status_t | Cy_SD_Host_WriteProtect (SDHC_Type *base, cy_en_sd_host_write_protect_t writeProtect, cy_stc_sd_host_context_t *context) |
Write protects the blocks of data from the SD card. More... | |
uint32_t | Cy_SD_Host_GetCardStatus (SDHC_Type *base, cy_stc_sd_host_context_t const *context) |
Returns the card status. More... | |
cy_en_sd_host_status_t | Cy_SD_Host_GetSdStatus (SDHC_Type *base, uint32_t *sdStatus, cy_stc_sd_host_context_t const *context) |
Returns the SD status from the card. More... | |
uint32_t | Cy_SD_Host_GetOcr (SDHC_Type *base, cy_stc_sd_host_context_t const *context) |
Reads the Operating Condition Register (OCR) register from the card. More... | |
cy_en_sd_host_status_t | Cy_SD_Host_GetCid (SDHC_Type *base, uint32_t *cid) |
Returns the Card Identification Register (CID) contents. More... | |
cy_en_sd_host_status_t | Cy_SD_Host_GetCsd (SDHC_Type *base, uint32_t *csd, cy_stc_sd_host_context_t *context) |
Returns the Card Specific Data (CSD) register contents. More... | |
cy_en_sd_host_status_t | Cy_SD_Host_GetExtCsd (SDHC_Type *base, uint32_t *extCsd, cy_stc_sd_host_context_t *context) |
Returns the EXTCSD Register contents. More... | |
uint32_t | Cy_SD_Host_GetRca (SDHC_Type *base) |
Reads the Relative Card Address (RCA) register from the card. More... | |
cy_en_sd_host_status_t | Cy_SD_Host_GetScr (SDHC_Type *base, uint32_t *scr, cy_stc_sd_host_context_t const *context) |
Returns the SD Card Configuration Register (SCR) Register contents. More... | |
uint32_t | Cy_SD_Host_GetPresentState (SDHC_Type const *base) |
Returns the values of the present state register. More... | |
bool | Cy_SD_Host_IsCardConnected (SDHC_Type const *base) |
Checks to see if a card is currently connected. More... | |
void | Cy_SD_Host_SoftwareReset (SDHC_Type *base, cy_en_sd_host_reset_t reset) |
Issues the software reset command to the SD card. More... | |
cy_en_syspm_status_t | Cy_SD_Host_DeepSleepCallback (cy_stc_syspm_callback_params_t *callbackParams, cy_en_syspm_callback_mode_t mode) |
This function handles the transition of the SD Host into and out of Deep Sleep mode. More... | |
cy_en_sd_host_status_t Cy_SD_Host_Init | ( | SDHC_Type * | base, |
const cy_stc_sd_host_init_config_t * | config, | ||
cy_stc_sd_host_context_t * | context | ||
) |
Initializes the SD host module.
*base | The SD host registers structure pointer. |
config | The SD host module configuration. |
context | The pointer to the context structure cy_stc_sd_host_context_t allocated by the user. The structure is used during the SD host operation for internal configuration and data retention. The user must not modify anything in this structure. If only the SD host functions which do not require context will be used, pass NULL as the pointer to the context. |
void Cy_SD_Host_DeInit | ( | SDHC_Type * | base | ) |
Restores the SD Host block registers back to default.
*base | The SD host registers structure pointer. |
void Cy_SD_Host_Enable | ( | SDHC_Type * | base | ) |
Enables the SD host block.
*base | The SD host registers structure pointer. |
void Cy_SD_Host_Disable | ( | SDHC_Type * | base | ) |
Disables the SD host block.
*base | The SD host registers structure pointer. |
__STATIC_INLINE void Cy_SD_Host_EnableSdClk | ( | SDHC_Type * | base | ) |
Enables the SD clock (SD host drives the SDCLK line).
*base | The SD host registers structure pointer. |
__STATIC_INLINE void Cy_SD_Host_DisableSdClk | ( | SDHC_Type * | base | ) |
Disables the SD clock (The SD Host doesn't drive the SDCLK line).
*base | The SD host registers structure pointer. |
cy_en_sd_host_status_t Cy_SD_Host_SetSdClkDiv | ( | SDHC_Type * | base, |
uint16_t | clkDiv | ||
) |
Changes the speed of the SD bus.
This function should be called along with Cy_SD_Host_SetHostSpeedMode to configure the bus correctly.
*base | The SD host registers structure pointer. |
clkDiv | The clock divider for the SD clock. |
bool Cy_SD_Host_IsWpSet | ( | SDHC_Type const * | base | ) |
Returns the state of the write protect switch on the SD card.
*base | The SD host registers structure pointer. |
cy_en_sd_host_status_t Cy_SD_Host_SetHostBusWidth | ( | SDHC_Type * | base, |
cy_en_sd_host_bus_width_t | width | ||
) |
Only changes the bus width on the host side.
It doesn't change the bus width on the card side. To change the bus width on the card, call Cy_SD_Host_SetBusWidth().
*base | The SD host registers structure pointer. |
width | The width of the data bus. |
cy_en_sd_host_status_t Cy_SD_Host_SetBusWidth | ( | SDHC_Type * | base, |
cy_en_sd_host_bus_width_t | width, | ||
cy_stc_sd_host_context_t const * | context | ||
) |
Sends out the SD bus width changing command.
*base | The SD host registers structure pointer. |
width | The width of the data bus. |
context | The pointer to the context structure cy_stc_sd_host_context_t allocated by the user. The structure is used during the SD host operation for internal configuration and data retention. The user must not modify anything in this structure. If only the SD host functions which do not require context will be used, pass NULL as the pointer to the context. |
cy_en_sd_host_status_t Cy_SD_Host_SetHostSpeedMode | ( | SDHC_Type * | base, |
cy_en_sd_host_bus_speed_mode_t | speedMode | ||
) |
Only updates the host register to indicate bus speed mode.
This function doesn't change the speed on the bus, or change anything in the card.
*base | The SD host registers structure pointer. |
speedMode | Bus Speed mode. |
cy_en_sd_host_status_t Cy_SD_Host_SetBusSpeedMode | ( | SDHC_Type * | base, |
cy_en_sd_host_bus_speed_mode_t | speedMode, | ||
cy_stc_sd_host_context_t const * | context | ||
) |
Negotiates with the card to change the bus speed mode of the card and the host.
It doesn't change the SD clock frequency that must be done separately.
*base | The SD host registers structure pointer. |
speedMode | Bus speed mode. |
context | The pointer to the context structure cy_stc_sd_host_context_t allocated by the user. The structure is used during the SD host operation for internal configuration and data retention. The user must not modify anything in this structure. If only the SD host functions which do not require context will be used, pass NULL as the pointer to the context. |
cy_en_sd_host_status_t Cy_SD_Host_SelBusVoltage | ( | SDHC_Type * | base, |
bool | enable18VSignal, | ||
cy_stc_sd_host_context_t * | context | ||
) |
Negotiates with the SD card to change the bus signaling level to 1.8V.
After this function is called, the card is in the ready state.
*base | The SD host registers structure pointer. |
enable18VSignal | If true, use the 1.8V signaling, false - use the 3.3V signaling. |
context | The pointer to the context structure cy_stc_sd_host_context_t allocated by the user. The structure is used during the SD host operation for internal configuration and data retention. The user must not modify anything in this structure. If only the SD host functions which do not require context will be used, pass NULL as the pointer to the context. |
void Cy_SD_Host_EnableCardVoltage | ( | SDHC_Type * | base | ) |
Sets the card_if_pwr_en pin high.
This pin can be used to enable a voltage regulator used to power the card.
*base | The SD host registers structure pointer. |
void Cy_SD_Host_DisableCardVoltage | ( | SDHC_Type * | base | ) |
Sets the card_if_pwr_en pin low.
This pin can be used to disable a voltage regulator used to power the card.
*base | The SD host registers structure pointer. |
cy_en_sd_host_status_t Cy_SD_Host_GetResponse | ( | SDHC_Type const * | base, |
uint32_t * | responsePtr, | ||
bool | largeResponse | ||
) |
This function reads the response register from the last completed command.
*base | The SD host registers structure pointer. |
*responsePtr | The pointer to response data. |
largeResponse | If true, the response is 136 bits, false - 32 bits. |
cy_en_sd_host_status_t Cy_SD_Host_SendCommand | ( | SDHC_Type * | base, |
cy_stc_sd_host_cmd_config_t const * | config | ||
) |
Starts sending a command on the SD bus.
If the command uses the data lines Cy_SD_Host_InitDataTransfer() must be call first. This function returns before the command completes. To determine if the command is done, read the Normal Interrupt Status register and check the CMD_COMPLETE flag. To determine if the entire transfer is done check the XFER_COMPLETE flag. Also the interrupt is used and flags are set on these events in an ISR.
*base | The SD host registers structure pointer. |
*config | The configuration structure for the command. |
cy_en_sd_host_status_t Cy_SD_Host_InitDataTransfer | ( | SDHC_Type * | base, |
cy_stc_sd_host_data_config_t const * | dataConfig | ||
) |
Initializes the SD block for a data transfer.
It does not start a transfer. To start a transfer call Cy_SD_Host_SendCommand() after calling this function. If DMA is not used for data transfer, the buffer needs to be filled with data first if this is a write.
*base | The SD host registers structure pointer. |
dataConfig | The pointer to the data transfer configuration structure. |
__STATIC_INLINE uint32_t Cy_SD_Host_BufferRead | ( | SDHC_Type const * | base | ) |
Reads 32-bits of data from the read buffer.
Only use this function if not using SD block DMA to transfer data from buffer.
*base | The SD host registers structure pointer. |
__STATIC_INLINE cy_en_sd_host_status_t Cy_SD_Host_BufferWrite | ( | SDHC_Type * | base, |
uint32_t | data | ||
) |
Writes 32-bits of data into the write buffer.
Only use this function if not using SD block DMA to transfer data to buffer.
*base | The SD host registers structure pointer. |
data | Data to be written. |
void Cy_SD_Host_ChangeIoVoltage | ( | SDHC_Type * | base, |
cy_en_sd_host_io_voltage_t | ioVoltage | ||
) |
Changes the logic level on the sd_io_volt_sel line.
It assumes that this line is used to control a regulator connected to the VDDIO of the PSoC. This regulator allows for switching between the 3.3V and 1.8V signaling.
*base | The SD host registers structure pointer. |
ioVoltage | The voltage for IO. |
__STATIC_INLINE void Cy_SD_Host_StopAtBlockGap | ( | SDHC_Type * | base | ) |
Commands SD host to stop transmitting at the next block gap.
*base | The SD host registers structure pointer. |
__STATIC_INLINE void Cy_SD_Host_ContinueFromBlockGap | ( | SDHC_Type * | base | ) |
Commands SD host to continue transmitting after stopping at the block gap.
*base | The SD host registers structure pointer. |
__STATIC_INLINE uint32_t Cy_SD_Host_GetAutoCmdErrStatus | ( | SDHC_Type const * | base | ) |
Gets the SD host error status of the auto command.
*base | The SD host registers structure pointer. |
__STATIC_INLINE cy_en_sd_host_status_t Cy_SD_Host_EnableAutoCmd23 | ( | SDHC_Type * | base | ) |
If the card supports AutoCmd23 call this function to enable it in the host.
*base | The SD host registers structure pointer. |
__STATIC_INLINE void Cy_SD_Host_DisableAutoCmd23 | ( | SDHC_Type * | base | ) |
Removes support for AutoCmd23 if it was previously set.
*base | The SD host registers structure pointer. |
__STATIC_INLINE cy_en_sd_host_status_t Cy_SD_Host_EnableAsyncInterrupt | ( | SDHC_Type * | base | ) |
Enables the Asynchronous Interrupt for SDIO cards.
Set this only if the card supports this feature.
*base | The SD host registers structure pointer. |
__STATIC_INLINE void Cy_SD_Host_DisableAsyncInterrupt | ( | SDHC_Type * | base | ) |
Removes the support for the Asynchronous Interrupt if it was previously set.
*base | The SD host registers structure pointer. |
__STATIC_INLINE uint32_t Cy_SD_Host_GetAdmaErrorStatus | ( | SDHC_Type const * | base | ) |
Returns the ADMA Error Status register.
*base | The SD host registers structure pointer. |
__STATIC_INLINE void Cy_SD_Host_EMMC_Reset | ( | SDHC_Type * | base | ) |
Resets the eMMC card.
*base | The SD host registers structure pointer. |
cy_en_sd_host_status_t Cy_SD_Host_AbortTransfer | ( | SDHC_Type * | base, |
cy_stc_sd_host_context_t const * | context | ||
) |
Calling this function causes abortion of the currently executing command with data.
It doesn't issue a reset, that is the users responsibility.
*base | The SD host registers structure pointer. |
context | The pointer to the context structure cy_stc_sd_host_context_t allocated by the user. The structure is used during the SD host operation for internal configuration and data retention. The user must not modify anything in this structure. If only the SD host functions which do not require context will be used, pass NULL as the pointer to the context. |
cy_en_sd_host_status_t Cy_SD_Host_WriteProtect | ( | SDHC_Type * | base, |
cy_en_sd_host_write_protect_t | writeProtect, | ||
cy_stc_sd_host_context_t * | context | ||
) |
Write protects the blocks of data from the SD card.
This function should only be called after Cy_SD_Host_SDCard_Init()/eMMC_Init().
*base | The SD host registers structure pointer. |
writeProtect | cy_en_sd_host_write_protect_t. |
context | The pointer to the context structure cy_stc_sd_host_context_t allocated by the user. The structure is used during the SD host operation for internal configuration and data retention. The user must not modify anything in this structure. If only the SD host functions which do not require context will be used, pass NULL as the pointer to the context. |
uint32_t Cy_SD_Host_GetCardStatus | ( | SDHC_Type * | base, |
cy_stc_sd_host_context_t const * | context | ||
) |
Returns the card status.
*base | The SD host registers structure pointer. |
context | The pointer to the context structure cy_stc_sd_host_context_t allocated by the user. The structure is used during the SD host operation for internal configuration and data retention. The user must not modify anything in this structure. If only the SD host functions which do not require context will be used, pass NULL as the pointer to the context. |
cy_en_sd_host_status_t Cy_SD_Host_GetSdStatus | ( | SDHC_Type * | base, |
uint32_t * | sdStatus, | ||
cy_stc_sd_host_context_t const * | context | ||
) |
Returns the SD status from the card.
*base | The SD host registers structure pointer. |
*sdStatus | The pointer to where to store the SD status array. |
context | The pointer to the context structure cy_stc_sd_host_context_t allocated by the user. The structure is used during the SD host operation for internal configuration and data retention. The user must not modify anything in this structure. If only the SD host functions which do not require context will be used, pass NULL as the pointer to the context. |
uint32_t Cy_SD_Host_GetOcr | ( | SDHC_Type * | base, |
cy_stc_sd_host_context_t const * | context | ||
) |
Reads the Operating Condition Register (OCR) register from the card.
*base | The SD host registers structure pointer. |
context | The pointer to the context structure cy_stc_sd_host_context_t allocated by the user. The structure is used during the SD host operation for internal configuration and data retention. The user must not modify anything in this structure. If only the SD host functions which do not require context will be used, pass NULL as the pointer to the context. |
cy_en_sd_host_status_t Cy_SD_Host_GetCid | ( | SDHC_Type * | base, |
uint32_t * | cid | ||
) |
Returns the Card Identification Register (CID) contents.
*base | The SD host registers structure pointer. |
cid | The pointer to where to store the CID register. |
cy_en_sd_host_status_t Cy_SD_Host_GetCsd | ( | SDHC_Type * | base, |
uint32_t * | csd, | ||
cy_stc_sd_host_context_t * | context | ||
) |
Returns the Card Specific Data (CSD) register contents.
*base | The SD host registers structure pointer. |
*csd | The pointer to where to store the CSD register. |
context | The pointer to the context structure cy_stc_sd_host_context_t allocated by the user. The structure is used during the SD host operation for internal configuration and data retention. The user must not modify anything in this structure. If only the SD host functions which do not require context will be used, pass NULL as the pointer to the context. |
cy_en_sd_host_status_t Cy_SD_Host_GetExtCsd | ( | SDHC_Type * | base, |
uint32_t * | extCsd, | ||
cy_stc_sd_host_context_t * | context | ||
) |
Returns the EXTCSD Register contents.
This is only for EMMC cards. There are 512 bytes of data being read.
*base | The SD host registers structure pointer. |
*extCsd | The pointer to where to store the EXTCSD register. |
context | The pointer to the context structure cy_stc_sd_host_context_t allocated by the user. The structure is used during the SD host operation for internal configuration and data retention. The user must not modify anything in this structure. If only the SD host functions which do not require context will be used, pass NULL as the pointer to the context. |
uint32_t Cy_SD_Host_GetRca | ( | SDHC_Type * | base | ) |
Reads the Relative Card Address (RCA) register from the card.
*base | The SD host registers structure pointer. |
cy_en_sd_host_status_t Cy_SD_Host_GetScr | ( | SDHC_Type * | base, |
uint32_t * | scr, | ||
cy_stc_sd_host_context_t const * | context | ||
) |
Returns the SD Card Configuration Register (SCR) Register contents.
*base | The SD host registers structure pointer. |
*scr | The pointer to where to store the SCR register. |
context | The pointer to the context structure cy_stc_sd_host_context_t allocated by the user. The structure is used during the SD host operation for internal configuration and data retention. The user must not modify anything in this structure. If only the SD host functions which do not require context will be used, pass NULL as the pointer to the context. |
uint32_t Cy_SD_Host_GetPresentState | ( | SDHC_Type const * | base | ) |
Returns the values of the present state register.
*base | The SD host registers structure pointer. |
bool Cy_SD_Host_IsCardConnected | ( | SDHC_Type const * | base | ) |
Checks to see if a card is currently connected.
*base | The SD host registers structure pointer. |
void Cy_SD_Host_SoftwareReset | ( | SDHC_Type * | base, |
cy_en_sd_host_reset_t | reset | ||
) |
Issues the software reset command to the SD card.
*base | The SD host registers structure pointer. |
reset | The reset type. |
cy_en_syspm_status_t Cy_SD_Host_DeepSleepCallback | ( | cy_stc_syspm_callback_params_t * | callbackParams, |
cy_en_syspm_callback_mode_t | mode | ||
) |
This function handles the transition of the SD Host into and out of Deep Sleep mode.
It disables SD CLK before going to Deep Sleep mode and enables SD CLK after wake up from Deep Sleep mode. If the DAT line is active, or a read (write) transfer is being executed on the bus, the device cannot enter Deep Sleep mode.
This function must be called during execution of Cy_SysPm_CpuEnterDeepSleep. To do it, register this function as a callback before calling Cy_SysPm_CpuEnterDeepSleep : specify CY_SYSPM_DEEPSLEEP as the callback type and call Cy_SysPm_RegisterCallback.
callbackParams | The pointer to the callback parameters structure cy_stc_syspm_callback_params_t. |
mode | Callback mode, see cy_en_syspm_callback_mode_t |