mirror of https://github.com/ARMmbed/mbed-os.git
Fixed bug causing usb_control_stall_test to fail intermittently. Preparing the Nordic HW for the status stage of a control transfer would sometimes cause the HW to automatically ACK an "invalid" command during the control stall test. This would cause the test to fail (because an invalid request was not stalled).
parent
c5f947754c
commit
f49b36c930
|
@ -298,6 +298,19 @@ uint32_t USBPhyHw::ep0_read_result() {
|
||||||
|
|
||||||
void USBPhyHw::ep0_write(uint8_t *buffer, uint32_t size) {
|
void USBPhyHw::ep0_write(uint8_t *buffer, uint32_t size) {
|
||||||
|
|
||||||
|
// If the transfer size is 0 and
|
||||||
|
// the setup packet request size was 0,
|
||||||
|
// enter the status stage immediately
|
||||||
|
if(size == 0 && setup_buf.wLength == 0)
|
||||||
|
{
|
||||||
|
nrf_drv_usbd_setup_clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO - this function should check what stage the control transfer
|
||||||
|
// is in before enabling shorts or triggering events.
|
||||||
|
// During the status stage ep0_write is called with size=0
|
||||||
|
// ZLP arguments. See note below:
|
||||||
|
|
||||||
nrf_drv_usbd_transfer_t* transfer = get_transfer_buffer(NRF_DRV_USBD_EPIN0);
|
nrf_drv_usbd_transfer_t* transfer = get_transfer_buffer(NRF_DRV_USBD_EPIN0);
|
||||||
memset(transfer, 0, sizeof(nrf_drv_usbd_transfer_t));
|
memset(transfer, 0, sizeof(nrf_drv_usbd_transfer_t));
|
||||||
transfer->p_data.tx = buffer;
|
transfer->p_data.tx = buffer;
|
||||||
|
@ -457,9 +470,9 @@ void USBPhyHw::process() {
|
||||||
setup_remaining = setup_buf.wLength;
|
setup_remaining = setup_buf.wLength;
|
||||||
|
|
||||||
// Skip data stage, go straight to status stage
|
// Skip data stage, go straight to status stage
|
||||||
if(setup_buf.wLength == 0) {
|
// if(setup_buf.wLength == 0) {
|
||||||
nrf_drv_usbd_setup_clear();
|
// nrf_drv_usbd_setup_clear();
|
||||||
}
|
// }
|
||||||
// else if((setup_buf.bmRequestType & SETUP_TRANSFER_DIR_MASK) == 0) {
|
// else if((setup_buf.bmRequestType & SETUP_TRANSFER_DIR_MASK) == 0) {
|
||||||
// // HOST->DEVICE transfer, need to notify hardware of Data OUT stage
|
// // HOST->DEVICE transfer, need to notify hardware of Data OUT stage
|
||||||
// nrf_drv_usbd_setup_data_clear();
|
// nrf_drv_usbd_setup_data_clear();
|
||||||
|
|
Loading…
Reference in New Issue