diff options
| author | hathach <[email protected]> | 2018-03-28 13:54:28 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2018-03-28 13:54:28 +0700 |
| commit | 47c125d0257fb8f053870b33bded1f422ff81847 (patch) | |
| tree | 58a235b28e0926cf90d4bccdb22c4a0d83bdfdcc /tinyusb/device/dcd.h | |
| parent | 4deb4da6cba0a5d9415279e63d9427e992c75028 (diff) | |
more dcd clean up
Diffstat (limited to 'tinyusb/device/dcd.h')
| -rw-r--r-- | tinyusb/device/dcd.h | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/tinyusb/device/dcd.h b/tinyusb/device/dcd.h index 587953e51..500cb8b8d 100644 --- a/tinyusb/device/dcd.h +++ b/tinyusb/device/dcd.h @@ -77,17 +77,15 @@ void dcd_xfer_complete (uint8_t rhport, uint8_t ep_addr, uint32_t xferred_byt static inline void dcd_control_complete(uint8_t rhport)
{
- // TODO all control complete is successful !!
+ // all control complete is successful !!
dcd_xfer_complete(rhport, 0, 0, true);
}
/*------------------------------------------------------------------*/
/* Endpoint API
*------------------------------------------------------------------*/
-//------------- Control Endpoint -------------//
-bool dcd_control_xfer (uint8_t rhport, tusb_dir_t dir, uint8_t * buffer, uint16_t length);
-//------------- Other Endpoints -------------//
+//------------- Non-control Endpoints -------------//
bool dcd_edpt_open (uint8_t rhport, tusb_desc_endpoint_t const * p_endpoint_desc);
bool dcd_edpt_xfer (uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, uint16_t total_bytes);
bool dcd_edpt_busy (uint8_t rhport, uint8_t ep_addr);
@@ -95,6 +93,21 @@ bool dcd_edpt_busy (uint8_t rhport, uint8_t ep_addr); void dcd_edpt_stall (uint8_t rhport, uint8_t ep_addr);
void dcd_edpt_clear_stall (uint8_t rhport, uint8_t ep_addr);
+//------------- Control Endpoint -------------//
+bool dcd_control_xfer (uint8_t rhport, tusb_dir_t dir, uint8_t * buffer, uint16_t length);
+
+// Note input dir is value of direction bit in setup packet (i.e DATA stage direction)
+static inline bool dcd_control_status(uint8_t rhport, tusb_dir_t dir)
+{
+ // status direction is reversed to one in the setup packet
+ return dcd_control_xfer(rhport, 1-dir, NULL, 0);
+}
+
+static inline void dcd_control_stall(uint8_t rhport)
+{
+ dcd_edpt_stall(rhport, 0);
+}
+
#ifdef __cplusplus
}
#endif
|
