fix zlp for nrf52840
This commit is contained in:
parent
7aa5a53652
commit
c8247f0907
|
@ -96,6 +96,8 @@ static bool _data_stage_xact(uint8_t rhport)
|
||||||
if ( xact_len ) memcpy(_usbd_ctrl_buf, _ctrl_xfer.buffer, xact_len);
|
if ( xact_len ) memcpy(_usbd_ctrl_buf, _ctrl_xfer.buffer, xact_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TU_LOG2(" XACT Control: 0x%02X, Bytes: %d\n", ep_addr, xact_len);
|
||||||
|
|
||||||
return dcd_edpt_xfer(rhport, ep_addr, xact_len ? _usbd_ctrl_buf : NULL, xact_len);
|
return dcd_edpt_xfer(rhport, ep_addr, xact_len ? _usbd_ctrl_buf : NULL, xact_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,10 +112,10 @@ bool tud_control_xfer(uint8_t rhport, tusb_control_request_t const * request, vo
|
||||||
{
|
{
|
||||||
TU_ASSERT(buffer);
|
TU_ASSERT(buffer);
|
||||||
|
|
||||||
|
TU_LOG2(" XFER Endpoint: 0x%02X, Bytes: %d\n", request->bmRequestType_bit.direction ? EDPT_CTRL_IN : EDPT_CTRL_OUT, _ctrl_xfer.data_len);
|
||||||
|
|
||||||
// Data stage
|
// Data stage
|
||||||
TU_ASSERT( _data_stage_xact(rhport) );
|
TU_ASSERT( _data_stage_xact(rhport) );
|
||||||
|
|
||||||
TU_LOG2(" XFER Endpoint: 0x%02X, Bytes: %d\n", request->bmRequestType_bit.direction ? EDPT_CTRL_IN : EDPT_CTRL_OUT, _ctrl_xfer.data_len);
|
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
// Status stage
|
// Status stage
|
||||||
|
|
|
@ -276,8 +276,10 @@ bool dcd_edpt_xfer (uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, uint16_t
|
||||||
xfer->total_len = total_bytes;
|
xfer->total_len = total_bytes;
|
||||||
xfer->actual_len = 0;
|
xfer->actual_len = 0;
|
||||||
|
|
||||||
// Control endpoint with zero-length packet --> status stage
|
// Control endpoint with zero-length packet and opposite direction to 1st request byte --> status stage
|
||||||
if ( epnum == 0 && total_bytes == 0 )
|
bool const control_status = (epnum == 0 && total_bytes == 0 && dir != tu_edpt_dir(NRF_USBD->BMREQUESTTYPE));
|
||||||
|
|
||||||
|
if ( control_status )
|
||||||
{
|
{
|
||||||
// Status Phase also require Easy DMA has to be free as well !!!!
|
// Status Phase also require Easy DMA has to be free as well !!!!
|
||||||
edpt_dma_start(&NRF_USBD->TASKS_EP0STATUS);
|
edpt_dma_start(&NRF_USBD->TASKS_EP0STATUS);
|
||||||
|
|
Loading…
Reference in New Issue