aboutsummaryrefslogtreecommitdiff
path: root/platforms/chibios/flash_stm32.h
diff options
context:
space:
mode:
Diffstat (limited to 'platforms/chibios/flash_stm32.h')
-rw-r--r--platforms/chibios/flash_stm32.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/platforms/chibios/flash_stm32.h b/platforms/chibios/flash_stm32.h
new file mode 100644
index 000000000..6c66642ec
--- /dev/null
+++ b/platforms/chibios/flash_stm32.h
@@ -0,0 +1,44 @@
1/*
2 * This software is experimental and a work in progress.
3 * Under no circumstances should these files be used in relation to any critical system(s).
4 * Use of these files is at your own risk.
5 *
6 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
7 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
8 * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
9 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
10 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
11 * DEALINGS IN THE SOFTWARE.
12 *
13 * This files are free to use from https://github.com/rogerclarkmelbourne/Arduino_STM32 and
14 * https://github.com/leaflabs/libmaple
15 *
16 * Modifications for QMK and STM32F303 by Yiancar
17 */
18
19#pragma once
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25#include <stdint.h>
26
27#ifdef FLASH_STM32_MOCKED
28extern uint8_t FlashBuf[MOCK_FLASH_SIZE];
29#endif
30
31typedef enum { FLASH_BUSY = 1, FLASH_ERROR_PG, FLASH_ERROR_WRP, FLASH_ERROR_OPT, FLASH_COMPLETE, FLASH_TIMEOUT, FLASH_BAD_ADDRESS } FLASH_Status;
32
33#define IS_FLASH_ADDRESS(ADDRESS) (((ADDRESS) >= 0x08000000) && ((ADDRESS) < 0x0807FFFF))
34
35FLASH_Status FLASH_WaitForLastOperation(uint32_t Timeout);
36FLASH_Status FLASH_ErasePage(uint32_t Page_Address);
37FLASH_Status FLASH_ProgramHalfWord(uint32_t Address, uint16_t Data);
38
39void FLASH_Unlock(void);
40void FLASH_Lock(void);
41
42#ifdef __cplusplus
43}
44#endif