ZEReader 0.1.0
A Zephyr-based E-Book-Reader
|
Functions | |
char * | sd_build_full_path (const char *folder, const char *filename, int *error) |
Returns a char pointer on the fully built-up SD card path. | |
int | sd_initialize (void) |
Initializes the SD card communication. | |
int | sd_open (char const *const path, struct fs_file_t *f_obj) |
Open a file on a SD card. | |
int | sd_close (struct fs_file_t *f_obj) |
Close a file on a SD card. | |
int | sd_read (struct fs_file_t *f_obj, char *buffer, size_t *size) |
Read from a file on a SD card. | |
int | sd_read_chunk (char const *const path, size_t *offset, char *const buffer, size_t *size) |
Open, read from a file on SD card and close it. | |
int | sd_write_chunk (char const *const path, char const *const data, size_t *size) |
Open, write to a file on SD card and close it. | |
int | sd_list_directories (char const *const path, char *buffer, size_t *size) |
List the directories on the SD card. | |
int | sd_tell_end_offset (char const *const path, size_t *offset) |
Get the current location of the file pointer inside the file. |
char * sd_build_full_path | ( | const char * | folder, |
const char * | filename, | ||
int * | error ) |
Returns a char pointer on the fully built-up SD card path.
[in] | folder | The folder's name |
[in] | filename | The file's name |
[in,out] | error | An int-typed error value |
0 | on success. |
-ENAMETOOLONG | If the path length is longer than CONFIG_FS_FATFS_MAX_LFN (255). |
-ENOMEM | If there is not enough RAM left to allocate memory for the full path. |
int sd_close | ( | struct fs_file_t * | f_obj | ) |
Close a file on a SD card.
[in] | f_obj | A pointer to the file object representing the file. |
0 | on success. |
int sd_initialize | ( | void | ) |
Initializes the SD card communication.
-ENODEV | If the device was not found. |
<0 | If getting the sector count or size failed or the card could not get mounted. |
int sd_list_directories | ( | char const *const | path, |
char * | buffer, | ||
size_t * | size ) |
List the directories on the SD card.
[in] | path | The path on the SD card to be listed. |
[in,out] | buffer | A pointer to the data buffer to be written. |
[in,out] | size | The maximum number of bytes to be written. |
>=0 | the number of bytes written, on success. |
int sd_open | ( | char const *const | path, |
struct fs_file_t * | f_obj ) |
Open a file on a SD card.
[in] | path | The file's full path. |
[in,out] | f_obj | A pointer to the file object representing the file. |
0 | on success. |
int sd_read | ( | struct fs_file_t * | f_obj, |
char * | buffer, | ||
size_t * | size ) |
Read from a file on a SD card.
[in,out] | f_obj | A file object representing the file. |
[in,out] | buffer | A pointer to the data buffer. |
[in,out] | size | The number of bytes to read. |
>=0 | a number of bytes read, on success. |
int sd_read_chunk | ( | char const *const | path, |
size_t * | offset, | ||
char *const | buffer, | ||
size_t * | size ) |
Open, read from a file on SD card and close it.
[in] | path | The name of the file to read from. |
[in,out] | offset | Relative location to move the file pointer to. |
[in,out] | buffer | A pointer to the data buffer. |
[in,out] | size | The number of bytes to read. |
>=0 | a number of bytes read, on success. |
int sd_tell_end_offset | ( | char const *const | path, |
size_t * | offset ) |
Get the current location of the file pointer inside the file.
[in] | path | The name of the file. |
[in,out] | offset | The offset within the file. |
0 | on success. |
int sd_write_chunk | ( | char const *const | path, |
char const *const | data, | ||
size_t * | size ) |
Open, write to a file on SD card and close it.
[in] | path | The name of the file to write to. |
[in] | data | A pointer to the data buffer to be written. |
[in,out] | size | The number of bytes to be written. |
0 | on success. |