enable readahead cache for faster file access

This commit is contained in:
dborth 2008-10-03 06:57:56 +00:00
parent 1c92d45bc1
commit a2136a2ac4
2 changed files with 6 additions and 5 deletions

View File

@ -63,6 +63,7 @@ bool ChangeFATInterface(int method, bool silent)
{ {
devFound = true; devFound = true;
fatSetDefaultInterface(PI_INTERNAL_SD); fatSetDefaultInterface(PI_INTERNAL_SD);
fatEnableReadAhead (PI_INTERNAL_SD, 6, 64);
} }
#endif #endif
@ -89,6 +90,7 @@ bool ChangeFATInterface(int method, bool silent)
{ {
devFound = true; devFound = true;
fatSetDefaultInterface(PI_USBSTORAGE); fatSetDefaultInterface(PI_USBSTORAGE);
fatEnableReadAhead (PI_USBSTORAGE, 6, 64);
} }
else else
{ {
@ -218,8 +220,7 @@ int
LoadBufferFromFAT (char *filepath, bool silent) LoadBufferFromFAT (char *filepath, bool silent)
{ {
FILE *handle; FILE *handle;
int boffset = 0; int size = 0;
int read = 0;
handle = fopen (filepath, "rb"); handle = fopen (filepath, "rb");
@ -238,12 +239,12 @@ LoadBufferFromFAT (char *filepath, bool silent)
fseek(handle, 0, SEEK_END); // go to end of file fseek(handle, 0, SEEK_END); // go to end of file
size = ftell(handle); // get filesize size = ftell(handle); // get filesize
fseek(handle, 0, SEEK_SET); // go to start of file fseek(handle, 0, SEEK_SET); // go to start of file
fread (sbuffer, 1, size, handle); fread (savebuffer, 1, size, handle);
fclose (handle); fclose (handle);
fclose (handle); fclose (handle);
return boffset; return size;
} }
/**************************************************************************** /****************************************************************************

View File

@ -278,7 +278,7 @@ main ()
while (1); while (1);
// Initialize libFAT for SD and USB // Initialize libFAT for SD and USB
fatInitDefault(); fatInit (8, false);
#ifdef _DEBUG_VIDEO #ifdef _DEBUG_VIDEO
// log stuff // log stuff