Fix SPI SD card detect logic; Fix AVR USB device interrupt initialization

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3740 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2011-07-02 16:45:04 +00:00
parent 3a29986d80
commit ad7f0bccc5

View File

@ -2745,14 +2745,6 @@ void up_usbinitialize(void)
{
usbtrace(TRACE_DEVINIT, 0);
/* Shutdown the USB interface to put it in a known initial state */
avr_usbshutdown();
/* Select USB device mode */
UHWCON |= (1 << UIMOD);
/* Initialize the device state structure */
memset(&g_usbdev, 0, sizeof(struct avr_usbdev_s));
@ -2760,10 +2752,6 @@ void up_usbinitialize(void)
g_usbdev.usbdev.ep0 = &g_usbdev.eplist[AVR_EP0].ep;
g_usbdev.epavail = AVR_ALL_EPS & ~(1 << AVR_EP0);
/* Reset the interface to force re-enumeration */
avr_usbreset();
/* Attach USB controller general interrupt handler */
if (irq_attach(AT90USB_IRQ_USBGEN, avr_geninterrupt) != 0)
@ -2780,6 +2768,20 @@ void up_usbinitialize(void)
goto errout;
}
/* Shutdown the USB interface to put it in a known initial state */
avr_usbshutdown();
/* Select USB device mode */
UHWCON |= (1 << UIMOD);
/* Reset the interface to force re-enumeration (the reset operation
* enables interrupts.
*/
avr_usbreset();
/* Set the VBUS pad */
USBCON |= (1 << OTGPADE);