* 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.
		
			
				
	
	
		
			41 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			41 lines
		
	
	
		
			1.0 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);
 |