/** * \file * * * \brief FatFS: kfile interface for FatFS module by ChaN. * * This driver needs some low level hardware access functions. An example implementation * is provided in sd.h. * * * \author Luca Ottaviano * * $WIZ$ module_name = "fat" * $WIZ$ module_configuration = "bertos/cfg/cfg_fat.h" * $WIZ$ module_depends = "kfile", "ff", "diskio" * */ #ifndef FS_FAT_H #define FS_FAT_H #include #include "fatfs/ff.h" typedef struct FatFile { KFile fd; FIL fat_file; FRESULT error_code; ///< error code for calls like kfile_read } FatFile; #define KFT_FATFILE MAKE_ID('F', 'A', 'T', 'F') INLINE FatFile * FATFILE_CAST(KFile *fd) { ASSERT(fd->_type == KFT_FATFILE); return (FatFile *)fd; } /** * Initialize \a file and open \a file_path for reading. * * \a mode is a OR combination of various flags, you can use \a FA_READ for * read access or \a FA_WRITE for write access. * The function returns \a FR_OK if success, other values (defined in ff.h) in case * of failure. * * \param file A pointer to a FatFile structure. * \param file_path The file path on the filesystem. * \param mode Open mode for the file, which can be OR'ed together * \sa ff.h for return code meaning and \a mode flags. */ FRESULT fatfile_open(FatFile *file, const char *file_path, BYTE mode); #endif /* FS_FAT_H */