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/>.
22 #include "drivers/flash.h"
24 #define FLASHFS_WRITE_BUFFER_SIZE 128
25 #define FLASHFS_WRITE_BUFFER_USABLE (FLASHFS_WRITE_BUFFER_SIZE - 1)
27 // Automatically trigger a flush when this much data is in the buffer
28 #define FLASHFS_WRITE_BUFFER_AUTO_FLUSH_LEN 64
30 void flashfsEraseCompletely(void);
31 void flashfsEraseRange(uint32_t start
, uint32_t end
);
33 void flashfsClose(void);
35 uint32_t flashfsGetSize(void);
36 uint32_t flashfsGetOffset(void);
37 uint32_t flashfsGetWriteBufferFreeSpace(void);
38 uint32_t flashfsGetWriteBufferSize(void);
39 int flashfsIdentifyStartOfFreeSpace(void);
41 void flashfsSeekAbs(uint32_t offset
);
42 void flashfsSeekRel(int32_t offset
);
44 void flashfsWriteByte(uint8_t byte
);
45 void flashfsWrite(const uint8_t *data
, unsigned int len
, bool sync
);
47 int flashfsReadAbs(uint32_t offset
, uint8_t *data
, unsigned int len
);
49 bool flashfsFlushAsync(void);
50 void flashfsFlushSync(void);
52 void flashfsInit(void);
54 bool flashfsIsReady(void);
55 bool flashfsIsEOF(void);