Added list of NVM areas to MDx targets

This commit is contained in:
Silvano Seva 2023-11-21 14:10:12 +01:00
parent d9b22c1d2d
commit 72c8b8246b
3 changed files with 107 additions and 0 deletions

View File

@ -26,6 +26,35 @@
#include <utils.h>
#include "W25Qx.h"
W25Qx_DEVICE_DEFINE(W25Q128_main, W25Qx_api)
W25Qx_DEVICE_DEFINE(W25Q128_secr, W25Qx_secReg_api)
static const struct nvmArea areas[] =
{
{
.name = "External flash",
.dev = &W25Q128_main,
.startAddr = 0x0000,
.size = 0x1000000, // 16 MB, 128 Mbit
.partitions = NULL
},
{
.name = "Cal. data 1",
.dev = &W25Q128_secr,
.startAddr = 0x1000,
.size = 0x100, // 256 byte
.partitions = NULL
},
{
.name = "Cal. data 2",
.dev = &W25Q128_secr,
.startAddr = 0x2000,
.size = 0x100, // 256 byte
.partitions = NULL
}
};
void nvm_init()
{
W25Qx_init();
@ -36,6 +65,13 @@ void nvm_terminate()
W25Qx_terminate();
}
size_t nvm_getMemoryAreas(const struct nvmArea **list)
{
*list = &areas[0];
return (sizeof(areas) / sizeof(struct nvmArea));
}
void nvm_readCalibData(void *buf)
{
W25Qx_wakeup();

View File

@ -26,6 +26,35 @@
#include <utils.h>
#include "W25Qx.h"
W25Qx_DEVICE_DEFINE(W25Q128_main, W25Qx_api)
W25Qx_DEVICE_DEFINE(W25Q128_secr, W25Qx_secReg_api)
static const struct nvmArea areas[] =
{
{
.name = "External flash",
.dev = &W25Q128_main,
.startAddr = 0x0000,
.size = 0x1000000, // 16 MB, 128 Mbit
.partitions = NULL
},
{
.name = "Cal. data 1",
.dev = &W25Q128_secr,
.startAddr = 0x1000,
.size = 0x100, // 256 byte
.partitions = NULL
},
{
.name = "Cal. data 2",
.dev = &W25Q128_secr,
.startAddr = 0x2000,
.size = 0x100, // 256 byte
.partitions = NULL
}
};
void nvm_init()
{
W25Qx_init();
@ -36,6 +65,13 @@ void nvm_terminate()
W25Qx_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;

View File

@ -26,6 +26,34 @@
#include <utils.h>
#include "W25Qx.h"
W25Qx_DEVICE_DEFINE(W25Q128_main, W25Qx_api)
W25Qx_DEVICE_DEFINE(W25Q128_secr, W25Qx_secReg_api)
static const struct nvmArea areas[] =
{
{
.name = "External flash",
.dev = &W25Q128_main,
.startAddr = 0x0000,
.size = 0x1000000, // 16 MB, 128 Mbit
.partitions = NULL
},
{
.name = "Cal. data 1",
.dev = &W25Q128_secr,
.startAddr = 0x1000,
.size = 0x100, // 256 byte
.partitions = NULL
},
{
.name = "Cal. data 2",
.dev = &W25Q128_secr,
.startAddr = 0x2000,
.size = 0x100, // 256 byte
.partitions = NULL
}
};
void nvm_init()
{
@ -37,6 +65,13 @@ void nvm_terminate()
W25Qx_terminate();
}
size_t nvm_getMemoryAreas(const struct nvmArea **list)
{
*list = &areas[0];
return (sizeof(areas) / sizeof(struct nvmArea));
}
void nvm_readCalibData(void *buf)
{
W25Qx_wakeup();