Removed disable from disconnect to see if it affects the success of the soft reset test.

pull/10689/head
George Beckstein 2018-12-26 19:15:28 -05:00 committed by aglass0fmilk
parent 09c5982a4b
commit f00053820b
1 changed files with 24 additions and 7 deletions

View File

@ -139,6 +139,10 @@ void USBPhyHw::connect() {
// when the internal regulator has settled // when the internal regulator has settled
if(!nrf_drv_usbd_is_enabled()) if(!nrf_drv_usbd_is_enabled())
nrf_drv_usbd_enable(); nrf_drv_usbd_enable();
if(nrf_drv_power_usbstatus_get() == NRF_DRV_POWER_USB_STATE_READY
&& !nrf_drv_usbd_is_started())
nrf_drv_usbd_start(false);//nrf_drv_usbd_start(true);
} }
} }
@ -148,8 +152,8 @@ void USBPhyHw::disconnect() {
if(nrf_drv_usbd_is_started()) if(nrf_drv_usbd_is_started())
nrf_drv_usbd_stop(); nrf_drv_usbd_stop();
if(nrf_drv_usbd_is_enabled()) // if(nrf_drv_usbd_is_enabled())
nrf_drv_usbd_disable(); // nrf_drv_usbd_disable();
} }
void USBPhyHw::configure() { void USBPhyHw::configure() {
@ -232,7 +236,16 @@ void USBPhyHw::ep0_read(uint8_t *data, uint32_t size) {
transfer->p_data.rx = data; transfer->p_data.rx = data;
transfer->size = size; transfer->size = size;
// Update the number of bytes remaining in the setup data stage // if((setup_total == 1) && ((setup_buf.bmRequestType & SETUP_TRANSFER_DIR_MASK) == 0))
// {
// setup_remaining -= size;
// }
// else
// {
// // Update the number of bytes remaining in the setup data stage
// setup_remaining -= size;
// }
setup_remaining -= size; setup_remaining -= size;
nrf_drv_usbd_setup_data_clear(); // tell the hardware to receive another OUT packet nrf_drv_usbd_setup_data_clear(); // tell the hardware to receive another OUT packet
@ -412,10 +425,10 @@ void USBPhyHw::process() {
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();
} // }
// Notify the Mbed stack // Notify the Mbed stack
events->ep0_setup(); events->ep0_setup();
@ -496,6 +509,10 @@ void USBPhyHw::_reset(void)
// Disable all endpoints except for control endpoints // Disable all endpoints except for control endpoints
nrf_drv_usbd_ep_default_config(); nrf_drv_usbd_ep_default_config();
nrf_drv_usbd_setup_clear();
usb_event_type = USB_HW_EVENT_NONE;
// TODO - Clear all endpoint interrupts? // TODO - Clear all endpoint interrupts?
} }