Data Structures | |
| struct | wicedfs_dir_struct |
| struct | wicedfs_file_struct |
| struct | wicedfs_filesystem_struct |
Typedefs | |
| typedef wicedfs_usize_t(* | wicedfs_read_func_t) (void *user_param, void *buf, wicedfs_usize_t size, wicedfs_usize_t pos) |
Functions | |
| int | wicedfs_closedir (wicedfs_dir_t *dirp) |
| int | wicedfs_eodir (wicedfs_dir_t *dirp) |
| int | wicedfs_fclose (wicedfs_file_t *stream) |
| int | wicedfs_feof (wicedfs_file_t *stream) |
| wicedfs_ssize_t | wicedfs_filesize (const wicedfs_filesystem_t *fs_handle, const char *filename) |
| int | wicedfs_fopen (const wicedfs_filesystem_t *fs_handle, wicedfs_file_t *handle, const char *filename) |
| wicedfs_usize_t | wicedfs_fread (void *data, wicedfs_usize_t size, wicedfs_usize_t count, wicedfs_file_t *stream) |
| int | wicedfs_fseek (wicedfs_file_t *stream, wicedfs_ssize_t offset, int whence) |
| wicedfs_usize_t | wicedfs_ftell (wicedfs_file_t *stream) |
| int | wicedfs_init (wicedfs_usize_t base, wicedfs_read_func_t read_func, wicedfs_filesystem_t *fs_handle, void *user_param) |
| int | wicedfs_opendir (const wicedfs_filesystem_t *fs_handle, wicedfs_dir_t *handle, const char *dirname) |
| int | wicedfs_readdir_with_size (wicedfs_dir_t *dirp, char *name_buf, unsigned int name_buf_len, wicedfs_entry_type_t *type, wicedfs_usize_t *size) |
| void | wicedfs_rewinddir (wicedfs_dir_t *dirp) |
Public API of the WicedFS Read-Only file system.
| typedef wicedfs_usize_t(* wicedfs_read_func_t) (void *user_param, void *buf, wicedfs_usize_t size, wicedfs_usize_t pos) |
Typedef of Read Function which will be used to read data from the hardware device.
| [in] | user_param | - The user_param value passed when wicedfs_init was called (use for hardware device handles) |
| [out] | buf | - The buffer to be filled with data |
| [in] | size | - The number of bytes to read |
| [in] | pos | - Absolute hardware device location to read from |
| int wicedfs_closedir | ( | wicedfs_dir_t * | dirp | ) |
Closes a directory handle
| [in] | dirp | - the directory handle to close |
| int wicedfs_eodir | ( | wicedfs_dir_t * | dirp | ) |
Check the end-of-directory flag for a directory
Checks whether the selected directory handle is at the end of the available directory entries.
| [in] | stream | - the file handle to check for EOF |
| int wicedfs_fclose | ( | wicedfs_file_t * | stream | ) |
Close a file
This is similar to the fclose() in ISO C.
| [in] | stream | - the file handle to close |
| int wicedfs_feof | ( | wicedfs_file_t * | stream | ) |
Check the end-of-file flag for a stream
This is similar to the feof() in ISO C.
| [in] | stream | - the file handle to check for EOF |
| wicedfs_ssize_t wicedfs_filesize | ( | const wicedfs_filesystem_t * | fs_handle, |
| const char * | filename ) |
Returns the size of a file
| [in] | filename | - The filename of the file to examine |
| [in] | fs_handle | - The filesystem handle to use - obtained from wicedfs_init |
| int wicedfs_fopen | ( | const wicedfs_filesystem_t * | fs_handle, |
| wicedfs_file_t * | handle, | ||
| const char * | filename ) |
Open a file for reading
Since the filesystem is read-only, a "file mode" is not needed.
| [in] | fs_handle | - The filesystem handle to use - obtained from wicedfs_init |
| [out] | handle | - a pointer to a wicedfs_file_t structure which will receive the file handle after it is opened |
| [in] | filename | - The filename of the file to open |
| wicedfs_usize_t wicedfs_fread | ( | void * | data, |
| wicedfs_usize_t | size, | ||
| wicedfs_usize_t | count, | ||
| wicedfs_file_t * | stream ) |
Reads data from a file into a memory buffer
This is similar to the fread() in ISO C.
| [out] | data | - A pointer to the memory buffer that will receive the data that is read |
| [in] | size | - the number of bytes per item |
| [in] | count | - the number of items to read i.e. total bytes read = size * count |
| [in] | stream | - the file handle to read from |
| int wicedfs_fseek | ( | wicedfs_file_t * | stream, |
| wicedfs_ssize_t | offset, | ||
| int | whence ) |
Seek to a location within a file
This is similar to the fseek() in ISO C.
| [in] | stream | - The file handle on which to perform the seek. Must have been previously opened with wicedfs_fopen. |
| [in] | offset | - The offset in bytes |
| [in] | whence | - SEEK_SET = Offset from start of file SEEK_CUR = Offset from current position in file SEEK_END = Offset from end of file |
| wicedfs_usize_t wicedfs_ftell | ( | wicedfs_file_t * | stream | ) |
Returns the current location within a file
This is similar to the ftell() in ISO C.
| [in] | stream | - The file handle to be examined |
| int wicedfs_init | ( | wicedfs_usize_t | base, |
| wicedfs_read_func_t | read_func, | ||
| wicedfs_filesystem_t * | fs_handle, | ||
| void * | user_param ) |
Initialise the file system
Initialises the filesystem for use. This function reads data from a hardware device via a function pointer. It assumes that the device is ready to read immediately.
| [in] | base | - The location on the hardware device where the filesystem start header resides. |
| [in] | read_func | - Function pointer to be used for reading hardware |
| [out] | fs_handle | - Receives the filesystem handle to be used when opening files/directories. |
| [in] | user_param | - A user parameter which will be passed to the WICEDFS_READ macro. e.g. for hardware device handles |
| int wicedfs_opendir | ( | const wicedfs_filesystem_t * | fs_handle, |
| wicedfs_dir_t * | handle, | ||
| const char * | dirname ) |
Opens a directory
This is similar to the opendir() in ISO C.
| [in] | fs_handle | - The filesystem handle to use - obtained from wicedfs_init |
| [out] | handle | - a pointer to a directory structure which will be filled with the opened handle |
| [in] | dirname | - the path of the directory to open |
| int wicedfs_readdir_with_size | ( | wicedfs_dir_t * | dirp, |
| char * | name_buf, | ||
| unsigned int | name_buf_len, | ||
| wicedfs_entry_type_t * | type, | ||
| wicedfs_usize_t * | size ) |
Reads a directory entry
This is similar to the readdir() in ISO C.
| [in] | dirp | - the directory handle to read from |
| [out] | name_buf | - pointer to a buffer that will receive the filename |
| [in] | name_buf_len | - the maximum number of bytes that can be put in the buffer |
| [out] | type | - pointer to variable that will receive entry type (file or dir) |
| [out] | size | - pointer to variable that will receive the file size (dir size is zero) |
| void wicedfs_rewinddir | ( | wicedfs_dir_t * | dirp | ) |
Returns a directory handle to the first entry
This is similar to the rewinddir() in ISO C.
| [in] | dirp | - the directory handle to rewind |