[FL-977] Internal Storage (#455)
* Add littlefs submodule * Furi: add mutex in logging, fix issues with corrupted printf * ApiHal: disable debug traces in ble glue * App-loader: more logs * Passport: fix invalid DolphinState usage * ApiHal, linker script: flash API is now aware of free space, complete abstraction layer for storage * Internal Storage: littlefs based storage services with key value API. Migrate dolphin state to new storage API.
This commit is contained in:
40
applications/internal-storage/internal-storage.h
Normal file
40
applications/internal-storage/internal-storage.h
Normal file
@@ -0,0 +1,40 @@
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/* Internal storage state */
|
||||
typedef enum {
|
||||
InternalStorageStateInitializing,
|
||||
InternalStorageStateReady,
|
||||
InternalStorageStateBroken,
|
||||
} InternalStorageState;
|
||||
|
||||
typedef struct InternalStorage InternalStorage;
|
||||
|
||||
/** Read key, blocking api
|
||||
* @param internal_storage - InternalStorage instance
|
||||
* @param key - file name to read data from
|
||||
* @param buffer - pointer to data buffer
|
||||
* @param size - buffer size
|
||||
* @return negative on error, otherwise data read
|
||||
*/
|
||||
int internal_storage_read_key(
|
||||
InternalStorage* internal_storage,
|
||||
const char* key,
|
||||
uint8_t* buffer,
|
||||
size_t size);
|
||||
|
||||
/** Write key, blocking api
|
||||
* @param internal_storage - InternalStorage instance
|
||||
* @param key - file name to store data to
|
||||
* @param buffer - pointer to data buffer
|
||||
* @param size - buffer size
|
||||
* @return negative on error, otherwise data written
|
||||
*/
|
||||
int internal_storage_write_key(
|
||||
InternalStorage* internal_storage,
|
||||
const char* key,
|
||||
uint8_t* buffer,
|
||||
size_t size);
|
||||
Reference in New Issue
Block a user