plain SPI external calibrations config #2

This commit is contained in:
rusEFI LLC 2024-05-01 20:21:02 -04:00
parent 1c365f4c1e
commit 8a5afa9f0b
2 changed files with 46 additions and 4 deletions

View File

@ -19,5 +19,7 @@ DDEFS += -DRAM_UNUSED_SIZE=100
# USE_OPT += -Wl,--defsym=FLASH_SIZE=768k
#Serial flash support
#include $(PROJECT_DIR)/hw_layer/drivers/flash/sst26f_jedec.mk
# This board uses ChibiOS MFS driver on external SPI flash
include $(PROJECT_DIR)/hw_layer/ports/stm32/use_higher_level_flash_api.mk
#Serial flash driver
include $(PROJECT_DIR)/hw_layer/drivers/flash/sst26f_jedec.mk

View File

@ -1,5 +1,45 @@
#include "pch.h"
void boardInitMfs() {
/* This board stores settings in external plain SPI flash */
#if !defined(EFI_BOOTLOADER) && (EFI_STORAGE_MFS == TRUE)
#include "hal_serial_nor.h"
#include "hal_mfs.h"
/* Some fields in following struct are used for DMA transfers, so do not cache */
NO_CACHE SNORDriver snor1;
const SPIConfig SPIcfg1 = {
.end_cb = NULL,
.error_cb = NULL,
.dcr = STM32_DCR_FSIZE(23U) | /* 8MB device. */
STM32_DCR_CSHT(1U) /* NCS 2 cycles delay. */
};
const SNORConfig snorcfg1 = {
.busp = &SPID1,
.buscfg = &SPIcfg1
};
const MFSConfig mfsd_nor_config = {
.flashp = (BaseFlash *)&snor1,
.erased = 0xFFFFFFFFU,
.bank_size = 64 * 1024U,
.bank0_start = 0U,
.bank0_sectors = 128U, /* 128 * 4 K = 0.5 Mb */
.bank1_start = 128U,
.bank1_sectors = 128U
};
void boardInitMfs() {
/* Initializing and starting snor1 driver.*/
snorObjectInit(&snor1);
snorStart(&snor1, &snorcfg1);
}
const MFSConfig *boardGetMfsConfig()
{
return &mfsd_nor_config;
}
#endif /* EFI_STORAGE_MFS == TRUE */