2.5.4.11 USB_DEVICE_CDC_EVENT_HANDLER Type

C

typedef USB_DEVICE_CDC_EVENT_RESPONSE (* USB_DEVICE_CDC_EVENT_HANDLER)(USB_DEVICE_CDC_INDEX instanceIndex, USB_DEVICE_CDC_EVENT event, void * pData, uintptr_t context);

Description

USB Device CDC Event Handler Function Pointer Type.

This data type defines the required function signature of the USB Device CDC Function Driver event handling callback function. The application must register a pointer to a CDC Function Driver events handling function whose function signature (parameter and return value types) match the types specified by this function pointer in order to receive event call backs from the CDC Function Driver. The function driver will invoke this function with event relevant parameters. The description of the event handler function parameters is given here.

instanceIndex - Instance index of the CDC Function Driver that generated the event.

event - Type of event generated.

pData - This parameter should be type cast to an event specific pointer type based on the event that has occurred. Refer to the USB_DEVICE_CDC_EVENT enumeration description for more details.

context - Value identifying the context of the application that was registered along with the event handling function.

Remarks

The event handler function executes in the USB interrupt context when the USB Device Stack is configured for interrupt based operation. It is not advisable to call blocking functions or computationally intensive functions in the event handler. Where the response to a control transfer related event requires extended processing, the response to the control transfer should be deferred and the event handler should be allowed to complete execution.