summaryrefslogtreecommitdiff
path: root/tinyusb/class
diff options
context:
space:
mode:
authorhathach <[email protected]>2013-12-01 13:53:36 +0700
committerhathach <[email protected]>2013-12-01 13:53:36 +0700
commitedb4226f23f6d4b4550614b1f8fe81604a3eb19b (patch)
tree5b56410e37a559f4c3dd56abf2ea2ee5930cc2a1 /tinyusb/class
parentd2f91af6b33e955961abfb379e6db0951506dc11 (diff)
change class_ixr to class_cb
use IAD whenever enable CDC to make sure windows driver can detect change keyboard, mouse send report to int_on_complete = true
Diffstat (limited to 'tinyusb/class')
-rw-r--r--tinyusb/class/cdc_device.c8
-rw-r--r--tinyusb/class/cdc_device.h4
-rw-r--r--tinyusb/class/hid_device.c22
-rw-r--r--tinyusb/class/hid_device.h6
4 files changed, 24 insertions, 16 deletions
diff --git a/tinyusb/class/cdc_device.c b/tinyusb/class/cdc_device.c
index 64b3e1227..bb3e86db4 100644
--- a/tinyusb/class/cdc_device.c
+++ b/tinyusb/class/cdc_device.c
@@ -211,7 +211,7 @@ tusb_error_t cdcd_control_request(uint8_t coreid, tusb_control_request_t const *
return TUSB_ERROR_NONE;
}
-void cdcd_isr(endpoint_handle_t edpt_hdl, tusb_event_t event, uint32_t xferred_bytes)
+tusb_error_t cdcd_xfer_cb(endpoint_handle_t edpt_hdl, tusb_event_t event, uint32_t xferred_bytes)
{
cdcd_data_t const * p_cdc = &cdcd_data[edpt_hdl.coreid];
@@ -219,10 +219,12 @@ void cdcd_isr(endpoint_handle_t edpt_hdl, tusb_event_t event, uint32_t xferred_b
{
if ( endpointhandle_is_equal(edpt_hdl, p_cdc->edpt_hdl[pipeid]) )
{
- tusbd_cdc_xfer_isr(edpt_hdl.coreid, event, pipeid, xferred_bytes);
- return;
+ tusbd_cdc_xfer_cb(edpt_hdl.coreid, event, pipeid, xferred_bytes);
+ break;
}
}
+
+ return TUSB_ERROR_NONE;
}
#endif
diff --git a/tinyusb/class/cdc_device.h b/tinyusb/class/cdc_device.h
index 6de9ab194..bb0c7644c 100644
--- a/tinyusb/class/cdc_device.h
+++ b/tinyusb/class/cdc_device.h
@@ -66,7 +66,7 @@ tusb_error_t tusbd_cdc_receive(uint8_t coreid, void * p_buffer, uint32_t length,
//--------------------------------------------------------------------+
void tusbd_cdc_mounted_cb(uint8_t coreid);
void tusbd_cdc_unmounted_cb(uint8_t coreid);
-void tusbd_cdc_xfer_isr(uint8_t coreid, tusb_event_t event, cdc_pipeid_t pipe_id, uint32_t xferred_bytes);
+void tusbd_cdc_xfer_cb(uint8_t coreid, tusb_event_t event, cdc_pipeid_t pipe_id, uint32_t xferred_bytes);
//void tusbd_cdc_line_coding_changed_cb(uint8_t coreid, cdc_line_coding_t* p_line_coding);
//--------------------------------------------------------------------+
@@ -77,7 +77,7 @@ void tusbd_cdc_xfer_isr(uint8_t coreid, tusb_event_t event, cdc_pipeid_t pipe_id
void cdcd_init(void);
tusb_error_t cdcd_open(uint8_t coreid, tusb_descriptor_interface_t const * p_interface_desc, uint16_t *p_length);
tusb_error_t cdcd_control_request(uint8_t coreid, tusb_control_request_t const * p_request);
-void cdcd_isr(endpoint_handle_t edpt_hdl, tusb_event_t event, uint32_t xferred_bytes);
+tusb_error_t cdcd_xfer_cb(endpoint_handle_t edpt_hdl, tusb_event_t event, uint32_t xferred_bytes);
void cdcd_close(uint8_t coreid);
#endif
diff --git a/tinyusb/class/hid_device.c b/tinyusb/class/hid_device.c
index 8872f042b..65d41dc0c 100644
--- a/tinyusb/class/hid_device.c
+++ b/tinyusb/class/hid_device.c
@@ -82,7 +82,7 @@ tusb_error_t tusbd_hid_keyboard_send(uint8_t coreid, hid_keyboard_report_t const
hidd_interface_t * p_kbd = &keyboardd_data; // TODO &keyboardd_data[coreid];
- ASSERT_STATUS( dcd_pipe_xfer(p_kbd->ept_handle, p_report, sizeof(hid_keyboard_report_t), false) ) ;
+ ASSERT_STATUS( dcd_pipe_xfer(p_kbd->ept_handle, p_report, sizeof(hid_keyboard_report_t), true) ) ;
return TUSB_ERROR_NONE;
}
@@ -108,7 +108,7 @@ tusb_error_t tusbd_hid_mouse_send(uint8_t coreid, hid_mouse_report_t const *p_re
hidd_interface_t * p_mouse = &moused_data; // TODO &keyboardd_data[coreid];
- ASSERT_STATUS( dcd_pipe_xfer(p_mouse->ept_handle, p_report, sizeof(hid_mouse_report_t), false) ) ;
+ ASSERT_STATUS( dcd_pipe_xfer(p_mouse->ept_handle, p_report, sizeof(hid_mouse_report_t), true) ) ;
return TUSB_ERROR_NONE;
}
@@ -232,13 +232,19 @@ tusb_error_t hidd_open(uint8_t coreid, tusb_descriptor_interface_t const * p_int
p_hid->interface_number = p_interface_desc->bInterfaceNumber;
p_hid->report_length = p_desc_hid->wReportLength;
+ #if TUSB_CFG_DEVICE_HID_KEYBOARD
if (p_interface_desc->bInterfaceProtocol == HID_PROTOCOL_KEYBOARD)
{
tusbd_hid_keyboard_mounted_cb(coreid);
- }else
+ }
+ #endif
+
+ #if TUSB_CFG_DEVICE_HID_MOUSE
+ if (p_interface_desc->bInterfaceProtocol == HID_PROTOCOL_MOUSE)
{
tusbd_hid_mouse_mounted_cb(coreid);
}
+ #endif
}
break;
@@ -255,23 +261,23 @@ tusb_error_t hidd_open(uint8_t coreid, tusb_descriptor_interface_t const * p_int
return TUSB_ERROR_NONE;
}
-void hidd_isr(endpoint_handle_t edpt_hdl, tusb_event_t event, uint32_t xferred_bytes)
+tusb_error_t hidd_xfer_cb(endpoint_handle_t edpt_hdl, tusb_event_t event, uint32_t xferred_bytes)
{
#if TUSB_CFG_DEVICE_HID_KEYBOARD
if ( endpointhandle_is_equal(edpt_hdl, keyboardd_data.ept_handle) )
{
- tusbd_hid_keyboard_isr(edpt_hdl.coreid, event, xferred_bytes);
- return;
+ tusbd_hid_keyboard_cb(edpt_hdl.coreid, event, xferred_bytes);
}
#endif
#if TUSB_CFG_DEVICE_HID_MOUSE
if ( endpointhandle_is_equal(edpt_hdl, moused_data.ept_handle) )
{
- tusbd_hid_mouse_isr(edpt_hdl.coreid, event, xferred_bytes);
- return;
+ tusbd_hid_mouse_cb(edpt_hdl.coreid, event, xferred_bytes);
}
#endif
+
+ return TUSB_ERROR_NONE;
}
#if defined(CAP_DEVICE_ROMDRIVER)
diff --git a/tinyusb/class/hid_device.h b/tinyusb/class/hid_device.h
index 8eebd1824..edef9e25a 100644
--- a/tinyusb/class/hid_device.h
+++ b/tinyusb/class/hid_device.h
@@ -91,7 +91,7 @@ tusb_error_t tusbd_hid_keyboard_send(uint8_t coreid, hid_keyboard_report_t const
* - TUSB_EVENT_XFER_ERROR : previously scheduled transfer encountered a transaction error.
* - TUSB_EVENT_XFER_STALLED : previously scheduled transfer is stalled by device.
*/
-void tusbd_hid_keyboard_isr(uint8_t coreid, tusb_event_t event, uint32_t xferred_bytes);
+void tusbd_hid_keyboard_cb(uint8_t coreid, tusb_event_t event, uint32_t xferred_bytes);
void tusbd_hid_keyboard_mounted_cb(uint8_t coreid);
void tusbd_hid_keyboard_unmounted_cb(uint8_t coreid);
@@ -141,7 +141,7 @@ tusb_error_t tusbd_hid_mouse_send(uint8_t coreid, hid_mouse_report_t const *p_re
* - TUSB_EVENT_XFER_ERROR : previously scheduled transfer encountered a transaction error.
* - TUSB_EVENT_XFER_STALLED : previously scheduled transfer is stalled by device.
*/
-void tusbd_hid_mouse_isr(uint8_t coreid, tusb_event_t event, uint32_t xferred_bytes);
+void tusbd_hid_mouse_cb(uint8_t coreid, tusb_event_t event, uint32_t xferred_bytes);
void tusbd_hid_mouse_mounted_cb(uint8_t coreid);
void tusbd_hid_mouse_unmounted_cb(uint8_t coreid);
@@ -158,7 +158,7 @@ void tusbd_hid_mouse_unmounted_cb(uint8_t coreid);
void hidd_init(void);
tusb_error_t hidd_open(uint8_t coreid, tusb_descriptor_interface_t const * p_interface_desc, uint16_t *p_length);
tusb_error_t hidd_control_request(uint8_t coreid, tusb_control_request_t const * p_request);
-void hidd_isr(endpoint_handle_t edpt_hdl, tusb_event_t event, uint32_t xferred_bytes);
+tusb_error_t hidd_xfer_cb(endpoint_handle_t edpt_hdl, tusb_event_t event, uint32_t xferred_bytes);
void hidd_close(uint8_t coreid);
#endif