summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2013-09-02 12:26:15 -0600
committerGregory Nutt <gnutt@nuttx.org>2013-09-02 12:26:15 -0600
commit6278ac1c4a69d20aae11071c3522a681297af107 (patch)
tree684a12e9145373ee36066bb1e8d28646b2c5bf0e
parent03a3769c31fc38a1924f09ff73e2ac0184394edd (diff)
downloadnuttx-6278ac1c4a69d20aae11071c3522a681297af107.tar.gz
nuttx-6278ac1c4a69d20aae11071c3522a681297af107.tar.bz2
nuttx-6278ac1c4a69d20aae11071c3522a681297af107.zip
SAMA5 UDPHS: Some very early debug corrections. Not yet working.
-rw-r--r--nuttx/arch/arm/src/sama5/sam_udphs.c11
-rw-r--r--nuttx/configs/sama5d3x-ek/README.txt9
-rw-r--r--nuttx/drivers/usbdev/cdcacm.c4
3 files changed, 18 insertions, 6 deletions
diff --git a/nuttx/arch/arm/src/sama5/sam_udphs.c b/nuttx/arch/arm/src/sama5/sam_udphs.c
index 1162f29d7..d05d78f3c 100644
--- a/nuttx/arch/arm/src/sama5/sam_udphs.c
+++ b/nuttx/arch/arm/src/sama5/sam_udphs.c
@@ -2862,7 +2862,7 @@ static void sam_epset_reset(struct sam_usbdev_s *priv, uint16_t epset)
/* Reset each endpoint in the set */
for (epno = 0, bit = 1, epset &= SAM_EPSET_ALL;
- epno < SAM_UDPHS_NENDPOINTS || epset == 0;
+ epno < SAM_UDPHS_NENDPOINTS && epset != 0;
epno++, bit <<= 1)
{
/* Is this endpoint in the set? */
@@ -3754,7 +3754,7 @@ static void sam_reset(struct sam_usbdev_s *priv)
sam_epset_reset(priv, SAM_EPSET_ALL);
sam_ep_configure_internal(&priv->eplist[EP0], &g_ep0desc);
- /* Reset endpoints */
+ /* Reset endpoint data structures */
for (epno = 0; epno < SAM_UDPHS_NENDPOINTS; epno++)
{
@@ -3779,7 +3779,6 @@ static void sam_reset(struct sam_usbdev_s *priv)
/* Re-configure the USB controller in its initial, unconnected state */
- sam_reset(priv);
priv->usbdev.speed = USB_SPEED_FULL;
sam_dumpep(priv, EP0);
}
@@ -3847,7 +3846,7 @@ static void sam_hw_setup(struct sam_usbdev_s *priv)
/* Initialize DMA channels */
- for (i = 1; i < SAM_UDPHS_NDMACHANNELS; i++)
+ for (i = 1; i <= SAM_UDPHS_NDMACHANNELS; i++)
{
/* Stop any DMA transfer */
@@ -3867,9 +3866,9 @@ static void sam_hw_setup(struct sam_usbdev_s *priv)
sam_putreg(regval, SAM_UDPHS_DMACONTROL(i));
}
- /* Initialize DMA channels */
+ /* Initialize Endpoints */
- for (i = 1; i < SAM_UDPHS_NENDPOINTS; i++)
+ for (i = 0; i < SAM_UDPHS_NENDPOINTS; i++)
{
/* Disable endpoint */
diff --git a/nuttx/configs/sama5d3x-ek/README.txt b/nuttx/configs/sama5d3x-ek/README.txt
index cfebbc954..bcbdff211 100644
--- a/nuttx/configs/sama5d3x-ek/README.txt
+++ b/nuttx/configs/sama5d3x-ek/README.txt
@@ -1241,6 +1241,15 @@ Configurations
Device Drivers -> USB Device Driver Support
CONFIG_CDCACM=y : Enable the CDC/ACM device
+ The following setting enables an example that can can be used to
+ control the CDC/ACM device. It will add two new NSH commands:
+ (1) sercon will connect the USB serial device (creating /dev/ttyACM0),
+ and (2) serdis which will disconnect the USB serial device (destroying
+ /dev/ttyACM0).
+
+ Application Configuration -> Examples:
+ CONFIG_EXAMPLES_CDCACM=y : Enable an CDC/ACM example
+
STATUS:
2013-7-19: This configuration (as do the others) run at 396MHz.
The SAMA5D3 can run at 536MHz. I still need to figure out the
diff --git a/nuttx/drivers/usbdev/cdcacm.c b/nuttx/drivers/usbdev/cdcacm.c
index dcd5b9aa1..81319e30c 100644
--- a/nuttx/drivers/usbdev/cdcacm.c
+++ b/nuttx/drivers/usbdev/cdcacm.c
@@ -535,6 +535,7 @@ static struct usbdev_req_s *cdcacm_allocreq(FAR struct usbdev_ep_s *ep,
req = NULL;
}
}
+
return req;
}
@@ -978,6 +979,7 @@ static int cdcacm_bind(FAR struct usbdevclass_driver_s *driver,
ret = -ENODEV;
goto errout;
}
+
priv->epintin->priv = priv;
/* Pre-allocate the IN bulk endpoint */
@@ -989,6 +991,7 @@ static int cdcacm_bind(FAR struct usbdevclass_driver_s *driver,
ret = -ENODEV;
goto errout;
}
+
priv->epbulkin->priv = priv;
/* Pre-allocate the OUT bulk endpoint */
@@ -1000,6 +1003,7 @@ static int cdcacm_bind(FAR struct usbdevclass_driver_s *driver,
ret = -ENODEV;
goto errout;
}
+
priv->epbulkout->priv = priv;
/* Pre-allocate read requests */