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:
parent
56991a648d
commit
ed9719a040
5 changed files with 297 additions and 571 deletions
|
@ -1410,3 +1410,9 @@
|
|||
* 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
|
||||
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">
|
||||
<td>
|
||||
<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>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -786,48 +786,48 @@
|
|||
Important bugfxes included:
|
||||
<ul>
|
||||
<li>
|
||||
Additional fixes needed with the TCP sequence number problem "fixed" in nuttx-5.14.
|
||||
</li>
|
||||
<li>
|
||||
In the <code>send()</code> logic, now checks if the destination IP address is in the ARP table before sending the packet;
|
||||
an ARP request will go out instead of the TCP packet.
|
||||
This improves behavior, for example, on the first on the first GET request from a browser
|
||||
</li>
|
||||
<li>
|
||||
All USB class drivers need to call DEV_CONNECT() when they are ready to be enumerated.
|
||||
That is, (1) initially when bound to the USB driver, and (2) after a USB reset.
|
||||
</li>
|
||||
<li>
|
||||
The SPI_SETBITS macro was calling the SPI setmode method.
|
||||
</li>
|
||||
<li>
|
||||
And several other bug fixes of lower criticality (see the ChangeLog for details).
|
||||
</li>
|
||||
Additional fixes needed with the TCP sequence number problem "fixed" in nuttx-5.14.
|
||||
</li>
|
||||
<li>
|
||||
In the <code>send()</code> logic, now checks if the destination IP address is in the ARP table before sending the packet;
|
||||
an ARP request will go out instead of the TCP packet.
|
||||
This improves behavior, for example, on the first on the first GET request from a browser
|
||||
</li>
|
||||
<li>
|
||||
All USB class drivers need to call DEV_CONNECT() when they are ready to be enumerated.
|
||||
That is, (1) initially when bound to the USB driver, and (2) after a USB reset.
|
||||
</li>
|
||||
<li>
|
||||
The SPI_SETBITS macro was calling the SPI setmode method.
|
||||
</li>
|
||||
<li>
|
||||
And several other bug fixes of lower criticality (see the ChangeLog for details).
|
||||
</li>
|
||||
</ul>
|
||||
</p>
|
||||
<p>
|
||||
And feature enhancements:
|
||||
<ul>
|
||||
<li>
|
||||
The LPC176x Ethernet driver was using all of AHB SRAM Bank0 for Ethernet packet buffers (16Kb).
|
||||
An option was added to limit the amount of SRAM used for packet buffering and to re-use any extra Bank0 memory for heap.
|
||||
</li>
|
||||
<li>
|
||||
Enabled networking and SD/MMC card support in the Olimex LPC1766-STK NuttShell (NSH) configuration.
|
||||
</li>
|
||||
<li>
|
||||
The LPC176x USB driver is now fully fully functional.
|
||||
</li>
|
||||
<li>
|
||||
Added an optional <code>cmddata()</code> method to the SPI interface.
|
||||
Some devices require an additional out-of-band bit to specify if the next word sent to the device is a command or data.
|
||||
The <code>cmddata()</code> method provides selection of command or data.
|
||||
</li>
|
||||
<li>
|
||||
A driver for the Nokia 6100 LCD (with either the Phillips PCF8833 LCD controller and for the Epson S1D15G10 LCD controller)
|
||||
and an NX graphics configuration for the Olimex LPC1766-STK have been added.
|
||||
However, neither the LCD driver nor the NX configuration have been verified as of the this release.
|
||||
</li>
|
||||
<li>
|
||||
The LPC176x Ethernet driver was using all of AHB SRAM Bank0 for Ethernet packet buffers (16Kb).
|
||||
An option was added to limit the amount of SRAM used for packet buffering and to re-use any extra Bank0 memory for heap.
|
||||
</li>
|
||||
<li>
|
||||
Enabled networking and SD/MMC card support in the Olimex LPC1766-STK NuttShell (NSH) configuration.
|
||||
</li>
|
||||
<li>
|
||||
The LPC176x USB driver is now fully fully functional.
|
||||
</li>
|
||||
<li>
|
||||
Added an optional <code>cmddata()</code> method to the SPI interface.
|
||||
Some devices require an additional out-of-band bit to specify if the next word sent to the device is a command or data.
|
||||
The <code>cmddata()</code> method provides selection of command or data.
|
||||
</li>
|
||||
<li>
|
||||
A driver for the Nokia 6100 LCD (with either the Phillips PCF8833 LCD controller and for the Epson S1D15G10 LCD controller)
|
||||
and an NX graphics configuration for the Olimex LPC1766-STK have been added.
|
||||
However, neither the LCD driver nor the NX configuration have been verified as of the this release.
|
||||
</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
|
@ -1272,10 +1272,10 @@
|
|||
<ul>
|
||||
<p>
|
||||
<b>STATUS:</b>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
<b>Nucleus2G LPC1768</b>.
|
||||
Some initial files for the LPC17xx family were released in NuttX 5.6, but the first
|
||||
Some initial files for the LPC17xx family were released in NuttX 5.6, but the first
|
||||
functional release for the NXP LPC1768/Nucleus2G occured with NuttX 5.7 with some
|
||||
additional enhancements through NuttX-5.9.
|
||||
That initial, 5.6, basic release included <i>timer</i> interrupts and a <i>serial console</i> and was
|
||||
|
@ -1288,21 +1288,21 @@
|
|||
(Although they have since been verfiied on other platforms; this needs to be revisited on the Nucleus2G).
|
||||
</p>
|
||||
<p>
|
||||
<b>mbed LPC1768</b>.
|
||||
<b>mbed LPC1768</b>.
|
||||
Support for the mbed board was contributed by Dave Marples and released in NuttX-5.11.
|
||||
This port includes a NuttX OS test configuration (see <code>examples/ostest</code>).
|
||||
</p>
|
||||
<p>
|
||||
<b>Olimex LPC1766-STK</b>.
|
||||
<b>Olimex LPC1766-STK</b>.
|
||||
Support for that Olimex-LPC1766-STK board was added to NuttX 5.13.
|
||||
The NuttX-5.14 release extended that support with an <i>Ethernet driver</i>.
|
||||
And the NuttX-5.15 release further extended the support with a functional <i>USB driver</i> and <i>SPI-based micro-SD</i>.
|
||||
And the NuttX-5.15 release further extended the support with a functional <i>USB driver</i> and <i>SPI-based micro-SD</i>.
|
||||
Verified configurations are now available for the NuttX OS test,
|
||||
for the NuttShell with networking and microSD support(NSH, see the <a href="ttp://www.nuttx.org/NuttShell.html">NSH User Guide</a>),
|
||||
for the NuttX network test, for the <a href="http://acme.com/software/thttpd">THTTPD</a> webserver,
|
||||
and for USB serial and USB storage examples.
|
||||
A driver for the <i>Nokia 6100 LCD</i> and an NX graphics configuration for the Olimex LPC1766-STK have been added.
|
||||
However, neither the LCD driver nor the NX configuration have been verified as of the the NuttX-5.15 release.
|
||||
and for USB serial and USB storage examples.
|
||||
A driver for the <i>Nokia 6100 LCD</i> and an NX graphics configuration for the Olimex LPC1766-STK have been added.
|
||||
However, neither the LCD driver nor the NX configuration have been verified as of the the NuttX-5.15 release.
|
||||
</p>
|
||||
<p>
|
||||
<b>Development Environments:</b>
|
||||
|
@ -1940,48 +1940,48 @@ Other memory:
|
|||
<ul><pre>
|
||||
5.15 2010-12-12 Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
|
||||
* net/uip/uip_tcpaddsend.c and net/send.c -- Another place where the TCP sequence
|
||||
number problem "fixed" in 5.14 might occur.
|
||||
* net/send.c -- Check if the destination IP address is in the ARP table. If
|
||||
not, then don't consider the packet sent. It won't be, an ARP packet will go
|
||||
out instead. This improves behavior, for example, on the first GET request
|
||||
from a browser.
|
||||
* arch/arm/src/lpc17xx/lpc17_emacram.h and lpc17_allocateheap.c -- The Ethernet
|
||||
logic was using all of AHB SRAM Bank0 for Ethernet packet buffers (16Kb). An
|
||||
option was added to limit the amount of SRAM used for packet buffering and to
|
||||
re-use any extra Bank0 memory for heap. configs/olimex-lpc1766stk/nettest
|
||||
now uses only 8Kb at the beginning of Bank0; the 8Kb at the end of Bank0 is
|
||||
included in the heap
|
||||
* arch/arm/src/lpc17xx/lpc17_ssp.c -- Fix compilation errors when SSP1 is
|
||||
selected.
|
||||
* configs/olimex-lpc1766stk/nsh -- Enable network and SD/MMC card support in
|
||||
NSH. Networking and telnetd interface as well as SPI-based microSD are
|
||||
now functional.
|
||||
* examples/nsh/nsh_netinit.c -- Fix NSH bug. If CONFIG_NET is selected, but
|
||||
CONFIG_EXAMPLES_NSH_TELNETD is not selected, then the network is never
|
||||
initialized and bad things happen if you try to ping.
|
||||
* drivers/lcd -- Add header files for the Phillips PCF8833 LCD controller and
|
||||
for the Epson S1D15G10 LCD controller. A driver for the Nokia 6100 LCD is
|
||||
coming.
|
||||
* include/nuttx/spi.h and almost all other SPI files -- Added an optional
|
||||
cmddata() method to the SPI interface. Some devices require an additional
|
||||
out-of-band bit to specify if the next word sent to the device is a command
|
||||
or data. This is typical, for example, in "9-bit" displays where the 9th bit
|
||||
is the CMD/DATA bit. The cmddata method provides selection of command or data.
|
||||
* drivers/lcd/p14201.c -- Now uses the cmddata() method of the SPI interface.
|
||||
* arch/arm/src/lpc17xx/lpc17_usbdev.c -- LPC17xx USB driver now appears to
|
||||
to be fully functional. examples/usbstorage configuration verified (the
|
||||
examples/usbserial configuration is untested).
|
||||
* drivers/usbdev/usbserial.c and usbstorage.c -- All USB class drivers need
|
||||
to call DEV_CONNECT() when they are ready to be enumerated. That is,
|
||||
(1) initially when bound to the USB driver, and (2) after a USB reset.
|
||||
* drivers/lcd/nokia6100.c -- A driver for the Nokia 6100 LCD. This driver
|
||||
has not be verified as of the initial check-in.
|
||||
* configs/olimex-lpc1766stk/nx -- A NX graphics configuration for the Olimex
|
||||
LPC1766-STK board using the Nokia 6100 LCD driver. This configuration has
|
||||
not been verified as of the initial check-in.
|
||||
* include/nuttx/spi.h -- the SPI_SETBITS macro was calling the setmode method.
|
||||
This is a very important bug-fix in some usages.
|
||||
* net/uip/uip_tcpaddsend.c and net/send.c -- Another place where the TCP sequence
|
||||
number problem "fixed" in 5.14 might occur.
|
||||
* net/send.c -- Check if the destination IP address is in the ARP table. If
|
||||
not, then don't consider the packet sent. It won't be, an ARP packet will go
|
||||
out instead. This improves behavior, for example, on the first GET request
|
||||
from a browser.
|
||||
* arch/arm/src/lpc17xx/lpc17_emacram.h and lpc17_allocateheap.c -- The Ethernet
|
||||
logic was using all of AHB SRAM Bank0 for Ethernet packet buffers (16Kb). An
|
||||
option was added to limit the amount of SRAM used for packet buffering and to
|
||||
re-use any extra Bank0 memory for heap. configs/olimex-lpc1766stk/nettest
|
||||
now uses only 8Kb at the beginning of Bank0; the 8Kb at the end of Bank0 is
|
||||
included in the heap
|
||||
* arch/arm/src/lpc17xx/lpc17_ssp.c -- Fix compilation errors when SSP1 is
|
||||
selected.
|
||||
* configs/olimex-lpc1766stk/nsh -- Enable network and SD/MMC card support in
|
||||
NSH. Networking and telnetd interface as well as SPI-based microSD are
|
||||
now functional.
|
||||
* examples/nsh/nsh_netinit.c -- Fix NSH bug. If CONFIG_NET is selected, but
|
||||
CONFIG_EXAMPLES_NSH_TELNETD is not selected, then the network is never
|
||||
initialized and bad things happen if you try to ping.
|
||||
* drivers/lcd -- Add header files for the Phillips PCF8833 LCD controller and
|
||||
for the Epson S1D15G10 LCD controller. A driver for the Nokia 6100 LCD is
|
||||
coming.
|
||||
* include/nuttx/spi.h and almost all other SPI files -- Added an optional
|
||||
cmddata() method to the SPI interface. Some devices require an additional
|
||||
out-of-band bit to specify if the next word sent to the device is a command
|
||||
or data. This is typical, for example, in "9-bit" displays where the 9th bit
|
||||
is the CMD/DATA bit. The cmddata method provides selection of command or data.
|
||||
* drivers/lcd/p14201.c -- Now uses the cmddata() method of the SPI interface.
|
||||
* arch/arm/src/lpc17xx/lpc17_usbdev.c -- LPC17xx USB driver now appears to
|
||||
to be fully functional. examples/usbstorage configuration verified (the
|
||||
examples/usbserial configuration is untested).
|
||||
* drivers/usbdev/usbserial.c and usbstorage.c -- All USB class drivers need
|
||||
to call DEV_CONNECT() when they are ready to be enumerated. That is,
|
||||
(1) initially when bound to the USB driver, and (2) after a USB reset.
|
||||
* drivers/lcd/nokia6100.c -- A driver for the Nokia 6100 LCD. This driver
|
||||
has not be verified as of the initial check-in.
|
||||
* configs/olimex-lpc1766stk/nx -- A NX graphics configuration for the Olimex
|
||||
LPC1766-STK board using the Nokia 6100 LCD driver. This configuration has
|
||||
not been verified as of the initial check-in.
|
||||
* include/nuttx/spi.h -- the SPI_SETBITS macro was calling the setmode method.
|
||||
This is a very important bug-fix in some usages.
|
||||
|
||||
pascal-2.0 2009-12-21 Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
|
||||
|
@ -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
|
||||
files to this new directory. Created a skeleton for a new USB host header
|
||||
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>
|
||||
|
||||
|
|
|
@ -53,7 +53,6 @@
|
|||
#include <nuttx/usb/usb.h>
|
||||
#include <nuttx/usb/ohci.h>
|
||||
#include <nuttx/usb/usbhost.h>
|
||||
#include <nuttx/usb/usbhost_trace.h>
|
||||
|
||||
#include <arch/irq.h>
|
||||
#include <arch/board/board.h>
|
||||
|
@ -71,6 +70,17 @@
|
|||
* 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 */
|
||||
|
||||
#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 */
|
||||
};
|
||||
|
||||
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 */
|
||||
};
|
||||
|
||||
|
@ -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 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,
|
||||
uint32_t toggle, volatile uint8_t *buffer,
|
||||
size_t buflen);
|
||||
|
@ -281,8 +297,11 @@ static struct lpc17_usbhost_s g_usbhost =
|
|||
|
||||
/* This is a free list of EDs and TD buffers */
|
||||
|
||||
static struct lpc17_edlist_s *g_edfree;
|
||||
static struct lpc17_tdlist_s *g_tdfree;
|
||||
static struct lpc17_edlist_s *g_edfree;
|
||||
static struct lpc17_buflist_s *g_tdfree;
|
||||
#ifdef CONFIG_UBHOST_AHBIOBUFFERS
|
||||
static struct lpc17_buflist_s *g_iofree;
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
* Public Data
|
||||
|
@ -503,6 +522,10 @@ static void lpc17_edfree(struct lpc17_usbhost_s *priv, struct lpc17_hced_s *ed)
|
|||
* Description:
|
||||
* 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)
|
||||
|
@ -510,7 +533,7 @@ static uint8_t *lpc17_tdalloc(struct lpc17_usbhost_s *priv)
|
|||
uint8_t *ret = (uint8_t *)g_tdfree;
|
||||
if (ret)
|
||||
{
|
||||
g_tdfree = ((struct lpc17_tdlist_s*)ret)->flink;
|
||||
g_tdfree = ((struct lpc17_buflist_s*)ret)->flink;
|
||||
}
|
||||
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)
|
||||
{
|
||||
struct lpc17_tdlist_s *tdfree = (struct lpc17_tdlist_s *)buffer;
|
||||
tdfree->flink = g_tdfree;
|
||||
g_tdfree = tdfree;
|
||||
struct lpc17_buflist_s *tdfree = (struct lpc17_buflist_s *)buffer;
|
||||
tdfree->flink = g_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
|
||||
*
|
||||
|
@ -758,7 +822,6 @@ static int lpc17_usbinterrupt(int irq, FAR void *context)
|
|||
|
||||
/* Read the device interrupt status register */
|
||||
|
||||
usbtrace(TRACE_INTENTRY(LPC17_TRACEINTID_USB), 0xbeef);
|
||||
uint32_t intstatus;
|
||||
uint32_t intenable;
|
||||
|
||||
|
@ -775,12 +838,12 @@ static int lpc17_usbinterrupt(int irq, FAR void *context)
|
|||
if ((intstatus & OHCI_INT_RHSC) != 0)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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 */
|
||||
|
||||
|
@ -867,7 +930,7 @@ static int lpc17_usbinterrupt(int irq, FAR void *context)
|
|||
|
||||
lpc17_putreg(intstatus, LPC17_USBHOST_INTST);
|
||||
}
|
||||
usbtrace(TRACE_INTEXIT(LPC17_TRACEINTID_USB), 0);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
@ -898,7 +961,9 @@ static int lpc17_usbinterrupt(int irq, FAR void *context)
|
|||
* returned indicating the nature of the failure
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* 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
|
||||
*
|
||||
* 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,64 +1318,111 @@ static int lpc17_transfer(FAR struct usbhost_driver_s *drvr,
|
|||
FAR uint8_t *buffer, size_t buflen)
|
||||
{
|
||||
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 regval;
|
||||
#ifdef CONFIG_UBHOST_AHBIOBUFFERS
|
||||
uint8_t *origbuf = NULL;
|
||||
#endif
|
||||
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 */
|
||||
|
||||
ed = lpc17_edalloc(priv);
|
||||
if (!ed)
|
||||
{
|
||||
goto errout;
|
||||
}
|
||||
|
||||
/* Format the endpoint descriptor */
|
||||
|
||||
lpc17_edinit(ed);
|
||||
ed->ctrl = (uint32_t)(ep->addr) << ED_CONTROL_EN_SHIFT |
|
||||
(uint32_t)(ep->mxpacketsize) << ED_CONTROL_MPS_SHIFT;
|
||||
|
||||
/* Get the direction of the endpoint */
|
||||
|
||||
if (ep->in)
|
||||
{
|
||||
ed->ctrl |= ED_CONTROL_D_IN;
|
||||
dirpid = GTD_STATUS_DP_IN;
|
||||
}
|
||||
else
|
||||
{
|
||||
ed->ctrl |= ED_CONTROL_D_OUT;
|
||||
dirpid = GTD_STATUS_DP_OUT;
|
||||
}
|
||||
|
||||
/* Then enqueue the transfer */
|
||||
|
||||
lpc17_enqueuetd(ed, dirpid, GTD_STATUS_T_TOGGLE, buffer, buflen);
|
||||
|
||||
lpc17_putreg((uint32_t)ed, LPC17_USBHOST_BULKHEADED);
|
||||
|
||||
regval = lpc17_getreg(LPC17_USBHOST_CMDST);
|
||||
regval |= OHCI_CMDST_BLF;
|
||||
lpc17_putreg(regval, LPC17_USBHOST_CMDST);
|
||||
|
||||
regval = lpc17_getreg(LPC17_USBHOST_CTRL);
|
||||
regval |= OHCI_CTRL_BLE;
|
||||
lpc17_putreg(regval, LPC17_USBHOST_CTRL);
|
||||
|
||||
/* Wait for the Writeback Done Head interrupt */
|
||||
|
||||
lpc17_takesem(&priv->wdhsem);
|
||||
|
||||
/* Check the TDHEAD completion status bits */
|
||||
|
||||
if (priv->tdstatus == 0)
|
||||
{
|
||||
ret = OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
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)
|
||||
{
|
||||
/* Format the endpoint descriptor */
|
||||
|
||||
lpc17_edinit(ed);
|
||||
ed->ctrl = (uint32_t)(ep->addr) << ED_CONTROL_EN_SHIFT |
|
||||
(uint32_t)(ep->mxpacketsize) << ED_CONTROL_MPS_SHIFT;
|
||||
|
||||
/* Get the direction of the endpoint */
|
||||
|
||||
if (ep->in)
|
||||
{
|
||||
ed->ctrl |= ED_CONTROL_D_IN;
|
||||
dirpid = GTD_STATUS_DP_IN;
|
||||
}
|
||||
else
|
||||
{
|
||||
ed->ctrl |= ED_CONTROL_D_OUT;
|
||||
dirpid = GTD_STATUS_DP_OUT;
|
||||
}
|
||||
|
||||
/* Then enqueue the transfer */
|
||||
|
||||
lpc17_enqueuetd(ed, dirpid, GTD_STATUS_T_TOGGLE, buffer, buflen);
|
||||
|
||||
lpc17_putreg((uint32_t)ed, LPC17_USBHOST_BULKHEADED);
|
||||
|
||||
regval = lpc17_getreg(LPC17_USBHOST_CMDST);
|
||||
regval |= OHCI_CMDST_BLF;
|
||||
lpc17_putreg(regval, LPC17_USBHOST_CMDST);
|
||||
|
||||
regval = lpc17_getreg(LPC17_USBHOST_CTRL);
|
||||
regval |= OHCI_CTRL_BLE;
|
||||
lpc17_putreg(regval, LPC17_USBHOST_CTRL);
|
||||
|
||||
/* Wait for the Writeback Done Head interrupt */
|
||||
|
||||
lpc17_takesem(&priv->wdhsem);
|
||||
|
||||
/* Check the TDHEAD completion status bits */
|
||||
|
||||
if (priv->tdstatus == 0)
|
||||
{
|
||||
ret = OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = -EIO;
|
||||
}
|
||||
lpc17_edfree(priv, ed);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1326,7 +1444,9 @@ static int lpc17_transfer(FAR struct usbhost_driver_s *drvr,
|
|||
* None
|
||||
*
|
||||
* 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;
|
||||
int i;
|
||||
|
||||
usbtrace(TRACE_DEVINIT, 0);
|
||||
|
||||
/* Initialize the state data structure */
|
||||
|
||||
sem_init(&priv->rhssem, 0, 0);
|
||||
|
@ -1508,8 +1626,7 @@ void up_usbhostinitialize(void)
|
|||
|
||||
if (irq_attach(LPC17_IRQ_USB, lpc17_usbinterrupt) != 0)
|
||||
{
|
||||
usbtrace(TRACE_DEVERROR(LPC17_TRACEERR_IRQREGISTRATION),
|
||||
(uint16_t)LPC17_IRQ_USB);
|
||||
udbg("Failed to attach IRQ\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -98,6 +98,7 @@
|
|||
#define USBHOST_ALLFOUND 0x07
|
||||
|
||||
#define USBHOST_MAX_RETRIES 100
|
||||
#define USBHOST_MAX_CREFS 0x7fff
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
|
@ -1532,7 +1533,7 @@ static int usbhost_open(FAR struct inode *inode)
|
|||
{
|
||||
/* 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);
|
||||
priv->crefs++;
|
||||
usbhost_givesem(&priv->exclsem);
|
||||
|
@ -1559,7 +1560,7 @@ static int usbhost_close(FAR struct inode *inode)
|
|||
|
||||
/* Decrement the reference count on the block driver */
|
||||
|
||||
DEBUGASSERT(priv->crefs > 0);
|
||||
DEBUGASSERT(priv->crefs > 1);
|
||||
usbhost_takesem(&priv->exclsem);
|
||||
priv->crefs--;
|
||||
|
||||
|
@ -1645,7 +1646,7 @@ static ssize_t usbhost_read(FAR struct inode *inode, unsigned char *buffer,
|
|||
if (result == OK)
|
||||
{
|
||||
/* Receive the user data */
|
||||
#warning "For lpc17xx, I think this buffer needs to lie in BANK1"
|
||||
|
||||
result = DRVR_TRANSFER(priv->drvr, &priv->bulkin,
|
||||
buffer, priv->blocksize * nsectors);
|
||||
if (result == OK)
|
||||
|
@ -1737,7 +1738,7 @@ static ssize_t usbhost_write(FAR struct inode *inode, const unsigned char *buffe
|
|||
if (result == OK)
|
||||
{
|
||||
/* Send the user data */
|
||||
#warning "For lpc17xx, I think this buffer needs to lie in BANK1"
|
||||
|
||||
result = DRVR_TRANSFER(priv->drvr, &priv->bulkout,
|
||||
(uint8_t*)buffer, priv->blocksize * nsectors);
|
||||
if (result == OK)
|
||||
|
|
|
@ -42,354 +42,19 @@
|
|||
|
||||
#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
|
||||
****************************************************************************/
|
||||
|
||||
/* 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
|
||||
****************************************************************************/
|
||||
|
||||
/* 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
|
||||
****************************************************************************/
|
||||
|
@ -402,74 +67,6 @@ extern "C" {
|
|||
# define EXTERN extern
|
||||
#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
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue