First, a quick update on eMOS: we have modified the eMOS_MsgReceive function to include a timeout value, so that the call may timeout if no message is received within the specified time period. A couple minor functions are also added. See the doc for details.
// EDIT: yes, the goal is to support both FAT16 and FAT32. Long File Name under FAT32 may require end user to pay Microsoft a licensing fee of $0.25 per copy used, or we may support a different LFN implemenation
We are now looking into our first plug-in module for eMOS, which is a file system and SD driver. We will probably also include a standalone version that does not require eMOS. The eMOS version will of course fully support multitasking.
In terms of API, the obvious choice for the FS is in fact the stdio.h C API, in summary:
(more under the …more…)
File IO functions:
- fprintf – formatted output
- fputs – outputs a string
- fwrite – writes a block of data
- fputc -writes a single character
- fscanf – formatted input
- fgets – reads a string
- fread – reads a block of data
- fgets – reads a single character
- ungetc – “unread” the last read character
File functions:
- fopen – opens a file by name and mode
- fclose – closes a file
- freopen – closes an open file and associates the FILE stream with another file
- rename – renames a file by name
- remove – removes a file by name
Auxiliary functions:
- ftell – returns IO position
- fsetpos – sets IO position
- fseek – sets IO position
- rewind – rewinds IO position to beginning of file
- setbuf, setvbuf – allocates a buffer for IO operations
- tmpnam – returns a unique temporary file name
- tmpfile – creates a temporary files
Standard C does not define directory functions, but of course they are needed:
- chdir – changes current directory
- getcwd, getcurdir – returns the current directory
- mkdir – creates a directory
- rmdir – removes a directory
- findfirst – returns the first file that matches a pattern
- findnext – returns the next file that matches the previous pattern
Low level file sys support:
- mount – mounts a file system device
- freespace – returns the amount of free bytes on the device
- devicesize – returns the storage size
The file system will be optimized for flash devices, in particular, SD and Data Flash drivers are initially included. “Wear leveling” will be optimized to maximize the lifetime of the unit.
Bootloader Update
Another design goal is to have a library usable by a bootloader to load an updated application program from a SD card. Due to the bootloader space limitation, not allAPI functions will be supported but this feature would allow you to perform field upgrades of your systems in a relatively pain free way.
*****
As we are still only in the design stage, I welcome your comments and suggestions, either as a reply to this post or to you can email me directly richard @imagecraft.com