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 
9 #pragma once
10 
20 #include "vcdiff.h"
21 #include "mtd.h"
22 
23 #ifndef CONFIG_TINYVCDIFF_MTD_WRITE_SIZE
27 #define CONFIG_TINYVCDIFF_MTD_WRITE_SIZE 4
28 #endif
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
37 extern const vcdiff_driver_t vcdiff_mtd_driver;
38 
42 typedef struct {
47 
52 
56  uint8_t write_buffer[CONFIG_TINYVCDIFF_MTD_WRITE_SIZE];
57 
61  size_t offset;
62 } vcdiff_mtd_t;
63 
67 #define VCDIFF_MTD_INIT(DEV) { .dev = DEV }
68 
69 #ifdef __cplusplus
70 }
71 #endif
72 
MTD device descriptor.
Definition: mtd.h:111
Context for the underlying MTD device.
Definition: vcdiff_mtd.h:42
mtd_dev_t * dev
Instance of the backing MTD device.
Definition: vcdiff_mtd.h:46
size_t offset
Current offset on the MTD device.
Definition: vcdiff_mtd.h:61
size_t next_erase_sector
Number of the next sector that must be erased.
Definition: vcdiff_mtd.h:51
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:27