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();
31 void flashfsEraseRange(uint32_t start
, uint32_t end
);
33 uint32_t flashfsGetSize();
34 uint32_t flashfsGetOffset();
35 uint32_t flashfsGetWriteBufferFreeSpace();
36 uint32_t flashfsGetWriteBufferSize();
37 int flashfsIdentifyStartOfFreeSpace();
38 const flashGeometry_t
* flashfsGetGeometry();
40 void flashfsSeekAbs(uint32_t offset
);
41 void flashfsSeekRel(int32_t offset
);
43 void flashfsWriteByte(uint8_t byte
);
44 void flashfsWrite(const uint8_t *data
, unsigned int len
, bool sync
);
46 int flashfsReadAbs(uint32_t offset
, uint8_t *data
, unsigned int len
);
48 bool flashfsFlushAsync();
49 void flashfsFlushSync();
53 bool flashfsIsReady();