MBNG_FILE_S
Detailed Description
Snapshot File access functions
NOTE: before accessing the SD Card, the upper level function should synchronize with the SD Card semaphore! MUTEX_SDCARD_TAKE; // to take the semaphore MUTEX_SDCARD_GIVE; // to release the semaphore
Define Documentation
#define DEBUG_VERBOSE_LEVEL 1 |
Include files for optional debugging messages via DEBUG_MSG (defined in mios32_config.h)
#define MBNG_FILES_PATH "/" |
#define NGS_FILE_FORMAT_NUMBER 0 |
Function Documentation
s32 MBNG_FILE_S_Init |
( |
u32 |
mode |
) |
|
s32 MBNG_FILE_S_Load |
( |
char * |
filename, |
|
|
int |
snapshot | |
|
) |
| | |
Loads snapshot file Called from MBNG_FILE_CheckSDCard() when the SD card has been connected
- Parameters:
-
| filename | the filename which should be read |
| snapshot | if < 0: load last snapshot, if >= 0: load given snapshot |
- Returns:
- < 0 on errors
s32 MBNG_FILE_S_Periodic_1s |
( |
u8 |
force |
) |
|
Should be called periodically each second to check for a delayed snapshot
- Parameters:
-
| force | if set to != 0, an ongoing request will be enforced |
- Returns:
- < 0 on errors (error codes are documented in seq_file.h)
s32 MBNG_FILE_S_Read |
( |
char * |
filename, |
|
|
int |
snapshot | |
|
) |
| | |
reads the snapshot file content (again)
- Parameters:
-
| filename | the filename which should be read |
| snapshot | if < 0: load last snapshot, if >= 0: load given snapshot |
- Returns:
- < 0 on errors (error codes are documented in mbng_file.h)
-
0 if snapshot not in file
-
1 if snapshot loaded from file
s32 MBNG_FILE_S_RequestDelayedSnapshot |
( |
u8 |
delay_s |
) |
|
Requests a delayed snapshot
- Parameters:
-
| delay_s | the delay in seconds - will be take if there is no ongoing request |
- Returns:
- < 0 on errors (error codes are documented in seq_file.h)
s32 MBNG_FILE_S_SnapshotGet |
( |
void |
|
) |
|
s32 MBNG_FILE_S_SnapshotSet |
( |
u8 |
snapshot |
) |
|
Sets the current snapshot (but doesn't load it!)
Used by SCS
s32 MBNG_FILE_S_Unload |
( |
void |
|
) |
|
Unloads snapshot file Called from MBNG_FILE_CheckSDCard() when the SD card has been disconnected
- Returns:
- < 0 on errors
s32 MBNG_FILE_S_Valid |
( |
void |
|
) |
|
- Returns:
- 1 if current snapshot file valid
-
0 if current snapshot file not valid
s32 MBNG_FILE_S_Write |
( |
char * |
filename, |
|
|
int |
snapshot | |
|
) |
| | |
writes data into snapshot file
- Parameters:
-
| filename | the filename which should be written |
| snapshot | if < 0: generate new file, if >= 0: write into given snapshot |
- Returns:
- < 0 on errors (error codes are documented in seq_file.h)
Variable Documentation