#ifndef _FSTORAGE_H_
#define _FSTORAGE_H_

#include <stdint.h>
#include "record.h"

typedef enum {
    FSTORAGE_STATE_UNKNOWN, /* initialization */
	FSTORAGE_STATE_ERASING,
	FSTORAGE_STATE_ERASED,
	FSTORAGE_STATE_WRITING,
	FSTORAGE_STATE_WRITTEN,
} fstorage_state_t;


int fstorageInit(void);
int fstorageErase(const uint32_t addr, const uint32_t pagesCnt);
int fstorageReadRecord(const uint32_t addr, record_t* pRecord);
int fstorageUpdateRecord(const record_data_type_t type, const record_t* pRecord);
int fstorageWriteRecord(const uint32_t addr, record_t* pRecord);
bool fstorageGetInitialized(void);
bool fstorageGetEraseDone(void);
bool fstorageGetWriteDone(void);
bool fstorageGetPageDirty(void);
fstorage_state_t fstorageGetState(void);

#endif /* _FSTORAGE_H_ */

