Add f_get_rc_string to get result code strings.

Probably only use for debugging
This commit is contained in:
Stefan `Sec` Zehl 2011-07-13 00:22:18 +02:00
parent 01ae52af76
commit f3f1c01d57
3 changed files with 22 additions and 0 deletions

View File

@ -9,6 +9,7 @@ OBJS += diskio.o
OBJS += iobase.o
OBJS += mmc.o
OBJS += at45db041d.o
OBJS += util.o
LIBNAME=fat

View File

@ -328,6 +328,9 @@ int ff_del_syncobj (_SYNC_t); /* Delete a sync object */
#define ST_DWORD(ptr,val) *(BYTE*)(ptr)=(BYTE)(val); *((BYTE*)(ptr)+1)=(BYTE)((WORD)(val)>>8); *((BYTE*)(ptr)+2)=(BYTE)((DWORD)(val)>>16); *((BYTE*)(ptr)+3)=(BYTE)((DWORD)(val)>>24)
#endif
/* Utility functions */
const char* f_get_rc_string (FRESULT rc);
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,18 @@
#include <ff.h>
const TCHAR *rcstrings =
_T("OK\0DISK_ERR\0INT_ERR\0NOT_READY\0NO_FILE\0NO_PATH\0INVALID_NAME\0")
_T("DENIED\0EXIST\0INVALID_OBJECT\0WRITE_PROTECTED\0INVALID_DRIVE\0")
_T("NOT_ENABLED\0NO_FILE_SYSTEM\0MKFS_ABORTED\0TIMEOUT\0LOCKED\0")
_T("NOT_ENOUGH_CORE\0TOO_MANY_OPEN_FILES\0");
const char* f_get_rc_string (FRESULT rc) {
FRESULT i;
const char *p=rcstrings;
for (i = 0; i != rc && *p; i++) {
while(*p++) ;
}
return p;
}