summaryrefslogtreecommitdiff
path: root/tinyusb/device
diff options
context:
space:
mode:
authorhathach <[email protected]>2018-03-11 13:13:04 +0700
committerhathach <[email protected]>2018-03-11 13:13:04 +0700
commitd0a810317fe9943d34effc021591ff78516ace51 (patch)
treeb6884029d7d9ed6e2ab24cedb0bb438847e2c41b /tinyusb/device
parent276603fead99065ce89557dab6286ceec8ea9995 (diff)
rename dcd_* API to tusb_dcd_*
Diffstat (limited to 'tinyusb/device')
-rw-r--r--tinyusb/device/dcd_lpc175x_6x.c32
-rw-r--r--tinyusb/device/dcd_lpc_11uxx_13uxx.c34
-rw-r--r--tinyusb/device/usbd.c20
3 files changed, 43 insertions, 43 deletions
diff --git a/tinyusb/device/dcd_lpc175x_6x.c b/tinyusb/device/dcd_lpc175x_6x.c
index f6bdcaf41..4328fbf1c 100644
--- a/tinyusb/device/dcd_lpc175x_6x.c
+++ b/tinyusb/device/dcd_lpc175x_6x.c
@@ -122,7 +122,7 @@ static void bus_reset(void)
memclr_(&dcd_data, sizeof(dcd_data_t));
}
-bool hal_dcd_init(uint8_t port)
+bool tusb_dcd_init(uint8_t port)
{
(void) port;
@@ -188,7 +188,7 @@ static void endpoint_control_isr(void)
tusb_control_request_t control_request;
pipe_control_read(&control_request, 8); // TODO read before clear setup above
- hal_dcd_setup_received(0, (uint8_t*) &control_request);
+ tusb_dcd_setup_received(0, (uint8_t*) &control_request);
}
else if (endpoint_int_status & 0x03)
{
@@ -230,23 +230,23 @@ void hal_dcd_isr(uint8_t port)
if (dev_status_reg & SIE_DEV_STATUS_RESET_MASK)
{
bus_reset();
- hal_dcd_bus_event(0, USBD_BUS_EVENT_RESET);
+ tusb_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)
- hal_dcd_bus_event(0, USBD_BUS_EVENT_UNPLUGGED);
+ tusb_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)
{
- hal_dcd_bus_event(0, USBD_BUS_EVENT_SUSPENDED);
+ tusb_dcd_bus_event(0, USBD_BUS_EVENT_SUSPENDED);
}
// else
// {
-// hal_dcd_bus_event(0, USBD_BUS_EVENT_RESUME);
+// tusb_dcd_bus_event(0, USBD_BUS_EVENT_RESUME);
// }
}
}
@@ -280,19 +280,19 @@ void hal_dcd_isr(uint8_t port)
//--------------------------------------------------------------------+
// USBD API - CONTROLLER
//--------------------------------------------------------------------+
-void hal_dcd_connect(uint8_t port)
+void tusb_dcd_connect(uint8_t port)
{
(void) port;
sie_write(SIE_CMDCODE_DEVICE_STATUS, 1, 1);
}
-void hal_dcd_set_address(uint8_t port, uint8_t dev_addr)
+void tusb_dcd_set_address(uint8_t port, uint8_t dev_addr)
{
(void) port;
sie_write(SIE_CMDCODE_SET_ADDRESS, 1, 0x80 | dev_addr); // 7th bit is : device_enable
}
-void hal_dcd_set_config(uint8_t port, uint8_t config_num)
+void tusb_dcd_set_config(uint8_t port, uint8_t config_num)
{
(void) port;
(void) config_num;
@@ -373,12 +373,12 @@ static tusb_error_t pipe_control_read(void * buffer, uint16_t length)
//--------------------------------------------------------------------+
// CONTROL PIPE API
//--------------------------------------------------------------------+
-void hal_dcd_control_stall(uint8_t port)
+void tusb_dcd_control_stall(uint8_t port)
{
sie_write(SIE_CMDCODE_ENDPOINT_SET_STATUS+0, 1, SIE_SET_ENDPOINT_STALLED_MASK | SIE_SET_ENDPOINT_CONDITION_STALLED_MASK);
}
-bool hal_dcd_control_xfer(uint8_t port, tusb_direction_t dir, uint8_t * p_buffer, uint16_t length, bool int_on_complete)
+bool tusb_dcd_control_xfer(uint8_t port, tusb_direction_t dir, uint8_t * p_buffer, uint16_t length, bool int_on_complete)
{
(void) port;
@@ -412,7 +412,7 @@ bool hal_dcd_control_xfer(uint8_t port, tusb_direction_t dir, uint8_t * p_buffer
//--------------------------------------------------------------------+
// BULK/INTERRUPT/ISO PIPE API
//--------------------------------------------------------------------+
-edpt_hdl_t hal_dcd_pipe_open(uint8_t port, tusb_descriptor_endpoint_t const * p_endpoint_desc, uint8_t class_code)
+edpt_hdl_t tusb_dcd_pipe_open(uint8_t port, tusb_descriptor_endpoint_t const * p_endpoint_desc, uint8_t class_code)
{
(void) port;
@@ -453,12 +453,12 @@ bool dcd_pipe_is_busy(edpt_hdl_t edpt_hdl)
return (dcd_data.udca[edpt_hdl.index] != NULL && !dcd_data.udca[edpt_hdl.index]->is_retired);
}
-void hal_dcd_pipe_stall(edpt_hdl_t edpt_hdl)
+void tusb_dcd_pipe_stall(edpt_hdl_t edpt_hdl)
{
sie_write(SIE_CMDCODE_ENDPOINT_SET_STATUS+edpt_hdl.index, 1, SIE_SET_ENDPOINT_STALLED_MASK);
}
-void hal_dcd_pipe_clear_stall(uint8_t port, uint8_t edpt_addr)
+void tusb_dcd_pipe_clear_stall(uint8_t port, uint8_t edpt_addr)
{
uint8_t ep_id = edpt_addr2phy(edpt_addr);
@@ -476,7 +476,7 @@ void dd_xfer_init(dcd_dma_descriptor_t* p_dd, void* buffer, uint16_t total_bytes
p_dd->present_count = 0;
}
-tusb_error_t dcd_pipe_queue_xfer(edpt_hdl_t edpt_hdl, uint8_t * buffer, uint16_t total_bytes)
+tusb_error_t tusb_dcd_pipe_queue_xfer(edpt_hdl_t edpt_hdl, uint8_t * buffer, uint16_t total_bytes)
{ // NOTE for sure the qhd has no dds
dcd_dma_descriptor_t* const p_fixed_dd = &dcd_data.dd[edpt_hdl.index][0]; // always queue with the fixed DD
@@ -487,7 +487,7 @@ tusb_error_t dcd_pipe_queue_xfer(edpt_hdl_t edpt_hdl, uint8_t * buffer, uint16_t
return TUSB_ERROR_NONE;
}
-tusb_error_t hal_dcd_pipe_xfer(edpt_hdl_t edpt_hdl, uint8_t* buffer, uint16_t total_bytes, bool int_on_complete)
+tusb_error_t tusb_dcd_pipe_xfer(edpt_hdl_t edpt_hdl, uint8_t* buffer, uint16_t total_bytes, bool int_on_complete)
{
dcd_dma_descriptor_t* const p_first_dd = &dcd_data.dd[edpt_hdl.index][0];
diff --git a/tinyusb/device/dcd_lpc_11uxx_13uxx.c b/tinyusb/device/dcd_lpc_11uxx_13uxx.c
index a4f8a595b..8a5691dc4 100644
--- a/tinyusb/device/dcd_lpc_11uxx_13uxx.c
+++ b/tinyusb/device/dcd_lpc_11uxx_13uxx.c
@@ -108,7 +108,7 @@ typedef struct ATTR_PACKED
STATIC_ASSERT( sizeof(dcd_11u_13u_qhd_t) == 4, "size is not correct" );
// NOTE data will be transferred as soon as dcd get request by dcd_pipe(_queue)_xfer using double buffering.
-// If there is another hal_dcd_pipe_xfer request, the new request will be saved and executed when the first is done.
+// If there is another tusb_dcd_pipe_xfer request, the new request will be saved and executed when the first is done.
// next_td stored the 2nd request information
// current_td is used to keep track of number of remaining & xferred bytes of the current request.
// queued_bytes_in_buff keep track of number of bytes queued to each buffer (in case of short packet)
@@ -164,18 +164,18 @@ static void queue_xfer_in_next_td(uint8_t ep_id);
//--------------------------------------------------------------------+
// CONTROLLER API
//--------------------------------------------------------------------+
-void hal_dcd_connect(uint8_t port)
+void tusb_dcd_connect(uint8_t port)
{
(void) port;
LPC_USB->DEVCMDSTAT |= CMDSTAT_DEVICE_CONNECT_MASK;
}
-void hal_dcd_set_config(uint8_t port, uint8_t config_num)
+void tusb_dcd_set_config(uint8_t port, uint8_t config_num)
{
}
-void hal_dcd_set_address(uint8_t port, uint8_t dev_addr)
+void tusb_dcd_set_address(uint8_t port, uint8_t dev_addr)
{
(void) port;
@@ -183,7 +183,7 @@ void hal_dcd_set_address(uint8_t port, uint8_t dev_addr)
LPC_USB->DEVCMDSTAT |= dev_addr;
}
-bool hal_dcd_init(uint8_t port)
+bool tusb_dcd_init(uint8_t port)
{
(void) port;
@@ -315,14 +315,14 @@ void hal_dcd_isr(uint8_t port)
if ( dev_cmd_stat & CMDSTAT_RESET_CHANGE_MASK) // bus reset
{
bus_reset();
- hal_dcd_bus_event(0, USBD_BUS_EVENT_RESET);
+ tusb_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
- hal_dcd_bus_event(0, USBD_BUS_EVENT_UNPLUGGED);
+ tusb_dcd_bus_event(0, USBD_BUS_EVENT_UNPLUGGED);
}
}
@@ -334,13 +334,13 @@ void hal_dcd_isr(uint8_t port)
// 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)
{
- hal_dcd_bus_event(0, USBD_BUS_EVENT_SUSPENDED);
+ tusb_dcd_bus_event(0, USBD_BUS_EVENT_SUSPENDED);
}
}
}
// else
// { // resume signal
-// hal_dcd_bus_event(0, USBD_BUS_EVENT_RESUME);
+// tusb_dcd_bus_event(0, USBD_BUS_EVENT_RESUME);
// }
// }
}
@@ -349,7 +349,7 @@ void hal_dcd_isr(uint8_t port)
if ( BIT_TEST_(int_status, 0) && (dev_cmd_stat & CMDSTAT_SETUP_RECEIVED_MASK) )
{ // received control request from host
// copy setup request & acknowledge so that the next setup can be received by hw
- hal_dcd_setup_received(port, (uint8_t*)&dcd_data.setup_request);
+ tusb_dcd_setup_received(port, (uint8_t*)&dcd_data.setup_request);
// NXP control flowchart clear Active & Stall on both Control IN/OUT endpoints
dcd_data.qhd[0][0].stall = dcd_data.qhd[1][0].stall = 0;
@@ -373,14 +373,14 @@ void hal_dcd_isr(uint8_t port)
//--------------------------------------------------------------------+
// CONTROL PIPE API
//--------------------------------------------------------------------+
-void hal_dcd_control_stall(uint8_t port)
+void tusb_dcd_control_stall(uint8_t port)
{
(void) port;
// TODO cannot able to STALL Control OUT endpoint !!!!! FIXME try some walk-around
dcd_data.qhd[0][0].stall = dcd_data.qhd[1][0].stall = 1;
}
-bool hal_dcd_control_xfer(uint8_t port, tusb_direction_t dir, uint8_t * p_buffer, uint16_t length, bool int_on_complete)
+bool tusb_dcd_control_xfer(uint8_t port, tusb_direction_t dir, uint8_t * p_buffer, uint16_t length, bool int_on_complete)
{
(void) port;
@@ -428,7 +428,7 @@ static inline uint8_t edpt_phy2log(uint8_t physical_endpoint)
//--------------------------------------------------------------------+
// BULK/INTERRUPT/ISOCHRONOUS PIPE API
//--------------------------------------------------------------------+
-void hal_dcd_pipe_stall(edpt_hdl_t edpt_hdl)
+void tusb_dcd_pipe_stall(edpt_hdl_t edpt_hdl)
{
dcd_data.qhd[edpt_hdl.index][0].stall = dcd_data.qhd[edpt_hdl.index][1].stall = 1;
}
@@ -438,7 +438,7 @@ bool dcd_pipe_is_stalled(edpt_hdl_t edpt_hdl)
return dcd_data.qhd[edpt_hdl.index][0].stall || dcd_data.qhd[edpt_hdl.index][1].stall;
}
-void hal_dcd_pipe_clear_stall(uint8_t port, uint8_t edpt_addr)
+void tusb_dcd_pipe_clear_stall(uint8_t port, uint8_t edpt_addr)
{
uint8_t ep_id = edpt_addr2phy(edpt_addr);
// uint8_t active_buffer = BIT_TEST_(LPC_USB->EPINUSE, ep_id) ? 1 : 0;
@@ -456,7 +456,7 @@ void hal_dcd_pipe_clear_stall(uint8_t port, uint8_t edpt_addr)
}
}
-edpt_hdl_t hal_dcd_pipe_open(uint8_t port, tusb_descriptor_endpoint_t const * p_endpoint_desc, uint8_t class_code)
+edpt_hdl_t tusb_dcd_pipe_open(uint8_t port, tusb_descriptor_endpoint_t const * p_endpoint_desc, uint8_t class_code)
{
(void) port;
edpt_hdl_t const null_handle = { 0 };
@@ -535,7 +535,7 @@ static void queue_xfer_in_next_td(uint8_t ep_id)
dcd_data.next_td[ep_id].total_bytes = 0; // clear this field as it is used to indicate whehther next TD available
}
-tusb_error_t dcd_pipe_queue_xfer(edpt_hdl_t edpt_hdl, uint8_t * buffer, uint16_t total_bytes)
+tusb_error_t tusb_dcd_pipe_queue_xfer(edpt_hdl_t edpt_hdl, uint8_t * buffer, uint16_t total_bytes)
{
ASSERT( !dcd_pipe_is_busy(edpt_hdl), TUSB_ERROR_INTERFACE_IS_BUSY); // endpoint must not in transferring
@@ -546,7 +546,7 @@ tusb_error_t dcd_pipe_queue_xfer(edpt_hdl_t edpt_hdl, uint8_t * buffer, uint16_t
return TUSB_ERROR_NONE;
}
-tusb_error_t hal_dcd_pipe_xfer(edpt_hdl_t edpt_hdl, uint8_t* buffer, uint16_t total_bytes, bool int_on_complete)
+tusb_error_t tusb_dcd_pipe_xfer(edpt_hdl_t edpt_hdl, uint8_t* buffer, uint16_t total_bytes, bool int_on_complete)
{
if( dcd_pipe_is_busy(edpt_hdl) || dcd_pipe_is_stalled(edpt_hdl) )
{ // save this transfer data to next td if pipe is busy or already been stalled
diff --git a/tinyusb/device/usbd.c b/tinyusb/device/usbd.c
index 5fdd306de..f090bc141 100644
--- a/tinyusb/device/usbd.c
+++ b/tinyusb/device/usbd.c
@@ -167,11 +167,11 @@ static tusb_error_t usbd_body_subtask(void);
tusb_error_t usbd_init (void)
{
#if (TUSB_CFG_CONTROLLER_0_MODE & TUSB_MODE_DEVICE)
- hal_dcd_init(0);
+ tusb_dcd_init(0);
#endif
#if (TUSB_CFG_CONTROLLER_1_MODE & TUSB_MODE_DEVICE)
- hal_dcd_init(1);
+ tusb_dcd_init(1);
#endif
//------------- Task init -------------//
@@ -296,12 +296,12 @@ tusb_error_t usbd_control_request_subtask(uint8_t port, tusb_control_request_t c
if ( TUSB_ERROR_NONE == error )
{
- hal_dcd_control_xfer(port, (tusb_direction_t) p_request->bmRequestType_bit.direction, (uint8_t*) p_buffer, length, false);
+ tusb_dcd_control_xfer(port, (tusb_direction_t) p_request->bmRequestType_bit.direction, (uint8_t*) p_buffer, length, false);
}
}
else if ( TUSB_REQUEST_SET_ADDRESS == p_request->bRequest )
{
- hal_dcd_set_address(port, (uint8_t) p_request->wValue);
+ tusb_dcd_set_address(port, (uint8_t) p_request->wValue);
usbd_devices[port].state = TUSB_DEVICE_STATE_ADDRESSED;
}
else if ( TUSB_REQUEST_SET_CONFIGURATION == p_request->bRequest )
@@ -335,7 +335,7 @@ tusb_error_t usbd_control_request_subtask(uint8_t port, tusb_control_request_t c
TUSB_REQUEST_TYPE_STANDARD == p_request->bmRequestType_bit.type &&
TUSB_REQUEST_CLEAR_FEATURE == p_request->bRequest )
{
- hal_dcd_pipe_clear_stall(port, u16_low_u8(p_request->wIndex) );
+ tusb_dcd_pipe_clear_stall(port, u16_low_u8(p_request->wIndex) );
} else
{
error = TUSB_ERROR_DCD_CONTROL_REQUEST_NOT_SUPPORT;
@@ -343,11 +343,11 @@ tusb_error_t usbd_control_request_subtask(uint8_t port, tusb_control_request_t c
if(TUSB_ERROR_NONE != error)
{ // Response with Protocol Stall if request is not supported
- hal_dcd_control_stall(port);
+ tusb_dcd_control_stall(port);
// ASSERT(error == TUSB_ERROR_NONE, VOID_RETURN);
}else if (p_request->wLength == 0)
{
- hal_dcd_control_xfer(port, (tusb_direction_t) p_request->bmRequestType_bit.direction, NULL, 0, false); // zero length for non-data
+ tusb_dcd_control_xfer(port, (tusb_direction_t) p_request->bmRequestType_bit.direction, NULL, 0, false); // zero length for non-data
}
OSAL_SUBTASK_END
@@ -357,7 +357,7 @@ tusb_error_t usbd_control_request_subtask(uint8_t port, tusb_control_request_t c
// may need to open interface before set configured
static tusb_error_t usbd_set_configure_received(uint8_t port, uint8_t config_number)
{
- hal_dcd_set_config(port, config_number);
+ tusb_dcd_set_config(port, config_number);
usbd_devices[port].state = TUSB_DEVICE_STATE_CONFIGURED;
//------------- parse configuration & open drivers -------------//
@@ -448,7 +448,7 @@ static tusb_error_t get_descriptor(uint8_t port, tusb_control_request_t const *
//--------------------------------------------------------------------+
// USBD-DCD Callback API
//--------------------------------------------------------------------+
-void hal_dcd_bus_event(uint8_t port, usbd_bus_event_type_t bus_event)
+void tusb_dcd_bus_event(uint8_t port, usbd_bus_event_type_t bus_event)
{
switch(bus_event)
{
@@ -486,7 +486,7 @@ void hal_dcd_bus_event(uint8_t port, usbd_bus_event_type_t bus_event)
}
}
-void hal_dcd_setup_received(uint8_t port, uint8_t const* p_request)
+void tusb_dcd_setup_received(uint8_t port, uint8_t const* p_request)
{
usbd_task_event_t task_event =
{