rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
board_storage.cpp
Go to the documentation of this file.
1/**
2 * @file boards/subaru_eg33/board_storage.h
3 *
4 * @brief Storage configuration file
5 *
6 * @date Nov 03, 2023
7 * @author Andrey Gusakov, 2023
8 */
9
10#include "pch.h"
11
12/* This board stores settings in external QSPI flash */
13#if !defined(EFI_BOOTLOADER) && (EFI_STORAGE_MFS == TRUE)
14
15#include "hal_serial_nor.h"
16#include "hal_mfs.h"
17
18/* Some fields in following struct are used for DMA transfers, so do not cache */
19/* TODO: can we drop NO_CACHE for snor1 since snor1buf? */
20static NO_CACHE SNORDriver snor1;
21static NO_CACHE snor_nocache_buffer_t snor1buf;
22
23const WSPIConfig WSPIcfg1 = {
24 .end_cb = NULL,
25 .error_cb = NULL,
26 .dcr = STM32_DCR_FSIZE(23U) | /* 8MB device. */
27 STM32_DCR_CSHT(1U) /* NCS 2 cycles delay. */
28};
29
30const SNORConfig snorcfg1 = {
31 .busp = &WSPID1,
32 .buscfg = &WSPIcfg1
33};
34
35const MFSConfig mfsd_nor_config = {
36 .flashp = (BaseFlash *)&snor1,
37 .erased = 0xFFFFFFFFU,
38 .bank_size = 64 * 1024U,
39 .bank0_start = 0U,
40 .bank0_sectors = 128U, /* 128 * 4 K = 0.5 Mb */
41 .bank1_start = 128U,
42 .bank1_sectors = 128U
43};
44
46{
47#if SNOR_SHARED_BUS == FALSE
48 wspiStart(&WSPID1, &WSPIcfg1);
49#endif
50 /* Initializing and starting snor1 driver.*/
51 snorObjectInit(&snor1, &snor1buf);
52 snorStart(&snor1, &snorcfg1);
53
54 return true;
55}
56
57const MFSConfig *boardGetMfsConfig()
58{
59 return &mfsd_nor_config;
60}
61
62#endif /* EFI_STORAGE_MFS == TRUE */
bool boardInitMfs()
const MFSConfig * boardGetMfsConfig()
static NO_CACHE SNORDriver snor1
const MFSConfig mfsd_nor_config
static NO_CACHE snor_nocache_buffer_t snor1buf
static union @47 NO_CACHE
const WSPIConfig WSPIcfg1
const SNORConfig snorcfg1