diff options
author | Nick Brassel <nick@tzarc.org> | 2022-11-23 19:50:19 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-23 08:50:19 +0000 |
commit | bebfdad795add9fbc8c6c1393d1b817d542474ed (patch) | |
tree | 1d09d181a2c6a3be74d3e9125f952afe0f1f5ab4 /platforms/chibios/drivers/flash/legacy_flash_ops.h | |
parent | bfdc76181980545b18d9e4d909b62d09895bca9d (diff) |
NVRAM refactor, phase 1. (#18969)
* Rename `eeprom_stm32` to `eeprom_legacy_emulated_flash`.
* Rename `flash_stm32` to `legacy_flash_ops`.
* Rename `eeprom_teensy` to `eeprom_kinetis_flexram`.
Diffstat (limited to 'platforms/chibios/drivers/flash/legacy_flash_ops.h')
-rw-r--r-- | platforms/chibios/drivers/flash/legacy_flash_ops.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/platforms/chibios/drivers/flash/legacy_flash_ops.h b/platforms/chibios/drivers/flash/legacy_flash_ops.h new file mode 100644 index 0000000000..ef80764055 --- /dev/null +++ b/platforms/chibios/drivers/flash/legacy_flash_ops.h @@ -0,0 +1,44 @@ +/* + * This software is experimental and a work in progress. + * Under no circumstances should these files be used in relation to any critical system(s). + * Use of these files is at your own risk. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR + * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * This files are free to use from https://github.com/rogerclarkmelbourne/Arduino_STM32 and + * https://github.com/leaflabs/libmaple + * + * Modifications for QMK and STM32F303 by Yiancar + */ + +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +#ifdef LEGACY_FLASH_OPS_MOCKED +extern uint8_t FlashBuf[MOCK_FLASH_SIZE]; +#endif + +typedef enum { FLASH_BUSY = 1, FLASH_ERROR_PG, FLASH_ERROR_WRP, FLASH_ERROR_OPT, FLASH_COMPLETE, FLASH_TIMEOUT, FLASH_BAD_ADDRESS } FLASH_Status; + +#define IS_FLASH_ADDRESS(ADDRESS) (((ADDRESS) >= 0x08000000) && ((ADDRESS) < 0x0807FFFF)) + +FLASH_Status FLASH_WaitForLastOperation(uint32_t Timeout); +FLASH_Status FLASH_ErasePage(uint32_t Page_Address); +FLASH_Status FLASH_ProgramHalfWord(uint32_t Address, uint16_t Data); + +void FLASH_Unlock(void); +void FLASH_Lock(void); + +#ifdef __cplusplus +} +#endif |