Embedded FAT16/32 for CF cards
Project name:
| | Embedded FAT16/32 for CF cards
| | | | Language: | | ANSI C, with use of a few extensions for interrupt handling etc. This could be easily changed for other platforms | | | | Target platform: | | Currently running on a Ti C6000, but suited to most other embedded platforms | | | | Abstract: | | This code takes data and stores it as files in the standard FAT16 or FAT32 file format. Functions are also included for formatting the drive. | | | | Key features and advantages: | | The software is a complete tested solution. The solution has been optimised for high data rates at low processor loading. Caching of sectors is built in to improve speed and special writing techniques are used to improve card performance. For a modern CF card, raw read rates of 10MBytes/s and raw write rates of 8MBytes/s are typical. | | | |
Full Description The library was originally developed for a very high speed data logging system running on a c6000 DSP from Ti. The library was designed to read and write data to/from a compact flash interface. The compact flash card is connected directly to the c6000 memory bus with only a few simple external logic gates required. There are several methods of reading and writing to compact flash cards, including UDMA and memory mapped. To keep the electronic interface as simple as possible our library uses a standard memory mapped mode of interface. The system reads information from the card (the PIO mode) and using this information sets up the maximum speed of access possible. All standard ANSI C disk operations are supported, making interfacing with existing code very simple indeed.
Overview of FAT16/32 library
Simultaneous Disk Access FAT16/32 library can access files on unlimited number of disk volumes at the same time.
Unlimited Number of Files FAT16/32 library can handle as many open files as required by the application.
Supports FAT16, and FAT32 FAT16/32 library supports the same FAT (File Allocation Table) formats as MS-DOS, Windows, and many other systems.
Supports Compact Flash FAT16/32 library supports LBA (Logical Block Addressing) to read from disk drives and tested with many different Compact Flash cards.
Support for Fast Writes FAT16/32 library can write large chunks of data at once making it to achieving the maximum possible data throughput for real-time writes.
Efficient Cache Support FAT16/32 library will cache frequently accessed data such as a volume's FAT or directories. The application has full control over the size of the cache and how delayed write operations should be handled.
Optimised FAT operations FAT16/32 library has its own native API consisting of about 20 functions highly optimised for maximum performance and control.
Compatible API FAT16/32 library emulates about 32 file I/O related functions. These are written with the prefix of “fs_” to remove ambiguity with ANSI C Standard I/O functions.
Disk Format FAT16/32 library supports FAT32 Disk Format according to the standards. Performance Parameters RAM requirements: xxkB minimum, typicall xxkB Typical code space requirements: xxkB Typical read speed: 10MB/s at xx% processor load (DM648 @900MHz) Typical write speed: 8MB/s at xx% processor load (DM648 @900MHz)
FAT16/32 library Application Programming Interface
fs_InitFATFS - FS initializing function (should call before file operations) fs_DoneFATFS - Close fs_FAT safely fs_chdir - change directory fs_getcwd - get current directory fs_fopen - file open fs_fclose - file close fs_fcloseall - close all files fs_fseek - seek to a specific place in the file given a starting position by 'whence' fs_rewind - go to the beginning of a file fs_ftell - get the current position of the file fs_feof - check whether end of file fs_fsize - get file size fs_fgetpos - get current position fs_fsetpos - set current position fs_fread - read file fs_fwrite - write file fs_fwrite_fast - Write the maximum possible sectors at once Limitations: * Recommended to start with a new file (Partially written files may provide problems) * Files with partially written clusters at end are not supported * All writes restricted to begin at end of file
fs_fgetc - get character fs_fputc - put character fs_fgets - get string fs_fputs - put string fs_fflush - flush file buffers fs_flushall - flush all file buffers fs_remove - delete file fs_mkdir - make directory fs_rmdir - remove directory fs_fstat - get statistics of a given file fs_chmod - change file mode fs_utime - change time of a given file fs_filecount - return file count for given extension fs_filename - return filename for given index fs_init_file - Initialise file structure (need to call for every file structure before use)
This page was printed from: http://www.hynav.com/index.php?pcat=2&cat=7490&lang=1
© Race Technology Ltd '24
|