cueOS  2.4
cueOS - Universal Show Control OS for ARM
fs.c
1
6#include <stdio.h>
7#include "fs.h"
8#include "mmc_driver.h"
9
10
11/***============================================================================================================================
12 * Private variables definitions
13 * These variables are only accessible from within the file's scope
14 *=============================================================================================================================*/
15
16static fs_s this = FS_DEFAULT;
17static FATFS _fatfs;
18static TCHAR _path[4];
19
20
21/***============================================================================================================================
22 * Public functions definitions
23 * These functions can be accessed outside of the file's scope
24 * @see DMX512_chaser.h for declarations
25 *=============================================================================================================================*/
26
34
35 fs_err_e err = FS_OK;
36
37 mmc_init();
38
39 this._link_status = FATFS_LinkDriver(&SD_Driver, (char *)_path);
40
41 if(this._mount_status == FS_MOUNTED){
42 err = FS_OK;
43 }else if(this._link_status == FS_LINKSTATUS_UNLINKED){
45 }else if(f_mount(&_fatfs, _path, 0) != FR_OK){
47 }else{
48 this._mount_status = FS_MOUNTED;
49 }
50
51 return err;
52
53}
54
62 return this._mount_status;
63}
uint8_t FATFS_LinkDriver(const Diskio_drvTypeDef *drv, char *path)
Links a compatible diskio driver and increments the number of active linked drivers.
Definition: ff_gen_drv.c:68
fs_err_e fs_init(void)
Initialises the file system.
Definition: fs.c:33
fs_mount_status_e fs_get_mount_status(void)
Returns the file system's current state.
Definition: fs.c:61
fs_err_e
file system error constants definition
Definition: fs.h:31
#define FS_DEFAULT
file system instance default values
Definition: fs.h:22
fs_mount_status_e
Actual initialisation state of the file system.
Definition: fs.h:49
@ FS_CANNOT_MOUNT_SD
Definition: fs.h:34
@ FS_OK
Definition: fs.h:32
@ FS_CANNOT_LINK_SD
Definition: fs.h:33
@ FS_LINKSTATUS_UNLINKED
Definition: fs.h:42
@ FS_MOUNTED
Definition: fs.h:50
filesystem object
Definition: fs.h:57