summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <andrew@tridgell.net>2015-02-06 18:06:36 +1100
committerAndrew Tridgell <andrew@tridgell.net>2015-02-18 09:33:51 +1100
commitc0b1903b7671c32fe19f7aa78b5147c003c12e99 (patch)
treeea62ed2c8b2e41c101cc180203298cf1c2153bd5
parent3c80d15993ee2e1fc4c7737050bc05cfca76f01b (diff)
downloadpx4-nuttx-c0b1903b7671c32fe19f7aa78b5147c003c12e99.tar.gz
px4-nuttx-c0b1903b7671c32fe19f7aa78b5147c003c12e99.tar.bz2
px4-nuttx-c0b1903b7671c32fe19f7aa78b5147c003c12e99.zip
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
-rw-r--r--nuttx/fs/fat/fs_mkfatfs.c9
1 files changed, 8 insertions, 1 deletions
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 */