Go to the source code of this file.
Data Structures | |
struct | KDATE |
The KOS Date structure. More... | |
struct | KTIME |
The KOS Time structure. More... | |
struct | KDATETIME |
struct | FILE_INFO |
The KOS File info structure. More... | |
Defines | |
#define | size_t unsigned int |
#define | SIZE_T size_t |
#define | NULL 0 |
#define | TIME_T unsigned int |
#define | FALSE 0 |
#define | TRUE (! FALSE) |
#define | KOS_MEM_FREE 0x0000 |
#define | KOS_MEM_GLOBAL 0x1000 |
#define | KOS_MEM_LOCAL 0x2000 |
#define | KOS_MEM_HEAP0 0x0100 |
#define | KOS_MODULE_FILESYSTEM 1 |
#define | KOS_FUNC_FOPEN 0 |
#define | KOS_FUNC_FREAD 1 |
#define | KOS_FUNC_FWRITE 2 |
#define | KOS_FUNC_FCLOSE 3 |
#define | KOS_FUNC_FSEEK 4 |
#define | KOS_FUNC_FDELETE 5 |
#define | KOS_FUNC_FRENAME 6 |
#define | KOS_FUNC_CHDIR 7 |
#define | KOS_FUNC_GETFILEINFO 8 |
#define | KOS_FUNC_GETFIRSTDIR 9 |
#define | KOS_FUNC_GETNEXTDIR 10 |
#define | KOS_FUNC_GETPREVDIR 11 |
#define | KOS_FUNC_GETFIRSTFILE 12 |
#define | KOS_FUNC_GETNEXTFILE 13 |
#define | KOS_FUNC_GETPREVFILE 14 |
#define | KOS_FUNC_FATTR 15 |
#define | KOS_FUNC_GETSIZE 16 |
#define | KOS_FUNC_CHECKINSERT 17 |
#define | KOS_FUNC_CHECKPROTECT 18 |
#define | KOS_READMODE 1 |
#define | KOS_WRITEMODE 2 |
#define | FAT32_SUPPORT 1 |
#define | NEW_FILE_NAME |
#define | KOS_READONLY_ATTRIBUTE (1) |
Read-only bit for read-only attribute field. | |
#define | KOS_HIDDEN_ATTRIBUTE (1<<1) |
Read-only bit for hidden file attribute field. | |
#define | KOS_SYSTEM_ATTRIBUTE (1<<2) |
Read-only bit for system file attribute field. | |
#define | KOS_ARCHIVE_ATTRIBUTE (1<<5) |
Read-only bit for archive attribute field. | |
#define | FILE_READONLY 0x00000001 |
#define | FILE_READWRITE 0x00000002 |
#define | FILE_APPEND 0x00000003 |
#define | FS_SEEK_SET 0 |
#define | FS_SEEK_CUR 1 |
#define | FS_SEEK_END 2 |
#define | ERR_FS_INVALID_NAME -1 |
#define | ERR_FS_FILE_OPENED -2 |
#define | ERR_FS_INVALID_HANDLE -3 |
#define | ERR_FS_INVALID_INDEX -4 |
#define | ERR_FS_INVALID_MODE -5 |
#define | ERR_FS_DISK_FULL -6 |
#define | ERR_FS_DISK_ERROR -7 |
#define | ERR_FS_DISK_CHANGE -8 |
#define | ERR_FS_NO_SDCARD -9 |
#define | ERR_FS_NO_MEMORY -10 |
#define | ERR_FS_NOT_SUPPORT -11 |
#define | ERR_FS_PROTECT -13 |
#define | ERR_FS_NOTFIND -14 |
#define | ERR_FS_DISK_REMOVE -15 |
#define | ERR_FS_FILE_NOTEXIST -16 |
#define | ERR_FS_UNKNOWN -100 |
#define | SUCCESS 0 |
#define | EOF -1 |
#define | KOS_ERR_INVALIDPTR -200 |
#define | fdelete(a) kos_fdelete(a); |
Typedefs | |
typedef unsigned int | U32 |
typedef int | S32 |
typedef unsigned short | U16 |
typedef short | S16 |
typedef unsigned char | U8 |
typedef unsigned char * | P_U8 |
typedef char | S8 |
typedef char | BYTE |
typedef char * | P_BYTE |
typedef int | BOOL |
typedef void * | P_VOID |
typedef U32(*) | FUNC_PTR () |
typedef U32(*) | FUNC0PTR () |
typedef U32(*) | FUNC1PTR (U32) |
typedef U32(*) | FUNC2PTR (U32, U32) |
typedef U32(*) | FUNC3PTR (U32, U32, U32) |
typedef struct KDATETIME * | P_KDATETIME |
typedef struct FILE_INFO | DIR_INFO |
typedef struct FILE_INFO * | P_FILE_INFO |
typedef struct FILE_INFO * | P_DIR_INFO |
typedef S32 | H_FILE |
Functions | |
FUNC_PTR | kos_GetFuncEntry (U32 module, U32 index) |
H_FILE | kos_fopen (P_BYTE fname, U8 mode) |
SIZE_T | kos_fread (H_FILE fd, P_BYTE buf, U32 length) |
SIZE_T | kos_fwrite (H_FILE fd, P_BYTE buf, U32 length) |
S32 | kos_fseek (H_FILE fd, S32 offset, U32 mode) |
S32 | kos_fclose (H_FILE fd) |
S32 | kos_fdelete (P_BYTE fname) |
S32 | kos_frename (P_BYTE oldname, P_BYTE newname) |
FIXME: this function does not seem to work as it should (return -200 err every time). | |
S32 | kos_chdir (P_BYTE pDir) |
Change system current directory. | |
S32 | kos_GetSpecialFileInfo (P_BYTE fname, P_FILE_INFO pInfo) |
FIXME: Still confused by this. | |
S32 | kos_GetFirstDirInfo (P_DIR_INFO pInfo) |
Fill a FILE_INFO structure of the first sub-directory of the current directory. | |
S32 | kos_GetNextDirInfo (P_DIR_INFO pInfo, U32 index) |
Fill a DIR_INFO structure of the next 'indexed' sub-directory of the current directory. | |
S32 | kos_GetPrevDirInfo (P_DIR_INFO pInfo, U32 index) |
Fill a DIR_INFO structure of the previous 'indexed' sub-directory of the current directory. | |
S32 | kos_GetFirstFileInfo (P_FILE_INFO pInfo) |
Fill a FILE_INFO structure of the first file of the current directory. | |
S32 | kos_GetNextFileInfo (P_FILE_INFO pInfo, U32 index) |
Fill a FILE_INFO structure of the next 'indexed' file of the current directory. | |
S32 | kos_GetPrevFileInfo (P_FILE_INFO pInfo, U32 index) |
Fill a FILE_INFO structure of the previous 'indexed' file of the current directory. | |
S32 | kos_fattr (P_BYTE fname, U8 attr) |
Set file attributes. | |
S32 | kos_GetDiskFreeSize (void) |
Get disk free size in bytes. | |
S32 | kos_CheckDiskInsert (void) |
Check if a valid SD is inserted. | |
S32 | kos_CheckDiskProtect (void) |
Check if a the SD is write-protected. | |
void | kos_ResetSD (void) |
Reset calculator OS file system. | |
void * | kos_malloc (SIZE_T size) |
S32 | kos_free (void *pMemory) |
void | kos_ClearLcd (void) |
U32 | kos_PutString (U32 dx, U32 dy, P_VOID ptr) |
void | kos_PutHexNumber (U32 dx, U32 dy, U32 value) |
void | kos_PutDecNumber (U32 dx, U32 dy, U32 value, U32 bit) |
U32 | kos_LCDGetContrast (void) |
void | kos_LCDSetContrast (U32 contrast) |
P_BYTE | kos_getSerialNumber (void) |
void | kos_Reset (void) |
S32 | kos_beep (U32 freq, TIME_T time, U32 override) |
U32 | kos_GetSysTickTime () |
#define KOS_ARCHIVE_ATTRIBUTE (1<<5) |
#define KOS_HIDDEN_ATTRIBUTE (1<<1) |
#define KOS_READONLY_ATTRIBUTE (1) |
#define KOS_SYSTEM_ATTRIBUTE (1<<2) |
typedef struct FILE_INFO * P_DIR_INFO |
typedef struct FILE_INFO * P_FILE_INFO |
typedef struct KDATETIME * P_KDATETIME |
S32 kos_CheckDiskInsert | ( | void | ) |
Check if a valid SD is inserted.
S32 kos_CheckDiskProtect | ( | void | ) |
Check if a the SD is write-protected.
void kos_ClearLcd | ( | void | ) |
Set file attributes.
S32 kos_free | ( | void * | pMemory | ) |
FIXME: this function does not seem to work as it should (return -200 err every time).
S32 kos_GetDiskFreeSize | ( | void | ) |
Get disk free size in bytes.
S32 kos_GetFirstDirInfo | ( | P_DIR_INFO | pInfo | ) |
Fill a FILE_INFO structure of the first sub-directory of the current directory.
Example: see kos_getFirstFileInfo example (change File by Dir).
S32 kos_GetFirstFileInfo | ( | P_FILE_INFO | pInfo | ) |
Fill a FILE_INFO structure of the first file of the current directory.
void print_file_info(P_FILE_INFO pInfo) { printf("%s : %d bytes\n", pInfo->file_name, pInfo->size); printf("Attr: %b %b\n", pInfo->attribute, pInfo->ext_attr); printf("Las.Acc: %d %d %d\n", pInfo->last_access_date.day, pInfo->last_access_date.month, pInfo->last_access_date.year); printf("T: %d %d %d\n", pInfo->create_date.date.day, pInfo->create_date.date.month, pInfo->create_date.date.year); printf("T: %d %d %d\n", pInfo->create_date.time.hours, pInfo->create_date.time.minutes, pInfo->create_date.time.seconds); printf("T: %d %d %d\n", pInfo->last_modifier.time.hours, pInfo->last_modifier.time.minutes, pInfo->last_modifier.time.seconds); } int main() { FILE_INFO Info; if (kos_GetFirstFileInfo(&Info) == SUCCESS) { print_file_info(&Info); keyb_waitKeyPressed(); unsigned int j; for (j = 0; kos_GetNextFileInfo(&Info, j++) == SUCCESS; ) { print_file_info(&Info); keyb_waitKeyPressed(); } } else { printf("No files\n"); keyb_waitKeyPressed(); } }
S32 kos_GetNextDirInfo | ( | P_DIR_INFO | pInfo, | |
U32 | index | |||
) |
Fill a DIR_INFO structure of the next 'indexed' sub-directory of the current directory.
You *must* call kos_getFirstDirInfo(P_DIR_INFO pInfo) first to ensure that the system current file ID is pointing to the first file of the current directory
pInfo | [out] pointer to structure | |
index | [in] index of current sub-directory |
S32 kos_GetNextFileInfo | ( | P_FILE_INFO | pInfo, | |
U32 | index | |||
) |
Fill a FILE_INFO structure of the next 'indexed' file of the current directory.
You *must* call kos_getFirstFileInfo(P_FILE_INFO pInfo) first to ensure that the system current file ID is pointing to the first file of the current directory
pInfo | [out] pointer to structure | |
index | [in] index of current file in the directory |
S32 kos_GetPrevDirInfo | ( | P_DIR_INFO | pInfo, | |
U32 | index | |||
) |
Fill a DIR_INFO structure of the previous 'indexed' sub-directory of the current directory.
You *must* call kos_getFirstDirInfo(P_DIR_INFO pInfo) first to ensure that the system current file ID is pointing to the first file of the current directory
pInfo | [out] pointer to structure | |
index | [in] index of current sub-directory |
S32 kos_GetPrevFileInfo | ( | P_FILE_INFO | pInfo, | |
U32 | index | |||
) |
Fill a FILE_INFO structure of the previous 'indexed' file of the current directory.
You *must* call kos_getFirstFileInfo(P_FILE_INFO pInfo) first to ensure that the system current file ID is pointing to the first file of the current directory
pInfo | [out] pointer to structure | |
index | [in] index of current file in the directory |
P_BYTE kos_getSerialNumber | ( | void | ) |
S32 kos_GetSpecialFileInfo | ( | P_BYTE | fname, | |
P_FILE_INFO | pInfo | |||
) |
FIXME: Still confused by this.
U32 kos_GetSysTickTime | ( | ) |
U32 kos_LCDGetContrast | ( | void | ) |
void kos_LCDSetContrast | ( | U32 | contrast | ) |
void* kos_malloc | ( | SIZE_T | size | ) |
void kos_Reset | ( | void | ) |
void kos_ResetSD | ( | void | ) |
Reset calculator OS file system.
Call to reinitiate SD card system after using the FSystem library.