aboutsummaryrefslogtreecommitdiffstats
path: root/src/stm32/internal.h
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2019-07-28 23:15:54 -0400
committerKevinOConnor <kevin@koconnor.net>2019-08-05 11:25:40 -0400
commit8b9cc62359057a686929cc713ffe2931e2203946 (patch)
treeab2e5469d7919cc6ed652e2928f0eaf9a24420c3 /src/stm32/internal.h
parentec3d865b517affd77678e5b1a45ef4691619726d (diff)
downloadkutter-8b9cc62359057a686929cc713ffe2931e2203946.tar.gz
kutter-8b9cc62359057a686929cc713ffe2931e2203946.tar.xz
kutter-8b9cc62359057a686929cc713ffe2931e2203946.zip
stm32: Rename stm32f4/ directory to stm32/
Now that the code in stm32f4/ can handle both stm32f1 and stm32f4 chips, rename the directory to just "stm32". Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/stm32/internal.h')
-rw-r--r--src/stm32/internal.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/stm32/internal.h b/src/stm32/internal.h
new file mode 100644
index 00000000..0edfefe5
--- /dev/null
+++ b/src/stm32/internal.h
@@ -0,0 +1,30 @@
+#ifndef __STM32_INTERNAL_H
+#define __STM32_INTERNAL_H
+// Local definitions for STM32 code
+
+#include "autoconf.h" // CONFIG_MACH_STM32F1
+
+#if CONFIG_MACH_STM32F1
+#include "stm32f1xx.h"
+#else
+#include "stm32f4xx.h"
+#endif
+
+extern GPIO_TypeDef * const digital_regs[];
+
+#define GPIO(PORT, NUM) (((PORT)-'A') * 16 + (NUM))
+#define GPIO2PORT(PIN) ((PIN) / 16)
+#define GPIO2BIT(PIN) (1<<((PIN) % 16))
+
+#define GPIO_INPUT 0
+#define GPIO_OUTPUT 1
+#define GPIO_FUNCTION(fn) (2 | ((fn) << 4))
+#define GPIO_ANALOG 3
+
+void enable_pclock(uint32_t periph_base);
+int is_enabled_pclock(uint32_t periph_base);
+uint32_t get_pclock_frequency(uint32_t periph_base);
+void clock_setup(void);
+void gpio_peripheral(uint32_t gpio, uint32_t mode, int pullup);
+
+#endif // internal.h