beautypg.com

Application programming interface (api), Api overview, File names – Sundance SMT387-FS User Manual

Page 9

background image

Application Programming Interface (API)

API Overview

User code accesses the SMT387 File System Package through definitions contained in the

header file smt387fs.h, as follows:

#include

The task making use of the SMT387 File System Package must make exactly one call to the

smt387fs_init() function before using any other API functions, passing through details of a

block of on-chip memory for use by the package. The memory passed through is used to

provide buffering and caching of file system metadata such as File Allocation Table (FAT)

contents. The more space is provided for these purposes, the better the performance of the

SMT387 File System Package will be.

Once the SMT387 File System Package has been initialized and space donated to it,

applications will normally open files for read or create files for write, read and write data to

open files, and finally close those files. Each open file is represented within the user code as

an smt387_stream_handle object; this type is defined within smt387fs.h. It is an abstract

type: all manipulation of smt387_stream_handle objects should be performed through the

API.

API functions are also provided to provide file-level operations such as file rename and

delete, as well as file system-level functions such as synchronizing the state of the disk

drives.

When all application operations have been completed, applications must call

smt387fs_deinit() to signify that they no longer require use of the SMT387 File System

Package.

File Names

The SMT387 File System Package uses a DOS-like file naming convention with an optional

“volume” prefix followed by a traditional “8+3” file name.

To distinguish SMT387 volumes from those on the host system, the SMT387 File System

Package uses numeric volume prefixes instead of alphabetic ones. These volume prefixes

range from 0: to 7: and are assigned in the order that the volumes are mounted. For

example, if the first SATA drive contained two mountable volumes, they would be referred to

as volumes 0: and 1:. The first volume on the second SATA drive would then be referred to

as volume 2:.

Page 9