1.1.6.4.17 DRV_SDMMC_EVENT_HANDLER Typedef

C

typedef SYS_MEDIA_EVENT_HANDLER DRV_SDMMC_EVENT_HANDLER;

Summary

Pointer to a SDMMCDriver Event handler function

Description

This data type defines the required function signature for the SDMMC event handling callback function. A client must register a pointer to an event handling function whose function signature (parameter and return value types) match the types specified by this function pointer in order to receive event calls back from the driver.

If the event is DRV_SDMMC_EVENT_COMMAND_COMPLETE, it means that the write or a read operation was completed successfully.

If the event is DRV_SDMMC_EVENT_COMMAND_ERROR, it means that the operation was not completed successfully.

The context parameter contains the handle to the client context, provided at the time the event handling function was registered using the DRV_SDMMC_EventHandlerSet function. This context handle value is passed back to the client as the "context" parameter. It can be any value necessary to identify the client context or instance (such as a pointer to the client's data) instance of the client that made the read/write request.

Parameters

ParamDescription
eventIdentifies the type of event
commandHandleHandle returned from the Read/Write requests
contextValue identifying the context of the application that registered the event handling function

Returns

None.

Example

void APP_MySDMMCEventHandler
(
    DRV_SDMMC_EVENT event,
    DRV_SDMMC_COMMAND_HANDLE commandHandle,
    uintptr_t context
)
{
    MY_APP_DATA_STRUCT* pAppData = (MY_APP_DATA_STRUCT* ) context;
    
    switch(event)
    {
        case DRV_SDMMC_EVENT_COMMAND_COMPLETE:
        {
            // Handle the completed buffer.
            break;
        }
        
        case DRV_SDMMC_EVENT_COMMAND_ERROR:
        default:
        {
            // Handle error.
            break;
        }
    }
}

Remarks

Refer sys_media.h for definition of SYS_MEDIA_EVENT_HANDLER.