vcdiff_mtd.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2022 Juergen Fitschen
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 
18 #ifndef VCDIFF_MTD_H
19 #define VCDIFF_MTD_H
20 
21 #include "vcdiff.h"
22 #include "mtd.h"
23 
24 #ifndef CONFIG_TINYVCDIFF_MTD_WRITE_SIZE
28 #define CONFIG_TINYVCDIFF_MTD_WRITE_SIZE 4
29 #endif
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
38 extern const vcdiff_driver_t vcdiff_mtd_driver;
39 
43 typedef struct {
48 
53 
57  uint8_t write_buffer[CONFIG_TINYVCDIFF_MTD_WRITE_SIZE];
58 
62  size_t offset;
63 } vcdiff_mtd_t;
64 
68 #define VCDIFF_MTD_INIT(DEV) { .dev = DEV }
69 
70 #ifdef __cplusplus
71 }
72 #endif
73 
74 #endif /* VCDIFF_MTD_H */
MTD device descriptor.
Definition: mtd.h:112
Context for the underlying MTD device.
Definition: vcdiff_mtd.h:43
mtd_dev_t * dev
Instance of the backing MTD device.
Definition: vcdiff_mtd.h:47
size_t offset
Current offset on the MTD device.
Definition: vcdiff_mtd.h:62
size_t next_erase_sector
Number of the next sector that must be erased.
Definition: vcdiff_mtd.h:52
const vcdiff_driver_t vcdiff_mtd_driver
Driver for accessing MTD devices.
#define CONFIG_TINYVCDIFF_MTD_WRITE_SIZE
Alignment and minimum size for MTD write access.
Definition: vcdiff_mtd.h:28