//********************************************************************* //-------------------- File System Configuration -------------------- //********************************************************************* //Defines the maximum size of a file used in the file system. //When FSEE_FILE_SIZE_16MB is defined, the file system can handle files with a size of up to 16 Mbytes. //When not defined, the maximum size of a file is 64 Kbyte. //When defined, the FSEE16M File System will be created. //when NOT defined, the FSEE File System will be created. #define FSEE_FILE_SIZE_16MB //Specifies the maximum number of files that can be open at any one time. When defined as 1, the code //will be much faster and smaller. This value should not be much less then the the number of HTTP //Connections, seeing that each HTTP connection can have a open file. If most web page files are //small (below 2 kbytes) then this is not so important. #define FSEE_MAX_FILES 1 //When this define is present, the FSEE File System is used as the primary file system. All functions //Will be remapped to general names, for example fseeOpen() will be mapped to fileOpen. This makes switching //between different File System much simpler. #define FSEE_IS_PRIMARY_FS
Data Structures | |
| struct | _FSEE_FILE_INFO |
Defines | |
| #define | FSEE_FILE BYTE |
| #define | FSEE_FILE_INVALID 0xff |
| #define | FSEE_FILE_POS WORD |
| #define | FSEE_MAX_FILES 1 |
| #define | FSEE_NOT_AVAILABLE 0xfe |
| #define | FSEE_POS SWORD |
| #define | FSEE_WRITE_PAGE_SIZE (64) |
| #define | FSEEFILE_EOF 0x40 |
| #define | FSEEFILE_ERROR 0x20 |
| #define | FSEEFILE_READING 0x02 |
| #define | FSEEFILE_RES 0x80 |
| #define | FSEEFILE_USED 0x01 |
| #define | FSEEFILE_WRITING 0x04 |
| #define | FSEEFLAG_AVAILABLE 0x01 |
| #define | FSEEFLAG_READING_WRITING 0x02 |
| #define | fseeHasError(fhandle) (FCB[0].flags & FSEEFILE_ERROR) |
| #define | fseeIsEOF(fhandle) (FCB[0].flags & FSEEFILE_EOF) |
| #define | fseeIsInUse() ((fseeFlags & FSEEFLAG_AVAILABLE) == 0) |
| #define | fseeIsOK(fhandle) (FCB[0].flags & (FSEEFILE_ERROR | FSEEFILE_EOF)) |
| #define | fseeIsValidHandle(fhandle) (fhandle < FSEE_MAX_FILES) |
Typedefs | |
| typedef _FSEE_FILE_INFO | FSEE_FILE_INFO |
Functions | |
| void | fseeClose (FSEE_FILE fhandle) |
| BOOL | fseeCloseImage (void) |
| void | fseeFlush (FSEE_FILE fhandle) |
| BOOL | fseeFormat (void) |
| BYTE | fseeGetByte (FSEE_FILE fhandle) |
| FSEE_POS | fseeGetFAT (BYTE *name) |
| FSEE_FILE_POS | fseeGetPos (FSEE_FILE fhandle) |
| BOOL | fseeInit (void) |
| FSEE_FILE | fseeOpen (BYTE *name, BYTE mode) |
| FSEE_FILE | fseeOpenFAT (FSEE_POS fatPos) |
| BOOL | fseeOpenImage (void) |
| BOOL | fseePutByte (FSEE_FILE fhandle, BYTE b) |
| BOOL | fseePutByteImage (BYTE b) |
| void | fseeRelease (FSEE_FILE fhandle) |
| void | fseeSetPos (FSEE_FILE fhandle, FSEE_FILE_POS put) |
Variables | |
| FSEE_FILE_INFO | FCB [FSEE_MAX_FILES] |
| BYTE | fseeFlags |
| BYTE | fseeOpenCount |
|
|
FILE handle. Each open files is assigned a file handle.
|
|
|
When FILE Handle has this value, it indicates an invalid file |
|
|
FILE position pointer. A variable that can be used to give the offset anywhere in a file. File length |
|
|
|
|
|
When FILE Handle has this value, it indicates that the File System is not available |
|
|
File System position pointer. A variable that can be used to give the offset anywhere in the File System. File address in the File System |
|
|
|
|
|
FILE flag. When set, indicates that then end of file has been reached. |
|
|
FILE flag. When set, indicates that an error has occured with this file. |
|
|
FILE flag. Indicates that we are currently reading from this file. For I2C devices, this means that the memory chip is in sequencial read mode and has control of the I2C bus! Before the bus can be used by any other node, it has to be released! |
|
|
FILE flag. Reserve (don't use) signed bit, is implemented differently by different compilers |
|
|
FILE flag. When set, indicates that this file is being used. |
|
|
FILE flag. Indicates that we are currently writing to this file. For I2C devices, this means that the memory chip is in sequencial write mode and has control of the I2C bus! Before the bus can be used by any other node, it has to be released! |
|
|
File System flag. When set, indicates that the File System is available. |
|
|
File System flag. When set, indicates that the File System is currently busy with a read or write operation. This File System can only perform a single read or write operation at any time. This flag is set as soon as a open file is read from or written to. It is cleared as soon as the open file is released or closed. |
|
|
Tests if the last operation on the given file generated an error.
|
|
|
Tests if the given file has reached it's EOF. This will happen:
|
|
|
Indicates if the File System is currently in use.
|
|
|
Tests if the last operation on the given file completed without an EOF or Error. If this function returns false, use the fileIsEOF() and fileIsOK() functions to determine exact condition.
|
|
|
Tests if the given FILE handle is a valid handle. A valid FILE handle is a value that could be assigned to an open file. Possible invalid FILE handles are FILE_INVALID and FSYS_NOT_AVAILABLE
|
|
|
FILE structure. Each file that is opened is assigned a FILE structure by the File System. |
|
|
Closes the given file. Seeing that the File System can only have a limited amount of files open at any time (defined by FSEE_MAX_FILES), it is very important to call this function after finished with a file!
|
|
|
Finishes writing the File System Image
|
|
|
Finishes writing any data that has not yet been written to the File System. When writing data to a file via the filePutByte() function, it is not always written straight to the File System Media, but some times to an intermediate buffer. This function will write all pending data from the buffer to the File System Media. |
|
|
Deletes all files present on the File System
|
|
|
Reads the next byte from current open file. Caller must call fileIsEOF() to check for end of file condition before calling this function to make sure the file has not reached it's end. If the fileIsEOF() returns true, then this function will have no affect! Caller must call fileHasError() function after calling this function to ensure byte was read without error! This function will place the EEPROM in sequencial read mode and take control of the I2C bus! To allow other devices to use the I2C bus while the file is open, call fileRelease() when finished reading some data. When calling fileRead() after calling fileRelease(), the EEPROM will automatically be placed in sequencial read mode again and take control of the bus. To read multiple bytes, see ex_file_read.c example file.
|
|
|
Gets the address in the File System of the requested file's FAT entry. This address can be used as a fast way to open files in the future with the fileOpenFAT() function. !!! IMPORTANT !!! The File System FAT entry address obtained with the fileGetFAT() function will only be valid as long as no modifications are made to the File System! If after obtaining a address with the fileGetFAT() function the File System is modified, this value might not be valid any more! |
|
|
Get the current file pointer for the given file. This is the offset in the given file that the next read or write will be performed on. This value can be used as a parameter to the fileSetPos() function at a later stage to restore the current file position. This is NOT the file address in the file system. |
|
|
Initializes the Modtronix File System
|
|
||||||||||||
|
Opens the given file for reading or writing, and returns a handle to the file. The file pointer (where next read or write will occur) will be positioned at the beginning of the file. To modify the file pointer use the fileSetPos() function.
|
|
|
Opens the given file for reading or writing, and returns a handle to the file. The file pointer (where next read or write will occur) will be positioned at the beginning of the file. To modify the file pointer use the fileSetPos() function. !!! IMPORTANT !!! The File System FAT entry address obtained with the fileGetFAT() function will only be valid as long as no modifications are made to the File System! If after obtaining a address with the fileGetFAT() function the File System is modified, this value might not be valid any more!
|
|
|
Prepares the File System to receive a new Image via following calls to fseePutByteImage() !!! IMPORTANT !!! This function will overwrite the entire File System! All data will be lost!
|
|
||||||||||||
|
Writes a byte to the given file. Caller must call fileIsEOF() to check for end of file condition before calling this function to make sure the file has not reached it's end. If the fileIsEOF() returns true, then this function will have no affect! Writes a byte to the current output. Actual write may not get started until internal write page is full. To ensure that previously data gets written, caller must call fileFlush() after last call to filePutByte().
|
|
|
Writes a byte to the File System Image. The File System Image contains the following "FSYS Header", "FAT Entries" and "File Data". !!! IMPORTANT !!! This function will overwrite the entire File System! All data will be lost!
|
|
|
Releases any resources that the given open file might be reserving. On certian File Systems, like ones that use EEPROMs on a shared I2C bus for example, the File System will take control of the bus once a file is opened. To release the bus so it can be used by other modules, the fileRelease() function has to be called. At a later stage, when the file has to be used again, the fileActive() function has to be called. This function should be called when a file has been opened, and we don't want to close it now, but still want to use it at a later stage. In this case, we can call fileRelease() and suspend operation to the system to perform other tasks. When at a later stage we want to use this file again, fileActivate() will automatically be called by the file read and write functions.
|
|
||||||||||||
|
Set the current file pointer for the given file. This is the offset in the given file that the next read or write will be performed on. |
|
|
|
|
|
|
|
|
|
1.4.5