Loading...
Searching...
No Matches
mtd_flashpage.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2018 OTA keys S.A.
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
24
25#include "mtd.h"
26#include "periph/flashpage.h"
27
28#ifdef __cplusplus
29extern "C"
30{
31#endif
32
36#define MTD_FLASHPAGE_INIT_VAL(_pages_per_sector) { \
37 .base = { \
38 .driver = &mtd_flashpage_driver, \
39 .sector_count = FLASHPAGE_NUMOF, \
40 .pages_per_sector = _pages_per_sector, \
41 .page_size = FLASHPAGE_SIZE / _pages_per_sector, \
42 .write_size = 1 \
43 }, \
44}
45
52#define MTD_FLASHPAGE_AUX_INIT_VAL(start, len) { \
53 .base = { \
54 .driver = &mtd_flashpage_driver, \
55 .sector_count = len / FLASHPAGE_SIZE, \
56 .pages_per_sector = 1, \
57 .page_size = FLASHPAGE_SIZE, \
58 .write_size = 1, \
59 }, \
60 .offset = start / FLASHPAGE_SIZE, \
61}
62
67
71typedef struct {
73 uint32_t offset;
77
78#if CONFIG_SLOT_AUX_LEN || DOXYGEN
83
87extern mtd_dev_t *mtd_aux;
88#endif
89
101#ifndef CONFIG_SLOT_AUX_LEN
102#define CONFIG_SLOT_AUX_LEN 0
103#endif
104
108#ifndef CONFIG_SLOT_AUX_MTD_OFFSET
109#define CONFIG_SLOT_AUX_MTD_OFFSET 1
110#endif
111
112#ifdef __cplusplus
113}
114#endif
115
Low-level flash page peripheral driver interface.
mtd_flashpage_t mtd_flash_aux_slot
MTD device representing the auxiliary flash slot.
mtd_dev_t * mtd_aux
Generic MTD device backed by the auxiliary flash slot.
const mtd_desc_t mtd_flashpage_driver
Flashpage MTD device operations table.
struct mtd_desc mtd_desc_t
MTD driver interface.
Definition mtd.h:100
MTD device descriptor.
Definition mtd.h:108
MTD flashpage descriptor.
mtd_dev_t base
MTD generic device.
uint32_t offset
Offset in terms of MTD pages, which must comprise a whole number of sectors from the start of the fla...