summaryrefslogtreecommitdiff
path: root/tinyusb/device/dcd.h
diff options
context:
space:
mode:
authorhathach <[email protected]>2013-11-01 12:11:26 +0700
committerhathach <[email protected]>2013-11-01 12:11:26 +0700
commit3a54ad4c0d4e31bf9a13cebb771ccc9e9f4f6449 (patch)
treea47a948c51dd729c57593ab572c157665f4e3fd3 /tinyusb/device/dcd.h
parentc760c69d51e44c98f9a15feb3f93bee599026332 (diff)
implement msc device class
usbd auto stall control for not supported return from class control request usbd implement xfer isr callback mechanism DCD - implement dcd multiple qtd support - dcd dcd_pipe_stall - implement dcd_pipe_queue_xfer - xfer_complete_isr - flush control endpoint if received new setup while previous transfer is not complete change msc_cmd_block_wrapper_t flags field to dir force full speed for easy testing NOTEs: somehow unable to get endpoint IN interrupt with ioc
Diffstat (limited to 'tinyusb/device/dcd.h')
-rw-r--r--tinyusb/device/dcd.h18
1 files changed, 10 insertions, 8 deletions
diff --git a/tinyusb/device/dcd.h b/tinyusb/device/dcd.h
index 73cbeb2cb..fa947bf11 100644
--- a/tinyusb/device/dcd.h
+++ b/tinyusb/device/dcd.h
@@ -53,21 +53,21 @@
typedef struct {
uint8_t coreid;
- uint8_t xfer_type; // cannot be control as control uses separated API
+ uint8_t xfer_type; // TODO redundant, cannot be control as control uses separated API
uint8_t index;
- uint8_t reserved;
+ uint8_t class_code;
} endpoint_handle_t;
-static inline bool endpointhandle_is_valid(endpoint_handle_t endpoint_handle) ATTR_CONST ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
-static inline bool endpointhandle_is_valid(endpoint_handle_t endpoint_handle)
+static inline bool endpointhandle_is_valid(endpoint_handle_t edpt_hdl) ATTR_CONST ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
+static inline bool endpointhandle_is_valid(endpoint_handle_t edpt_hdl)
{
- return endpoint_handle.xfer_type != TUSB_XFER_CONTROL;
+ return (edpt_hdl.xfer_type != TUSB_XFER_CONTROL) && (edpt_hdl.class_code != 0);
}
static inline bool endpointhandle_is_equal(endpoint_handle_t x, endpoint_handle_t y) ATTR_CONST ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
static inline bool endpointhandle_is_equal(endpoint_handle_t x, endpoint_handle_t y)
{
- return (x.coreid == y.coreid) && (x.xfer_type == y.xfer_type) && (x.index == y.index);
+ return (x.coreid == y.coreid) && (x.xfer_type == y.xfer_type) && (x.index == y.index) && (x.class_code == y.class_code);
}
tusb_error_t dcd_init(void) ATTR_WARN_UNUSED_RESULT;
@@ -89,8 +89,10 @@ void dcd_pipe_control_stall(uint8_t coreid);
//tusb_error_t dcd_pipe_control_read(uint8_t coreid, void * buffer, uint16_t length);
//void dcd_pipe_control_write_zero_length(uint8_t coreid);
-endpoint_handle_t dcd_pipe_open(uint8_t coreid, tusb_descriptor_endpoint_t const * p_endpoint_desc) ATTR_WARN_UNUSED_RESULT;
-tusb_error_t dcd_pipe_xfer(endpoint_handle_t pipe_hdl, uint8_t buffer[], uint16_t total_bytes, bool int_on_complete) ATTR_WARN_UNUSED_RESULT;
+endpoint_handle_t dcd_pipe_open(uint8_t coreid, tusb_descriptor_endpoint_t const * p_endpoint_desc, uint8_t class_code) ATTR_WARN_UNUSED_RESULT;
+tusb_error_t dcd_pipe_queue_xfer(endpoint_handle_t edpt_hdl, void * buffer, uint16_t total_bytes) ATTR_WARN_UNUSED_RESULT; // only queue, not transferring yet
+tusb_error_t dcd_pipe_xfer(endpoint_handle_t edpt_hdl, void * buffer, uint16_t total_bytes, bool int_on_complete) ATTR_WARN_UNUSED_RESULT;
+tusb_error_t dcd_pipe_stall(endpoint_handle_t edpt_hdl) ATTR_WARN_UNUSED_RESULT;
#ifdef __cplusplus
}