blob: 87084564381bd5aefea7230f8ef9ecf0c8db9a2b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#include "arch.h"
#include "kern/panic.h"
#include "kern/log.h"
#include "kern/init.h"
#include "arch/stm32l4xxx/peripherals/clock.h"
#include "kern/gpio/sysled.h"
#include "kern/gpio/gpio_manager.h"
#include "kern/delay.h"
#include <stdarg.h>
#ifdef ARCH_STM32L4
_Noreturn void panic(const char* fmt, ...)
{
if (get_system_init_level() > INIT_LEVEL_2) {
va_list l;
va_start(l, fmt);
kerr_logf("** Kernel Panic! **\n");
kerr_vlogf(fmt, l);
set_system_clock_MHz(4); /* reduce power usage while we do nothing. */
for(;;);
} else {
set_system_clock_MHz(4); /* reduce power usage while we do nothing. */
gpio_reserved_pin_t pin3 = get_sysled();
for (;;) {
set_gpio_pin_high(pin3);
delay(100000);
set_gpio_pin_low(pin3);
delay(100000);
}
}
}
#endif
|