FreeCalypso > hg > fc-magnetite
comparison src/condat2/com/include/ffs_pc_api.h @ 3:93999a60b835
src/aci2, src/condat2: import of g23m/condat source pieces from TCS211
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Mon, 26 Sep 2016 00:29:36 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 2:c41a534f33c6 | 3:93999a60b835 |
|---|---|
| 1 /********************************************************************************/ | |
| 2 /* */ | |
| 3 /* File Name: ffs_pc_api.h */ | |
| 4 /* */ | |
| 5 /* Purpose: This header file contains the external constants and */ | |
| 6 /* prototypes related to the Flash File System. */ | |
| 7 /* */ | |
| 8 /* Note: None. */ | |
| 9 /* */ | |
| 10 /* Revision History: */ | |
| 11 /* 02/27/02 Pascal Pompei */ | |
| 12 /* - Create. */ | |
| 13 /* */ | |
| 14 /* (C) Copyright 2002 by Texas Instruments Incorporated, All Rights Reserved. */ | |
| 15 /* */ | |
| 16 /********************************************************************************/ | |
| 17 #ifndef _FFS_PC_API_ | |
| 18 #define _FFS_PC_API_ | |
| 19 | |
| 20 #include <windows.h> | |
| 21 | |
| 22 #ifdef __cplusplus | |
| 23 extern "C" | |
| 24 { | |
| 25 #endif | |
| 26 | |
| 27 | |
| 28 /******************************** FILE DESCRIPTOR *******************************/ | |
| 29 /* */ | |
| 30 /* Define the file descriptor. */ | |
| 31 typedef INT32 T_FFS_FD; | |
| 32 | |
| 33 | |
| 34 /*********************************** FILE SIZE **********************************/ | |
| 35 /* */ | |
| 36 /* Define the file size. */ | |
| 37 typedef INT32 T_FFS_SIZE; | |
| 38 | |
| 39 | |
| 40 /************************************ OFFSET ************************************/ | |
| 41 /* */ | |
| 42 /* Define the offset. */ | |
| 43 typedef UINT32 T_FFS_OFFSET; | |
| 44 | |
| 45 /************************************* FLAGS ************************************/ | |
| 46 /* */ | |
| 47 /* Define the modes used to open the file. */ | |
| 48 typedef UINT32 T_FFS_OPEN_FLAGS; | |
| 49 | |
| 50 #define FFS_O_CREATE (0x00000001) | |
| 51 #define FFS_O_APPEND (0x00000002) | |
| 52 #define FFS_O_EXCL (0x00000004) | |
| 53 #define FFS_O_TRUNC (0x00000008) | |
| 54 #define FFS_O_RDONLY (0x00000010) | |
| 55 #define FFS_O_WRONLY (0x00000020) | |
| 56 #define FFS_O_RDWR (FFS_O_RDONLY | FFS_O_WRONLY) | |
| 57 | |
| 58 /* Define the starting point for the file pointer move. */ | |
| 59 typedef UINT32 T_FFS_WHENCE; | |
| 60 | |
| 61 #define FFS_SEEK_SET (FILE_BEGIN) | |
| 62 #define FFS_SEEK_CUR (FILE_CURRENT) | |
| 63 #define FFS_SEEK_END (FILE_END) | |
| 64 | |
| 65 | |
| 66 /*********************************** META-DATA **********************************/ | |
| 67 /* */ | |
| 68 /* Define object types. */ | |
| 69 typedef enum | |
| 70 { | |
| 71 OT_FILE = 0x00000001, | |
| 72 OT_DIR, | |
| 73 OT_LINK | |
| 74 } T_FFS_OBJECT_TYPE; | |
| 75 | |
| 76 /* Define a structure used to gather information (meta-data) about an object. */ | |
| 77 typedef struct | |
| 78 { | |
| 79 T_FFS_OBJECT_TYPE type; /* Object type: file, folder, ... */ | |
| 80 T_FFS_SIZE size; /* Size of data space occupied by object. */ | |
| 81 } T_FFS_STAT; | |
| 82 | |
| 83 | |
| 84 /*********************************** DIRECTORY **********************************/ | |
| 85 /* */ | |
| 86 /* Define a structure used to gather information about a directory. */ | |
| 87 typedef struct | |
| 88 { | |
| 89 WIN32_FIND_DATA find_data; | |
| 90 HANDLE search_handle; | |
| 91 } T_FFS_DIR; | |
| 92 | |
| 93 | |
| 94 /***************************** INTERNAL ERROR CODES *****************************/ | |
| 95 /* */ | |
| 96 /* Define the internal error codes. */ | |
| 97 typedef enum | |
| 98 { | |
| 99 EFFS_OK = 0, /* OK. */ | |
| 100 | |
| 101 EFFS_NODEVICE = -1, /* Flash device unknown. */ | |
| 102 EFFS_CORRUPTED = -2, /* File system corrupted. */ | |
| 103 EFFS_NOPREFORMAT = -3, /* Flash File System not preformatted. */ | |
| 104 EFFS_NOFORMAT = -4, /* Flash File System not formatted. */ | |
| 105 EFFS_BADFORMAT = -5, /* Format not recognized. */ | |
| 106 EFFS_MAGIC = -6, /* Bad magic. */ | |
| 107 EFFS_AGAIN = -7, /* Not ready, try again later on. */ | |
| 108 EFFS_NOSYS = -8, /* Function not implemented. */ | |
| 109 EFFS_DRIVER = -9, /* Driver error. */ | |
| 110 | |
| 111 EFFS_NOSPACE = -10, /* Out of file space (no free data space). */ | |
| 112 EFFS_FSFULL = -11, /* File system full (no free inodes). */ | |
| 113 EFFS_BADNAME = -12, /* Bad filename. */ | |
| 114 EFFS_NOTFOUND = -13, /* Not found. */ | |
| 115 EFFS_EXISTS = -14, /* Object already exists. */ | |
| 116 EFFS_ACCESS = -15, /* File access permission violation. */ | |
| 117 EFFS_NAMETOOLONG = -16, /* Filename too long. */ | |
| 118 EFFS_INVALID = -17, /* Invalid argument. */ | |
| 119 EFFS_DIRNOTEMPTY = -18, /* Directory not empty. */ | |
| 120 EFFS_NOTADIR = -19, /* Object is not a directory. */ | |
| 121 EFFS_SPARE = -20, /* Spare. */ | |
| 122 | |
| 123 EFFS_FILETOOBIG = -21, /* File too big. */ | |
| 124 EFFS_NOTAFILE = -22, /* Object is not a file. */ | |
| 125 EFFS_PATHTOODEEP = -23, /* Path too deep. */ | |
| 126 EFFS_NUMFD = -24, /* Maximum number of open files reached. */ | |
| 127 EFFS_BADFD = -25, /* Bad file descriptor. */ | |
| 128 EFFS_BADOP = -26, /* Bad options. */ | |
| 129 EFFS_LOCKED = -27, /* File locked by another file descriptor. */ | |
| 130 | |
| 131 EFFS_TOOBIG = -30, /* Too big (buffer overflow). */ | |
| 132 EFFS_MSGALLOC = -31, /* Message allocation failed. */ | |
| 133 EFFS_MSGSEND = -32, /* Message send failed. */ | |
| 134 | |
| 135 EFFS_SIBLINGLOOP = -40, /* Directory sibling loop. */ | |
| 136 EFFS_NOBLOCKS = -41, /* No more blocks. */ | |
| 137 EFFS_DBR = -42, /* Data reclaim did not finish. */ | |
| 138 } T_FFS_RET; | |
| 139 | |
| 140 | |
| 141 /* | |
| 142 * Prototypes for functions provided by the FFS simulation on the PC | |
| 143 */ | |
| 144 T_FFS_FD ffs_open (const char *pathname_p, | |
| 145 T_FFS_OPEN_FLAGS flags); | |
| 146 T_FFS_RET ffs_close (T_FFS_FD fd); | |
| 147 T_FFS_SIZE ffs_write (T_FFS_FD fd, | |
| 148 void *buffer_p, | |
| 149 T_FFS_SIZE size); | |
| 150 T_FFS_SIZE ffs_read (T_FFS_FD fd, | |
| 151 void *buffer_p, | |
| 152 T_FFS_SIZE size); | |
| 153 T_FFS_SIZE ffs_seek (T_FFS_FD fd, | |
| 154 T_FFS_SIZE offset, | |
| 155 T_FFS_WHENCE whence); | |
| 156 T_FFS_RET ffs_ftruncate (T_FFS_FD fd, | |
| 157 T_FFS_OFFSET length); | |
| 158 T_FFS_RET ffs_stat (const char *pathname_p, | |
| 159 T_FFS_STAT *stat_p); | |
| 160 T_FFS_RET ffs_remove (const char *pathname_p); | |
| 161 T_FFS_RET ffs_mkdir (const char *pathname_p); | |
| 162 T_FFS_SIZE ffs_opendir (const char *pathname_p, | |
| 163 T_FFS_DIR *dir_p); | |
| 164 T_FFS_SIZE ffs_readdir (T_FFS_DIR *dir_p, | |
| 165 char *buffer_p, | |
| 166 T_FFS_SIZE size); | |
| 167 T_FFS_RET ffs_rename (const char *old_pathname_p, | |
| 168 const char *new_pathname_p); | |
| 169 | |
| 170 T_FFS_SIZE ffs_file_read(const char *name, void *addr, T_FFS_SIZE size); | |
| 171 | |
| 172 T_FFS_SIZE ffs_init (void); | |
| 173 | |
| 174 #ifdef __cplusplus | |
| 175 } | |
| 176 #endif | |
| 177 | |
| 178 #endif /* #ifndef _FFS_PC_API_ */ |
