Fix unused param, add PERIPH_DRIVER flag for F4, tidied up F1 and F3 in prep.
[betaflight.git] / src / main / io / flashfs.h
blob90f1ca9e57313ed1c741c27754d55901e9744906
1 /*
2 * This file is part of Cleanflight.
4 * Cleanflight is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * Cleanflight is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
18 #pragma once
20 #define FLASHFS_WRITE_BUFFER_SIZE 128
21 #define FLASHFS_WRITE_BUFFER_USABLE (FLASHFS_WRITE_BUFFER_SIZE - 1)
23 // Automatically trigger a flush when this much data is in the buffer
24 #define FLASHFS_WRITE_BUFFER_AUTO_FLUSH_LEN 64
26 void flashfsEraseCompletely();
27 void flashfsEraseRange(uint32_t start, uint32_t end);
29 uint32_t flashfsGetSize();
30 uint32_t flashfsGetOffset();
31 uint32_t flashfsGetWriteBufferFreeSpace();
32 uint32_t flashfsGetWriteBufferSize();
33 int flashfsIdentifyStartOfFreeSpace();
34 struct flashGeometry_s;
35 const struct flashGeometry_s* flashfsGetGeometry();
37 void flashfsSeekAbs(uint32_t offset);
38 void flashfsSeekRel(int32_t offset);
40 void flashfsWriteByte(uint8_t byte);
41 void flashfsWrite(const uint8_t *data, unsigned int len, bool sync);
43 int flashfsReadAbs(uint32_t offset, uint8_t *data, unsigned int len);
45 bool flashfsFlushAsync();
46 void flashfsFlushSync();
48 void flashfsInit();
50 bool flashfsIsReady();
51 bool flashfsIsEOF();