summaryrefslogtreecommitdiff
path: root/nuttx/arch/arm/src/lpc43xx
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-09-13 14:14:18 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-09-13 14:14:18 +0000
commit05a6ec77b4fc41cc5b866b9228ee037fbf3eb902 (patch)
treee60b015f4c47e705a04ef8f95e46d5ddd6465d4a /nuttx/arch/arm/src/lpc43xx
parent236f0c0aa20e817bed9d3625ef3ebb14c44d6fae (diff)
downloadpx4-nuttx-05a6ec77b4fc41cc5b866b9228ee037fbf3eb902.tar.gz
px4-nuttx-05a6ec77b4fc41cc5b866b9228ee037fbf3eb902.tar.bz2
px4-nuttx-05a6ec77b4fc41cc5b866b9228ee037fbf3eb902.zip
USB device drivers: Add hooks to to use common, external DMA buffer allocation implementation..
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5142 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/arm/src/lpc43xx')
-rw-r--r--nuttx/arch/arm/src/lpc43xx/lpc43_usb0dev.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/nuttx/arch/arm/src/lpc43xx/lpc43_usb0dev.c b/nuttx/arch/arm/src/lpc43xx/lpc43_usb0dev.c
index 2ce19a325..b4ca55420 100644
--- a/nuttx/arch/arm/src/lpc43xx/lpc43_usb0dev.c
+++ b/nuttx/arch/arm/src/lpc43xx/lpc43_usb0dev.c
@@ -404,7 +404,7 @@ static int lpc43_epdisable(FAR struct usbdev_ep_s *ep);
static FAR struct usbdev_req_s *lpc43_epallocreq(FAR struct usbdev_ep_s *ep);
static void lpc43_epfreereq(FAR struct usbdev_ep_s *ep,
FAR struct usbdev_req_s *);
-#ifdef CONFIG_ARCH_USBDEV_DMA
+#ifdef CONFIG_USBDEV_DMA
static void *lpc43_epallocbuffer(FAR struct usbdev_ep_s *ep, unsigned bytes);
static void lpc43_epfreebuffer(FAR struct usbdev_ep_s *ep, FAR void *buf);
#endif
@@ -441,7 +441,7 @@ static const struct usbdev_epops_s g_epops =
.disable = lpc43_epdisable,
.allocreq = lpc43_epallocreq,
.freereq = lpc43_epfreereq,
-#ifdef CONFIG_ARCH_USBDEV_DMA
+#ifdef CONFIG_USBDEV_DMA
.allocbuffer = lpc43_epallocbuffer,
.freebuffer = lpc43_epfreebuffer,
#endif
@@ -1958,11 +1958,16 @@ static void lpc43_epfreereq(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s
*
*******************************************************************************/
-#ifdef CONFIG_ARCH_USBDEV_DMA
+#ifdef CONFIG_USBDEV_DMA
static void *lpc43_epallocbuffer(FAR struct usbdev_ep_s *ep, unsigned bytes)
{
usbtrace(TRACE_EPALLOCBUFFER, privep->epphy);
- return malloc(bytes)
+
+#ifdef CONFIG_USBDEV_DMAMEMORY
+ return usbdev_dma_alloc(bytes);
+#else
+ return malloc(bytes);
+#endif
}
#endif
@@ -1974,11 +1979,16 @@ static void *lpc43_epallocbuffer(FAR struct usbdev_ep_s *ep, unsigned bytes)
*
*******************************************************************************/
-#ifdef CONFIG_LPC433x_USBDEV_DMA
+#ifdef CONFIG_USBDEV_DMA
static void lpc43_epfreebuffer(FAR struct usbdev_ep_s *ep, FAR void *buf)
{
usbtrace(TRACE_EPFREEBUFFER, privep->epphy);
+
+#ifdef CONFIG_USBDEV_DMAMEMORY
+ usbdev_dma_free(buf);
+#else
free(buf);
+#endif
}
#endif