Skip to content

Commit

Permalink
plain SPI external calibrations config #2
Browse files Browse the repository at this point in the history
  • Loading branch information
rusefillc committed May 2, 2024
1 parent 1c365f4 commit 8a5afa9
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 3 deletions.
6 changes: 4 additions & 2 deletions board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
42 changes: 41 additions & 1 deletion board_storage.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,45 @@
#include "pch.h"

/* 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 */

0 comments on commit 8a5afa9

Please sign in to comment.