34 lines
999 B
C
34 lines
999 B
C
#ifndef CORE_USB_USB_CALLBACK_EVENT
|
|
#define CORE_USB_USB_CALLBACK_EVENT
|
|
|
|
#include <stdint.h>
|
|
|
|
#include "usb_device_types.h"
|
|
|
|
typedef enum {
|
|
USB_CBEVT_OUT, // OUT event
|
|
USB_CBEVT_IN, // IN event
|
|
USB_CBEVT_UNKNOWN_REQ // unknown request on a control endpoint
|
|
} USB_CallbackEventType;
|
|
|
|
typedef enum {
|
|
USB_CBEVST_IN_NONE = 0, // no subtype
|
|
USB_CBEVST_IN_REQ // IN request was received but could not be responded
|
|
} USB_CallbackEventSubType;
|
|
|
|
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
|
|
} USB_CallbackEvent;
|
|
|
|
#endif /* CORE_USB_USB_CALLBACK_EVENT */
|