# SD Host Events¶

group group_sd_host_macros_events

The constants below can be used with Cy_SD_Host_GetNormalInterruptStatus, Cy_SD_Host_ClearNormalInterruptStatus, Cy_SD_Host_GetErrorInterruptStatus and Cy_SD_Host_ClearErrorInterruptStatus functions.

Each event is encoded in a separate bit, and therefore it is possible to notify about multiple events.

Defines

CY_SD_HOST_CMD_COMPLETE

Command complete.

In SD/eMMC mode, this event is set after detecting the end bit of a response except for Auto CMD12 and Auto CMD23. This event is not generated when the Response Interrupt is disabled.

CY_SD_HOST_XFER_COMPLETE

Transfer complete.

This event is set when a read/write transfer and a command with the Busy Status are completed.

CY_SD_HOST_BGAP

Block gap.

This event is set when both read/write transactions are stopped at the block gap due to a Stop-at-Block-Gap Request.

CY_SD_HOST_DMA_INTERRUPT

DMA Interrupt.

This event is set if the Host Controller detects a SDMA Buffer Boundary during a transfer. For ADMA, the Host controller generates this interrupt by setting the Int field in the descriptor table. This interrupt is not generated after a Transfer Complete.

CY_SD_HOST_BUF_WR_READY

This event is set if the Buffer Write Enable changes from 0 to 1.

CY_SD_HOST_BUF_RD_READY

This event is set if the Buffer Read Enable changes from 0 to 1.

CY_SD_HOST_CARD_INSERTION

Card insertion.

This event is set if the Card Inserted in the Present State register changes from 0 to 1.

CY_SD_HOST_CARD_REMOVAL

Card removal.

This event is set if the Card Inserted in the Present State register changes from 1 to 0.

CY_SD_HOST_CARD_INTERRUPT

The Card interrupt.

This event reflects the synchronized value of DAT[1] Interrupt Input for SD Mode

CY_SD_HOST_FX_EVENT

FX event.

This status is set when R[14] of the response register is set to 1 and Response Type R1/R5 is set to 0 in the Transfer Mode register. This interrupt is used with the response check function.

CY_SD_HOST_CQE_EVENT

Command Queuing event.

This status is set if a Command Queuing/Crypto related event has occurred in eMMC/SD mode.

CY_SD_HOST_ERR_INTERRUPT

Error Interrupt.

If any of the bits in the Error Interrupt Status register are set, then this bit is set.

CY_SD_HOST_CMD_TOUT_ERR

Command timeout error.

In SD/eMMC Mode, this event is set only if no response is returned within 64 SD clock cycles from the end bit of the command. If the Host Controller detects a CMD line conflict, along with Command CRC Error bit, this event is set to 1, without waiting for 64 SD/eMMC card clock cycles.

CY_SD_HOST_CMD_CRC_ERR

Command CRC error.

A Command CRC Error is generated in SD/eMMC mode when:

1. A response is returned and the Command Timeout Error is set to 0 (indicating no timeout), this bit is set to 1 when detecting a CRC error in the command response.

2. The Host Controller detects a CMD line conflict by monitoring the CMD line when a command is issued. If the Host Controller drives the CMD line to level 1, but detects level 0 on the CMD line at the next SD clock edge, then the Host Controller aborts the command (stop driving CMD line) and sets this bit to 1. The Command Timeout Error is also set to 1 to distinguish a CMD line conflict.

CY_SD_HOST_CMD_END_BIT_ERR

Command End Bit error.

This bit is set after detecting that the end bit of a command response is 0 in SD/eMMC mode.

CY_SD_HOST_CMD_IDX_ERR

Command Index error.

This bit is set if a Command Index error occurs in the command response in SD/eMMC mode.

CY_SD_HOST_DATA_TOUT_ERR

Data Timeout error.

This bit is set in SD/eMMC mode when detecting one of the following timeout conditions:

• Busy timeout for R1b, R5b type

• Busy timeout after Write CRC status

• Write CRC Status timeout

CY_SD_HOST_DATA_CRC_ERR

Data CRC error.

This error occurs in SD/eMMC mode after detecting a CRC error while transferring read data that uses the DAT line, after detecting the Write CRC status having a value other than 010 or when writing a CRC status timeout.

CY_SD_HOST_DATA_END_BIT_ERR

Data End Bit error.

This error occurs in SD/eMMC mode either when detecting 0 at the end bit position of read data that uses the DAT line or at the end bit position of the CRC status.

CY_SD_HOST_CUR_LMT_ERR

Current Limit error.

The SD Host driver does not support this function, this bit is always set to 0.

CY_SD_HOST_AUTO_CMD_ERR

Auto CMD error.

This error status is used by Auto CMD12 and Auto CMD23 in SD/eMMC mode. This bit is set after detecting that any of the bits D00 to D05 in the Auto CMD Error Status register has changed from 0 to 1. D07 is effective in case for Auto CMD12. The Auto CMD Error Status register is valid while this bit is set to 1 and may be cleared by clearing this bit.

CY_SD_HOST_ADMA_ERR

This bit is set when the Host Controller detects an error during an ADMA-based data transfer. The possible reasons for an error:

• An error response is received from the System bus;

• CQE Task or Transfer descriptors are invalid. When an error occurs, the state of the ADMA is saved in the ADMA Error Status register.

CY_SD_HOST_TUNING_ERR

Tuning error.

The SD Host driver does not support this function.

CY_SD_HOST_RESP_ERR

Response error.

Host Controller Version 4.00 supports the response error check function to avoid overhead of the response error check by Host Driver during DMA execution. If the Response Error Check Enable is set to 1 in the Transfer Mode register, the Host Controller checks R1 or R5 response. If an error is detected in a response, this bit is set to 1. This is applicable in SD/eMMC mode.

CY_SD_HOST_BOOT_ACK_ERR

Boot Acknowledgement error.

This bit is set when there is a timeout for boot acknowledgement or after detecting the boot ACK status having a value other than 010. This is applicable only when boot acknowledgement is expected in eMMC mode.