From 578c4f425b6a3d3be5e95990b1a7e199f2059bd0 Mon Sep 17 00:00:00 2001 From: Silvano Seva Date: Tue, 21 Nov 2023 14:11:12 +0100 Subject: [PATCH] Added list of NVM areas to ttwrplus target --- platform/drivers/NVM/nvmem_ttwrplus.c | 94 ++++++++++++++++++++++++ platform/targets/ttwrplus/CMakeLists.txt | 2 +- platform/targets/ttwrplus/ttwrplus.dts | 1 + 3 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 platform/drivers/NVM/nvmem_ttwrplus.c diff --git a/platform/drivers/NVM/nvmem_ttwrplus.c b/platform/drivers/NVM/nvmem_ttwrplus.c new file mode 100644 index 00000000..e7812b7f --- /dev/null +++ b/platform/drivers/NVM/nvmem_ttwrplus.c @@ -0,0 +1,94 @@ +/*************************************************************************** + * Copyright (C) 2023 by Federico Amedeo Izzo IU2NUO, * + * Niccolò Izzo IU2KIN * + * Frederik Saraci IU2NRO * + * Silvano Seva IU2KWO * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, see * + ***************************************************************************/ + +#include +#include +#include +#include "flash_zephyr.h" + +ZEPHYR_FLASH_DEVICE_DEFINE(extFlash, flash); + +static const struct nvmArea areas[] = +{ + { + .name = "External flash", + .dev = &extFlash, + .startAddr = FIXED_PARTITION_OFFSET(storage_partition), + .size = FIXED_PARTITION_SIZE(storage_partition), + .partitions = NULL + } +}; + + +void nvm_init() +{ + +} + +void nvm_terminate() +{ + +} + +size_t nvm_getMemoryAreas(const struct nvmArea **list) +{ + *list = &areas[0]; + + return (sizeof(areas) / sizeof(struct nvmArea)); +} + +void nvm_readCalibData(void *buf) +{ + (void) buf; +} + +void nvm_readHwInfo(hwInfo_t *info) +{ + (void) info; +} + +int nvm_readVfoChannelData(channel_t *channel) +{ + (void) channel; + + return -1; +} + +int nvm_readSettings(settings_t *settings) +{ + (void) settings; + + return -1; +} + +int nvm_writeSettings(const settings_t *settings) +{ + (void) settings; + + return -1; +} + +int nvm_writeSettingsAndVfo(const settings_t *settings, const channel_t *vfo) +{ + (void) settings; + (void) vfo; + + return -1; +} diff --git a/platform/targets/ttwrplus/CMakeLists.txt b/platform/targets/ttwrplus/CMakeLists.txt index 5404221e..902f91c1 100644 --- a/platform/targets/ttwrplus/CMakeLists.txt +++ b/platform/targets/ttwrplus/CMakeLists.txt @@ -20,9 +20,9 @@ target_sources(app ${OPENRTX_ROOT}/platform/drivers/GPS/GPS_ttwrplus.c ${OPENRTX_ROOT}/platform/drivers/audio/audio_ttwrplus.c ${OPENRTX_ROOT}/platform/drivers/NVM/flash_zephyr.c + ${OPENRTX_ROOT}/platform/drivers/NVM/nvmem_ttwrplus.c ${OPENRTX_ROOT}/platform/drivers/stubs/cps_io_stub.c - ${OPENRTX_ROOT}/platform/drivers/stubs/nvmem_stub.c ${OPENRTX_ROOT}/subprojects/XPowersLib/src/XPowersLibInterface.cpp ) diff --git a/platform/targets/ttwrplus/ttwrplus.dts b/platform/targets/ttwrplus/ttwrplus.dts index 5ee058d1..eebc90c8 100644 --- a/platform/targets/ttwrplus/ttwrplus.dts +++ b/platform/targets/ttwrplus/ttwrplus.dts @@ -25,6 +25,7 @@ pmu-irq = &pmu_irq; qdec0 = &pcnt; led0 = &ws2812c; + flash = &flash0; }; chosen {