summaryrefslogtreecommitdiff
path: root/nuttx/arch
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2015-03-25 09:04:51 -0600
committerGregory Nutt <gnutt@nuttx.org>2015-03-25 09:04:51 -0600
commit7cee9b355dd78ba26982373eaf8f05fc8297ffc0 (patch)
treed9b2f85cefdd7e2b14183358af20df98527eeb70 /nuttx/arch
parenta6b2ebd5262cbbe70ae3ee1c2be2dc5369175acf (diff)
downloadpx4-nuttx-7cee9b355dd78ba26982373eaf8f05fc8297ffc0.tar.gz
px4-nuttx-7cee9b355dd78ba26982373eaf8f05fc8297ffc0.tar.bz2
px4-nuttx-7cee9b355dd78ba26982373eaf8f05fc8297ffc0.zip
SAMV7 USB DCD: A few more fixed from early intergration. Still does not work
Diffstat (limited to 'nuttx/arch')
-rw-r--r--nuttx/arch/arm/src/samv7/chip/sam_usbhs.h6
-rw-r--r--nuttx/arch/arm/src/samv7/sam_usbdevhs.c21
2 files changed, 7 insertions, 20 deletions
diff --git a/nuttx/arch/arm/src/samv7/chip/sam_usbhs.h b/nuttx/arch/arm/src/samv7/chip/sam_usbhs.h
index f63578219..c4ef7b91d 100644
--- a/nuttx/arch/arm/src/samv7/chip/sam_usbhs.h
+++ b/nuttx/arch/arm/src/samv7/chip/sam_usbhs.h
@@ -232,7 +232,7 @@
#define USBHS_DEVINT_UPRSM (1 << 6) /* Bit 6: Upstream Resume Interrupt */
#define USBHS_DEVINT_PEP_SHIFT (12) /* Bits 12-23: Endpoint interrupts (1) */
#define USBHS_DEVINT_PEP_MASK (0xfff << USBHS_DEVINT_PEP_SHIFT)
-# define USBHS_DEVINT_PEP(n) (1 << +((n)+12)) /* Endpoint n Interrupt, n=0-11 (1) */
+# define USBHS_DEVINT_PEP(n) (1 << ((n)+12)) /* Endpoint n Interrupt, n=0-11 (1) */
# define USBHS_DEVINT_PEP0 (1 << 12) /* Bit 12: Endpoint 0 Interrupt (1) */
# define USBHS_DEVINT_PEP1 (1 << 13) /* Bit 13: Endpoint 1 Interrupt (1) */
# define USBHS_DEVINT_PEP2 (1 << 14) /* Bit 14: Endpoint 2 Interrupt (1) */
@@ -747,9 +747,9 @@
#define USBHS_CTRL_RDERRE (1 << 4) /* Bit 4: Remote Device Connection Error Interrupt Enable */
#define USBHS_CTRL_FRZCLK (1 << 14) /* Bit 14: Freeze USB Clock */
#define USBHS_CTRL_USBE (1 << 15) /* Bit 15: USBHS Enable */
-#define USBHS_CTRL_UIMOD (1 << 25) /* Bit 25: USBHS Mode */
+#define USBHS_CTRL_UIMOD_MASK (1 << 25) /* Bit 25: USBHS Mode */
# define USBHS_CTRL_UIMOD_HOST (0 << 25) /* 0=Host mode */
-# define USBHS_CTRL_UIMOD_DEVICE (1 << 25) /* 1= Device mode */
+# define USBHS_CTRL_UIMOD_DEVICE (1 << 25) /* 1=Device mode */
/* General Status Register */
diff --git a/nuttx/arch/arm/src/samv7/sam_usbdevhs.c b/nuttx/arch/arm/src/samv7/sam_usbdevhs.c
index a89dfb857..3bb1739b5 100644
--- a/nuttx/arch/arm/src/samv7/sam_usbdevhs.c
+++ b/nuttx/arch/arm/src/samv7/sam_usbdevhs.c
@@ -1704,7 +1704,7 @@ static void sam_req_cancel(struct sam_ep_s *privep, int16_t result)
epno = USB_EPNO(privep->ep.eplog);
if (epno != 0)
{
- sam_putreg(~USBHS_DEVINT_DMA(epno), SAM_USBHS_DEVIDR);
+ sam_putreg(USBHS_DEVINT_DMA(epno), SAM_USBHS_DEVIDR);
}
/* Then complete every queued request with the specified status */
@@ -4197,8 +4197,8 @@ static void sam_reset(struct sam_usbdev_s *priv)
{
struct sam_ep_s *privep = &priv->eplist[epno];
- /* Cancel any queued requests. Since they are canceled
- * with status -ESHUTDOWN, then will not be requeued
+ /* Cancel any queued requests. Since they are cancelled
+ * with status -ESHUTDOWN, then will not be re-queued
* until the configuration is reset. NOTE: This should
* not be necessary... the CLASS_DISCONNECT above should
* result in the class implementation calling sam_ep_disable
@@ -4312,22 +4312,9 @@ static void sam_hw_setup(struct sam_usbdev_s *priv)
/* Stop any DMA transfer */
sam_putreg(0, SAM_USBHS_DEVDMACTRL(i));
-
- /* Reset DMA channel (Buffer count and Control field) */
-
- sam_putreg(USBHS_DEVDMACTRL_LDNXTDSC, SAM_USBHS_DEVDMACTRL(i));
-
- /* Reset DMA channel */
-
- sam_putreg(0, SAM_USBHS_DEVDMACTRL(i));
-
- /* Clear DMA channel status (read to clear) */
-
- regval = sam_getreg(SAM_USBHS_DEVDMASTA(i));
- sam_putreg(regval, SAM_USBHS_DEVDMACTRL(i));
}
- /* Disable all interrupts. Disable all endpoints */
+ /* Disable all endpoint interrupts. Disable all endpoints */
sam_putreg(USBHS_DEVEPT_ALLEPEN, SAM_USBHS_DEVIDR);
sam_putreg(0, SAM_USBHS_DEVEPT);