mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 14:53:47 +08:00
Final cleanup before testing
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3203 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -1410,3 +1410,9 @@
|
|||||||
* include/nuttx/usb -- Created new directory. Moved all usb-related header
|
* include/nuttx/usb -- Created new directory. Moved all usb-related header
|
||||||
files to this new directory. Created a skeleton for a new USB host header
|
files to this new directory. Created a skeleton for a new USB host header
|
||||||
file
|
file
|
||||||
|
* drivers/usbhost -- Add USB host "registry" where connect devices can be
|
||||||
|
matched with the correct USB class driver. Add a USB host class driver
|
||||||
|
for the (Bulk-Only) USB Mass Storage Class. Untested on initial check-iin
|
||||||
|
* arc/arc/src/lpc17xx/lpc17_usbhost.c -- Add a simple USB host driver for
|
||||||
|
the NXP lpc17xx. Untested on initial check-in.
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<tr align="center" bgcolor="#e4e4e4">
|
<tr align="center" bgcolor="#e4e4e4">
|
||||||
<td>
|
<td>
|
||||||
<h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1>
|
<h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1>
|
||||||
<p>Last Updated: December 13, 2010</p>
|
<p>Last Updated: December 20, 2010</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@@ -2016,6 +2016,11 @@ nuttx-5.16 2011-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
|
|||||||
* include/nuttx/usb -- Created new directory. Moved all usb-related header
|
* include/nuttx/usb -- Created new directory. Moved all usb-related header
|
||||||
files to this new directory. Created a skeleton for a new USB host header
|
files to this new directory. Created a skeleton for a new USB host header
|
||||||
file
|
file
|
||||||
|
* drivers/usbhost -- Add USB host "registry" where connect devices can be
|
||||||
|
matched with the correct USB class driver. Add a USB host class driver
|
||||||
|
for the (Bulk-Only) USB Mass Storage Class. Untested on initial check-iin
|
||||||
|
* arc/arc/src/lpc17xx/lpc17_usbhost.c -- Add a simple USB host driver for
|
||||||
|
the NXP lpc17xx. Untested on initial check-in.
|
||||||
|
|
||||||
pascal-2.1 2010-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
|
pascal-2.1 2010-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,6 @@
|
|||||||
#include <nuttx/usb/usb.h>
|
#include <nuttx/usb/usb.h>
|
||||||
#include <nuttx/usb/ohci.h>
|
#include <nuttx/usb/ohci.h>
|
||||||
#include <nuttx/usb/usbhost.h>
|
#include <nuttx/usb/usbhost.h>
|
||||||
#include <nuttx/usb/usbhost_trace.h>
|
|
||||||
|
|
||||||
#include <arch/irq.h>
|
#include <arch/irq.h>
|
||||||
#include <arch/board/board.h>
|
#include <arch/board/board.h>
|
||||||
@@ -71,6 +70,17 @@
|
|||||||
* Definitions
|
* Definitions
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
|
/* I think it is the case that all I/O buffers must lie in AHB SRAM because of
|
||||||
|
* the OHCI DMA. But this definition has here so that I can experiment later
|
||||||
|
* to see if this really required.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define CONFIG_UBHOST_AHBIOBUFFERS 1
|
||||||
|
|
||||||
|
#if defined(CONFIG_UBHOST_AHBIOBUFFERS) && LPC17_IOBUFFERS < 1
|
||||||
|
# error "No IO buffers allocated"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Frame Interval */
|
/* Frame Interval */
|
||||||
|
|
||||||
#define FI (12000-1) /* 12000 bits per frame (-1) */
|
#define FI (12000-1) /* 12000 bits per frame (-1) */
|
||||||
@@ -178,9 +188,9 @@ struct lpc17_edlist_s
|
|||||||
uint32_t pad[3]; /* To make the same size as struct lpc17_hced_s */
|
uint32_t pad[3]; /* To make the same size as struct lpc17_hced_s */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct lpc17_tdlist_s
|
struct lpc17_buflist_s
|
||||||
{
|
{
|
||||||
struct lpc17_tdlist_s *flink; /* Link to next TD buffer in the list */
|
struct lpc17_buflist_s *flink; /* Link to next buffer in the list */
|
||||||
/* Variable length buffer data follows */
|
/* Variable length buffer data follows */
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -214,6 +224,12 @@ static void lpc17_putle16(uint8_t *dest, uint16_t val);
|
|||||||
|
|
||||||
static struct lpc17_hced_s *lpc17_edalloc(struct lpc17_usbhost_s *priv);
|
static struct lpc17_hced_s *lpc17_edalloc(struct lpc17_usbhost_s *priv);
|
||||||
static void lpc17_edfree(struct lpc17_usbhost_s *priv, struct lpc17_hced_s *ed);
|
static void lpc17_edfree(struct lpc17_usbhost_s *priv, struct lpc17_hced_s *ed);
|
||||||
|
static uint8_t *lpc17_tdalloc(struct lpc17_usbhost_s *priv);
|
||||||
|
static void lpc17_tdfree(struct lpc17_usbhost_s *priv, uint8_t *buffer);
|
||||||
|
#ifdef CONFIG_UBHOST_AHBIOBUFFERS
|
||||||
|
static uint8_t *lpc17_ioalloc(struct lpc17_usbhost_s *priv);
|
||||||
|
static void lpc17_iofree(struct lpc17_usbhost_s *priv, uint8_t *buffer);
|
||||||
|
#endif
|
||||||
static void lpc17_enqueuetd(volatile struct lpc17_hced_s *ed, uint32_t dirpid,
|
static void lpc17_enqueuetd(volatile struct lpc17_hced_s *ed, uint32_t dirpid,
|
||||||
uint32_t toggle, volatile uint8_t *buffer,
|
uint32_t toggle, volatile uint8_t *buffer,
|
||||||
size_t buflen);
|
size_t buflen);
|
||||||
@@ -282,7 +298,10 @@ static struct lpc17_usbhost_s g_usbhost =
|
|||||||
/* This is a free list of EDs and TD buffers */
|
/* This is a free list of EDs and TD buffers */
|
||||||
|
|
||||||
static struct lpc17_edlist_s *g_edfree;
|
static struct lpc17_edlist_s *g_edfree;
|
||||||
static struct lpc17_tdlist_s *g_tdfree;
|
static struct lpc17_buflist_s *g_tdfree;
|
||||||
|
#ifdef CONFIG_UBHOST_AHBIOBUFFERS
|
||||||
|
static struct lpc17_buflist_s *g_iofree;
|
||||||
|
#endif
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Public Data
|
* Public Data
|
||||||
@@ -503,6 +522,10 @@ static void lpc17_edfree(struct lpc17_usbhost_s *priv, struct lpc17_hced_s *ed)
|
|||||||
* Description:
|
* Description:
|
||||||
* Allocate an TD buffer from the free list
|
* Allocate an TD buffer from the free list
|
||||||
*
|
*
|
||||||
|
* Assumptions:
|
||||||
|
* - Called from a single thread so no mutual exclusion is required.
|
||||||
|
* - Never called from an interrupt handler.
|
||||||
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
static uint8_t *lpc17_tdalloc(struct lpc17_usbhost_s *priv)
|
static uint8_t *lpc17_tdalloc(struct lpc17_usbhost_s *priv)
|
||||||
@@ -510,7 +533,7 @@ static uint8_t *lpc17_tdalloc(struct lpc17_usbhost_s *priv)
|
|||||||
uint8_t *ret = (uint8_t *)g_tdfree;
|
uint8_t *ret = (uint8_t *)g_tdfree;
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
g_tdfree = ((struct lpc17_tdlist_s*)ret)->flink;
|
g_tdfree = ((struct lpc17_buflist_s*)ret)->flink;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -525,11 +548,52 @@ static uint8_t *lpc17_tdalloc(struct lpc17_usbhost_s *priv)
|
|||||||
|
|
||||||
static void lpc17_tdfree(struct lpc17_usbhost_s *priv, uint8_t *buffer)
|
static void lpc17_tdfree(struct lpc17_usbhost_s *priv, uint8_t *buffer)
|
||||||
{
|
{
|
||||||
struct lpc17_tdlist_s *tdfree = (struct lpc17_tdlist_s *)buffer;
|
struct lpc17_buflist_s *tdfree = (struct lpc17_buflist_s *)buffer;
|
||||||
tdfree->flink = g_tdfree;
|
tdfree->flink = g_tdfree;
|
||||||
g_tdfree = tdfree;
|
g_tdfree = tdfree;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
* Name: lpc17_ioalloc
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Allocate an IO buffer from the free list
|
||||||
|
*
|
||||||
|
* Assumptions:
|
||||||
|
* - Called from a single thread so no mutual exclusion is required.
|
||||||
|
* - Never called from an interrupt handler.
|
||||||
|
*
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_UBHOST_AHBIOBUFFERS
|
||||||
|
static uint8_t *lpc17_ioalloc(struct lpc17_usbhost_s *priv)
|
||||||
|
{
|
||||||
|
uint8_t *ret = (uint8_t *)g_iofree;
|
||||||
|
if (ret)
|
||||||
|
{
|
||||||
|
g_iofree = ((struct lpc17_buflist_s*)ret)->flink;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
* Name: lpc17_tdfree
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Return an TD buffer to the free list
|
||||||
|
*
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_UBHOST_AHBIOBUFFERS
|
||||||
|
static void lpc17_iofree(struct lpc17_usbhost_s *priv, uint8_t *buffer)
|
||||||
|
{
|
||||||
|
struct lpc17_buflist_s *iofree = (struct lpc17_buflist_s *)buffer;
|
||||||
|
iofree->flink = g_iofree;
|
||||||
|
g_iofree = iofree;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Name: lpc17_enqueuetd
|
* Name: lpc17_enqueuetd
|
||||||
*
|
*
|
||||||
@@ -758,7 +822,6 @@ static int lpc17_usbinterrupt(int irq, FAR void *context)
|
|||||||
|
|
||||||
/* Read the device interrupt status register */
|
/* Read the device interrupt status register */
|
||||||
|
|
||||||
usbtrace(TRACE_INTENTRY(LPC17_TRACEINTID_USB), 0xbeef);
|
|
||||||
uint32_t intstatus;
|
uint32_t intstatus;
|
||||||
uint32_t intenable;
|
uint32_t intenable;
|
||||||
|
|
||||||
@@ -775,12 +838,12 @@ static int lpc17_usbinterrupt(int irq, FAR void *context)
|
|||||||
if ((intstatus & OHCI_INT_RHSC) != 0)
|
if ((intstatus & OHCI_INT_RHSC) != 0)
|
||||||
{
|
{
|
||||||
uint32_t rhportst1 = lpc17_getreg(LPC17_USBHOST_RHPORTST1);
|
uint32_t rhportst1 = lpc17_getreg(LPC17_USBHOST_RHPORTST1);
|
||||||
ullvdbg("Root Hub Status Change, RHPORTST: %08x\n", portstatus);
|
ullvdbg("Root Hub Status Change, RHPORTST: %08x\n", rhportst1);
|
||||||
|
|
||||||
if ((rhportst1 & OHCI_RHPORTST_CSC) != 0)
|
if ((rhportst1 & OHCI_RHPORTST_CSC) != 0)
|
||||||
{
|
{
|
||||||
uint32_t rhstatus = lpc17_getreg(LPC17_USBHOST_RHSTATUS);
|
uint32_t rhstatus = lpc17_getreg(LPC17_USBHOST_RHSTATUS);
|
||||||
ullvdbg("Connect Status Change, RHSTATUS: %08x\n", portstatus);
|
ullvdbg("Connect Status Change, RHSTATUS: %08x\n", rhportst1);
|
||||||
|
|
||||||
/* If DRWE is set, Connect Status Change indicates a remote wake-up event */
|
/* If DRWE is set, Connect Status Change indicates a remote wake-up event */
|
||||||
|
|
||||||
@@ -867,7 +930,7 @@ static int lpc17_usbinterrupt(int irq, FAR void *context)
|
|||||||
|
|
||||||
lpc17_putreg(intstatus, LPC17_USBHOST_INTST);
|
lpc17_putreg(intstatus, LPC17_USBHOST_INTST);
|
||||||
}
|
}
|
||||||
usbtrace(TRACE_INTEXIT(LPC17_TRACEINTID_USB), 0);
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -898,7 +961,9 @@ static int lpc17_usbinterrupt(int irq, FAR void *context)
|
|||||||
* returned indicating the nature of the failure
|
* returned indicating the nature of the failure
|
||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
* This function will *not* be called from an interrupt handler.
|
* - Only a single class bound to a single device is supported.
|
||||||
|
* - Called from a single thread so no mutual exclusion is required.
|
||||||
|
* - Never called from an interrupt handler.
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
@@ -1081,7 +1146,8 @@ errout:
|
|||||||
* returned indicating the nature of the failure
|
* returned indicating the nature of the failure
|
||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
* This function will *not* be called from an interrupt handler.
|
* - Called from a single thread so no mutual exclusion is required.
|
||||||
|
* - Never called from an interrupt handler.
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
@@ -1119,7 +1185,8 @@ static int lpc17_alloc(FAR struct usbhost_driver_s *drvr,
|
|||||||
* returned indicating the nature of the failure
|
* returned indicating the nature of the failure
|
||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
* This function will *not* be called from an interrupt handler.
|
* - Called from a single thread so no mutual exclusion is required.
|
||||||
|
* - Never called from an interrupt handler.
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
@@ -1158,7 +1225,9 @@ static int lpc17_free(FAR struct usbhost_driver_s *drvr, FAR uint8_t *buffer)
|
|||||||
* returned indicating the nature of the failure
|
* returned indicating the nature of the failure
|
||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
* This function will *not* be called from an interrupt handler.
|
* - Only a single class bound to a single device is supported.
|
||||||
|
* - Called from a single thread so no mutual exclusion is required.
|
||||||
|
* - Never called from an interrupt handler.
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
@@ -1238,7 +1307,9 @@ static int lpc17_ctrlout(FAR struct usbhost_driver_s *drvr,
|
|||||||
* returned indicating the nature of the failure
|
* returned indicating the nature of the failure
|
||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
* This function will *not* be called from an interrupt handler.
|
* - Only a single class bound to a single device is supported.
|
||||||
|
* - Called from a single thread so no mutual exclusion is required.
|
||||||
|
* - Never called from an interrupt handler.
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
@@ -1247,16 +1318,46 @@ static int lpc17_transfer(FAR struct usbhost_driver_s *drvr,
|
|||||||
FAR uint8_t *buffer, size_t buflen)
|
FAR uint8_t *buffer, size_t buflen)
|
||||||
{
|
{
|
||||||
struct lpc17_usbhost_s *priv = (struct lpc17_usbhost_s *)drvr;
|
struct lpc17_usbhost_s *priv = (struct lpc17_usbhost_s *)drvr;
|
||||||
struct lpc17_hced_s *ed;
|
struct lpc17_hced_s *ed = NULL;
|
||||||
uint32_t dirpid;
|
uint32_t dirpid;
|
||||||
uint32_t regval;
|
uint32_t regval;
|
||||||
|
#ifdef CONFIG_UBHOST_AHBIOBUFFERS
|
||||||
|
uint8_t *origbuf = NULL;
|
||||||
|
#endif
|
||||||
int ret = -ENOMEM;
|
int ret = -ENOMEM;
|
||||||
|
|
||||||
|
/* Allocate an IO buffer if the user buffer does not lie in AHB SRAM */
|
||||||
|
|
||||||
|
#ifdef CONFIG_UBHOST_AHBIOBUFFERS
|
||||||
|
if ((uintptr_t)buffer >= LPC17_SRAM_BANK0 &&
|
||||||
|
(uintptr_t)buffer < (LPC17_SRAM_BANK0 + LPC17_SRAM_BANK0 + LPC17_SRAM_BANK0))
|
||||||
|
{
|
||||||
|
/* Allocate an IO buffer in AHB SRAM */
|
||||||
|
|
||||||
|
origbuf = buffer;
|
||||||
|
buffer = lpc17_ioalloc(priv);
|
||||||
|
if (!buffer)
|
||||||
|
{
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
memcpy(buffer, origbuf, buflen);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Allocate an ED */
|
/* Allocate an ED */
|
||||||
|
|
||||||
ed = lpc17_edalloc(priv);
|
ed = lpc17_edalloc(priv);
|
||||||
if (ed)
|
if (!ed)
|
||||||
{
|
{
|
||||||
|
goto errout;
|
||||||
|
}
|
||||||
|
|
||||||
/* Format the endpoint descriptor */
|
/* Format the endpoint descriptor */
|
||||||
|
|
||||||
lpc17_edinit(ed);
|
lpc17_edinit(ed);
|
||||||
@@ -1304,7 +1405,24 @@ static int lpc17_transfer(FAR struct usbhost_driver_s *drvr,
|
|||||||
{
|
{
|
||||||
ret = -EIO;
|
ret = -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
errout:
|
||||||
|
/* Free any temporary IO buffers */
|
||||||
|
|
||||||
|
#ifdef CONFIG_UBHOST_AHBIOBUFFERS
|
||||||
|
if (buffer && origbuf)
|
||||||
|
{
|
||||||
|
lpc17_iofree(priv, buffer);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Free the endpoint descriptor */
|
||||||
|
|
||||||
|
if (ed)
|
||||||
|
{
|
||||||
|
lpc17_edfree(priv, ed);
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1326,7 +1444,9 @@ static int lpc17_transfer(FAR struct usbhost_driver_s *drvr,
|
|||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
* This function will *not* be called from an interrupt handler.
|
* - Only a single class bound to a single device is supported.
|
||||||
|
* - Called from a single thread so no mutual exclusion is required.
|
||||||
|
* - Never called from an interrupt handler.
|
||||||
*
|
*
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
@@ -1393,8 +1513,6 @@ void up_usbhostinitialize(void)
|
|||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
usbtrace(TRACE_DEVINIT, 0);
|
|
||||||
|
|
||||||
/* Initialize the state data structure */
|
/* Initialize the state data structure */
|
||||||
|
|
||||||
sem_init(&priv->rhssem, 0, 0);
|
sem_init(&priv->rhssem, 0, 0);
|
||||||
@@ -1508,8 +1626,7 @@ void up_usbhostinitialize(void)
|
|||||||
|
|
||||||
if (irq_attach(LPC17_IRQ_USB, lpc17_usbinterrupt) != 0)
|
if (irq_attach(LPC17_IRQ_USB, lpc17_usbinterrupt) != 0)
|
||||||
{
|
{
|
||||||
usbtrace(TRACE_DEVERROR(LPC17_TRACEERR_IRQREGISTRATION),
|
udbg("Failed to attach IRQ\n");
|
||||||
(uint16_t)LPC17_IRQ_USB);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -98,6 +98,7 @@
|
|||||||
#define USBHOST_ALLFOUND 0x07
|
#define USBHOST_ALLFOUND 0x07
|
||||||
|
|
||||||
#define USBHOST_MAX_RETRIES 100
|
#define USBHOST_MAX_RETRIES 100
|
||||||
|
#define USBHOST_MAX_CREFS 0x7fff
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Types
|
* Private Types
|
||||||
@@ -1532,7 +1533,7 @@ static int usbhost_open(FAR struct inode *inode)
|
|||||||
{
|
{
|
||||||
/* Otherwise, just increment the reference count on the driver */
|
/* Otherwise, just increment the reference count on the driver */
|
||||||
|
|
||||||
DEBUGASSERT(priv->crefs < MAX_CREFS);
|
DEBUGASSERT(priv->crefs > 0 && priv->crefs < USBHOST_MAX_CREFS);
|
||||||
usbhost_takesem(&priv->exclsem);
|
usbhost_takesem(&priv->exclsem);
|
||||||
priv->crefs++;
|
priv->crefs++;
|
||||||
usbhost_givesem(&priv->exclsem);
|
usbhost_givesem(&priv->exclsem);
|
||||||
@@ -1559,7 +1560,7 @@ static int usbhost_close(FAR struct inode *inode)
|
|||||||
|
|
||||||
/* Decrement the reference count on the block driver */
|
/* Decrement the reference count on the block driver */
|
||||||
|
|
||||||
DEBUGASSERT(priv->crefs > 0);
|
DEBUGASSERT(priv->crefs > 1);
|
||||||
usbhost_takesem(&priv->exclsem);
|
usbhost_takesem(&priv->exclsem);
|
||||||
priv->crefs--;
|
priv->crefs--;
|
||||||
|
|
||||||
@@ -1645,7 +1646,7 @@ static ssize_t usbhost_read(FAR struct inode *inode, unsigned char *buffer,
|
|||||||
if (result == OK)
|
if (result == OK)
|
||||||
{
|
{
|
||||||
/* Receive the user data */
|
/* Receive the user data */
|
||||||
#warning "For lpc17xx, I think this buffer needs to lie in BANK1"
|
|
||||||
result = DRVR_TRANSFER(priv->drvr, &priv->bulkin,
|
result = DRVR_TRANSFER(priv->drvr, &priv->bulkin,
|
||||||
buffer, priv->blocksize * nsectors);
|
buffer, priv->blocksize * nsectors);
|
||||||
if (result == OK)
|
if (result == OK)
|
||||||
@@ -1737,7 +1738,7 @@ static ssize_t usbhost_write(FAR struct inode *inode, const unsigned char *buffe
|
|||||||
if (result == OK)
|
if (result == OK)
|
||||||
{
|
{
|
||||||
/* Send the user data */
|
/* Send the user data */
|
||||||
#warning "For lpc17xx, I think this buffer needs to lie in BANK1"
|
|
||||||
result = DRVR_TRANSFER(priv->drvr, &priv->bulkout,
|
result = DRVR_TRANSFER(priv->drvr, &priv->bulkout,
|
||||||
(uint8_t*)buffer, priv->blocksize * nsectors);
|
(uint8_t*)buffer, priv->blocksize * nsectors);
|
||||||
if (result == OK)
|
if (result == OK)
|
||||||
|
|||||||
@@ -42,354 +42,19 @@
|
|||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <stdint.h>
|
/* NOTE: Trace debug capability has not been implemented for USB host. It
|
||||||
|
* should be a simple port of the USB device trace logic. But that has not
|
||||||
|
* yet been done.
|
||||||
|
*/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Preprocessor definitions
|
* Preprocessor definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/* Event encoding/decoding macros *******************************************/
|
|
||||||
|
|
||||||
#define TRACE_EVENT(id,data) ((uint16_t)(id)|(data))
|
|
||||||
#define TRACE_ID(event) ((event)&0xff00)
|
|
||||||
#define TRACE_DATA(event) ((event)&0x00ff)
|
|
||||||
|
|
||||||
/* Events ******************************************************************/
|
|
||||||
|
|
||||||
/* Event class IDs */
|
|
||||||
|
|
||||||
#define TRACE_INIT_ID (0x0000) /* Initialization events */
|
|
||||||
#define TRACE_EP_ID (0x0100) /* Endpoint API calls */
|
|
||||||
#define TRACE_DEV_ID (0x0200) /* USB device API calls */
|
|
||||||
#define TRACE_CLASS_ID (0x0300) /* USB class driver API calls */
|
|
||||||
#define TRACE_CLASSAPI_ID (0x0400) /* Other class driver system API calls */
|
|
||||||
#define TRACE_CLASSSTATE_ID (0x0500) /* Track class driver state changes */
|
|
||||||
#define TRACE_INTENTRY_ID (0x0600) /* Interrupt handler entry */
|
|
||||||
#define TRACE_INTDECODE_ID (0x0700) /* Decoded interrupt event */
|
|
||||||
#define TRACE_INTEXIT_ID (0x0800) /* Interrupt handler exit */
|
|
||||||
#define TRACE_OUTREQQUEUED_ID (0x0900) /* Request queued for OUT endpoint */
|
|
||||||
#define TRACE_INREQQUEUED_ID (0x0a00) /* Request queued for IN endpoint */
|
|
||||||
#define TRACE_READ_ID (0x0b00) /* Read (OUT) action */
|
|
||||||
#define TRACE_WRITE_ID (0x0c00) /* Write (IN) action */
|
|
||||||
#define TRACE_COMPLETE_ID (0x0d00) /* Request completed */
|
|
||||||
#define TRACE_DEVERROR_ID (0x0e00) /* USB controller driver error event */
|
|
||||||
#define TRACE_CLSERROR_ID (0x0f00) /* USB class driver error event */
|
|
||||||
|
|
||||||
#define TRACE_NIDS 16 /* Cannot exceed bits in usbtrace_idset_t */
|
|
||||||
|
|
||||||
/* Bit settings for usbtrace_enable */
|
|
||||||
|
|
||||||
#define TRACE_ID2BIT(id) ((1) << ((id) >> 8))
|
|
||||||
#define TRACE_INIT_BIT TRACE_ID2BIT(TRACE_INIT_ID)
|
|
||||||
#define TRACE_EP_BIT TRACE_ID2BIT(TRACE_EP_ID)
|
|
||||||
#define TRACE_DEV_BIT TRACE_ID2BIT(TRACE_DEV_ID)
|
|
||||||
#define TRACE_CLASS_BIT TRACE_ID2BIT(TRACE_CLASS_ID)
|
|
||||||
#define TRACE_CLASSAPI_BIT TRACE_ID2BIT(TRACE_CLASSAPI_ID)
|
|
||||||
#define TRACE_CLASSSTATE_BIT TRACE_ID2BIT(TRACE_CLASSSTATE_ID)
|
|
||||||
#define TRACE_INTENTRY_BIT TRACE_ID2BIT(TRACE_INTENTRY_ID)
|
|
||||||
#define TRACE_INTDECODE_BIT TRACE_ID2BIT(TRACE_INTDECODE_ID)
|
|
||||||
#define TRACE_INTEXIT_BIT TRACE_ID2BIT(TRACE_INTEXIT_ID)
|
|
||||||
#define TRACE_OUTREQQUEUED_BIT TRACE_ID2BIT(TRACE_OUTREQQUEUED_ID)
|
|
||||||
#define TRACE_INREQQUEUED_BIT TRACE_ID2BIT(TRACE_INREQQUEUED_ID)
|
|
||||||
#define TRACE_READ_BIT TRACE_ID2BIT(TRACE_READ_ID)
|
|
||||||
#define TRACE_WRITE_BIT TRACE_ID2BIT(TRACE_WRITE_ID)
|
|
||||||
#define TRACE_COMPLETE_BIT TRACE_ID2BIT(TRACE_COMPLETE_ID)
|
|
||||||
#define TRACE_DEVERROR_BIT TRACE_ID2BIT(TRACE_DEVERROR_ID)
|
|
||||||
#define TRACE_CLSERROR_BIT TRACE_ID2BIT(TRACE_CLSERROR_ID)
|
|
||||||
#define TRACE_ALLBITS ((usbtrace_idset_t)-1)
|
|
||||||
|
|
||||||
/* Initialization events */
|
|
||||||
|
|
||||||
#define TRACE_DEVINIT TRACE_EVENT(TRACE_INIT_ID, 0x0001)
|
|
||||||
#define TRACE_DEVUNINIT TRACE_EVENT(TRACE_INIT_ID, 0x0002)
|
|
||||||
#define TRACE_DEVREGISTER TRACE_EVENT(TRACE_INIT_ID, 0x0003)
|
|
||||||
#define TRACE_DEVUNREGISTER TRACE_EVENT(TRACE_INIT_ID, 0x0004)
|
|
||||||
|
|
||||||
/* API calls (see usbdev.h) */
|
|
||||||
|
|
||||||
#define TRACE_EPCONFIGURE TRACE_EVENT(TRACE_EP_ID, 0x0001)
|
|
||||||
#define TRACE_EPDISABLE TRACE_EVENT(TRACE_EP_ID, 0x0002)
|
|
||||||
#define TRACE_EPALLOCREQ TRACE_EVENT(TRACE_EP_ID, 0x0003)
|
|
||||||
#define TRACE_EPFREEREQ TRACE_EVENT(TRACE_EP_ID, 0x0004)
|
|
||||||
#define TRACE_EPALLOCBUFFER TRACE_EVENT(TRACE_EP_ID, 0x0005)
|
|
||||||
#define TRACE_EPFREEBUFFER TRACE_EVENT(TRACE_EP_ID, 0x0006)
|
|
||||||
#define TRACE_EPSUBMIT TRACE_EVENT(TRACE_EP_ID, 0x0007)
|
|
||||||
#define TRACE_EPCANCEL TRACE_EVENT(TRACE_EP_ID, 0x0008)
|
|
||||||
#define TRACE_EPSTALL TRACE_EVENT(TRACE_EP_ID, 0x0009)
|
|
||||||
#define TRACE_EPRESUME TRACE_EVENT(TRACE_EP_ID, 0x000a)
|
|
||||||
|
|
||||||
#define TRACE_DEVALLOCEP TRACE_EVENT(TRACE_DEV_ID, 0x0001)
|
|
||||||
#define TRACE_DEVFREEEP TRACE_EVENT(TRACE_DEV_ID, 0x0002)
|
|
||||||
#define TRACE_DEVGETFRAME TRACE_EVENT(TRACE_DEV_ID, 0x0003)
|
|
||||||
#define TRACE_DEVWAKEUP TRACE_EVENT(TRACE_DEV_ID, 0x0004)
|
|
||||||
#define TRACE_DEVSELFPOWERED TRACE_EVENT(TRACE_DEV_ID, 0x0005)
|
|
||||||
#define TRACE_DEVPULLUP TRACE_EVENT(TRACE_DEV_ID, 0x0006)
|
|
||||||
|
|
||||||
#define TRACE_CLASSBIND TRACE_EVENT(TRACE_CLASS_ID, 0x0001)
|
|
||||||
#define TRACE_CLASSUNBIND TRACE_EVENT(TRACE_CLASS_ID, 0x0002)
|
|
||||||
#define TRACE_CLASSDISCONNECT TRACE_EVENT(TRACE_CLASS_ID, 0x0003)
|
|
||||||
#define TRACE_CLASSSETUP TRACE_EVENT(TRACE_CLASS_ID, 0x0004)
|
|
||||||
#define TRACE_CLASSSUSPEND TRACE_EVENT(TRACE_CLASS_ID, 0x0005)
|
|
||||||
#define TRACE_CLASSRESUME TRACE_EVENT(TRACE_CLASS_ID, 0x0006)
|
|
||||||
|
|
||||||
#define TRACE_CLASSRDCOMPLETE TRACE_EVENT(TRACE_CLASS_ID, 0x0007)
|
|
||||||
#define TRACE_CLASSWRCOMPLETE TRACE_EVENT(TRACE_CLASS_ID, 0x0008)
|
|
||||||
|
|
||||||
#define TRACE_CLASSAPI(id) TRACE_EVENT(TRACE_CLASSAPI_ID, id)
|
|
||||||
|
|
||||||
#define TRACE_CLASSSTATE(id) TRACE_EVENT(TRACE_CLASSSTATE_ID, id)
|
|
||||||
|
|
||||||
/* USB device controller interrupt events. The 'id' is specific to the driver.
|
|
||||||
* Particular values for 'id' are unique for a given implementation of a
|
|
||||||
* controller driver
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define TRACE_INTENTRY(id) TRACE_EVENT(TRACE_INTENTRY_ID, id)
|
|
||||||
#define TRACE_INTDECODE(id) TRACE_EVENT(TRACE_INTDECODE_ID, id)
|
|
||||||
#define TRACE_INTEXIT(id) TRACE_EVENT(TRACE_INTEXIT_ID, id)
|
|
||||||
|
|
||||||
/* Controller data transfer */
|
|
||||||
|
|
||||||
#define TRACE_OUTREQQUEUED(ep) TRACE_EVENT(TRACE_OUTREQQUEUED_ID, ep)
|
|
||||||
#define TRACE_INREQQUEUED(ep) TRACE_EVENT(TRACE_INREQQUEUED_ID, ep)
|
|
||||||
#define TRACE_READ(ep) TRACE_EVENT(TRACE_READ_ID, ep)
|
|
||||||
#define TRACE_WRITE(ep) TRACE_EVENT(TRACE_WRITE_ID, ep)
|
|
||||||
#define TRACE_COMPLETE(ep) TRACE_EVENT(TRACE_COMPLETE_ID, ep)
|
|
||||||
|
|
||||||
/* USB device controller error events. The 'id' is specific to the driver.
|
|
||||||
* Particular values for 'id' are unique for a given implementation of a
|
|
||||||
* controller driver
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define TRACE_DEVERROR(id) TRACE_EVENT(TRACE_DEVERROR_ID, id)
|
|
||||||
|
|
||||||
/* USB class driver error events. The 'id' is specific to the class driver,
|
|
||||||
* but common to all driver controller instances.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define TRACE_CLSERROR(id) TRACE_EVENT(TRACE_CLSERROR_ID, id)
|
|
||||||
|
|
||||||
/* USB Serial driver class events *******************************************/
|
|
||||||
|
|
||||||
/* UART interface API calls */
|
|
||||||
|
|
||||||
#define USBSER_TRACECLASSAPI_SETUP 0x0001
|
|
||||||
#define USBSER_TRACECLASSAPI_SHUTDOWN 0x0002
|
|
||||||
#define USBSER_TRACECLASSAPI_ATTACH 0x0003
|
|
||||||
#define USBSER_TRACECLASSAPI_DETACH 0x0004
|
|
||||||
#define USBSER_TRACECLASSAPI_IOCTL 0x0005
|
|
||||||
#define USBSER_TRACECLASSAPI_RECEIVE 0x0006
|
|
||||||
#define USBSER_TRACECLASSAPI_RXINT 0x0007
|
|
||||||
#define USBSER_TRACECLASSAPI_RXAVAILABLE 0x0008
|
|
||||||
#define USBSER_TRACECLASSAPI_SEND 0x0009
|
|
||||||
#define USBSER_TRACECLASSAPI_TXINT 0x000a
|
|
||||||
#define USBSER_TRACECLASSAPI_TXREADY 0x000b
|
|
||||||
#define USBSER_TRACECLASSAPI_TXEMPTY 0x000c
|
|
||||||
|
|
||||||
/* Values of the class error ID used by the USB serial driver */
|
|
||||||
|
|
||||||
#define USBSER_TRACEERR_ALLOCCTRLREQ 0x0001
|
|
||||||
#define USBSER_TRACEERR_ALLOCDEVSTRUCT 0x0002
|
|
||||||
#define USBSER_TRACEERR_ALREADYCLOSED 0x0003
|
|
||||||
#define USBSER_TRACEERR_ALREADYCONFIGURED 0x0004
|
|
||||||
#define USBSER_TRACEERR_CONFIGIDBAD 0x0005
|
|
||||||
#define USBSER_TRACEERR_CONFIGNONE 0x0006
|
|
||||||
#define USBSER_TRACEERR_CONSOLEREGISTER 0x0007
|
|
||||||
#define USBSER_TRACEERR_DEVREGISTER 0x0008
|
|
||||||
#define USBSER_TRACEERR_EPRESPQ 0x0009
|
|
||||||
#define USBSER_TRACEERR_GETUNKNOWNDESC 0x000a
|
|
||||||
#define USBSER_TRACEERR_INVALIDARG 0x000b
|
|
||||||
#define USBSER_TRACEERR_EP0NOTBOUND 0x000c
|
|
||||||
#define USBSER_TRACEERR_EPBULKINALLOCFAIL 0x000d
|
|
||||||
#define USBSER_TRACEERR_EPBULKINCONFIGFAIL 0x000e
|
|
||||||
#define USBSER_TRACEERR_EPBULKOUTALLOCFAIL 0x000f
|
|
||||||
#define USBSER_TRACEERR_EPINTINALLOCFAIL 0x0010
|
|
||||||
#define USBSER_TRACEERR_EPINTINCONFIGFAIL 0x0011
|
|
||||||
#define USBSER_TRACEERR_EPBULKOUTCONFIGFAIL 0x0012
|
|
||||||
#define USBSER_TRACEERR_RDALLOCREQ 0x0013
|
|
||||||
#define USBSER_TRACEERR_RDSHUTDOWN 0x0014
|
|
||||||
#define USBSER_TRACEERR_RDSUBMIT 0x0015
|
|
||||||
#define USBSER_TRACEERR_RDUNEXPECTED 0x0016
|
|
||||||
#define USBSER_TRACEERR_REQRESULT 0x0017
|
|
||||||
#define USBSER_TRACEERR_RXOVERRUN 0x0018
|
|
||||||
#define USBSER_TRACEERR_SETUPNOTCONNECTED 0x0019
|
|
||||||
#define USBSER_TRACEERR_SUBMITFAIL 0x001a
|
|
||||||
#define USBSER_TRACEERR_UARTREGISTER 0x001b
|
|
||||||
#define USBSER_TRACEERR_UNSUPPORTEDCTRLREQ 0x001c
|
|
||||||
#define USBSER_TRACEERR_UNSUPPORTEDRWREQ 0x001d
|
|
||||||
#define USBSER_TRACEERR_UNSUPPORTEDSTDREQ 0x001e
|
|
||||||
#define USBSER_TRACEERR_UNSUPPORTEDTYPE 0x001f
|
|
||||||
#define USBSER_TRACEERR_WRALLOCREQ 0x0020
|
|
||||||
#define USBSER_TRACEERR_WRSHUTDOWN 0x0021
|
|
||||||
#define USBSER_TRACEERR_WRUNEXPECTED 0x0022
|
|
||||||
|
|
||||||
/* USB Storage driver class events ******************************************/
|
|
||||||
|
|
||||||
/* State transitions */
|
|
||||||
|
|
||||||
#define USBSTRG_CLASSSTATE_IDLECMDPARSE 0x0001
|
|
||||||
#define USBSTRG_CLASSSTATE_CMDPARSECMDFINISH 0x0002
|
|
||||||
#define USBSTRG_CLASSSTATE_CMDPARSECMDREAD6 0x0003
|
|
||||||
#define USBSTRG_CLASSSTATE_CMDPARSECMDREAD10 0x0004
|
|
||||||
#define USBSTRG_CLASSSTATE_CMDPARSECMDREAD12 0x0005
|
|
||||||
#define USBSTRG_CLASSSTATE_CMDPARSECMDWRITE6 0x0006
|
|
||||||
#define USBSTRG_CLASSSTATE_CMDPARSECMDWRITE10 0x0007
|
|
||||||
#define USBSTRG_CLASSSTATE_CMDPARSECMDWRITE12 0x0008
|
|
||||||
#define USBSTRG_CLASSSTATE_CMDREAD 0x0009
|
|
||||||
#define USBSTRG_CLASSSTATE_CMDREADCMDFINISH 0x000a
|
|
||||||
#define USBSTRG_CLASSSTATE_CMDWRITE 0x000b
|
|
||||||
#define USBSTRG_CLASSSTATE_CMDWRITECMDFINISH 0x000c
|
|
||||||
#define USBSTRG_CLASSSTATE_CMDFINISHCMDSTATUS 0x000d
|
|
||||||
#define USBSTRG_CLASSSTATE_CMDSTATUSIDLE 0x000e
|
|
||||||
|
|
||||||
/* Values of the class error ID used by the USB storage driver */
|
|
||||||
|
|
||||||
#define USBSTRG_TRACEERR_ALLOCCTRLREQ 0x0001
|
|
||||||
#define USBSTRG_TRACEERR_ALLOCDEVSTRUCT 0x0002
|
|
||||||
#define USBSTRG_TRACEERR_ALLOCIOBUFFER 0x0003
|
|
||||||
#define USBSTRG_TRACEERR_ALREADYCONFIGURED 0x0004
|
|
||||||
#define USBSTRG_TRACEERR_ALREADYUNINIT 0x0005
|
|
||||||
#define USBSTRG_TRACEERR_BADREQUEST 0x0006
|
|
||||||
#define USBSTRG_TRACEERR_BINDLUNINVALIDARGS2 0x0007
|
|
||||||
#define USBSTRG_TRACEERR_BINDLUNINVALIDARGS3 0x0008
|
|
||||||
#define USBSTRG_TRACEERR_BINDLUNINVALIDARGS4 0x0009
|
|
||||||
#define USBSTRG_TRACEERR_BINLUNINVALIDARGS1 0x000a
|
|
||||||
#define USBSTRG_TRACEERR_BLKDRVEOPEN 0x000b
|
|
||||||
#define USBSTRG_TRACEERR_CMDBADLUN 0x000c
|
|
||||||
#define USBSTRG_TRACEERR_CMDFINISHRESIDUE 0x000d
|
|
||||||
#define USBSTRG_TRACEERR_CMDFINISHRQEMPTY 0x000e
|
|
||||||
#define USBSTRG_TRACEERR_CMDFINISHSHORTPKT 0x000f
|
|
||||||
#define USBSTRG_TRACEERR_CMDFINISHSUBMIT 0x0010
|
|
||||||
#define USBSTRG_TRACEERR_CMDFINSHDIR 0x0011
|
|
||||||
#define USBSTRG_TRACEERR_CMDFINSHSUBMIT 0x0012
|
|
||||||
#define USBSTRG_TRACEERR_CMDPARSEWRREQLISTEMPTY 0x0013
|
|
||||||
#define USBSTRG_TRACEERR_CMDREADREADFAIL 0x0014
|
|
||||||
#define USBSTRG_TRACEERR_CMDREADSUBMIT 0x0015
|
|
||||||
#define USBSTRG_TRACEERR_CMDREADWRRQEMPTY 0x0016
|
|
||||||
#define USBSTRG_TRACEERR_CMDSTATUSRDREQLISTEMPTY 0x0017
|
|
||||||
#define USBSTRG_TRACEERR_CMDUNEVIOLATION 0x0018
|
|
||||||
#define USBSTRG_TRACEERR_CMDWRITERDSUBMIT 0x0019
|
|
||||||
#define USBSTRG_TRACEERR_CMDWRITERDRQEMPTY 0x001a
|
|
||||||
#define USBSTRG_TRACEERR_CMDWRITEWRITEFAIL 0x001b
|
|
||||||
#define USBSTRG_TRACEERR_CONFIGIDBAD 0x001c
|
|
||||||
#define USBSTRG_TRACEERR_CONFIGNONE 0x001d
|
|
||||||
#define USBSTRG_TRACEERR_DEFERREDRESPINVALIDARGS 0x001e
|
|
||||||
#define USBSTRG_TRACEERR_DEFERREDRESPSTALLED 0x001f
|
|
||||||
#define USBSTRG_TRACEERR_DEFERREDRESPSUBMIT 0x0020
|
|
||||||
#define USBSTRG_TRACEERR_DEVREGISTER 0x0021
|
|
||||||
#define USBSTRG_TRACEERR_DISCONNECTINVALIDARGS 0x0022
|
|
||||||
#define USBSTRG_TRACEERR_EP0NOTBOUND1 0x0023
|
|
||||||
#define USBSTRG_TRACEERR_EP0NOTBOUND2 0x0024
|
|
||||||
#define USBSTRG_TRACEERR_EP0NOTBOUND3 0x0025
|
|
||||||
#define USBSTRG_TRACEERR_EPBULKINALLOCFAIL 0x0026
|
|
||||||
#define USBSTRG_TRACEERR_EPBULKINCONFIGFAIL 0x0027
|
|
||||||
#define USBSTRG_TRACEERR_EPBULKOUTALLOCFAIL 0x0028
|
|
||||||
#define USBSTRG_TRACEERR_EPBULKOUTCONFIGFAIL 0x0029
|
|
||||||
#define USBSTRG_TRACEERR_EPRESPQ 0x002a
|
|
||||||
#define USBSTRG_TRACEERR_EXPORTLUNSINVALIDARGS 0x002b
|
|
||||||
#define USBSTRG_TRACEERR_GETMAXLUNNDX 0x002c
|
|
||||||
#define USBSTRG_TRACEERR_GETUNKNOWNDESC 0x002d
|
|
||||||
#define USBSTRG_TRACEERR_IDLERDREQLISTEMPTY 0x002e
|
|
||||||
#define USBSTRG_TRACEERR_IDLERDSUBMIT 0x002f
|
|
||||||
#define USBSTRG_TRACEERR_INQUIRYFLAGS 0x0030
|
|
||||||
#define USBSTRG_TRACEERR_INTERNALCONFUSION1 0x0031
|
|
||||||
#define USBSTRG_TRACEERR_INTERNALCONFUSION2 0x0032
|
|
||||||
#define USBSTRG_TRACEERR_INVALIDCBWCONTENT 0x0033
|
|
||||||
#define USBSTRG_TRACEERR_INVALIDCBWSIGNATURE 0x0034
|
|
||||||
#define USBSTRG_TRACEERR_INVALIDSTATE 0x0035
|
|
||||||
#define USBSTRG_TRACEERR_LUNALREADYBOUND 0x0036
|
|
||||||
#define USBSTRG_TRACEERR_LUNNOTBOUND 0x0037
|
|
||||||
#define USBSTRG_TRACEERR_MODEPAGEFLAGS 0x0038
|
|
||||||
#define USBSTRG_TRACEERR_MODESENSE10FLAGS 0x0039
|
|
||||||
#define USBSTRG_TRACEERR_MODESENSE6FLAGS 0x003a
|
|
||||||
#define USBSTRG_TRACEERR_MSRESETNDX 0x003b
|
|
||||||
#define USBSTRG_TRACEERR_NOGEOMETRY 0x003c
|
|
||||||
#define USBSTRG_TRACEERR_NOTCONFIGURED 0x003d
|
|
||||||
#define USBSTRG_TRACEERR_NOTREMOVABLE 0x003e
|
|
||||||
#define USBSTRG_TRACEERR_PCSAVED 0x003f
|
|
||||||
#define USBSTRG_TRACEERR_PHASEERROR1 0x0040
|
|
||||||
#define USBSTRG_TRACEERR_PHASEERROR2 0x0041
|
|
||||||
#define USBSTRG_TRACEERR_PHASEERROR3 0x0042
|
|
||||||
#define USBSTRG_TRACEERR_PREVENTMEDIUMREMOVALPREVENT 0x0043
|
|
||||||
#define USBSTRG_TRACEERR_RDALLOCREQ 0x0044
|
|
||||||
#define USBSTRG_TRACEERR_RDCOMPLETEINVALIDARGS 0x0045
|
|
||||||
#define USBSTRG_TRACEERR_RDCOMPLETERDSUBMIT 0x0046
|
|
||||||
#define USBSTRG_TRACEERR_RDSHUTDOWN 0x0047
|
|
||||||
#define USBSTRG_TRACEERR_RDSUBMIT 0x0048
|
|
||||||
#define USBSTRG_TRACEERR_RDUNEXPECTED 0x0049
|
|
||||||
#define USBSTRG_TRACEERR_READ10FLAGS 0x004a
|
|
||||||
#define USBSTRG_TRACEERR_READ10LBARANGE 0x004b
|
|
||||||
#define USBSTRG_TRACEERR_READ10MEDIANOTPRESENT 0x004c
|
|
||||||
#define USBSTRG_TRACEERR_READ12FLAGS 0x004d
|
|
||||||
#define USBSTRG_TRACEERR_READ12LBARANGE 0x004e
|
|
||||||
#define USBSTRG_TRACEERR_READ12MEDIANOTPRESENT 0x004f
|
|
||||||
#define USBSTRG_TRACEERR_READ6LBARANGE 0x0050
|
|
||||||
#define USBSTRG_TRACEERR_READ6MEDIANOTPRESENT 0x0051
|
|
||||||
#define USBSTRG_TRACEERR_READCAPACITYFLAGS 0x0052
|
|
||||||
#define USBSTRG_TRACEERR_REALLOCIOBUFFER 0x0053
|
|
||||||
#define USBSTRG_TRACEERR_REQRESULT 0x0054
|
|
||||||
#define USBSTRG_TRACEERR_SCSICMDCONTROL 0x0055
|
|
||||||
#define USBSTRG_TRACEERR_SETCONFIGINVALIDARGS 0x0056
|
|
||||||
#define USBSTRG_TRACEERR_SETUPINVALIDARGS 0x0057
|
|
||||||
#define USBSTRG_TRACEERR_SNDCSWFAIL 0x0058
|
|
||||||
#define USBSTRG_TRACEERR_SNDPHERROR 0x0059
|
|
||||||
#define USBSTRG_TRACEERR_SNDSTATUSSUBMIT 0x005a
|
|
||||||
#define USBSTRG_TRACEERR_SYNCCACHEMEDIANOTPRESENT 0x005b
|
|
||||||
#define USBSTRG_TRACEERR_THREADCREATE 0x005c
|
|
||||||
#define USBSTRG_TRACEERR_TOOMANYLUNS 0x005d
|
|
||||||
#define USBSTRG_TRACEERR_UNBINDINVALIDARGS 0x005e
|
|
||||||
#define USBSTRG_TRACEERR_UNBINDLUNINVALIDARGS1 0x005f
|
|
||||||
#define USBSTRG_TRACEERR_UNBINDLUNINVALIDARGS2 0x0060
|
|
||||||
#define USBSTRG_TRACEERR_UNINITIALIZEINVALIDARGS 0x0061
|
|
||||||
#define USBSTRG_TRACEERR_UNSUPPORTEDSTDREQ 0x0062
|
|
||||||
#define USBSTRG_TRACEERR_VERIFY10FLAGS 0x0063
|
|
||||||
#define USBSTRG_TRACEERR_VERIFY10LBARANGE 0x0064
|
|
||||||
#define USBSTRG_TRACEERR_VERIFY10MEDIANOTPRESENT 0x0065
|
|
||||||
#define USBSTRG_TRACEERR_VERIFY10NOBLOCKS 0x0066
|
|
||||||
#define USBSTRG_TRACEERR_VERIFY10READFAIL 0x0067
|
|
||||||
#define USBSTRG_TRACEERR_WRALLOCREQ 0x0068
|
|
||||||
#define USBSTRG_TRACEERR_SNDPHERROR 0x0069
|
|
||||||
#define USBSTRG_TRACEERR_WRCOMPLETEINVALIDARGS 0x006a
|
|
||||||
#define USBSTRG_TRACEERR_WRITE10FLAGS 0x006b
|
|
||||||
#define USBSTRG_TRACEERR_WRITE10LBARANGE 0x006c
|
|
||||||
#define USBSTRG_TRACEERR_WRITE10MEDIANOTPRESENT 0x006d
|
|
||||||
#define USBSTRG_TRACEERR_WRITE10READONLY 0x006e
|
|
||||||
#define USBSTRG_TRACEERR_WRITE12FLAGS 0x006f
|
|
||||||
#define USBSTRG_TRACEERR_WRITE12LBARANGE 0x0070
|
|
||||||
#define USBSTRG_TRACEERR_WRITE12MEDIANOTPRESENT 0x0071
|
|
||||||
#define USBSTRG_TRACEERR_WRITE12READONLY 0x0072
|
|
||||||
#define USBSTRG_TRACEERR_WRITE6LBARANGE 0x0073
|
|
||||||
#define USBSTRG_TRACEERR_WRITE6MEDIANOTPRESENT 0x0074
|
|
||||||
#define USBSTRG_TRACEERR_WRITE6READONLY 0x0075
|
|
||||||
#define USBSTRG_TRACEERR_WRSHUTDOWN 0x0076
|
|
||||||
#define USBSTRG_TRACEERR_WRUNEXPECTED 0x0077
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Types
|
* Public Types
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/* The reported trace information */
|
|
||||||
|
|
||||||
struct usbtrace_s
|
|
||||||
{
|
|
||||||
uint16_t event;
|
|
||||||
uint16_t value;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Enumeration callback function signature */
|
|
||||||
|
|
||||||
typedef int (*trace_callback_t)(struct usbtrace_s *trace, void *arg);
|
|
||||||
|
|
||||||
/* Bit mask input type for usbtrace_enable(). If TRACE_NIDS grows beyond
|
|
||||||
* 16, then this will have to be changed to uint32_t
|
|
||||||
*/
|
|
||||||
|
|
||||||
typedef uint16_t usbtrace_idset_t;
|
|
||||||
|
|
||||||
/* Print routine to use for usbdev_trprint() output */
|
|
||||||
|
|
||||||
typedef int (*trprintf_t)(const char *fmt, ...);
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Function Prototypes
|
* Public Function Prototypes
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -402,74 +67,6 @@ extern "C" {
|
|||||||
# define EXTERN extern
|
# define EXTERN extern
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* Name: usbtrace_enable
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Enable/disable tracing per trace ID. The initial state is all IDs enabled.
|
|
||||||
*
|
|
||||||
* Input Parameters:
|
|
||||||
* idset - The bitset of IDs to be masked. TRACE_ALLIDS enables all IDS; zero
|
|
||||||
* masks all IDs.
|
|
||||||
*
|
|
||||||
* Returned Value:
|
|
||||||
* The previous idset value.
|
|
||||||
*
|
|
||||||
* Assumptions:
|
|
||||||
* - May be called from an interrupt handler
|
|
||||||
*
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
#if defined(CONFIG_USBDEV_TRACE) || (defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_USB))
|
|
||||||
EXTERN usbtrace_idset_t usbtrace_enable(usbtrace_idset_t idset);
|
|
||||||
#else
|
|
||||||
# define usbtrace_enable(idset)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* Name: usbtrace
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Record a USB event (tracing must be enabled)
|
|
||||||
*
|
|
||||||
* Assumptions:
|
|
||||||
* May be called from an interrupt handler
|
|
||||||
*
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
#if defined(CONFIG_USBDEV_TRACE) || (defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_USB))
|
|
||||||
EXTERN void usbtrace(uint16_t event, uint16_t value);
|
|
||||||
#else
|
|
||||||
# define usbtrace(event, value)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* Name: usbtrace_enumerate
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Enumerate all buffer trace data (will temporarily disable tracing)
|
|
||||||
*
|
|
||||||
* Assumptions:
|
|
||||||
* NEVER called from an interrupt handler
|
|
||||||
*
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
#ifdef CONFIG_USBDEV_TRACE
|
|
||||||
EXTERN int usbtrace_enumerate(trace_callback_t callback, void *arg);
|
|
||||||
#else
|
|
||||||
# define usbtrace_enumerate(event)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
* Name: usbtrace_trprint
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* Print the trace record using the supplied printing function
|
|
||||||
*
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
EXTERN void usbtrace_trprintf(trprintf_t trprintf, uint16_t event, uint16_t value);
|
|
||||||
|
|
||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user