filesystem.h 997 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#ifndef EPICARDIUM_MODULE_FILESYSTEM_INCLUDED
#define EPICARDIUM_MODULE_FILESYSTEM_INCLUDED

/* ---------- FAT fs ------------------------------------------------------ */

#include <stdbool.h>
#include "epicardium.h"

/**
 * module initialization - to be called once at startup before any FreeRTOS tasks
 * have been started
 *
 * calls fatfs_attach
 */
void fatfs_init(void);

/**
 * initialize and mount the FLASH storage
Rahix's avatar
Rahix committed
19
 *
swym's avatar
swym committed
20
 * NOTE: not safe to be called from an ISR
21
22
23
 */
int fatfs_attach(void);

swym's avatar
swym committed
24
25
26

/**
 * asynchronously attach the FLASH storage
Rahix's avatar
Rahix committed
27
 *
swym's avatar
swym committed
28
29
30
31
 * safe to be called from an ISR
 */
void fatfs_schedule_attach(void);

32
33
34
/** close all opened FDs, sync and deinitialize FLASH layer */
void fatfs_detach(void);

Rahix's avatar
Rahix committed
35
/** close all onpened FDs
36
37
38
39
40
41
42
43
 * TODO: add ability to close FDs opened by core0/core1 only
 */
#define EPICARDIUM_COREMASK_0		0x01
#define EPICARDIUM_COREMASK_1		0x02
#define EPICARDIUM_COREMASK_BOTH	0x03

void fatfs_close_all(int coreMask);

44
#endif//EPICARDIUM_MODULE_FILESYSTEM_INCLUDED