unleashed-firmware/applications/internal-storage/internal-storage.h
あく aa24484b99
[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.
2021-05-11 11:29:44 +03:00

40 lines
1 KiB
C

#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);