diff options
| author | hathach <[email protected]> | 2018-03-11 12:37:07 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2018-03-11 12:37:07 +0700 |
| commit | 539fbe5d6276575d3f2dd943b7d5d7463a522732 (patch) | |
| tree | b5d2020985240da39063d02880c4f34e9785c694 /tinyusb/device | |
| parent | 6392903fb2b81c24bcbdfea323f58aaaf94e15ce (diff) | |
rename endpoint_handle_t to edpt_hdl_t
Diffstat (limited to 'tinyusb/device')
| -rw-r--r-- | tinyusb/device/dcd.h | 16 | ||||
| -rw-r--r-- | tinyusb/device/dcd_lpc175x_6x.c | 18 | ||||
| -rw-r--r-- | tinyusb/device/dcd_lpc_11uxx_13uxx.c | 20 | ||||
| -rw-r--r-- | tinyusb/device/usbd.c | 4 | ||||
| -rw-r--r-- | tinyusb/device/usbd.h | 2 |
5 files changed, 30 insertions, 30 deletions
diff --git a/tinyusb/device/dcd.h b/tinyusb/device/dcd.h index 344ec4f3c..b786a92a1 100644 --- a/tinyusb/device/dcd.h +++ b/tinyusb/device/dcd.h @@ -62,9 +62,9 @@ typedef enum typedef struct {
uint8_t port;
uint8_t index; // must be zero to indicate control
-} endpoint_handle_t;
+} edpt_hdl_t;
-static inline bool edpt_equal(endpoint_handle_t x, endpoint_handle_t y)
+static inline bool edpt_equal(edpt_hdl_t x, edpt_hdl_t y)
{
return (x.port == y.port) && (x.index == y.index);
}
@@ -79,22 +79,22 @@ void hal_dcd_set_config (uint8_t port, uint8_t config_num); /*------------- Event function -------------*/
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 usbd_xfer_isr(endpoint_handle_t edpt_hdl, tusb_event_t event, uint32_t xferred_bytes);
+void usbd_xfer_isr(edpt_hdl_t edpt_hdl, tusb_event_t event, uint32_t xferred_bytes);
//------------- PIPE API -------------//
bool hal_dcd_control_xfer(uint8_t port, tusb_direction_t dir, uint8_t * p_buffer, uint16_t length, bool int_on_complete);
void hal_dcd_control_stall(uint8_t port);
-bool hal_dcd_pipe_open(uint8_t port, tusb_descriptor_endpoint_t const * p_endpoint_desc, endpoint_handle_t* eh);
+bool hal_dcd_pipe_open(uint8_t port, tusb_descriptor_endpoint_t const * p_endpoint_desc, edpt_hdl_t* eh);
-tusb_error_t dcd_pipe_queue_xfer(endpoint_handle_t edpt_hdl, uint8_t * buffer, uint16_t total_bytes); // only queue, not transferring yet
-tusb_error_t hal_dcd_pipe_xfer(endpoint_handle_t edpt_hdl, uint8_t * buffer, uint16_t total_bytes, bool int_on_complete);
+tusb_error_t dcd_pipe_queue_xfer(edpt_hdl_t edpt_hdl, uint8_t * buffer, uint16_t total_bytes); // only queue, not transferring yet
+tusb_error_t hal_dcd_pipe_xfer(edpt_hdl_t edpt_hdl, uint8_t * buffer, uint16_t total_bytes, bool int_on_complete);
-bool dcd_pipe_is_busy(endpoint_handle_t edpt_hdl);
+bool dcd_pipe_is_busy(edpt_hdl_t edpt_hdl);
// TODO port + endpoint address are part of endpoint handle, not endpoint handle, data toggle also need to be reset
-void hal_dcd_pipe_stall(endpoint_handle_t edpt_hdl);
+void hal_dcd_pipe_stall(edpt_hdl_t edpt_hdl);
void hal_dcd_pipe_clear_stall(uint8_t port, uint8_t edpt_addr);
#ifdef __cplusplus
diff --git a/tinyusb/device/dcd_lpc175x_6x.c b/tinyusb/device/dcd_lpc175x_6x.c index 3ceb2896d..f6bdcaf41 100644 --- a/tinyusb/device/dcd_lpc175x_6x.c +++ b/tinyusb/device/dcd_lpc175x_6x.c @@ -159,7 +159,7 @@ static void endpoint_non_control_isr(uint32_t eot_int) if ( p_last_dd->int_on_complete )
{
- endpoint_handle_t edpt_hdl =
+ edpt_hdl_t edpt_hdl =
{
.port = 0,
.index = ep_id,
@@ -204,7 +204,7 @@ static void endpoint_control_isr(void) if ( BIT_TEST_(dcd_data.control_dma.int_on_complete, ep_id) )
{
- endpoint_handle_t edpt_hdl = { .port = 0, .class_code = 0 };
+ edpt_hdl_t edpt_hdl = { .port = 0, .class_code = 0 };
dcd_data.control_dma.int_on_complete = 0;
// FIXME xferred_byte for control xfer is not needed now !!!
@@ -412,11 +412,11 @@ bool hal_dcd_control_xfer(uint8_t port, tusb_direction_t dir, uint8_t * p_buffer //--------------------------------------------------------------------+
// BULK/INTERRUPT/ISO PIPE API
//--------------------------------------------------------------------+
-endpoint_handle_t hal_dcd_pipe_open(uint8_t port, tusb_descriptor_endpoint_t const * p_endpoint_desc, uint8_t class_code)
+edpt_hdl_t hal_dcd_pipe_open(uint8_t port, tusb_descriptor_endpoint_t const * p_endpoint_desc, uint8_t class_code)
{
(void) port;
- endpoint_handle_t const null_handle = { 0 };
+ edpt_hdl_t const null_handle = { 0 };
// TODO refractor to universal pipe open validation function
if (p_endpoint_desc->bmAttributes.xfer == TUSB_XFER_ISOCHRONOUS) return null_handle; // TODO not support ISO yet
@@ -440,7 +440,7 @@ endpoint_handle_t hal_dcd_pipe_open(uint8_t port, tusb_descriptor_endpoint_t con sie_write(SIE_CMDCODE_ENDPOINT_SET_STATUS+ep_id, 1, 0); // clear all endpoint status
- return (endpoint_handle_t)
+ return (edpt_hdl_t)
{
.port = 0,
.index = ep_id,
@@ -448,12 +448,12 @@ endpoint_handle_t hal_dcd_pipe_open(uint8_t port, tusb_descriptor_endpoint_t con };
}
-bool dcd_pipe_is_busy(endpoint_handle_t edpt_hdl)
+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(endpoint_handle_t edpt_hdl)
+void hal_dcd_pipe_stall(edpt_hdl_t edpt_hdl)
{
sie_write(SIE_CMDCODE_ENDPOINT_SET_STATUS+edpt_hdl.index, 1, SIE_SET_ENDPOINT_STALLED_MASK);
}
@@ -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(endpoint_handle_t edpt_hdl, uint8_t * buffer, uint16_t total_bytes)
+tusb_error_t 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(endpoint_handle_t edpt_hdl, uint8_t * buffer, u return TUSB_ERROR_NONE;
}
-tusb_error_t hal_dcd_pipe_xfer(endpoint_handle_t edpt_hdl, uint8_t* buffer, uint16_t total_bytes, bool int_on_complete)
+tusb_error_t hal_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 1d1d132f8..a4f8a595b 100644 --- a/tinyusb/device/dcd_lpc_11uxx_13uxx.c +++ b/tinyusb/device/dcd_lpc_11uxx_13uxx.c @@ -246,7 +246,7 @@ static void endpoint_non_control_isr(uint32_t int_status) if ( BIT_TEST_(dcd_data.current_ioc, ep_id) )
{
- endpoint_handle_t edpt_hdl =
+ edpt_hdl_t edpt_hdl =
{
.port = 0,
.index = ep_id,
@@ -286,7 +286,7 @@ static void endpoint_control_isr(uint32_t int_status) if ( BIT_TEST_(dcd_data.current_ioc, ep_id) )
{
- endpoint_handle_t edpt_hdl = { .port = 0 };
+ edpt_hdl_t edpt_hdl = { .port = 0 };
dcd_data.current_ioc = BIT_CLR_(dcd_data.current_ioc, ep_id);
@@ -428,12 +428,12 @@ static inline uint8_t edpt_phy2log(uint8_t physical_endpoint) //--------------------------------------------------------------------+
// BULK/INTERRUPT/ISOCHRONOUS PIPE API
//--------------------------------------------------------------------+
-void hal_dcd_pipe_stall(endpoint_handle_t edpt_hdl)
+void hal_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;
}
-bool dcd_pipe_is_stalled(endpoint_handle_t edpt_hdl)
+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;
}
@@ -456,10 +456,10 @@ void hal_dcd_pipe_clear_stall(uint8_t port, uint8_t edpt_addr) }
}
-endpoint_handle_t hal_dcd_pipe_open(uint8_t port, tusb_descriptor_endpoint_t const * p_endpoint_desc, uint8_t class_code)
+edpt_hdl_t hal_dcd_pipe_open(uint8_t port, tusb_descriptor_endpoint_t const * p_endpoint_desc, uint8_t class_code)
{
(void) port;
- endpoint_handle_t const null_handle = { 0 };
+ edpt_hdl_t const null_handle = { 0 };
if (p_endpoint_desc->bmAttributes.xfer == TUSB_XFER_ISOCHRONOUS) return null_handle; // TODO not support ISO yet
@@ -481,7 +481,7 @@ endpoint_handle_t hal_dcd_pipe_open(uint8_t port, tusb_descriptor_endpoint_t con LPC_USB->EPBUFCFG |= BIT_(ep_id);
LPC_USB->INTEN |= BIT_(ep_id);
- return (endpoint_handle_t)
+ return (edpt_hdl_t)
{
.port = 0,
.index = ep_id,
@@ -489,7 +489,7 @@ endpoint_handle_t hal_dcd_pipe_open(uint8_t port, tusb_descriptor_endpoint_t con };
}
-bool dcd_pipe_is_busy(endpoint_handle_t edpt_hdl)
+bool dcd_pipe_is_busy(edpt_hdl_t edpt_hdl)
{
return dcd_data.qhd[edpt_hdl.index][0].active || dcd_data.qhd[edpt_hdl.index][1].active;
}
@@ -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(endpoint_handle_t edpt_hdl, uint8_t * buffer, uint16_t total_bytes)
+tusb_error_t 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(endpoint_handle_t edpt_hdl, uint8_t * buffer, u return TUSB_ERROR_NONE;
}
-tusb_error_t hal_dcd_pipe_xfer(endpoint_handle_t edpt_hdl, uint8_t* buffer, uint16_t total_bytes, bool int_on_complete)
+tusb_error_t hal_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 38a44a70f..5fdd306de 100644 --- a/tinyusb/device/usbd.c +++ b/tinyusb/device/usbd.c @@ -138,7 +138,7 @@ typedef struct ATTR_ALIGNED(4) tusb_control_request_t setup_received;
struct { // USBD_EVENTID_XFER_DONE
- endpoint_handle_t edpt_hdl;
+ edpt_hdl_t edpt_hdl;
uint32_t xferred_byte;
}xfer_done;
};
@@ -498,7 +498,7 @@ void hal_dcd_setup_received(uint8_t port, uint8_t const* p_request) osal_queue_send(usbd_queue_hdl, &task_event);
}
-void usbd_xfer_isr(endpoint_handle_t edpt_hdl, tusb_event_t event, uint32_t xferred_bytes)
+void usbd_xfer_isr(edpt_hdl_t edpt_hdl, tusb_event_t event, uint32_t xferred_bytes)
{
if (edpt_hdl.index == 0 )
{
diff --git a/tinyusb/device/usbd.h b/tinyusb/device/usbd.h index b3c6c23fc..7363afc2a 100644 --- a/tinyusb/device/usbd.h +++ b/tinyusb/device/usbd.h @@ -80,7 +80,7 @@ typedef struct { void (* init) (void);
tusb_error_t (* open)(uint8_t, tusb_descriptor_interface_t const *, uint16_t*);
tusb_error_t (* control_request_subtask) (uint8_t port, tusb_control_request_t const *);
- tusb_error_t (* xfer_cb) (endpoint_handle_t, tusb_event_t, uint32_t);
+ tusb_error_t (* xfer_cb) (edpt_hdl_t, tusb_event_t, uint32_t);
// void (* routine)(void);
void (* sof)(uint8_t port);
void (* close) (uint8_t);
|
