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
This commit is contained in:
hathach 2013-12-01 13:53:36 +07:00
parent d2f91af6b3
commit edb4226f23
12 changed files with 51 additions and 35 deletions

View File

@ -86,11 +86,11 @@ ServiceBinary=%12%\%DRIVERFILENAME%.sys
[SourceDisksFiles]
[SourceDisksNames]
[DeviceList]
%DESCRIPTION%=DriverInstall, USB\VID_1FC9&PID_4001, USB\VID_1FC9&PID_4001&MI_00, USB\VID_1FC9&PID_4003&MI_00, USB\VID_1FC9&PID_4005&MI_00, USB\VID_1FC9&PID_4007&MI_00, USB\VID_1FC9&PID_4009&MI_00, USB\VID_1FC9&PID_400b&MI_00, USB\VID_1FC9&PID_400d&MI_00, USB\VID_1FC9&PID_400f&MI_00, USB\VID_1FC9&PID_4011&MI_00, USB\VID_1FC9&PID_4013&MI_00, USB\VID_1FC9&PID_4015&MI_00, USB\VID_1FC9&PID_4017&MI_00, USB\VID_1FC9&PID_4019&MI_00, USB\VID_1FC9&PID_401b&MI_00, USB\VID_1FC9&PID_401d&MI_00, USB\VID_1FC9&PID_401f&MI_00, USB\VID_1FC9&PID_4021&MI_00, USB\VID_1FC9&PID_4023&MI_00, USB\VID_1FC9&PID_4025&MI_00, USB\VID_1FC9&PID_4027&MI_00, USB\VID_1FC9&PID_4029&MI_00, USB\VID_1FC9&PID_402b&MI_00, USB\VID_1FC9&PID_402d&MI_00, USB\VID_1FC9&PID_402f&MI_00, USB\VID_1FC9&PID_4031&MI_00, USB\VID_1FC9&PID_4033&MI_00, USB\VID_1FC9&PID_4035&MI_00, USB\VID_1FC9&PID_4037&MI_00, USB\VID_1FC9&PID_4039&MI_00, USB\VID_1FC9&PID_403b&MI_00, USB\VID_1FC9&PID_403d&MI_00, USB\VID_1FC9&PID_403f&MI_00
%DESCRIPTION%=DriverInstall, USB\VID_1FC9&PID_4001&MI_00, USB\VID_1FC9&PID_4003&MI_00, USB\VID_1FC9&PID_4005&MI_00, USB\VID_1FC9&PID_4007&MI_00, USB\VID_1FC9&PID_4009&MI_00, USB\VID_1FC9&PID_400b&MI_00, USB\VID_1FC9&PID_400d&MI_00, USB\VID_1FC9&PID_400f&MI_00, USB\VID_1FC9&PID_4011&MI_00, USB\VID_1FC9&PID_4013&MI_00, USB\VID_1FC9&PID_4015&MI_00, USB\VID_1FC9&PID_4017&MI_00, USB\VID_1FC9&PID_4019&MI_00, USB\VID_1FC9&PID_401b&MI_00, USB\VID_1FC9&PID_401d&MI_00, USB\VID_1FC9&PID_401f&MI_00, USB\VID_1FC9&PID_4021&MI_00, USB\VID_1FC9&PID_4023&MI_00, USB\VID_1FC9&PID_4025&MI_00, USB\VID_1FC9&PID_4027&MI_00, USB\VID_1FC9&PID_4029&MI_00, USB\VID_1FC9&PID_402b&MI_00, USB\VID_1FC9&PID_402d&MI_00, USB\VID_1FC9&PID_402f&MI_00, USB\VID_1FC9&PID_4031&MI_00, USB\VID_1FC9&PID_4033&MI_00, USB\VID_1FC9&PID_4035&MI_00, USB\VID_1FC9&PID_4037&MI_00, USB\VID_1FC9&PID_4039&MI_00, USB\VID_1FC9&PID_403b&MI_00, USB\VID_1FC9&PID_403d&MI_00, USB\VID_1FC9&PID_403f&MI_00
[DeviceList.NTamd64]
%DESCRIPTION%=DriverInstall, USB\VID_1FC9&PID_4001, USB\VID_1FC9&PID_4001&MI_00, USB\VID_1FC9&PID_4003&MI_00, USB\VID_1FC9&PID_4005&MI_00, USB\VID_1FC9&PID_4007&MI_00, USB\VID_1FC9&PID_4009&MI_00, USB\VID_1FC9&PID_400b&MI_00, USB\VID_1FC9&PID_400d&MI_00, USB\VID_1FC9&PID_400f&MI_00, USB\VID_1FC9&PID_4011&MI_00, USB\VID_1FC9&PID_4013&MI_00, USB\VID_1FC9&PID_4015&MI_00, USB\VID_1FC9&PID_4017&MI_00, USB\VID_1FC9&PID_4019&MI_00, USB\VID_1FC9&PID_401b&MI_00, USB\VID_1FC9&PID_401d&MI_00, USB\VID_1FC9&PID_401f&MI_00, USB\VID_1FC9&PID_4021&MI_00, USB\VID_1FC9&PID_4023&MI_00, USB\VID_1FC9&PID_4025&MI_00, USB\VID_1FC9&PID_4027&MI_00, USB\VID_1FC9&PID_4029&MI_00, USB\VID_1FC9&PID_402b&MI_00, USB\VID_1FC9&PID_402d&MI_00, USB\VID_1FC9&PID_402f&MI_00, USB\VID_1FC9&PID_4031&MI_00, USB\VID_1FC9&PID_4033&MI_00, USB\VID_1FC9&PID_4035&MI_00, USB\VID_1FC9&PID_4037&MI_00, USB\VID_1FC9&PID_4039&MI_00, USB\VID_1FC9&PID_403b&MI_00, USB\VID_1FC9&PID_403d&MI_00, USB\VID_1FC9&PID_403f&MI_00
%DESCRIPTION%=DriverInstall, USB\VID_1FC9&PID_4001&MI_00, USB\VID_1FC9&PID_4003&MI_00, USB\VID_1FC9&PID_4005&MI_00, USB\VID_1FC9&PID_4007&MI_00, USB\VID_1FC9&PID_4009&MI_00, USB\VID_1FC9&PID_400b&MI_00, USB\VID_1FC9&PID_400d&MI_00, USB\VID_1FC9&PID_400f&MI_00, USB\VID_1FC9&PID_4011&MI_00, USB\VID_1FC9&PID_4013&MI_00, USB\VID_1FC9&PID_4015&MI_00, USB\VID_1FC9&PID_4017&MI_00, USB\VID_1FC9&PID_4019&MI_00, USB\VID_1FC9&PID_401b&MI_00, USB\VID_1FC9&PID_401d&MI_00, USB\VID_1FC9&PID_401f&MI_00, USB\VID_1FC9&PID_4021&MI_00, USB\VID_1FC9&PID_4023&MI_00, USB\VID_1FC9&PID_4025&MI_00, USB\VID_1FC9&PID_4027&MI_00, USB\VID_1FC9&PID_4029&MI_00, USB\VID_1FC9&PID_402b&MI_00, USB\VID_1FC9&PID_402d&MI_00, USB\VID_1FC9&PID_402f&MI_00, USB\VID_1FC9&PID_4031&MI_00, USB\VID_1FC9&PID_4033&MI_00, USB\VID_1FC9&PID_4035&MI_00, USB\VID_1FC9&PID_4037&MI_00, USB\VID_1FC9&PID_4039&MI_00, USB\VID_1FC9&PID_403b&MI_00, USB\VID_1FC9&PID_403d&MI_00, USB\VID_1FC9&PID_403f&MI_00
;------------------------------------------------------------------------------
; String Definitions

View File

@ -67,6 +67,7 @@ FIFO_DEF(fifo_serial, CDCD_APP_BUFFER_SIZE, uint8_t, true);
//--------------------------------------------------------------------+
// IMPLEMENTATION
//--------------------------------------------------------------------+
void cdcd_serial_app_init(void)
{
sem_hdl = osal_semaphore_create( OSAL_SEM_REF(cdcd_semaphore) );
@ -82,7 +83,7 @@ void tusbd_cdc_mounted_cb(uint8_t coreid)
tusbd_cdc_receive(coreid, serial_rx_buffer, CDCD_APP_BUFFER_SIZE, true);
}
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)
{
switch ( pipe_id )
{

View File

@ -59,9 +59,15 @@ static uint8_t keyboardd_report_count; // number of reports sent each mounted
//--------------------------------------------------------------------+
// tinyusb Callbacks
//--------------------------------------------------------------------+
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)
{
switch(event)
{
case TUSB_EVENT_XFER_COMPLETE:
case TUSB_EVENT_XFER_ERROR:
case TUSB_EVENT_XFER_STALLED:
default: break;
}
}
void tusbd_hid_keyboard_mounted_cb(uint8_t coreid)

View File

@ -59,9 +59,15 @@ static uint8_t moused_report_count; // number of reports sent each mounted
//--------------------------------------------------------------------+
// tinyusb Callbacks
//--------------------------------------------------------------------+
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)
{
switch(event)
{
case TUSB_EVENT_XFER_COMPLETE:
case TUSB_EVENT_XFER_ERROR:
case TUSB_EVENT_XFER_STALLED:
default: break;
}
}
void tusbd_hid_mouse_mounted_cb(uint8_t coreid)

View File

@ -86,8 +86,8 @@
#define TUSB_CFG_DEVICE_HID_KEYBOARD 0
#define TUSB_CFG_DEVICE_HID_MOUSE 0
#define TUSB_CFG_DEVICE_HID_GENERIC 0
#define TUSB_CFG_DEVICE_MSC 1
#define TUSB_CFG_DEVICE_CDC 0
#define TUSB_CFG_DEVICE_MSC 0
#define TUSB_CFG_DEVICE_CDC 1
//--------------------------------------------------------------------+

View File

@ -140,10 +140,6 @@ tusb_descriptor_device_t app_tusb_desc_device =
.bDeviceClass = TUSB_CLASS_MISC,
.bDeviceSubClass = MISC_SUBCLASS_COMMON,
.bDeviceProtocol = MISC_PROTOCOL_IAD,
#elif TUSB_CFG_DEVICE_CDC
.bDeviceClass = TUSB_CLASS_CDC,
.bDeviceSubClass = 0x00,
.bDeviceProtocol = 0x00,
#else
.bDeviceClass = 0x00,
.bDeviceSubClass = 0x00,
@ -198,7 +194,6 @@ app_descriptor_configuration_t app_tusb_desc_configuration =
#endif
#if TUSB_CFG_DEVICE_CDC
// USB CDC Serial Interface
//------------- CDC Communication Interface -------------//
.cdc_comm_interface =
{

View File

@ -65,8 +65,8 @@
#define TOTAL_INTEFACES (2*TUSB_CFG_DEVICE_CDC + TUSB_CFG_DEVICE_HID_KEYBOARD + TUSB_CFG_DEVICE_HID_MOUSE + \
TUSB_CFG_DEVICE_HID_GENERIC + TUSB_CFG_DEVICE_MSC)
// Interface Assosication Descriptor is required when enable CDC with any other class
#define IAD_DESC_REQUIRED ( TUSB_CFG_DEVICE_CDC && (TOTAL_INTEFACES > 2) )
// Interface Assosication Descriptor is required when enable CDC
#define IAD_DESC_REQUIRED ( TUSB_CFG_DEVICE_CDC )
//--------------------------------------------------------------------+
// Endpoints Address & Max Packet Size

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -70,7 +70,7 @@ static usbd_class_driver_t const usbd_class_drivers[TUSB_CLASS_MAPPED_INDEX_STAR
.init = hidd_init,
.open = hidd_open,
.control_request = hidd_control_request,
.xfer_cb = hidd_isr,
.xfer_cb = hidd_xfer_cb,
.close = hidd_close
},
#endif
@ -81,7 +81,7 @@ static usbd_class_driver_t const usbd_class_drivers[TUSB_CLASS_MAPPED_INDEX_STAR
.init = mscd_init,
.open = mscd_open,
.control_request = mscd_control_request,
.xfer_cb = mscd_xfer_cb,
.xfer_cb = mscd_xfer_cb,
.close = mscd_close
},
#endif
@ -92,7 +92,7 @@ static usbd_class_driver_t const usbd_class_drivers[TUSB_CLASS_MAPPED_INDEX_STAR
.init = cdcd_init,
.open = cdcd_open,
.control_request = cdcd_control_request,
.xfer_cb = cdcd_isr,
.xfer_cb = cdcd_xfer_cb,
.close = cdcd_close
},
#endif