diff options
author | Keith Packard <keithp@keithp.com> | 2019-03-18 17:17:21 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2019-03-18 17:22:22 -0700 |
commit | 65be5d1e07ff4ae619233f3b541b9599c44490ab (patch) | |
tree | 52e3aa8360dce2dddc12b2d9ab9e138c38fe0129 /src/stm32f4/stm32f4.h | |
parent | efc2c093819b3ec2e5743126efb76d3a9c0ad231 (diff) |
altos/stm32f4: Need to read-back register after clock enable
This was reported as necessary; I have no idea, but it's not
expensive, so why not...
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/stm32f4/stm32f4.h')
-rw-r--r-- | src/stm32f4/stm32f4.h | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/src/stm32f4/stm32f4.h b/src/stm32f4/stm32f4.h index dcdce667..3e8ec957 100644 --- a/src/stm32f4/stm32f4.h +++ b/src/stm32f4/stm32f4.h @@ -66,8 +66,8 @@ struct stm_rcc { vuint32_t pad_28; vuint32_t pad_2c; - vuint32_t ahb1enr; - vuint32_t ahb2enr; + vuint32_t _ahb1enr; + vuint32_t _ahb2enr; vuint32_t ahbdnr; vuint32_t pad_3c; @@ -277,6 +277,38 @@ extern struct stm_rcc stm_rcc; #define STM_RCC_DCKCFGR2_I2CFMP1SEL_HSI 2 #define STM_RCC_DCKCFGR2_I2CFMP1SEL_APB_ALSO 3 +static inline void +stm_rcc_ahb1_clk_enable(uint32_t bit) +{ + stm_rcc._ahb1enr |= bit; + uint32_t value = stm_rcc._ahb1enr; + (void) value; +} + +static inline void +stm_rcc_ahb1_clk_disable(uint32_t bit) +{ + stm_rcc._ahb1enr &= ~bit; + uint32_t value = stm_rcc._ahb1enr; + (void) value; +} + +static inline void +stm_rcc_ahb2_clk_enable(uint32_t bit) +{ + stm_rcc._ahb2enr |= bit; + uint32_t value = stm_rcc._ahb2enr; + (void) value; +} + +static inline void +stm_rcc_ahb2_clk_disable(uint32_t bit) +{ + stm_rcc._ahb2enr &= ~bit; + uint32_t value = stm_rcc._ahb2enr; + (void) value; +} + struct stm_ictr { vuint32_t ictr; }; @@ -378,6 +410,8 @@ stm_nvic_get_priority(int irq) { #define isr(name) void stm_ ## name ## _isr(void) +isr(halt); +isr(ignore); isr(nmi); isr(hardfault); isr(memmanage); |