Don't enable interrupts until bound

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@976 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2008-10-03 21:54:16 +00:00
parent 11911ac2a3
commit 05d4dd0f73
1 changed files with 18 additions and 6 deletions

View File

@ -1432,14 +1432,14 @@ static inline void lpc214x_ep0setup(struct lpc214x_usbdev_s *priv)
/* Read EP0 data */
ret = lpc214x_epread(LPC214X_EP0_OUT, (ubyte*)&ctrl, sizeof(struct usb_ctrlreq_s));
ret = lpc214x_epread(LPC214X_EP0_OUT, (ubyte*)&ctrl, USB_SIZEOF_CTRLREQ);
if (ret <= 0)
{
return;
}
uvdbg("type=%02x req=%02x value=%04x index=%04x len=%04x\n",
ctrl.req, ctrl.type,
ctrl.type, ctrl.req,
GETUINT16(ctrl.value), GETUINT16(ctrl.index), GETUINT16(ctrl.len));
/* Dispatch any non-standard requests */
@ -2936,7 +2936,7 @@ void up_usbinitialize(void)
usbtrace(TRACE_DEVINIT, 0);
/* Disable USB inerrupts */
/* Disable USB interrupts */
lpc214x_putreg(0, LPC214X_USBDEV_INTST);
@ -2996,10 +2996,12 @@ void up_usbinitialize(void)
goto errout;
}
/* Enable USB inerrupts */
/* Enable USB inerrupts at the controller -- but do not disable
* the ARM interrupt until the device is bound to the class
* driver
*/
lpc214x_putreg(USBDEV_INTST_ENUSBINTS, LPC214X_USBDEV_INTST);
up_enable_irq(LPC214X_USB_IRQ);
/* Disconnect device */
@ -3103,6 +3105,12 @@ int usbdev_register(struct usbdevclass_driver_s *driver)
usbtrace(TRACE_DEVERROR(LPC214X_TRACEERR_BINDFAILED), (uint16)-ret);
g_usbdev.driver = NULL;
}
else
{
/* Enable USB controller interrupts */
up_enable_irq(LPC214X_USB_IRQ);
}
return ret;
}
@ -3132,6 +3140,10 @@ int usbdev_unregister(struct usbdevclass_driver_s *driver)
CLASS_UNBIND(driver, &g_usbdev.usbdev);
/* Disable USB controller interrupts */
up_disable_irq(LPC214X_USB_IRQ);
/* Unhook the driver */
g_usbdev.driver = NULL;