Loading...
Searching...
No Matches
mtd_mapper.h
1/*
2 * Copyright (C) 2020 Koen Zandberg <koen@bergzand.net>
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
63
64#include <stdint.h>
65#include <stdbool.h>
66#include "mtd.h"
67#include "mutex.h"
68
69#ifdef __cplusplus
70extern "C" {
71#endif
72
77#define MTD_PARENT_INIT(_parent) \
78{ \
79 .mtd = _parent, \
80 .lock = MUTEX_INIT, \
81 .init = false, \
82}
83
92
101
105extern const mtd_desc_t mtd_mapper_driver;
106
107#ifdef __cplusplus
108}
109#endif
110
const mtd_desc_t mtd_mapper_driver
Mapper MTD device operations table.
struct mtd_desc mtd_desc_t
MTD driver interface.
Definition mtd.h:103
Mutex for thread synchronization.
MTD device descriptor.
Definition mtd.h:111
MTD mapper backing device context.
Definition mtd_mapper.h:87
mutex_t lock
Mutex for guarding the backing device access.
Definition mtd_mapper.h:89
mtd_dev_t * mtd
Parent MTD device.
Definition mtd_mapper.h:88
bool init
Initialization flag.
Definition mtd_mapper.h:90
MTD mapped region.
Definition mtd_mapper.h:96
mtd_mapper_parent_t * parent
MTD mapper parent device.
Definition mtd_mapper.h:98
mtd_dev_t mtd
MTD context.
Definition mtd_mapper.h:97
uint32_t sector
first sector of the region
Definition mtd_mapper.h:99
Mutex structure.
Definition mutex.h:39