Implemented USBPhyHw::unconfigure() as it was causing configuration changes to fail. Endpoints were not being removed properly in the Nordic driver

pull/11023/head
George Beckstein 2019-02-02 11:22:55 -05:00 committed by Evelyne Donnaes
parent 1b2df29254
commit c2beffb7fa
1 changed files with 6 additions and 13 deletions

View File

@ -73,11 +73,6 @@ static uint8_t debug_evt_index = 0;
#endif #endif
// TODO remove this -- for debugging purposes
int nrf_usb_iface = 0;
void usb_phy_interface_was_set(int iface) { nrf_usb_iface = iface; }
USBPhy *get_usb_phy() { USBPhy *get_usb_phy() {
static USBPhyHw usbphy; static USBPhyHw usbphy;
return &usbphy; return &usbphy;
@ -199,7 +194,8 @@ void USBPhyHw::configure() {
} }
void USBPhyHw::unconfigure() { void USBPhyHw::unconfigure() {
// Not needed // Remove all endpoints (except control, obviously)
nrf_drv_usbd_ep_default_config();
} }
void USBPhyHw::sof_enable() { void USBPhyHw::sof_enable() {
@ -419,8 +415,8 @@ bool USBPhyHw::endpoint_write(usb_ep_t endpoint, uint8_t *data, uint32_t size) {
void USBPhyHw::endpoint_abort(usb_ep_t endpoint) { void USBPhyHw::endpoint_abort(usb_ep_t endpoint) {
nrf_drv_usbd_ep_t nrf_ep = get_nordic_endpoint(endpoint); nrf_drv_usbd_ep_t nrf_ep = get_nordic_endpoint(endpoint);
// Don't call abort on ISO endpoints -- this will cause an ASSERT in the Nordic driver // Don't call abort on ISO endpoints -- this will cause an ASSERT in the Nordic driver
if(nrf_ep != NRF_DRV_USBD_EPOUT8 && nrf_ep != NRF_DRV_USBD_EPIN8) //if(nrf_ep != NRF_DRV_USBD_EPOUT8 && nrf_ep != NRF_DRV_USBD_EPIN8)
nrf_drv_usbd_ep_abort(nrf_ep); nrf_drv_usbd_ep_abort(nrf_ep);
} }
void USBPhyHw::process() { void USBPhyHw::process() {
@ -456,11 +452,8 @@ void USBPhyHw::process() {
events->sof(usb_event.data.sof.framecnt); events->sof(usb_event.data.sof.framecnt);
break; break;
case NRF_DRV_USBD_EVT_EPTRANSFER: case NRF_DRV_USBD_EVT_EPTRANSFER:
if(nrf_usb_iface == 2 && usb_event.data.eptransfer.ep == NRF_DRV_USBD_EPOUT1) if(usb_event.data.eptransfer.status == NRF_USBD_EP_OK)// ||
{ //usb_event.data.eptransfer.status == NRF_USBD_EP_WAITING)
while(true);
}
if(usb_event.data.eptransfer.status == NRF_USBD_EP_OK)
{ {
if(IS_IN_EP(usb_event.data.eptransfer.ep)) if(IS_IN_EP(usb_event.data.eptransfer.ep))
{ {