EZ-USB FX3 Technical Reference Manual, Document Number: 001-76074 Rev. *F 209
Storage Ports
For bit definitions, refer to SDMMC_STATUS register on page 649, SDMMC_INTR register on page 651, and
SDMMC_INTR_MASK register on page 653.
CyU3PSibRegisterCbk can be used to register a callback function that will be called to provide a notification for storage-
related events such as card insertion/removal and data transfer completion; as well as for the status of the storage read/write
operations.
/* Register a callback for SIB events. */
CyU3PSibRegisterCbk (CyFxMscApplnSibCB);
void
CyFxMscApplnSibCB (
uint8_t portId,
CyU3PSibEventType evt,
CyU3PReturnStatus_t status)
{
CyU3PDmaSocketConfig_t sockConf;
if (evt == CY_U3P_SIB_EVENT_XFER_CPLT)
{
if (status != CY_U3P_SUCCESS)
{
glMscCmdStatus = 1;
glSensePtr[portId] = CY_FX_MSC_SENSE_CRC_ERROR;
/* Transfer has failed. Reset the DMA channel. */
if (glCmdDirection)
{
CyU3PDmaSocketGetConfig ((uint16_t)(CY_U3P_UIB_SOCKET_CONS_0 | CY_FX_M-
SC_EP_BULK_IN_SOCKET),
&sockConf);
glMscResidue -= sockConf.xferCount;
CyU3PDmaChannelReset (&glChHandleMscIn);
}
else
{
CyU3PDmaSocketGetConfig ((uint16_t)(CY_U3P_UIB_SOCKET_PROD_0 + CY_FX_M-
SC_EP_BULK_OUT_SOCKET),
&sockConf);
glMscResidue -= sockConf.xferCount;
CyU3PDmaChannelReset (&glChHandleMscOut);
}
}
else
{
glMscCmdStatus = 0;
glMscResidue = 0;
glSensePtr[portId] = CY_FX_MSC_SENSE_OK;
}
CyU3PEventSet (&glMscAppEvent, CY_FX_MSC_SIBCB_EVENT_FLAG, CYU3P_EVENT_OR);
}
if (evt == CY_U3P_SIB_EVENT_INSERT)
{
uint8_t i = 0;
CyU3PDebugPrint (2, "Insert event on port %d\r\n", portId);