summaryrefslogtreecommitdiff
path: root/src/device/dcd.h
diff options
context:
space:
mode:
authorhathach <[email protected]>2021-09-18 13:35:26 +0700
committerhathach <[email protected]>2021-09-18 13:35:26 +0700
commit3333703d257b4b2a37f543a65ea4a6e2db777fdb (patch)
treefb37112e82f7f64857473d8346f32c763bd67ec9 /src/device/dcd.h
parent82618d2d5f15d0f8dd9631dec3807964a1281782 (diff)
parent90465299b42facff3c815d97950066706dbbd74a (diff)
Merge branch 'master' into zhangslice-master
Diffstat (limited to 'src/device/dcd.h')
-rw-r--r--src/device/dcd.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/device/dcd.h b/src/device/dcd.h
index 63e97df96..d43a0dd9a 100644
--- a/src/device/dcd.h
+++ b/src/device/dcd.h
@@ -30,11 +30,24 @@
#include "common/tusb_common.h"
#include "osal/osal.h"
#include "common/tusb_fifo.h"
+#include "dcd_attr.h"
#ifdef __cplusplus
extern "C" {
#endif
+//--------------------------------------------------------------------+
+// Configuration
+//--------------------------------------------------------------------+
+
+#ifndef CFG_TUD_ENDPPOINT_MAX
+ #define CFG_TUD_ENDPPOINT_MAX DCD_ATTR_ENDPOINT_MAX
+#endif
+
+//--------------------------------------------------------------------+
+// MACRO CONSTANT TYPEDEF PROTYPES
+//--------------------------------------------------------------------+
+
typedef enum
{
DCD_EVENT_INVALID = 0,
@@ -124,6 +137,11 @@ void dcd_edpt0_status_complete(uint8_t rhport, tusb_control_request_t const * re
// Configure endpoint's registers according to descriptor
bool dcd_edpt_open (uint8_t rhport, tusb_desc_endpoint_t const * desc_ep);
+// Close all non-control endpoints, cancel all pending transfers if any.
+// Invoked when switching from a non-zero Configuration by SET_CONFIGURE therefore
+// required for multiple configuration support.
+void dcd_edpt_close_all (uint8_t rhport);
+
// Close an endpoint.
// Since it is weak, caller must TU_ASSERT this function's existence before calling it.
void dcd_edpt_close (uint8_t rhport, uint8_t ep_addr) TU_ATTR_WEAK;
@@ -135,10 +153,11 @@ bool dcd_edpt_xfer (uint8_t rhport, uint8_t ep_addr, uint8_t * buffer
// This API is optional, may be useful for register-based for transferring data.
bool dcd_edpt_xfer_fifo (uint8_t rhport, uint8_t ep_addr, tu_fifo_t * ff, uint16_t total_bytes) TU_ATTR_WEAK;
-// Stall endpoint
+// Stall endpoint, any queuing transfer should be removed from endpoint
void dcd_edpt_stall (uint8_t rhport, uint8_t ep_addr);
// clear stall, data toggle is also reset to DATA0
+// This API never calls with control endpoints, since it is auto cleared when receiving setup packet
void dcd_edpt_clear_stall (uint8_t rhport, uint8_t ep_addr);
//--------------------------------------------------------------------+