mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-17 05:32:55 +08:00
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.
This commit is contained in:
parent
9a48a4aa03
commit
dfae1904d5
@ -353,6 +353,7 @@ void dcd_pipe_control_stall(uint8_t coreid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// control transfer does not need to use qtd find function
|
// 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)
|
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];
|
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_data = (dir == TUSB_DIR_DEV_TO_HOST) ? 1 : 0;
|
||||||
uint8_t const ep_status = 1 - ep_data;
|
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);
|
ASSERT_FALSE(p_dcd->qhd[0].qtd_overlay.active || p_dcd->qhd[1].qtd_overlay.active, TUSB_ERROR_FAILED);
|
||||||
|
|
||||||
//------------- Data Phase -------------//
|
//------------- 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;
|
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;
|
return TUSB_ERROR_NONE;
|
||||||
}
|
}
|
||||||
|
@ -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)
|
void usbd_setup_received_isr(uint8_t coreid, tusb_control_request_t * p_request)
|
||||||
{
|
{
|
||||||
|
#if 1
|
||||||
usbd_task_event_t task_event =
|
usbd_task_event_t task_event =
|
||||||
{
|
{
|
||||||
.coreid = coreid,
|
.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);
|
task_event.setup_received = (*p_request);
|
||||||
osal_queue_send(usbd_queue_hdl, &task_event);
|
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)
|
void usbd_xfer_isr(endpoint_handle_t edpt_hdl, tusb_event_t event, uint32_t xferred_bytes)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user