- doxygen styling added - CDC -> ACM refactor - type refactoring - examples categorized - flatUSB_config.h examples added
44 lines
1.4 KiB
C
44 lines
1.4 KiB
C
#ifndef CORE_USB_USB_CALLBACK_EVENT
|
|
#define CORE_USB_USB_CALLBACK_EVENT
|
|
|
|
#include <stdint.h>
|
|
|
|
#include "usb_device_types.h"
|
|
|
|
/**
|
|
* Callback event type.
|
|
*/
|
|
typedef enum {
|
|
USB_CBEVT_OUT, ///< OUT event
|
|
USB_CBEVT_IN, ///< IN event
|
|
USB_CBEVT_UNKNOWN_REQ ///< unknown request on a control endpoint
|
|
} Usb_CallbackEventType;
|
|
|
|
/**
|
|
* Callback event subtype.
|
|
*/
|
|
typedef enum {
|
|
USB_CBEVST_IN_NONE = 0, ///< No subtype
|
|
USB_CBEVST_IN_REQ ///< IN request was received but could not be responded
|
|
} Usb_CallbackEventSubType;
|
|
|
|
/**
|
|
* USB callback event.
|
|
*/
|
|
typedef struct {
|
|
uint8_t type : 4; ///< Event type
|
|
uint8_t subtype : 4; ///< Event subtype
|
|
uint8_t ep; ///< Endpoint number
|
|
uint8_t dir; ///< Endpoint direction
|
|
uint8_t size; ///< Size of accompaining data
|
|
const uint8_t *data; ///< Event data
|
|
const USB_SetupRequest *setup_request; ///< Corresponding setup request (if exists)
|
|
|
|
bool reply_valid; ///< Reply message is valid
|
|
const uint8_t *reply_data; ///< Reply data
|
|
uint8_t reply_size; ///< Reply size
|
|
bool arm_out_endpoint; ///< Automatically arm OUT endpoint at the end of the current transmission
|
|
} Usb_CallbackEvent;
|
|
|
|
#endif /* CORE_USB_USB_CALLBACK_EVENT */
|