forked from rusefi/fw-custom-mega-legacy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
board_storage.cpp
45 lines (36 loc) · 1.01 KB
/
board_storage.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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 */