diff options
| author | hathach <[email protected]> | 2018-03-03 16:24:43 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2018-03-03 16:24:43 +0700 |
| commit | 185b240f033fc692e3dfe1593895a9c28ee41c7b (patch) | |
| tree | ae9e82b2df3fd9d9c95c322e2479c09b54db2dce /tinyusb/device | |
| parent | 394302c8cb1b712d55929ae19805a96d560376db (diff) | |
rename usbd_dcd_bus_event_isr to hal_dcd_bus_event
Diffstat (limited to 'tinyusb/device')
| -rw-r--r-- | tinyusb/device/dcd.h | 22 | ||||
| -rw-r--r-- | tinyusb/device/dcd_lpc175x_6x.c | 8 | ||||
| -rw-r--r-- | tinyusb/device/dcd_lpc_11uxx_13uxx.c | 8 | ||||
| -rw-r--r-- | tinyusb/device/usbd.c | 5 | ||||
| -rw-r--r-- | tinyusb/device/usbd_dcd.h | 11 |
5 files changed, 29 insertions, 25 deletions
diff --git a/tinyusb/device/dcd.h b/tinyusb/device/dcd.h index 06e3f1976..925506a5a 100644 --- a/tinyusb/device/dcd.h +++ b/tinyusb/device/dcd.h @@ -49,6 +49,14 @@ extern "C" {
#endif
+typedef enum
+{
+ USBD_BUS_EVENT_RESET = 1,
+ USBD_BUS_EVENT_UNPLUGGED,
+ USBD_BUS_EVENT_SUSPENDED,
+ USBD_BUS_EVENT_RESUME
+}usbd_bus_event_type_t;
+
typedef struct {
uint8_t coreid;
uint8_t reserved; // TODO redundant, cannot be control as control uses separated API
@@ -68,15 +76,19 @@ static inline bool endpointhandle_is_equal(endpoint_handle_t x, endpoint_handle_ return (x.coreid == y.coreid) && (x.index == y.index) && (x.class_code == y.class_code);
}
-bool hal_dcd_init(uint8_t coreid);
void dcd_isr(uint8_t coreid);
//------------- Controller API -------------//
-void hal_dcd_connect (uint8_t coreid);
-void hal_dcd_disconnect (uint8_t coreid);
-void hal_dcd_set_address(uint8_t coreid, uint8_t dev_addr);
-void hal_dcd_set_config (uint8_t coreid, uint8_t config_num);
+bool hal_dcd_init (uint8_t coreid);
+void hal_dcd_connect (uint8_t coreid);
+void hal_dcd_disconnect (uint8_t coreid);
+void hal_dcd_set_address (uint8_t coreid, uint8_t dev_addr);
+void hal_dcd_set_config (uint8_t coreid, uint8_t config_num);
+
+/*------------- Event function -------------*/
+void hal_dcd_setup_received(uint8_t coreid, uint8_t const* p_request);
+void hal_dcd_bus_event(uint8_t coreid, usbd_bus_event_type_t bus_event);
//------------- PIPE API -------------//
bool dcd_pipe_control_xfer(uint8_t coreid, tusb_direction_t dir, uint8_t * p_buffer, uint16_t length, bool int_on_complete);
diff --git a/tinyusb/device/dcd_lpc175x_6x.c b/tinyusb/device/dcd_lpc175x_6x.c index f34da292c..3c82ae850 100644 --- a/tinyusb/device/dcd_lpc175x_6x.c +++ b/tinyusb/device/dcd_lpc175x_6x.c @@ -230,23 +230,23 @@ void dcd_isr(uint8_t coreid) if (dev_status_reg & SIE_DEV_STATUS_RESET_MASK)
{
bus_reset();
- usbd_dcd_bus_event_isr(0, USBD_BUS_EVENT_RESET);
+ hal_dcd_bus_event(0, USBD_BUS_EVENT_RESET);
}
if (dev_status_reg & SIE_DEV_STATUS_CONNECT_CHANGE_MASK)
{ // device is disconnected, require using VBUS (P1_30)
- usbd_dcd_bus_event_isr(0, USBD_BUS_EVENT_UNPLUGGED);
+ hal_dcd_bus_event(0, USBD_BUS_EVENT_UNPLUGGED);
}
if (dev_status_reg & SIE_DEV_STATUS_SUSPEND_CHANGE_MASK)
{
if (dev_status_reg & SIE_DEV_STATUS_SUSPEND_MASK)
{
- usbd_dcd_bus_event_isr(0, USBD_BUS_EVENT_SUSPENDED);
+ hal_dcd_bus_event(0, USBD_BUS_EVENT_SUSPENDED);
}
// else
// {
-// usbd_dcd_bus_event_isr(0, USBD_BUS_EVENT_RESUME);
+// hal_dcd_bus_event(0, USBD_BUS_EVENT_RESUME);
// }
}
}
diff --git a/tinyusb/device/dcd_lpc_11uxx_13uxx.c b/tinyusb/device/dcd_lpc_11uxx_13uxx.c index 34b0861e4..9d4ad702a 100644 --- a/tinyusb/device/dcd_lpc_11uxx_13uxx.c +++ b/tinyusb/device/dcd_lpc_11uxx_13uxx.c @@ -315,14 +315,14 @@ void dcd_isr(uint8_t coreid) if ( dev_cmd_stat & CMDSTAT_RESET_CHANGE_MASK) // bus reset
{
bus_reset();
- usbd_dcd_bus_event_isr(0, USBD_BUS_EVENT_RESET);
+ hal_dcd_bus_event(0, USBD_BUS_EVENT_RESET);
}
if (dev_cmd_stat & CMDSTAT_CONNECT_CHANGE_MASK)
{ // device disconnect
if (dev_cmd_stat & CMDSTAT_DEVICE_ADDR_MASK)
{ // debouncing as this can be set when device is powering
- usbd_dcd_bus_event_isr(0, USBD_BUS_EVENT_UNPLUGGED);
+ hal_dcd_bus_event(0, USBD_BUS_EVENT_UNPLUGGED);
}
}
@@ -334,13 +334,13 @@ void dcd_isr(uint8_t coreid) // Note: Host may delay more than 3 ms before and/or after bus reset before doing enumeration.
if (dev_cmd_stat & CMDSTAT_DEVICE_ADDR_MASK)
{
- usbd_dcd_bus_event_isr(0, USBD_BUS_EVENT_SUSPENDED);
+ hal_dcd_bus_event(0, USBD_BUS_EVENT_SUSPENDED);
}
}
}
// else
// { // resume signal
-// usbd_dcd_bus_event_isr(0, USBD_BUS_EVENT_RESUME);
+// hal_dcd_bus_event(0, USBD_BUS_EVENT_RESUME);
// }
// }
}
diff --git a/tinyusb/device/usbd.c b/tinyusb/device/usbd.c index 5908404da..351ea3cb3 100644 --- a/tinyusb/device/usbd.c +++ b/tinyusb/device/usbd.c @@ -409,12 +409,11 @@ static tusb_error_t get_descriptor(uint8_t coreid, tusb_control_request_t const //--------------------------------------------------------------------+
// USBD-DCD Callback API
//--------------------------------------------------------------------+
-void usbd_dcd_bus_event_isr(uint8_t coreid, usbd_bus_event_type_t bus_event)
+void hal_dcd_bus_event(uint8_t coreid, usbd_bus_event_type_t bus_event)
{
switch(bus_event)
{
case USBD_BUS_EVENT_RESET :
- case USBD_BUS_EVENT_UNPLUGGED :
memclr_(&usbd_devices[coreid], sizeof(usbd_device_info_t));
osal_queue_flush(usbd_queue_hdl);
osal_semaphore_reset(usbd_control_xfer_sem_hdl);
@@ -424,6 +423,8 @@ void usbd_dcd_bus_event_isr(uint8_t coreid, usbd_bus_event_type_t bus_event) }
break;
+ case USBD_BUS_EVENT_UNPLUGGED : break;
+
case USBD_BUS_EVENT_SUSPENDED:
usbd_devices[coreid].state = TUSB_DEVICE_STATE_SUSPENDED;
break;
diff --git a/tinyusb/device/usbd_dcd.h b/tinyusb/device/usbd_dcd.h index 8bc3a5fbd..a32fffae3 100644 --- a/tinyusb/device/usbd_dcd.h +++ b/tinyusb/device/usbd_dcd.h @@ -55,13 +55,7 @@ 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_RESUME
-}usbd_bus_event_type_t;
+
typedef struct {
volatile uint8_t state;
@@ -74,9 +68,6 @@ extern usbd_device_info_t usbd_devices[CONTROLLER_DEVICE_NUMBER]; //--------------------------------------------------------------------+
// callback from DCD ISR
//--------------------------------------------------------------------+
-void usbd_dcd_bus_event_isr(uint8_t coreid, usbd_bus_event_type_t bus_event);
-void hal_dcd_setup_received(uint8_t coreid, uint8_t const* p_request);
-
void usbd_xfer_isr(endpoint_handle_t edpt_hdl, tusb_event_t event, uint32_t xferred_bytes);
|
