diff options
| author | hathach <[email protected]> | 2018-03-11 15:20:27 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2018-03-11 15:20:27 +0700 |
| commit | cfdc7999f661ecc5d978073f2808d4319ee44426 (patch) | |
| tree | 495fdb52ed753960ac76b18a4426d9cf2c9e594a /tinyusb/tusb_dcd.h | |
| parent | fd250b92cb62780dee5d99b49bbcbc05080b6987 (diff) | |
refactor dcd API, drop edpt_hdl_t in favor of endpoint address for easy port
Diffstat (limited to 'tinyusb/tusb_dcd.h')
| -rw-r--r-- | tinyusb/tusb_dcd.h | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/tinyusb/tusb_dcd.h b/tinyusb/tusb_dcd.h index f35523bfd..611511f2d 100644 --- a/tinyusb/tusb_dcd.h +++ b/tinyusb/tusb_dcd.h @@ -58,15 +58,6 @@ typedef enum USBD_BUS_EVENT_RESUME
}usbd_bus_event_type_t;
-typedef struct {
- uint8_t port;
- uint8_t index; // must be zero to indicate control
-} edpt_hdl_t;
-
-static inline bool edpt_equal(edpt_hdl_t x, edpt_hdl_t y)
-{
- return (x.port == y.port) && (x.index == y.index);
-}
//------------- Controller API -------------//
bool tusb_dcd_init (uint8_t port);
@@ -81,7 +72,7 @@ void tusb_dcd_set_config (uint8_t port, uint8_t config_num); *------------------------------------------------------------------*/
void tusb_dcd_bus_event(uint8_t port, usbd_bus_event_type_t bus_event);
void tusb_dcd_setup_received(uint8_t port, uint8_t const* p_request);
-void tusb_dcd_xfer_complete(edpt_hdl_t edpt_hdl, uint32_t xferred_bytes, bool succeeded);
+void tusb_dcd_xfer_complete(uint8_t port, uint8_t edpt_addr, uint32_t xferred_bytes, bool succeeded);
/*------------------------------------------------------------------*/
/* API
@@ -90,14 +81,14 @@ void tusb_dcd_xfer_complete(edpt_hdl_t edpt_hdl, uint32_t xferred_bytes, bool su bool tusb_dcd_control_xfer(uint8_t port, tusb_direction_t dir, uint8_t * p_buffer, uint16_t length, bool int_on_complete);
void tusb_dcd_control_stall(uint8_t port);
-bool tusb_dcd_edpt_open(uint8_t port, tusb_descriptor_endpoint_t const * p_endpoint_desc, edpt_hdl_t* eh);
-tusb_error_t tusb_dcd_edpt_queue_xfer(edpt_hdl_t edpt_hdl, uint8_t * buffer, uint16_t total_bytes); // only queue, not transferring yet
-tusb_error_t tusb_dcd_edpt_xfer(edpt_hdl_t edpt_hdl, uint8_t * buffer, uint16_t total_bytes, bool int_on_complete);
+bool tusb_dcd_edpt_open(uint8_t port, tusb_descriptor_endpoint_t const * p_endpoint_desc);
+tusb_error_t tusb_dcd_edpt_queue_xfer(uint8_t port, uint8_t edpt_addr, uint8_t * buffer, uint16_t total_bytes); // only queue, not transferring yet
+tusb_error_t tusb_dcd_edpt_xfer(uint8_t port, uint8_t edpt_addr, uint8_t * buffer, uint16_t total_bytes, bool int_on_complete);
-bool tusb_dcd_edpt_busy(edpt_hdl_t edpt_hdl);
+bool tusb_dcd_edpt_busy(uint8_t port, uint8_t edpt_addr);
// TODO port + endpoint address are part of endpoint handle, not endpoint handle, data toggle also need to be reset
-void tusb_dcd_edpt_stall(edpt_hdl_t edpt_hdl);
+void tusb_dcd_edpt_stall(uint8_t port, uint8_t edpt_addr);
void tusb_dcd_edpt_clear_stall(uint8_t port, uint8_t edpt_addr);
#ifdef __cplusplus
|
