mkfatfs: 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 From Andrew Tridgell via the PX4/NuttX repository
This commit is contained in:
parent
e07d2abcbd
commit
b3dd424e10
|
@ -298,7 +298,12 @@ 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*)kmm_malloc(var.fv_sectorsize);
|
||||
#endif
|
||||
|
||||
if (!var.fv_sect)
|
||||
{
|
||||
fdbg("ERROR: Failed to allocate working buffers\n");
|
||||
|
@ -319,7 +324,11 @@ errout:
|
|||
|
||||
if (var.fv_sect)
|
||||
{
|
||||
#ifdef CONFIG_FAT_DMAMEMORY
|
||||
fat_dma_free(var.fv_sect, var.fv_sectorsize);
|
||||
#else
|
||||
kmm_free(var.fv_sect);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Return any reported errors */
|
||||
|
|
Loading…
Reference in New Issue