Skip to content

Commit

Permalink
Merge pull request #47 from tridge/pullrequest-mkfatfs-dma
Browse files Browse the repository at this point in the history
fat: use DMA memory for mkfatfs when needed
  • Loading branch information
LorenzMeier committed Feb 18, 2015
2 parents 3c80d15 + c0b1903 commit 11afcdf
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion nuttx/fs/fat/fs_mkfatfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -299,7 +302,11 @@ int mkfatfs(FAR const char *pathname, FAR struct fat_format_s *fmt)

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 */
Expand Down

0 comments on commit 11afcdf

Please sign in to comment.