summaryrefslogtreecommitdiff
path: root/tinyusb/class/cdc_host.c
diff options
context:
space:
mode:
authorhathach <[email protected]>2013-07-03 11:36:08 +0700
committerhathach <[email protected]>2013-07-03 11:36:08 +0700
commit1667ef5041ad80d0f7b9dc76c286b8c59cedf180 (patch)
tree5199d458d727f607302cc9d895d3386862efbe17 /tinyusb/class/cdc_host.c
parentb3f98bc15a47bea88806cbfdc899d46efe40d921 (diff)
replace tusbh_cdc_isr by tusbh_cdc_xfer_isr with extra parameter as
- pipe id - xferred_bytes host_class_driver_t add xferred_bytes parameter void (* const isr) (pipe_handle_t, tusb_event_t); --> void (* const isr) (pipe_handle_t, tusb_event_t, uint32_t); update hid_host & its tests
Diffstat (limited to 'tinyusb/class/cdc_host.c')
-rw-r--r--tinyusb/class/cdc_host.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/tinyusb/class/cdc_host.c b/tinyusb/class/cdc_host.c
index d2830e41e..023c69a19 100644
--- a/tinyusb/class/cdc_host.c
+++ b/tinyusb/class/cdc_host.c
@@ -63,6 +63,16 @@ STATIC_ INLINE_ bool tusbh_cdc_is_mounted(uint8_t dev_addr)
return (tusbh_device_get_mounted_class_flag(dev_addr) & BIT_(TUSB_CLASS_CDC)) != 0;
}
+static inline cdc_pipeid_t get_app_pipeid(pipe_handle_t pipe_hdl) ATTR_PURE ATTR_ALWAYS_INLINE;
+static inline cdc_pipeid_t get_app_pipeid(pipe_handle_t pipe_hdl)
+{
+ cdch_data_t const * p_cdc = cdch_data + (pipe_hdl.dev_addr-1);
+
+ return pipehandle_is_equal( pipe_hdl, p_cdc->pipe_notification ) ? CDC_PIPE_NOTIFICATION :
+ pipehandle_is_equal( pipe_hdl, p_cdc->pipe_in ) ? CDC_PIPE_DATA_IN :
+ pipehandle_is_equal( pipe_hdl, p_cdc->pipe_out ) ? CDC_PIPE_DATA_OUT : 0;
+}
+
//--------------------------------------------------------------------+
// APPLICATION API (parameter validation needed)
//--------------------------------------------------------------------+
@@ -186,11 +196,11 @@ tusb_error_t cdch_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t con
return TUSB_ERROR_NONE;
}
-void cdch_isr(pipe_handle_t pipe_hdl, tusb_event_t event)
+void cdch_isr(pipe_handle_t pipe_hdl, tusb_event_t event, uint32_t xferred_bytes)
{
- if (tusbh_cdc_isr)
+ if (tusbh_cdc_xfer_isr)
{
- tusbh_cdc_isr(pipe_hdl.dev_addr, event);
+ tusbh_cdc_xfer_isr( pipe_hdl.dev_addr, event, get_app_pipeid(pipe_hdl), xferred_bytes );
}
}