Loading...
Searching...
No Matches
mtd_flashpage.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2018 OTA keys S.A.
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
9#pragma once
10
27
28#include "mtd.h"
29#include "periph/flashpage.h"
30
31#ifdef __cplusplus
32extern "C"
33{
34#endif
35
39#define MTD_FLASHPAGE_INIT_VAL(_pages_per_sector) { \
40 .base = { \
41 .driver = &mtd_flashpage_driver, \
42 .sector_count = FLASHPAGE_NUMOF, \
43 .pages_per_sector = _pages_per_sector, \
44 .page_size = FLASHPAGE_SIZE / _pages_per_sector, \
45 .write_size = 1 \
46 }, \
47}
48
55#define MTD_FLASHPAGE_AUX_INIT_VAL(start, len) { \
56 .base = { \
57 .driver = &mtd_flashpage_driver, \
58 .sector_count = len / FLASHPAGE_SIZE, \
59 .pages_per_sector = 1, \
60 .page_size = FLASHPAGE_SIZE, \
61 .write_size = 1, \
62 }, \
63 .offset = start / FLASHPAGE_SIZE, \
64}
65
70
74typedef struct {
76 uint32_t offset;
80
81#if CONFIG_SLOT_AUX_LEN || DOXYGEN
86
90extern mtd_dev_t *mtd_aux;
91#endif
92
104#ifndef CONFIG_SLOT_AUX_LEN
105#define CONFIG_SLOT_AUX_LEN 0
106#endif
107
111#ifndef CONFIG_SLOT_AUX_MTD_OFFSET
112#define CONFIG_SLOT_AUX_MTD_OFFSET 1
113#endif
114
115#ifdef __cplusplus
116}
117#endif
118
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:103
MTD device descriptor.
Definition mtd.h:111
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...