diff options
Diffstat (limited to '02-usart/include')
-rw-r--r-- | 02-usart/include/arch/stm32l4xxx/peripherals/clock.h | 2 | ||||
-rw-r--r-- | 02-usart/include/arch/stm32l4xxx/peripherals/usart.h | 3 | ||||
-rw-r--r-- | 02-usart/include/kern/init.h | 67 | ||||
-rw-r--r-- | 02-usart/include/kern/log.h | 12 |
4 files changed, 84 insertions, 0 deletions
diff --git a/02-usart/include/arch/stm32l4xxx/peripherals/clock.h b/02-usart/include/arch/stm32l4xxx/peripherals/clock.h index 6e461de..6f628fd 100644 --- a/02-usart/include/arch/stm32l4xxx/peripherals/clock.h +++ b/02-usart/include/arch/stm32l4xxx/peripherals/clock.h @@ -123,4 +123,6 @@ int configure_pll( pllm_divisor_t pllm, /* PLL denominator. */ pll_src_t pllsrc /* PLL source */); +uint8_t get_clock_mhz(); + #endif /* CORE_CLOCK_H__ */ diff --git a/02-usart/include/arch/stm32l4xxx/peripherals/usart.h b/02-usart/include/arch/stm32l4xxx/peripherals/usart.h index e42e31e..a1542f4 100644 --- a/02-usart/include/arch/stm32l4xxx/peripherals/usart.h +++ b/02-usart/include/arch/stm32l4xxx/peripherals/usart.h @@ -3,6 +3,7 @@ #include <arch.h> #include <stdint.h> +#include <stdarg.h> #include "kern/common.h" #include "arch/stm32l4xxx/peripherals/rcc.h" @@ -197,5 +198,7 @@ void usart_transmit_str_sync(__IO usart_t* usart, const char* str); void usart_printf(__IO usart_t* usart, const char* fmt, ...); +void usart_vprintf(__IO usart_t* usart, const char* fmt, va_list l); + #endif /* H__USART_ */ diff --git a/02-usart/include/kern/init.h b/02-usart/include/kern/init.h new file mode 100644 index 0000000..737b85f --- /dev/null +++ b/02-usart/include/kern/init.h @@ -0,0 +1,67 @@ +#ifndef INIT_H_ +#define INIT_H_ + +/** Globals annotated with _no_init will not be set during init1 bootup + * where the data segement is loaded from flash and the bss segment is + * cleared. + * + * This is useful for routines that run in the init0 boot procedure + * that need persistent globals. + * + * Note that initializing a global annotated with _no_init will have + * no effect as the variable will remain uninitialized until explicitly + * set by by the program. + */ +#define _no_init \ + __attribute((__section__(".noinit"))) + +#define init0 \ + static void init0fn(); \ + static __attribute((__section__(".init0"))) \ + __attribute((__used__)) \ + void(*init0_ptr)() = init0fn; \ + static void init0fn +#define init1 \ + static void init1fn(); \ + static __attribute((__section__(".init1"))) \ + __attribute((__used__)) \ + void(*init1_ptr)() = init1fn; \ + static void init1fn +#define init2 \ + static void init2fn(); \ + static __attribute((__section__(".init2"))) \ + __attribute((__used__)) \ + void(*init2_ptr)() = init2fn; \ + static void init2fn +#define init3 \ + static void init3fn(); \ + static __attribute((__section__(".init3"))) \ + __attribute((__used__)) \ + void(*init3_ptr)() = init3fn; \ + static void init3fn +#define init4 \ + static void init4fn(); \ + static __attribute((__section__(".init4"))) \ + __attribute((__used__)) \ + void(*init4_ptr)() = init4fn; \ + static void init4fn +#define init5 \ + static void init5fn(); \ + static __attribute((__section__(".init5"))) \ + __attribute((__used__)) \ + void(*init5_ptr)() = init5fn; \ + static void init5fn +#define init6 \ + static void init6fn(); \ + static __attribute((__section__(".init6"))) \ + __attribute((__used__)) \ + void(*init6_ptr)() = init6fn; \ + static void init6fn +#define init7 \ + static void init7fn(); \ + static __attribute((__section__(".init7"))) \ + __attribute((__used__)) \ + void(*init7_ptr)() = init7fn; \ + static void init7fn + +#endif /* INIT_H_ */ diff --git a/02-usart/include/kern/log.h b/02-usart/include/kern/log.h new file mode 100644 index 0000000..5e49def --- /dev/null +++ b/02-usart/include/kern/log.h @@ -0,0 +1,12 @@ +#ifndef LOG_H_ +#define LOG_H_ + +/* + * Defines logging capabilities. This logging unit will enable logging on + * the systems main USART output. + */ + +/** Similar to fprintf, but with a stripped-down format-string DSL. */ +void klogf(const char* fmt, ...); + +#endif |