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:
patacongo
2012-09-11 18:22:27 +00:00
parent 64c8e5c7c3
commit 3ca467c029
10 changed files with 796 additions and 8 deletions
+2 -2
View File
@@ -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);
+4 -4
View File
@@ -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
/****************************************************************************
+1 -1
View File
@@ -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;