aboutsummaryrefslogtreecommitdiff
path: root/02-usart/include/arch
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2020-11-16 18:20:32 -0700
committerJosh Rahm <joshuarahm@gmail.com>2020-11-16 18:20:32 -0700
commit9f17335c19a6ae91a450e267b5313148644a7a14 (patch)
treef1ae946ada62148913a8cc10bc985f8de926a4a0 /02-usart/include/arch
parent4767c73fb2e1f96469fe24a83b443c1774b01d86 (diff)
downloadstm32l4-9f17335c19a6ae91a450e267b5313148644a7a14.tar.gz
stm32l4-9f17335c19a6ae91a450e267b5313148644a7a14.tar.bz2
stm32l4-9f17335c19a6ae91a450e267b5313148644a7a14.zip
Add DMA header file which defines the DMA registers and add
testing_harness with fake environment to allow testing on x86 development machines.
Diffstat (limited to '02-usart/include/arch')
-rw-r--r--02-usart/include/arch/arm/arch.h20
-rw-r--r--02-usart/include/arch/x86_64/arch.h19
2 files changed, 39 insertions, 0 deletions
diff --git a/02-usart/include/arch/arm/arch.h b/02-usart/include/arch/arm/arch.h
new file mode 100644
index 0000000..904cbdb
--- /dev/null
+++ b/02-usart/include/arch/arm/arch.h
@@ -0,0 +1,20 @@
+#ifndef ARCH_H_
+#define ARCH_H_
+
+
+#define ARCH_STM32L4
+
+#define enable_interrupts() \
+ asm volatile(" cpsie i ")
+
+#define DMA1_BASE (0x40020000)
+#define DMA2_BASE (0x40020400)
+
+#define USART1_BASE (0x40013800)
+#define USART2_BASE (0x40004400)
+
+#define GPIOA_BASE (0x48000000)
+#define GPIOB_BASE (0x48000400)
+#define GPIOC_BASE (0x48000800)
+
+#endif /* ARCH_H_ */
diff --git a/02-usart/include/arch/x86_64/arch.h b/02-usart/include/arch/x86_64/arch.h
new file mode 100644
index 0000000..43f6077
--- /dev/null
+++ b/02-usart/include/arch/x86_64/arch.h
@@ -0,0 +1,19 @@
+#ifndef ARCH_H_
+#define ARCH_H_
+
+#include "fake_env.h"
+
+#define ARCH_PC
+#define enable_interrupts() do {} while(0)
+
+#define DMA1_BASE (load_fake_ahb1__() + 0x0)
+#define DMA2_BASE (load_fake_ahb1__() + 0x400)
+
+#define USART1_BASE (load_fake_apb2__() + 0x3800)
+#define USART2_BASE (load_fake_apb1__() + 0x4400)
+
+#define GPIOA_BASE (load_fake_ahb2__() + 0x0)
+#define GPIOB_BASE (load_fake_ahb2__() + 0x400)
+#define GPIOC_BASE (load_fake_ahb2__() + 0x800)
+
+#endif /* ARCH_H_ */