mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 22:53:33 +08:00
Add beginning of a simple granule allocator to support DMA IO buffer allocation
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@5129 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
@@ -405,7 +405,7 @@ static int fat_close(FAR struct file *filep)
|
||||
|
||||
if (ff->ff_buffer)
|
||||
{
|
||||
fat_io_free(ff->ff_buffer);
|
||||
fat_io_free(ff->ff_buffer, fs->fs_hwsectorsize);
|
||||
}
|
||||
|
||||
/* Then free the file structure itself. */
|
||||
@@ -1651,7 +1651,7 @@ static int fat_unbind(void *handle, FAR struct inode **blkdriver)
|
||||
|
||||
if (fs->fs_buffer)
|
||||
{
|
||||
fat_io_free(fs->fs_buffer);
|
||||
fat_io_free(fs->fs_buffer, fs->fs_hwsectorsize);
|
||||
}
|
||||
|
||||
kfree(fs);
|
||||
|
||||
@@ -697,11 +697,11 @@
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_FAT_DMAMEMORY
|
||||
# define fat_io_alloc(s) fat_dma_alloc(s)
|
||||
# define fat_io_free(s) fat_dma_free(s)
|
||||
# define fat_io_alloc(s) fat_dma_alloc(s)
|
||||
# define fat_io_free(m,s) fat_dma_free(m,s)
|
||||
#else
|
||||
# define fat_io_alloc(s) kmalloc(s)
|
||||
# define fat_io_free(s) kfree(s)
|
||||
# define fat_io_alloc(s) kmalloc(s)
|
||||
# define fat_io_free(m,s) kfree(m)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
@@ -668,7 +668,7 @@ int fat_mount(struct fat_mountpt_s *fs, bool writeable)
|
||||
return OK;
|
||||
|
||||
errout_with_buffer:
|
||||
fat_io_free(fs->fs_buffer);
|
||||
fat_io_free(fs->fs_buffer, fs->fs_hwsectorsize);
|
||||
fs->fs_buffer = 0;
|
||||
errout:
|
||||
fs->fs_mounted = false;
|
||||
|
||||
Reference in New Issue
Block a user