summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2013-09-07 11:43:06 -0600
committerGregory Nutt <gnutt@nuttx.org>2013-09-07 11:43:06 -0600
commit56ecc7ff06b521dbda03a4c7b6274459a5709ab2 (patch)
tree079f123c9da25dd6f2a98518daa1db63cbd36d1f
parent41f052cc7b494d198e5bcb662790c1c1102c5dfb (diff)
downloadpx4-nuttx-56ecc7ff06b521dbda03a4c7b6274459a5709ab2.tar.gz
px4-nuttx-56ecc7ff06b521dbda03a4c7b6274459a5709ab2.tar.bz2
px4-nuttx-56ecc7ff06b521dbda03a4c7b6274459a5709ab2.zip
SAMA5: Add support EHCI/OHCI to sama5d3x-ek/demo (does not work yet); Fix some EHCI/OHCI compilation issues when DEBUG is disabled
-rwxr-xr-xnuttx/arch/arm/src/sama5/sam_ehci.c2
-rw-r--r--nuttx/arch/arm/src/sama5/sam_ohci.c2
-rw-r--r--nuttx/configs/sama5d3x-ek/README.txt35
-rw-r--r--nuttx/configs/sama5d3x-ek/demo/defconfig41
4 files changed, 72 insertions, 8 deletions
diff --git a/nuttx/arch/arm/src/sama5/sam_ehci.c b/nuttx/arch/arm/src/sama5/sam_ehci.c
index 447a6e024..5ea84870a 100755
--- a/nuttx/arch/arm/src/sama5/sam_ehci.c
+++ b/nuttx/arch/arm/src/sama5/sam_ehci.c
@@ -690,7 +690,7 @@ static void sam_putreg(uint32_t regval, volatile uint32_t *regaddr)
#else
static inline void sam_putreg(uint32_t regval, volatile uint32_t *regaddr)
{
- *regaval = regval;
+ *regaddr = regval;
}
#endif
diff --git a/nuttx/arch/arm/src/sama5/sam_ohci.c b/nuttx/arch/arm/src/sama5/sam_ohci.c
index 526859537..d943d01d9 100644
--- a/nuttx/arch/arm/src/sama5/sam_ohci.c
+++ b/nuttx/arch/arm/src/sama5/sam_ohci.c
@@ -2504,7 +2504,9 @@ errout:
static int sam_epfree(FAR struct usbhost_driver_s *drvr, usbhost_ep_t ep)
{
+#ifdef CONFIG_DEBUG
struct sam_rhport_s *rhport = (struct sam_rhport_s *)drvr;
+#endif
struct sam_eplist_s *eplist = (struct sam_eplist_s *)ep;
struct sam_ed_s *ed;
int ret;
diff --git a/nuttx/configs/sama5d3x-ek/README.txt b/nuttx/configs/sama5d3x-ek/README.txt
index d050ac32f..0716476d0 100644
--- a/nuttx/configs/sama5d3x-ek/README.txt
+++ b/nuttx/configs/sama5d3x-ek/README.txt
@@ -1037,10 +1037,37 @@ Configurations
nsh> msdis
nsh> mount -t vfat /dev/mtdblock0 /mnt/at25
+ 7. The USB high-speed EHCI and the low-/full- OHCI host drivers are supported
+ in this configuration.
+ Here are the relevant configuration options that enable EHCI support:
+
+ System Type -> ATSAMA5 Peripheral Support
+ CONFIG_SAMA5_UHPHS=y : USB Host High Speed
+
+ System Type -> USB High Speed Host driver options
+ CONFIG_SAMA5_EHCI=y : High-speed EHCI support
+ CONFIG_SAMA5_OHCI=y : Low/full-speed OHCI support
+ : Defaults for values probably OK for both
+ Device Drivers
+ CONFIG_USBHOST=y : Enable USB host support
+ CONFIG_USBHOST_ISOC_DISABLE=y : Isochronous endpoints not needed
+
+ Device Drivers -> USB Host Driver Support
+ CONFIG_USBHOST_ISOC_DISABLE=y : Isochronous endpoints not used
+ CONFIG_USBHOST_MSC=y : Enable the mass storage class driver
+ CONFIG_USBHOST_HIDKBD=y : Enable the HID keybaord class driver
+ : Defaults for values probably OK for both
+
+ Library Routines
+ CONFIG_SCHED_WORKQUEUE=y : Worker thread support is required
+
+ Application Configuration -> NSH Library
+ CONFIG_NSH_ARCHINIT=y : NSH board-initialization
+
The following features are *not* enabled in the demo configuration but
might be of some use to you:
- 7. Debugging USB Device. There is normal console debug output available
+ 8. Debugging USB Device. There is normal console debug output available
that can be enabled with CONFIG_DEBUG + CONFIG_DEBUG_USB. However,
USB device operation is very time critical and enabling this debug
output WILL interfere with the operation of the UDPHS. USB device
@@ -1395,7 +1422,7 @@ Configurations
CONFIG_USBHOST_MSC=y : Enable the mass storage class driver
Library Routines
- CONFIG_SCHED_WORKQUEUE : Worker thread support is required
+ CONFIG_SCHED_WORKQUEUE=y : Worker thread support is required
Application Configuration -> NSH Library
CONFIG_NSH_ARCHINIT=y : NSH board-initialization
@@ -1427,12 +1454,12 @@ Configurations
CONFIG_USBHOST_MSC=y : Enable the mass storage class driver
Library Routines
- CONFIG_SCHED_WORKQUEUE : Worker thread support is required
+ CONFIG_SCHED_WORKQUEUE=y : Worker thread support is required
Application Configuration -> NSH Library
CONFIG_NSH_ARCHINIT=y : NSH board-initialization
- 12. Support the USB high-speed EHCI device driver (UDPHS) can be enabled
+ 12. Support the USB high-speed USB device driver (UDPHS) can be enabled
by changing the NuttX configuration file as follows:
Device Drivers -> USB Device Driver Support
diff --git a/nuttx/configs/sama5d3x-ek/demo/defconfig b/nuttx/configs/sama5d3x-ek/demo/defconfig
index e3362f2b6..1a94d9772 100644
--- a/nuttx/configs/sama5d3x-ek/demo/defconfig
+++ b/nuttx/configs/sama5d3x-ek/demo/defconfig
@@ -109,6 +109,9 @@ CONFIG_ARMV7A_TOOLCHAIN_CODESOURCERYW=y
# CONFIG_ARMV7A_TOOLCHAIN_GNU_EABIL is not set
# CONFIG_ARMV7A_TOOLCHAIN_GNU_EABIW is not set
# CONFIG_ARMV7A_TOOLCHAIN_GNU_OABI is not set
+# CONFIG_USBHOST_BULK_DISABLE is not set
+# CONFIG_USBHOST_INT_DISABLE is not set
+CONFIG_USBHOST_ISOC_DISABLE=y
#
# ATSAMA5 Configuration Options
@@ -146,7 +149,7 @@ CONFIG_SAMA5_SPI0=y
# CONFIG_SAMA5_ADC is not set
CONFIG_SAMA5_DMAC0=y
# CONFIG_SAMA5_DMAC1 is not set
-# CONFIG_SAMA5_UHPHS is not set
+CONFIG_SAMA5_UHPHS=y
CONFIG_SAMA5_UDPHS=y
# CONFIG_SAMA5_GMAC is not set
# CONFIG_SAMA5_EMAC is not set
@@ -177,6 +180,22 @@ CONFIG_SAMA5_SPI_DMATHRESHOLD=4
# CONFIG_UDPHS_SCATTERGATHER is not set
#
+# USB High Speed Host Controller driver (HCD) options
+#
+CONFIG_SAMA5_OHCI=y
+CONFIG_SAMA5_OHCI_NEDS=6
+CONFIG_SAMA5_OHCI_NTDS=9
+CONFIG_SAMA5_OHCI_TDBUFFERS=6
+CONFIG_SAMA5_OHCI_TDBUFSIZE=128
+CONFIG_SAMA5_EHCI=y
+CONFIG_SAMA5_EHCI_NQHS=4
+CONFIG_SAMA5_EHCI_NQTDS=6
+CONFIG_SAMA5_EHCI_BUFSIZE=128
+CONFIG_SAMA5_EHCI_PREALLOCATE=y
+CONFIG_SAMA5_UHPHS_RHPORT2=y
+CONFIG_SAMA5_UHPHS_RHPORT3=y
+
+#
# External Memory Configuration
#
CONFIG_SAMA5_DDRCS=y
@@ -313,6 +332,7 @@ CONFIG_SIG_SIGUSR1=1
CONFIG_SIG_SIGUSR2=2
CONFIG_SIG_SIGALARM=3
CONFIG_SIG_SIGCONDTIMEDOUT=16
+CONFIG_SIG_SIGWORK=17
#
# Sizes of configurable things (0 disables)
@@ -449,7 +469,17 @@ CONFIG_USBMSC_PRODUCTID=0x5342
CONFIG_USBMSC_PRODUCTSTR="Mass Storage"
CONFIG_USBMSC_VERSIONNO=0x399
# CONFIG_USBMSC_REMOVABLE is not set
-# CONFIG_USBHOST is not set
+CONFIG_USBHOST=y
+CONFIG_USBHOST_NPREALLOC=4
+CONFIG_USBHOST_MSC=y
+CONFIG_USBHOST_HIDKBD=y
+CONFIG_HIDKBD_POLLUSEC=100000
+CONFIG_HIDKBD_DEFPRIO=50
+CONFIG_HIDKBD_STACKSIZE=1024
+CONFIG_HIDKBD_BUFSIZE=64
+# CONFIG_HIDKBD_RAWSCANCODES is not set
+# CONFIG_HIDKBD_ALLSCANCODES is not set
+# CONFIG_HIDKBD_NODEBOUNCE is not set
# CONFIG_WIRELESS is not set
#
@@ -551,7 +581,12 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512
#
# Non-standard Library Support
#
-# CONFIG_SCHED_WORKQUEUE is not set
+CONFIG_SCHED_WORKQUEUE=y
+CONFIG_SCHED_HPWORK=y
+CONFIG_SCHED_WORKPRIORITY=192
+CONFIG_SCHED_WORKPERIOD=50000
+CONFIG_SCHED_WORKSTACKSIZE=2048
+# CONFIG_SCHED_LPWORK is not set
# CONFIG_LIB_KBDCODEC is not set
# CONFIG_LIB_SLCDCODEC is not set