summaryrefslogtreecommitdiff
path: root/tinyusb/host
diff options
context:
space:
mode:
authorhathach <[email protected]>2013-07-05 11:46:12 +0700
committerhathach <[email protected]>2013-07-05 11:46:12 +0700
commitc08c655fd120033f33fc40464018c743c646a512 (patch)
treefbc0a3cbd48c45c09a1bb1b00b8ee4ed99935abd /tinyusb/host
parent9d50b0fa6a6a42d79bc35ccccf212af805a93ae6 (diff)
implementing initializing for RNDIS
Diffstat (limited to 'tinyusb/host')
-rw-r--r--tinyusb/host/usbh.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/tinyusb/host/usbh.c b/tinyusb/host/usbh.c
index 06c95f4fe..7e7de66d2 100644
--- a/tinyusb/host/usbh.c
+++ b/tinyusb/host/usbh.c
@@ -184,6 +184,8 @@ tusb_error_t usbh_init(void)
//------------- USBH control transfer -------------//
// function called within a task, requesting os blocking services, subtask input parameter must be static/global variables
+//tusb_error_t usbh_control_xfer_subtask(uint8_t dev_addr, uint8_t bmRequestType, uint8_t bRequest,
+// uint16_t wValue, uint16_t wIndex, uint16_t wLength, uint8_t* data )
tusb_error_t usbh_control_xfer_subtask(uint8_t dev_addr, tusb_control_request_t const* p_request, uint8_t* data)
{
tusb_error_t error;
@@ -195,15 +197,16 @@ tusb_error_t usbh_control_xfer_subtask(uint8_t dev_addr, tusb_control_request_t
usbh_devices[dev_addr].control.request = *p_request;
/*SUBTASK_ASSERT_STATUS*/ (void) ( hcd_pipe_control_xfer(dev_addr, &usbh_devices[dev_addr].control.request, data) );
- usbh_devices[dev_addr].control.pipe_status = TUSB_INTERFACE_STATUS_BUSY;
+ usbh_devices[dev_addr].control.pipe_status = 0;
osal_semaphore_wait(usbh_devices[dev_addr].control.sem_hdl, OSAL_TIMEOUT_NORMAL, &error); // careful of local variable without static
osal_mutex_release(usbh_devices[dev_addr].control.mutex_hdl);
// TODO make handler for this function general purpose
- SUBTASK_ASSERT_WITH_HANDLER(TUSB_ERROR_NONE == error && usbh_devices[dev_addr].control.pipe_status != TUSB_INTERFACE_STATUS_ERROR,
- tusbh_device_mount_failed_cb(TUSB_ERROR_USBH_MOUNT_DEVICE_NOT_RESPOND, NULL) );
+ SUBTASK_ASSERT_WITH_HANDLER(TUSB_ERROR_NONE == error &&
+ TUSB_EVENT_XFER_COMPLETE == usbh_devices[dev_addr].control.pipe_status,
+ tusbh_device_mount_failed_cb(TUSB_ERROR_USBH_MOUNT_DEVICE_NOT_RESPOND, NULL) );
OSAL_SUBTASK_END
}
@@ -241,7 +244,7 @@ void usbh_xfer_isr(pipe_handle_t pipe_hdl, uint8_t class_code, tusb_event_t even
uint8_t class_index = std_class_code_to_index(class_code);
if (TUSB_XFER_CONTROL == pipe_hdl.xfer_type)
{
- usbh_devices[ pipe_hdl.dev_addr ].control.pipe_status = (event == TUSB_EVENT_XFER_COMPLETE) ? TUSB_INTERFACE_STATUS_COMPLETE : TUSB_INTERFACE_STATUS_ERROR;
+ usbh_devices[ pipe_hdl.dev_addr ].control.pipe_status = event;
osal_semaphore_post( usbh_devices[ pipe_hdl.dev_addr ].control.sem_hdl );
}else if (usbh_class_drivers[class_index].isr)
{
@@ -451,7 +454,9 @@ tusb_error_t enumeration_body_subtask(void)
if (usbh_class_drivers[class_index].open_subtask) // supported class
{
- uint16_t length=0;
+ static uint16_t length;
+ length = 0;
+
OSAL_SUBTASK_INVOKED_AND_WAIT ( // parameters in task/sub_task must be static storage (static or global)
usbh_class_drivers[class_index].open_subtask( new_addr, (tusb_descriptor_interface_t*) p_desc, &length ),
error