diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-09-13 14:14:18 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-09-13 14:14:18 +0000 |
commit | 05a6ec77b4fc41cc5b866b9228ee037fbf3eb902 (patch) | |
tree | e60b015f4c47e705a04ef8f95e46d5ddd6465d4a /nuttx/arch/avr/src | |
parent | 236f0c0aa20e817bed9d3625ef3ebb14c44d6fae (diff) | |
download | px4-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/avr/src')
-rw-r--r-- | nuttx/arch/avr/src/at90usb/at90usb_usbdev.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/nuttx/arch/avr/src/at90usb/at90usb_usbdev.c b/nuttx/arch/avr/src/at90usb/at90usb_usbdev.c index dcda5d6d0..89949e662 100644 --- a/nuttx/arch/avr/src/at90usb/at90usb_usbdev.c +++ b/nuttx/arch/avr/src/at90usb/at90usb_usbdev.c @@ -313,7 +313,7 @@ static int avr_epdisable(FAR struct usbdev_ep_s *ep); static FAR struct usbdev_req_s *avr_epallocreq(FAR struct usbdev_ep_s *ep); static void avr_epfreereq(FAR struct usbdev_ep_s *ep, FAR struct usbdev_req_s *); -#ifdef CONFIG_ARCH_USBDEV_DMA +#ifdef CONFIG_USBDEV_DMA static void *avr_epallocbuffer(FAR struct usbdev_ep_s *ep, unsigned bytes); static void avr_epfreebuffer(FAR struct usbdev_ep_s *ep, FAR void *buf); #endif @@ -346,7 +346,7 @@ static const struct usbdev_epops_s g_epops = .disable = avr_epdisable, .allocreq = avr_epallocreq, .freereq = avr_epfreereq, -#ifdef CONFIG_ARCH_USBDEV_DMA +#ifdef CONFIG_USBDEV_DMA .allocbuffer = avr_epallocbuffer, .freebuffer = avr_epfreebuffer, #endif @@ -2314,11 +2314,17 @@ static void avr_epfreereq(FAR struct usbdev_ep_s *ep, * *******************************************************************************/ -#ifdef CONFIG_ARCH_USBDEV_DMA +#ifdef CONFIG_USBDEV_DMA static void *avr_epallocbuffer(FAR struct usbdev_ep_s *ep, unsigned bytes) { usbtrace(TRACE_EPALLOCBUFFER, privep->ep.eplog); - return malloc(bytes)} + +#ifdef CONFIG_USBDEV_DMAMEMORY + return usbdev_dma_alloc(bytes); +#else + return malloc(bytes); +#endif +} #endif /******************************************************************************* @@ -2329,11 +2335,16 @@ static void *avr_epallocbuffer(FAR struct usbdev_ep_s *ep, unsigned bytes) * *******************************************************************************/ -#ifdef CONFIG_ARCH_USBDEV_DMA +#ifdef CONFIG_USBDEV_DMA static void avr_epfreebuffer(FAR struct usbdev_ep_s *ep, FAR void *buf) { usbtrace(TRACE_EPFREEBUFFER, privep->ep.eplog); + +#ifdef CONFIG_USBDEV_DMAMEMORY + usbdev_dma_free(buf); +#else free(buf); +#endif } #endif |