summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenz Meier <lorenz@px4.io>2015-02-18 08:29:28 +0100
committerLorenz Meier <lorenz@px4.io>2015-02-18 08:29:28 +0100
commit11afcdfee6a3961952dd92f02c1abaa4756b115f (patch)
treeea62ed2c8b2e41c101cc180203298cf1c2153bd5
parent3c80d15993ee2e1fc4c7737050bc05cfca76f01b (diff)
parentc0b1903b7671c32fe19f7aa78b5147c003c12e99 (diff)
downloadpx4-nuttx-11afcdfee6a3961952dd92f02c1abaa4756b115f.tar.gz
px4-nuttx-11afcdfee6a3961952dd92f02c1abaa4756b115f.tar.bz2
px4-nuttx-11afcdfee6a3961952dd92f02c1abaa4756b115f.zip
Merge pull request #47 from tridge/pullrequest-mkfatfs-dma
fat: use DMA memory for mkfatfs when needed
-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 */