diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-01-04 03:04:06 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-01-04 03:04:06 +0000 |
commit | a4298bd439dfe30019734fa6e6e1558b2f8b1e02 (patch) | |
tree | 41b7adcdcf3be301ef8b23104e7b813158b1df95 /nuttx | |
parent | 23b9abccb76fba1095baef05e6016328a2bd3f3b (diff) | |
download | px4-nuttx-a4298bd439dfe30019734fa6e6e1558b2f8b1e02.tar.gz px4-nuttx-a4298bd439dfe30019734fa6e6e1558b2f8b1e02.tar.bz2 px4-nuttx-a4298bd439dfe30019734fa6e6e1558b2f8b1e02.zip |
Mostly debug stuff
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3233 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx')
-rwxr-xr-x | nuttx/arch/arm/src/lpc17xx/lpc17_usbhost.c | 61 | ||||
-rw-r--r-- | nuttx/drivers/usbhost/usbhost_storage.c | 5 | ||||
-rwxr-xr-x | nuttx/include/nuttx/usb/ohci.h | 2 |
3 files changed, 53 insertions, 15 deletions
diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_usbhost.c b/nuttx/arch/arm/src/lpc17xx/lpc17_usbhost.c index 6a1fbeeb2..49719673c 100755 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_usbhost.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_usbhost.c @@ -91,7 +91,18 @@ /* CLKCTRL enable bits */ -#define LPC17_CLKCTRL_ENABLES (USBOTG_CLK_HOSTCLK|USBOTG_CLK_PORTSELCLK|USBOTG_CLK_AHBCLK) +#define LPC17_CLKCTRL_ENABLES (USBOTG_CLK_HOSTCLK|USBOTG_CLK_PORTSELCLK|USBOTG_CLK_AHBCLK) + +/* Interrupt enable bits */ + +#ifdef CONFIG_DEBUG_USB +# define LPC17_DEBUG_INTS (OHCI_INT_SO|OHCI_INT_RD|OHCI_INT_UE|OHCI_INT_OC) +#else +# define LPC17_DEBUG_INTS 0 +#endif + +#define LPC17_NORMAL_INTS (OHCI_INT_WDH|OHCI_INT_RHSC) +#define LPC17_ALL_INTS (LPC17_NORMAL_INTS|LPC17_DEBUG_INTS) /* Dump GPIO registers */ @@ -816,6 +827,13 @@ static int lpc17_usbinterrupt(int irq, FAR void *context) lpc17_givesem(&priv->wdhsem); } +#ifdef CONFIG_DEBUG_USB + if ((pending & LPC17_DEBUG_INTS) != 0) + { + ulldbg("ERROR: Unhandled interrupts INTST:%08x\n", intst); + } +#endif + /* Clear interrupt status register */ lpc17_putreg(intst, LPC17_USBHOST_INTST); @@ -865,6 +883,7 @@ static int lpc17_wait(FAR struct usbhost_driver_s *drvr, bool connected) lpc17_takesem(&priv->rhssem); } + udbg("Connected:%s\n", priv->connected ? "YES" : "NO"); return OK; } @@ -1214,12 +1233,16 @@ static int lpc17_transfer(FAR struct usbhost_driver_s *drvr, goto errout; } - /* Copy the user data into the AHB SRAM IO buffer. Sad... so - * inefficient. But without exposing the AHB SRAM to the final, - * end-user client I don't know of any way around this copy. + /* If this is an OUT transaction, copy the user data into the AHB + * SRAM IO buffer. Sad... so inefficient. But without exposing + * the AHB SRAM to the final, end-user client I don't know of any + * way around this copy. */ - memcpy(buffer, origbuf, buflen); + if (ep->in == 0) + { + memcpy(buffer, origbuf, buflen); + } } #endif @@ -1303,6 +1326,19 @@ errout: #ifdef CONFIG_UBHOST_AHBIOBUFFERS if (buffer && origbuf) { + /* If this is an IN transaction, get the user data from the AHB + * SRAM IO buffer. Sad... so inefficient. But without exposing + * the AHB SRAM to the final, end-user client I don't know of any + * way around this copy. + */ + + if (ep->in != 0) + { + memcpy(origbuf, buffer, buflen); + } + + /* Then free the temporary I/O buffer */ + lpc17_iofree(priv, buffer); } #endif @@ -1561,8 +1597,8 @@ FAR struct usbhost_driver_s *usbhost_initialize(int controller) lpc17_putreg(regval, LPC17_USBHOST_INTST); /* Enable OHCI interrupts */ - - lpc17_putreg((OHCI_INT_MIE | OHCI_INT_WDH | OHCI_INT_RHSC), LPC17_USBHOST_INTEN); + + lpc17_putreg((LPC17_ALL_INTS|OHCI_INT_MIE), LPC17_USBHOST_INTEN); /* Attach USB host controller interrupt handler */ @@ -1582,11 +1618,6 @@ FAR struct usbhost_driver_s *usbhost_initialize(int controller) lpc17_putreg(regval, LPC17_SYSCON_USBINTST); irqrestore(flags); - /* Enable interrupts at the interrupt controller */ - - up_enable_irq(LPC17_IRQ_USB); /* enable USB interrupt */ - udbg("USB host Initialized\n"); - /* If there is a USB device in the slot at power up, then we will not * get the status change interrupt to signal us that the device is * connected. We need to set the initial connected state accordingly. @@ -1595,5 +1626,11 @@ FAR struct usbhost_driver_s *usbhost_initialize(int controller) regval = lpc17_getreg(LPC17_USBHOST_RHPORTST1); priv->connected = ((regval & OHCI_RHPORTST_CCS) != 0); + /* Enable interrupts at the interrupt controller */ + + up_enable_irq(LPC17_IRQ_USB); /* enable USB interrupt */ + udbg("USB host Initialized, Device connected:%s\n", + priv->connected ? "YES" : "NO"); + return &priv->drvr; } diff --git a/nuttx/drivers/usbhost/usbhost_storage.c b/nuttx/drivers/usbhost/usbhost_storage.c index 21a87c5b0..680e21569 100644 --- a/nuttx/drivers/usbhost/usbhost_storage.c +++ b/nuttx/drivers/usbhost/usbhost_storage.c @@ -928,7 +928,10 @@ static void usbhost_initvolume(FAR void *arg) break; } - /* No.. Request mode sense information (ignoring return status) */ + /* No.. Request mode sense information. The REQUEST SENSE command + * is sent only "to clear interlocked unit attention conditions." + * The returned status is ignored here. + */ uvdbg("Request sense\n"); result = usbhost_requestsense(priv); diff --git a/nuttx/include/nuttx/usb/ohci.h b/nuttx/include/nuttx/usb/ohci.h index bf151b5e6..c20e34b3e 100755 --- a/nuttx/include/nuttx/usb/ohci.h +++ b/nuttx/include/nuttx/usb/ohci.h @@ -180,7 +180,6 @@ /* HcFmRemaining: Bit time remaining in current frame (7.3.2) */ -#define OHCI_FMREM_ #define OHCI_FMREM_FR_SHIFT (0) /* Bits 0-13: Frame remaining */ #define OHCI_FMREM_FR_MASK (0x3fff << OHCI_FMREM_FR_SHIFT) /* Bits 16-30: Reserved */ @@ -188,7 +187,6 @@ /* HcFmNumber: Frame number counter (7.3.3) */ -#define OHCI_FMNO_ #define OHCI_FMNO_FI_SHIFT (0) /* Bits 0-15: Frame number */ #define OHCI_FMNO_FI_MASK (0xffff << OHCI_FMINT_FI_SHIFT) /* Bits 16-31: Reserved */ |