summaryrefslogtreecommitdiff
path: root/uart/stm32_uart.h
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2021-09-15 17:05:36 +0200
committerVegard Storheil Eriksen <zyp@jvnv.net>2021-09-15 17:05:36 +0200
commit9801227da93abb418d12804d2ceb56ce04d90c1d (patch)
tree7927fbc98a8ff870a34315d54cf8ad5a38fbb4b7 /uart/stm32_uart.h
parentcb486529482ef66902fd15bbd6e3a3b12ff4fa4b (diff)
uart: Generate instances from platform spec.
Diffstat (limited to 'uart/stm32_uart.h')
-rw-r--r--uart/stm32_uart.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/uart/stm32_uart.h b/uart/stm32_uart.h
new file mode 100644
index 0000000..e4902a5
--- /dev/null
+++ b/uart/stm32_uart.h
@@ -0,0 +1,33 @@
+#pragma once
+
+#include <mmio/mmio.h>
+
+struct STM32_UART_reg_v1_t {
+ volatile uint32_t SR;
+ volatile uint32_t DR;
+ volatile uint32_t BRR;
+ volatile uint32_t CR1;
+ volatile uint32_t CR2;
+ volatile uint32_t CR3;
+ volatile uint32_t GTPR;
+};
+
+struct STM32_UART_reg_v2_t {
+ volatile uint32_t CR1;
+ volatile uint32_t CR2;
+ volatile uint32_t CR3;
+ volatile uint32_t BRR;
+ volatile uint32_t GTPR;
+ volatile uint32_t RTOR;
+ volatile uint32_t RQR;
+ volatile uint32_t ISR;
+ volatile uint32_t ICR;
+ volatile uint32_t RDR;
+ volatile uint32_t TDR;
+};
+
+template <typename T>
+class STM32_UART_t : public mmio_ptr<T> {
+ public:
+ using mmio_ptr<T>::ptr;
+};