From 436e3ffc29fd9c8bb9abaf619610a7b247b6a359 Mon Sep 17 00:00:00 2001 From: cfif Date: Fri, 24 Jan 2025 13:22:33 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=BD=D0=BE=D1=81=20?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=BD=D0=BE=D0=B2=D1=83=D1=8E=20=D0=BE=D1=80?= =?UTF-8?q?=D0=B3=D0=B0=D0=BD=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D1=8E=20GONEC?= 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