From 446eb86b3c51095a9e13f0d7a633bcc819b156cc Mon Sep 17 00:00:00 2001 From: Karl Palsson Date: Thu, 6 Jan 2022 23:33:46 +0000 Subject: stm32wb: exti: initial registers Basic registers to start with, a lot of commonality, but extra registers on the WB. Signed-off-by --- .gitignore | 1 + SConscript | 1 + exti/SConscript | 21 +++++++++++++++++++++ exti/stm32_exti.h | 33 +++++++++++++++++++++++++++++++++ platforms/stm32/wb.yaml | 5 +++++ 5 files changed, 61 insertions(+) create mode 100644 exti/SConscript create mode 100644 exti/stm32_exti.h diff --git a/.gitignore b/.gitignore index 42cb9aa..8db6560 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ docs # Generated source files: ld_scripts/generated.ld dma/dma.h +exti/exti.h gpio/gpio.h interrupt/interrupt.h interrupt/interrupt_enums.h diff --git a/SConscript b/SConscript index ab20f19..1d228cb 100644 --- a/SConscript +++ b/SConscript @@ -8,6 +8,7 @@ env.SConscript('ld_scripts/SConscript') env.Append( LIB_SOURCES = [ env.SConscript('dma/SConscript'), + env.SConscript('exti/SConscript'), env.SConscript('gpio/SConscript'), env.SConscript('interrupt/SConscript'), env.SConscript('pwr/SConscript'), diff --git a/exti/SConscript b/exti/SConscript new file mode 100644 index 0000000..b620818 --- /dev/null +++ b/exti/SConscript @@ -0,0 +1,21 @@ +Import('env') + +headers = [] +instances = [] +sources = [] +aliases = {} + +periph = env['PLATFORM_SPEC'].get('periph', {}) + +if 'stm32_exti' in periph: + headers.append('stm32_exti.h') + for name, data in periph['stm32_exti'].items(): + instances.append({ + 'type': 'STM32_EXTI_t' % data['type'], + 'name': name, + 'args': [data['offset']], + }) + +env.Jinja2('exti.h', '../templates/periph_instances.h.j2', headers = headers, instances = instances, aliases = aliases) + +Return('sources') diff --git a/exti/stm32_exti.h b/exti/stm32_exti.h new file mode 100644 index 0000000..525a483 --- /dev/null +++ b/exti/stm32_exti.h @@ -0,0 +1,33 @@ +#pragma once + +#include + +struct STM32_EXTI_reg_wb_t { + volatile uint32_t RTSR1; + volatile uint32_t FTSR1; + volatile uint32_t SWIER1; + volatile uint32_t PR1; + uint32_t _reserved1[4]; + volatile uint32_t RTSR2; + volatile uint32_t FTSR2; + volatile uint32_t SWIER2; + volatile uint32_t PR2; + uint32_t _reserved2[20]; + volatile uint32_t IMR1; + volatile uint32_t EMR1; + uint32_t _reserved3[2]; + volatile uint32_t IMR2; + volatile uint32_t EMR2; + uint32_t _reserved4[10]; + volatile uint32_t C2IMR1; + volatile uint32_t C2EMR1; + uint32_t _reserved5[2]; + volatile uint32_t C2IMR2; + volatile uint32_t C2EMR2; +}; + +template +class STM32_EXTI_t : public mmio_ptr { + public: + using mmio_ptr::ptr; +}; diff --git a/platforms/stm32/wb.yaml b/platforms/stm32/wb.yaml index 314b729..5fdb127 100644 --- a/platforms/stm32/wb.yaml +++ b/platforms/stm32/wb.yaml @@ -41,6 +41,11 @@ type: v1 offset: 0x40020800 + stm32_exti: + EXTI: + type: wb + offset: 0x58000800 + stm32_flash: FLASH: type: wb -- cgit v1.2.3