diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2010-08-07 01:48:15 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2010-08-07 01:48:15 +0000 |
commit | 580db74929cdb7489a744aa3a6e4385f1abfb71b (patch) | |
tree | 9a3e78a489aac8c0df16cdef1994dc0078ad03d5 /nuttx/arch | |
parent | 73d29d6d9c28602c74f70eb7f3193c3fa399b93a (diff) | |
download | px4-nuttx-580db74929cdb7489a744aa3a6e4385f1abfb71b.tar.gz px4-nuttx-580db74929cdb7489a744aa3a6e4385f1abfb71b.tar.bz2 px4-nuttx-580db74929cdb7489a744aa3a6e4385f1abfb71b.zip |
Misc USB device driver debug
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2828 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch')
-rwxr-xr-x | nuttx/arch/arm/src/lpc17xx/lpc17_usb.h | 22 | ||||
-rwxr-xr-x | nuttx/arch/arm/src/lpc17xx/lpc17_usbdev.c | 6 |
2 files changed, 27 insertions, 1 deletions
diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_usb.h b/nuttx/arch/arm/src/lpc17xx/lpc17_usb.h index f9d9752e5..ec2331504 100755 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_usb.h +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_usb.h @@ -679,6 +679,28 @@ #define CMD_USBDEV_CLRBUFFER_PO (0x00000001)
+/* SETMODE(0xf3) command */
+
+#define CMD_SETMODE_APCLK (1 << 0) /* Bit 0: Always PLL Clock */
+#define CMD_SETMODE_INAKCI (1 << 1) /* Bit 1: Interrupt on NAK for Control IN endpoint */
+#define CMD_SETMODE_INAKCO (1 << 2) /* Bit 2: Interrupt on NAK for Control OUT endpoint */
+#define CMD_SETMODE_INAKII (1 << 3) /* Bit 3: Interrupt on NAK for Interrupt IN endpoint */
+#define CMD_SETMODE_INAKIO (1 << 4) /* Bit 4: Interrupt on NAK for Interrupt OUT endpoints */
+#define CMD_SETMODE_INAKBI (1 << 5) /* Bit 5: Interrupt on NAK for Bulk IN endpoints */
+#define CMD_SETMODE_INAKBO (1 << 6) /* Bit 6: Interrupt on NAK for Bulk OUT endpoints */
+
+/* READERRORSTATUS (0xFb) command */
+
+#define CMD_READERRORSTATUS_PIDERR (1 << 0) /* Bit 0: PID encoding/unknown or Token CRC */
+#define CMD_READERRORSTATUS_UEPKT (1 << 1) /* Bit 1: Unexpected Packet */
+#define CMD_READERRORSTATUS_DCRC (1 << 2) /* Bit 2: Data CRC error */
+#define CMD_READERRORSTATUS_TIMEOUT (1 << 3) /* Bit 3: Time out error */
+#define CMD_READERRORSTATUS_EOP (1 << 4) /* Bit 4: End of packet error */
+#define CMD_READERRORSTATUS_BOVRN (1 << 5) /* Bit 5: Buffer Overrun */
+#define CMD_READERRORSTATUS_BTSTF (1 << 6) /* Bit 6: Bit stuff error */
+#define CMD_READERRORSTATUS_TGLERR (1 << 7) /* Bit 7: Wrong toggle in data PID */
+#define CMD_READERRORSTATUS_ALLERRS (0xff)
+
/* DMA ******************************************************************************/
/* The DMA descriptor */
diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_usbdev.c b/nuttx/arch/arm/src/lpc17xx/lpc17_usbdev.c index c5389813a..7faa7bd3c 100755 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_usbdev.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_usbdev.c @@ -2080,7 +2080,7 @@ static int lpc17_usbinterrupt(int irq, FAR void *context) /* And show what error occurred */ - errcode = (uint8_t)lpc17_usbcmd(CMD_USBDEV_READERRORSTATUS, 0) & 0x0f; + errcode = (uint8_t)lpc17_usbcmd(CMD_USBDEV_READERRORSTATUS, 0) & CMD_READERRORSTATUS_ALLERRS; usbtrace(TRACE_INTDECODE(LPC17_TRACEINTID_ERRINT), (uint16_t)errcode); } #endif @@ -3245,6 +3245,10 @@ void up_usbinitialize(void) lpc17_putreg(0xffffffff, LPC17_USBDEV_EPINTCLR); lpc17_putreg(0, LPC17_USBDEV_EPINTPRI); + /* Interrupt only on ACKs */ + + lpc17_usbcmd(CMD_USBDEV_SETMODE, 0); + /* Attach USB controller interrupt handler */ if (irq_attach(LPC17_IRQ_USB, lpc17_usbinterrupt) != 0) |