From c0b1903b7671c32fe19f7aa78b5147c003c12e99 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 6 Feb 2015 18:06:36 +1100 Subject: fat: use DMA memory for mkfatfs when needed this makes mkfatfs use fat_dma_alloc() when CONFIG_FAT_DMAMEMORY is set. This is needed to ensure mkfatfs operates with boards that use DMA for microSD --- nuttx/fs/fat/fs_mkfatfs.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/nuttx/fs/fat/fs_mkfatfs.c b/nuttx/fs/fat/fs_mkfatfs.c index ed7ed2a66..f5df0b653 100644 --- a/nuttx/fs/fat/fs_mkfatfs.c +++ b/nuttx/fs/fat/fs_mkfatfs.c @@ -277,8 +277,11 @@ int mkfatfs(FAR const char *pathname, FAR struct fat_format_s *fmt) } /* Allocate a buffer that will be working sector memory */ - +#ifdef CONFIG_FAT_DMAMEMORY + var.fv_sect = (uint8_t*)fat_dma_alloc(var.fv_sectorsize); +#else var.fv_sect = (uint8_t*)kmalloc(var.fv_sectorsize); +#endif if (!var.fv_sect) { fdbg("Failed to allocate working buffers\n"); @@ -299,7 +302,11 @@ errout: if (var.fv_sect) { +#ifdef CONFIG_FAT_DMAMEMORY + fat_dma_free(var.fv_sect, var.fv_sectorsize); +#else kfree(var.fv_sect); +#endif } /* Return any reported errors */ -- cgit v1.2.3