From 8693ae1bd880a758eb2efec4fccd32f89593855d Mon Sep 17 00:00:00 2001 From: Nebuleon Fumika Date: Sun, 3 Feb 2013 04:19:11 -0500 Subject: Add SDK modifications by BassAceGold as of 2011-04-14, as well as modified DMA functions as of 2013-01-29. --- sdk-modifications/libsrc/fs/fatfile_ex.c | 47 ++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 sdk-modifications/libsrc/fs/fatfile_ex.c (limited to 'sdk-modifications/libsrc/fs/fatfile_ex.c') diff --git a/sdk-modifications/libsrc/fs/fatfile_ex.c b/sdk-modifications/libsrc/fs/fatfile_ex.c new file mode 100644 index 0000000..aa23fb3 --- /dev/null +++ b/sdk-modifications/libsrc/fs/fatfile_ex.c @@ -0,0 +1,47 @@ +#include +#include +#include +#include +#include +#include +#include + +#include "cache.h" +#include "file_allocation_table.h" +#include "bit_ops.h" +#include "filetime.h" +#include "fatfile.h" + +// origin fread/fwrite do not take advantage of continuous read/write function of SD/NAND, +// it looks like the third parameter to _FAT_read_r()/_FAT_write_r() is a fixed '2' +// so they are much slower than these two.... + +// due to behavior of _FAT_read_r()/_FAT_write_r(), +// FAT should have a at least 8192 cluster size to get better performance, +// 16K or larger cluster size can get the best performance. + + + +int freadex( void * buffer, int _size, int _n, FILE * f ) +{ + if( 0 == _n ) + return 0; + dbg_printf("freadx %d\n", _n ); + struct _reent r; + int ret = _FAT_read_r( &r, (int)f->_file + 8, buffer, _size * _n ); + errno = r._errno; + return ret; +} + + +int fwriteex( const void * buffer, int _size, int _n, FILE * f ) +{ + if( 0 == _n ) + return 0; + dbg_printf("fwritex new %d\n", _n ); + struct _reent r; + int ret = _FAT_write_r( &r, (int)f->_file + 8, buffer, _size * _n ); + errno = r._errno; + return ret; +} + -- cgit v1.2.3 From d1a7bf5eb558e7db4a1a27e15ebedb02e6b7f804 Mon Sep 17 00:00:00 2001 From: Nebuleon Fumika Date: Mon, 4 Feb 2013 23:45:44 -0500 Subject: Fully integrate BassAceGold's libraries, finally. The README still states that 1.2 is required to overwrite 0.13's stuff; really, 0.13 is needed only for `gcc`. So the sequence goes 0.13's `gcc` -> 1.2 -> BassAceGold's libraries -> make `libds2a.a`. DMA function names changed to match BassAceGold's. --- sdk-modifications/libsrc/fs/fatfile_ex.c | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 sdk-modifications/libsrc/fs/fatfile_ex.c (limited to 'sdk-modifications/libsrc/fs/fatfile_ex.c') diff --git a/sdk-modifications/libsrc/fs/fatfile_ex.c b/sdk-modifications/libsrc/fs/fatfile_ex.c old mode 100644 new mode 100755 -- cgit v1.2.3