summaryrefslogtreecommitdiffstats
path: root/nuttx/arch/avr/src
diff options
context:
space:
mode:
authorpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2011-07-02 16:45:04 +0000
committerpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2011-07-02 16:45:04 +0000
commit63a09012e2de6d905cce708c26d2e3f78e6715c2 (patch)
tree8abecc32e9bf05dc6c173de957835f66468674cd /nuttx/arch/avr/src
parentd45523ec1b419f36053f7b66f69543afce7ccbf1 (diff)
Fix SPI SD card detect logic; Fix AVR USB device interrupt initialization
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@3740 7fd9a85b-ad96-42d3-883c-3090e2eb8679
Diffstat (limited to 'nuttx/arch/avr/src')
-rw-r--r--nuttx/arch/avr/src/at90usb/at90usb_usbdev.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/nuttx/arch/avr/src/at90usb/at90usb_usbdev.c b/nuttx/arch/avr/src/at90usb/at90usb_usbdev.c
index deac78beb6..3022352948 100644
--- a/nuttx/arch/avr/src/at90usb/at90usb_usbdev.c
+++ b/nuttx/arch/avr/src/at90usb/at90usb_usbdev.c
@@ -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);