summaryrefslogtreecommitdiff
path: root/tinyusb/class/hid_device.c
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/class/hid_device.c
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/class/hid_device.c')
-rw-r--r--tinyusb/class/hid_device.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/tinyusb/class/hid_device.c b/tinyusb/class/hid_device.c
index 09fd24186..cbb0bd61c 100644
--- a/tinyusb/class/hid_device.c
+++ b/tinyusb/class/hid_device.c
@@ -138,13 +138,10 @@ tusb_error_t hidd_control_request(uint8_t coreid, tusb_control_request_t const *
uint8_t const desc_type = u16_high_u8(p_request->wValue);
uint8_t const desc_index = u16_low_u8 (p_request->wValue);
- if ( p_request->bRequest == TUSB_REQUEST_GET_DESCRIPTOR && desc_type == HID_DESC_TYPE_REPORT)
- {
- dcd_pipe_control_xfer(coreid, TUSB_DIR_DEV_TO_HOST, p_hid->p_report_desc, p_hid->report_length);
- }else
- {
- dcd_pipe_control_stall(coreid);
- }
+ ASSERT ( p_request->bRequest == TUSB_REQUEST_GET_DESCRIPTOR && desc_type == HID_DESC_TYPE_REPORT,
+ TUSB_ERROR_DCD_CONTROL_REQUEST_NOT_SUPPORT);
+
+ dcd_pipe_control_xfer(coreid, TUSB_DIR_DEV_TO_HOST, p_hid->p_report_desc, p_hid->report_length);
}
//------------- Class Specific Request -------------//
else if (p_request->bmRequestType_bit.type == TUSB_REQUEST_TYPE_CLASS)
@@ -170,12 +167,11 @@ tusb_error_t hidd_control_request(uint8_t coreid, tusb_control_request_t const *
case HID_REQUEST_CONTROL_GET_PROTOCOL:
case HID_REQUEST_CONTROL_SET_PROTOCOL:
default:
- dcd_pipe_control_stall(coreid);
- return TUSB_ERROR_NOT_SUPPORTED_YET;
+ return TUSB_ERROR_DCD_CONTROL_REQUEST_NOT_SUPPORT;
}
}else
{
- dcd_pipe_control_stall(coreid);
+ return TUSB_ERROR_DCD_CONTROL_REQUEST_NOT_SUPPORT;
}
return TUSB_ERROR_NONE;
@@ -215,7 +211,7 @@ 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;
- p_hid->ept_handle = dcd_pipe_open(coreid, p_desc_endpoint);
+ p_hid->ept_handle = dcd_pipe_open(coreid, p_desc_endpoint, p_interface_desc->bInterfaceClass);
ASSERT( endpointhandle_is_valid(p_hid->ept_handle), TUSB_ERROR_DCD_FAILED);
}
break;
@@ -233,6 +229,7 @@ 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);
#if defined(CAP_DEVICE_ROMDRIVER) && TUSB_CFG_DEVICE_USE_ROM_DRIVER
#include "device/dcd_nxp_romdriver.h" // TODO remove rom driver dependency