43 lines
1.1 KiB
C
43 lines
1.1 KiB
C
#ifndef __FS_H__
|
|
#define __FS_H__
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include "app_config.h"
|
|
|
|
#include "lfs.h"
|
|
#include "lfs_util.h"
|
|
|
|
typedef lfs_file_t file_t;
|
|
|
|
#define FS_O_RDONLY LFS_O_RDONLY // Open a file as read only
|
|
#define FS_O_WRONLY LFS_O_WRONLY // Open a file as write only
|
|
#define FS_O_RDWR LFS_O_RDWR // Open a file as read and write
|
|
#define FS_O_CREAT LFS_O_CREAT // Create a file if it does not exist
|
|
#define FS_O_EXCL LFS_O_EXCL // Fail if a file already exists
|
|
#define FS_O_TRUNC LFS_O_TRUNC // Truncate the existing file to zero size
|
|
#define FS_O_APPEND LFS_O_APPEND // Move to end of file on every write
|
|
|
|
#if (DEF_FS_ENABLED)
|
|
void fs_init(void);
|
|
int fs_file_open(file_t *hFile, char *filename, uint32_t attr);
|
|
int fs_file_write(file_t *hFile, void *write, uint32_t size);
|
|
int fs_file_read(file_t *hFile, void *read, uint32_t size);
|
|
int fs_file_close(file_t *hFile);
|
|
int fs_dir(char *path);
|
|
#else
|
|
#define fs_init()
|
|
#define fs_file_write(x, y, z)
|
|
#define fs_file_read(x, y, z)
|
|
#define fs_file_close(x)
|
|
#define fs_dir(x)
|
|
#endif /* ! DEF_FS_ENABLED */
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* ! __FS_H__ */
|