Loading...
Searching...
No Matches
fal_cfg.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2022 ML!PA Consulting GmbH
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
25#ifndef FAL_CFG_H
26#define FAL_CFG_H
27
28#include "board.h"
29#include "macros/units.h"
30#include "mtd_default.h"
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36#if !defined(CONFIG_FLASHDB_MIN_SECTOR_SIZE_DEFAULT_KiB) || defined(DOXYGEN)
60#define CONFIG_FLASHDB_MIN_SECTOR_SIZE_DEFAULT_KiB 4
61#endif
62
66#define FAL_PART_HAS_TABLE_CFG
67
71extern struct fal_flash_dev mtd_flash0;
72
76#define FAL_FLASH_DEV_TABLE \
77{ \
78 &mtd_flash0, \
79}
80
81#if !defined(FAL_MTD) || defined(DOXYGEN)
85#define FAL_MTD mtd_default_get_dev(0)
86#endif
87
88#if !defined(FAL_PART0_LABEL) || defined(DOXYGEN)
92#define FAL_PART0_LABEL "part0"
93#endif
94
95#if !defined(FAL_PART0_LENGTH) || defined(DOXYGEN)
105#define FAL_PART0_LENGTH (2 * (CONFIG_FLASHDB_MIN_SECTOR_SIZE_DEFAULT_KiB * KiB(1)))
106#endif
107
111#if defined(FAL_PART0_LABEL) || defined(DOXYGEN)
112#if !defined(FAL_PART0_OFFSET) || defined(DOXYGEN)
116#define FAL_PART0_OFFSET 0
117#endif
121#define FAL_ROW_PART0 { FAL_PART_MAGIC_WORD, FAL_PART0_LABEL, "fal_mtd", \
122 FAL_PART0_OFFSET, FAL_PART0_LENGTH, 0 },
123#else
124#define FAL_ROW_PART0
125#endif
126
130#if defined(FAL_PART1_LABEL) || defined(DOXYGEN)
131#if !defined(FAL_PART1_OFFSET) || defined(DOXYGEN)
135#define FAL_PART1_OFFSET (FAL_PART0_OFFSET + FAL_PART0_LENGTH)
136#endif
140#define FAL_ROW_PART1 { FAL_PART_MAGIC_WORD, FAL_PART1_LABEL, "fal_mtd", \
141 FAL_PART1_OFFSET, FAL_PART1_LENGTH, 0 },
142#else
143#define FAL_ROW_PART1
144#endif
145
149#if defined(FAL_PART2_LABEL) || defined(DOXYGEN)
150#if !defined(FAL_PART2_OFFSET) || defined(DOXYGEN)
154#define FAL_PART2_OFFSET (FAL_PART1_OFFSET + FAL_PART1_LENGTH)
155#endif
159#define FAL_ROW_PART2 { FAL_PART_MAGIC_WORD, FAL_PART2_LABEL, "fal_mtd", \
160 FAL_PART2_OFFSET, FAL_PART2_LENGTH, 0 },
161#else
162#define FAL_ROW_PART2
163#endif
164
168#if defined(FAL_PART3_LABEL) || defined(DOXYGEN)
169#if !defined(FAL_PART3_OFFSET) || defined(DOXYGEN)
173#define FAL_PART3_OFFSET (FAL_PART2_OFFSET + FAL_PART2_LENGTH)
174#endif
178#define FAL_ROW_PART3 { FAL_PART_MAGIC_WORD, FAL_PART3_LABEL, "fal_mtd", \
179 FAL_PART3_OFFSET, FAL_PART3_LENGTH, 0 },
180#else
181#define FAL_ROW_PART3
182#endif
183
187#define FAL_PART_TABLE \
188{ \
189 FAL_ROW_PART0 \
190 FAL_ROW_PART1 \
191 FAL_ROW_PART2 \
192 FAL_ROW_PART3 \
193}
194
195#ifdef __cplusplus
196}
197#endif
198#endif /* FAL_CFG_H */
struct fal_flash_dev mtd_flash0
FAL <-> MTD adapter.
Unit helper macros.