diff options
author | Keith Packard <keithp@keithp.com> | 2014-05-12 22:55:38 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2014-05-12 22:55:38 -0700 |
commit | 530894f508874f4cb3db644ca9ca679ed704f964 (patch) | |
tree | 6f0744a9eee34ee9028ee26a77a325ca224a6b7f /src/stm/stm32l.h | |
parent | 2c543be5548ccda6bd29a2a7659fcc287f7a9f07 (diff) |
altos/stm: Figure out available flash space based on chip id registers
Look at the flash size and the device id registers to figure out how
much flash is available.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/stm/stm32l.h')
-rw-r--r-- | src/stm/stm32l.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/stm/stm32l.h b/src/stm/stm32l.h index 302f4d24..9226e9cb 100644 --- a/src/stm/stm32l.h +++ b/src/stm/stm32l.h @@ -1492,6 +1492,36 @@ extern struct stm_temp_cal stm_temp_cal; #define stm_temp_cal_cold 25 #define stm_temp_cal_hot 110 +struct stm_dbg_mcu { + uint32_t idcode; +}; + +extern struct stm_dbg_mcu stm_dbg_mcu; + +static inline uint16_t +stm_dev_id(void) { + return stm_dbg_mcu.idcode & 0xfff; +} + +struct stm_flash_size { + uint16_t f_size; +}; + +extern struct stm_flash_size stm_flash_size_medium; +extern struct stm_flash_size stm_flash_size_large; + +/* Returns flash size in bytes */ +extern uint32_t +stm_flash_size(void); + +struct stm_device_id { + uint32_t u_id0; + uint32_t u_id1; + uint32_t u_id2; +}; + +extern struct stm_device_id stm_device_id; + #define STM_NUM_I2C 2 #define STM_I2C_INDEX(channel) ((channel) - 1) |