summaryrefslogtreecommitdiff
path: root/tinyusb/device/usbd_dcd.h
diff options
context:
space:
mode:
authorhathach <[email protected]>2013-11-21 12:47:55 +0700
committerhathach <[email protected]>2013-11-21 12:47:55 +0700
commit6887e5e642c71666d622d28b52e1d32fea67982c (patch)
tree8bbb974398b88df45a16e1076c9d06ddb2814c3c /tinyusb/device/usbd_dcd.h
parentd94efa60d62a6b6b1beecaf823ab67648563ea52 (diff)
refractor usbd-dcd callback, add bus event isr
Diffstat (limited to 'tinyusb/device/usbd_dcd.h')
-rw-r--r--tinyusb/device/usbd_dcd.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/tinyusb/device/usbd_dcd.h b/tinyusb/device/usbd_dcd.h
index e72cdf060..8fbcc317c 100644
--- a/tinyusb/device/usbd_dcd.h
+++ b/tinyusb/device/usbd_dcd.h
@@ -55,24 +55,31 @@
extern "C" {
#endif
-#define USBD_MAX_INTERFACE 16 // TODO refractor later
-#define USBD_MAX_ENDPOINT 32 // TODO refractor later
+enum {
+ USBD_INTERFACE_NUM_MAX = 16 // USB specs specify up to 16 endpoints per device
+};
+typedef enum {
+ USBD_BUS_EVENT_RESET = 1,
+ USBD_BUS_EVENT_UNPLUGGED,
+ USBD_BUS_EVENT_SUSPENDED
+}usbd_bus_event_type_t;
typedef struct {
volatile uint8_t state;
uint8_t is_waiting_control_xfer; // set if task is waiting for control xfer to complete to proceed
tusb_control_request_t control_request;
- uint8_t interface2class[USBD_MAX_INTERFACE]; // determine interface number belongs to which class
+ uint8_t interface2class[USBD_INTERFACE_NUM_MAX]; // determine interface number belongs to which class
}usbd_device_info_t;
extern usbd_device_info_t usbd_devices[CONTROLLER_DEVICE_NUMBER];
//--------------------------------------------------------------------+
// callback from DCD ISR
//--------------------------------------------------------------------+
-void usbd_xfer_isr(endpoint_handle_t edpt_hdl, tusb_event_t event, uint32_t xferred_bytes);
-void usbd_bus_reset(uint32_t coreid);
+void usbd_dcd_bus_event_isr(uint8_t coreid, usbd_bus_event_type_t bus_event);
void usbd_setup_received_isr(uint8_t coreid, tusb_control_request_t * p_request);
+void usbd_xfer_isr(endpoint_handle_t edpt_hdl, tusb_event_t event, uint32_t xferred_bytes);
+
#ifdef __cplusplus
}