kopia lustrzana https://github.com/OpenRTX/OpenRTX
CS7000P: enabled NVM storage
rodzic
989b194ef3
commit
891f18cac7
|
@ -514,7 +514,9 @@ cs7000_def += openrtx_def + stm32f405_def
|
|||
##
|
||||
## Connect Systems CS70000-PLUS
|
||||
##
|
||||
cs7000p_src = ['platform/drivers/stubs/nvmem_stub.c',
|
||||
cs7000p_src = ['platform/drivers/NVM/nvmem_CS7000.c',
|
||||
'platform/drivers/NVM/W25Qx.c',
|
||||
'platform/drivers/NVM/eeep.c',
|
||||
'platform/drivers/stubs/cps_io_stub.c',
|
||||
'platform/drivers/stubs/radio_stub.c',
|
||||
'platform/drivers/stubs/audio_stub.c',
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <calibInfo_CS7000.h>
|
||||
#include <nvmem_access.h>
|
||||
#include <spi_bitbang.h>
|
||||
#include <spi_stm32.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#include <utils.h>
|
||||
|
@ -33,7 +34,12 @@ static const struct W25QxCfg cfg =
|
|||
.cs = { FLASH_CS }
|
||||
};
|
||||
|
||||
#ifdef PLATFORM_CS7000P
|
||||
W25Qx_DEVICE_DEFINE(eflash, cfg, 0x2000000) // 32 MB, 256 Mbit
|
||||
#else
|
||||
W25Qx_DEVICE_DEFINE(eflash, cfg, 0x1000000) // 16 MB, 128 Mbit
|
||||
#endif
|
||||
|
||||
EEEP_DEVICE_DEFINE(eeep)
|
||||
|
||||
const struct nvmPartition memPartitions[] =
|
||||
|
@ -42,6 +48,16 @@ const struct nvmPartition memPartitions[] =
|
|||
.offset = 0x0000, // First partition, calibration and other OEM data
|
||||
.size = 32768 // 32kB
|
||||
},
|
||||
#ifdef PLATFORM_CS7000P
|
||||
{
|
||||
.offset = 0x1000000,// Second partition EEEP storage
|
||||
.size = 16384 // 16kB
|
||||
},
|
||||
{
|
||||
.offset = 0x1000C000,// Third partition, available memory
|
||||
.size = 0xFF4000
|
||||
}
|
||||
#else
|
||||
{
|
||||
.offset = 0x8000, // Second partition EEEP storage
|
||||
.size = 16384 // 16kB
|
||||
|
@ -50,6 +66,7 @@ const struct nvmPartition memPartitions[] =
|
|||
.offset = 0xC000, // Third partition, available memory
|
||||
.size = 0xFF4000
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
static const struct nvmDescriptor extMem[] =
|
||||
|
@ -73,7 +90,14 @@ static uint16_t vfoCrc;
|
|||
|
||||
void nvm_init()
|
||||
{
|
||||
#ifdef PLATFORM_CS7000P
|
||||
gpio_setMode(FLASH_CLK, ALTERNATE | ALTERNATE_FUNC(5));
|
||||
gpio_setMode(FLASH_SDI, ALTERNATE | ALTERNATE_FUNC(5));
|
||||
gpio_setMode(FLASH_SDO, ALTERNATE | ALTERNATE_FUNC(5));
|
||||
spiStm32_init(&flash_spi, 25000000, 0);
|
||||
#else
|
||||
spiBitbang_init(&flash_spi);
|
||||
#endif
|
||||
W25Qx_init(&eflash);
|
||||
eeep_init(&eeep, 0, 1);
|
||||
}
|
||||
|
@ -82,7 +106,11 @@ void nvm_terminate()
|
|||
{
|
||||
eeep_terminate(&eeep);
|
||||
W25Qx_terminate(&eflash);
|
||||
#ifdef PLATFORM_CS7000P
|
||||
spiStm32_terminate(&flash_spi);
|
||||
#else
|
||||
spiBitbang_terminate(&flash_spi);
|
||||
#endif
|
||||
}
|
||||
|
||||
const struct nvmDescriptor *nvm_getDesc(const size_t index)
|
||||
|
|
|
@ -70,5 +70,6 @@ static const struct gpioPin shiftRegStrobe = { GPIOEXT_STR };
|
|||
static pthread_mutex_t adc1Mutex;
|
||||
|
||||
SPI_CUSTOM_DEVICE_DEFINE(spiSr, spiSr_func, NULL, NULL)
|
||||
SPI_STM32_DEVICE_DEFINE(flash_spi, SPI4, NULL)
|
||||
GPIO_SHIFTREG_DEVICE_DEFINE(extGpio, (const struct spiDevice *) &spiSr, shiftRegStrobe, 24)
|
||||
ADC_STM32_DEVICE_DEFINE(adc1, ADC1, &adc1Mutex, ADC_COUNTS_TO_UV(3300000, 16))
|
||||
|
|
|
@ -43,6 +43,7 @@ enum AdcChannels
|
|||
|
||||
extern const struct Adc adc1;
|
||||
extern const struct spiCustomDevice spiSr;
|
||||
extern const struct spiDevice flash_spi;
|
||||
extern const struct gpioDev extGpio;
|
||||
extern const struct ak2365a detector;
|
||||
extern const struct sky73210 pll;
|
||||
|
@ -66,6 +67,9 @@ extern const struct sky73210 pll;
|
|||
/* Device has a GPS chip */
|
||||
// #define CONFIG_GPS
|
||||
|
||||
/* Use extended addressing for external flash memory */
|
||||
#define CONFIG_W25Qx_EXT_ADDR
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Ładowanie…
Reference in New Issue