From 016d9ff6d73209e6f9c53fdfc511f876a262588b Mon Sep 17 00:00:00 2001 From: cfif Date: Fri, 24 Oct 2025 12:29:49 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Inc/StorageIO.h | 32 ++++++++++++++++++++++++++++++++ modular.json | 7 +++++++ 2 files changed, 39 insertions(+) create mode 100644 Inc/StorageIO.h create mode 100644 modular.json diff --git a/Inc/StorageIO.h b/Inc/StorageIO.h new file mode 100644 index 0000000..a769d37 --- /dev/null +++ b/Inc/StorageIO.h @@ -0,0 +1,32 @@ +// +// Created by cfif on 07.10.22. +// + +#ifndef MODULE_STORAGEIO_H +#define MODULE_STORAGEIO_H + +#include "stdint.h" +#include "stddef.h" + +typedef enum { + STORAGE_OK = 0, + STORAGE_ERR_DATA = 1, + STORAGE_ERR_DEVICE = 2, +} eStorageStatus; + +typedef eStorageStatus (*StorageIOTransaction )(void *env, void *mem, size_t size); + +typedef struct { + void *env; + StorageIOTransaction load; + StorageIOTransaction dump; +} tStorageInterface; + +#define StorageDump(STORAGE, MEM, SIZE) (STORAGE)->dump((STORAGE)->env, MEM, SIZE) +#define StorageLoad(STORAGE, MEM, SIZE) (STORAGE)->load((STORAGE)->env, MEM, SIZE) + +#define StorageDumpStatic(STORAGE, MEM) (STORAGE)->dump((STORAGE)->env, &(MEM), sizeof(MEM)) +#define StorageLoadStatic(STORAGE, MEM) (STORAGE)->load((STORAGE)->env, &(MEM), sizeof(MEM)) + + +#endif //MODULE_STORAGEIO_H diff --git a/modular.json b/modular.json new file mode 100644 index 0000000..9bdd478 --- /dev/null +++ b/modular.json @@ -0,0 +1,7 @@ +{ + "cmake": { + "inc_dirs": [ + "Inc" + ] + } +} \ No newline at end of file