diff options
| author | hathach <[email protected]> | 2014-04-21 21:55:17 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2014-04-21 21:55:17 +0700 |
| commit | dfae1904d51069f4714d97638764fb1f2dd1d4df (patch) | |
| tree | 19459df965564daacf11410aef35e56224b1c6a0 /tinyusb | |
| parent | 9a48a4aa0318cc499369758b6cbafe9088fb85bb (diff) | |
minor adjustment to dcd_lpc43xx.c
usbd still defer setup received and handle in usbd task since the problem is caused by usb mini otg on the board EA4357.
Diffstat (limited to 'tinyusb')
| -rw-r--r-- | tinyusb/device/dcd_lpc43xx.c | 4 | ||||
| -rw-r--r-- | tinyusb/device/usbd.c | 10 |
2 files changed, 13 insertions, 1 deletions
diff --git a/tinyusb/device/dcd_lpc43xx.c b/tinyusb/device/dcd_lpc43xx.c index f2c8519ee..ea020a4ef 100644 --- a/tinyusb/device/dcd_lpc43xx.c +++ b/tinyusb/device/dcd_lpc43xx.c @@ -353,6 +353,7 @@ void dcd_pipe_control_stall(uint8_t coreid) }
// control transfer does not need to use qtd find function
+// follows UM 24.10.8.1.1 Setup packet handling using setup lockout mechanism
tusb_error_t dcd_pipe_control_xfer(uint8_t coreid, tusb_direction_t dir, uint8_t * p_buffer, uint16_t length, bool int_on_complete)
{
LPC_USB0_Type* const lpc_usb = LPC_USB[coreid];
@@ -362,6 +363,7 @@ tusb_error_t dcd_pipe_control_xfer(uint8_t coreid, tusb_direction_t dir, uint8_t uint8_t const ep_data = (dir == TUSB_DIR_DEV_TO_HOST) ? 1 : 0;
uint8_t const ep_status = 1 - ep_data;
+ while(lpc_usb->ENDPTSETUPSTAT & BIT_(0)) {} // wait until ENDPTSETUPSTAT before priming data/status in response
ASSERT_FALSE(p_dcd->qhd[0].qtd_overlay.active || p_dcd->qhd[1].qtd_overlay.active, TUSB_ERROR_FAILED);
//------------- Data Phase -------------//
@@ -381,7 +383,7 @@ tusb_error_t dcd_pipe_control_xfer(uint8_t coreid, tusb_direction_t dir, uint8_t p_dcd->qhd[ep_status].qtd_overlay.next = (uint32_t) p_qtd_status;
- LPC_USB0->ENDPTPRIME = BIT_(edpt_phy2pos(ep_status)); // | (length>0 ? BIT_(edpt_phy2pos(ep_data)) : 0 );
+ lpc_usb->ENDPTPRIME = BIT_(edpt_phy2pos(ep_status));
return TUSB_ERROR_NONE;
}
diff --git a/tinyusb/device/usbd.c b/tinyusb/device/usbd.c index 258a8ef9f..693e50ada 100644 --- a/tinyusb/device/usbd.c +++ b/tinyusb/device/usbd.c @@ -417,6 +417,7 @@ void usbd_dcd_bus_event_isr(uint8_t coreid, usbd_bus_event_type_t bus_event) void usbd_setup_received_isr(uint8_t coreid, tusb_control_request_t * p_request)
{
+#if 1
usbd_task_event_t task_event =
{
.coreid = coreid,
@@ -425,6 +426,15 @@ void usbd_setup_received_isr(uint8_t coreid, tusb_control_request_t * p_request) task_event.setup_received = (*p_request);
osal_queue_send(usbd_queue_hdl, &task_event);
+#else
+ if ( (p_request->wLength > 0) && (p_request->bmRequestType_bit.direction == TUSB_DIR_HOST_TO_DEV) )
+ { // Control Out with data --> get data first and handle in control complete
+
+ }else
+ {
+ usbd_control_request_subtask(coreid, p_request);
+ }
+#endif
}
void usbd_xfer_isr(endpoint_handle_t edpt_hdl, tusb_event_t event, uint32_t xferred_bytes)
|
