blob: 8fe68b3dd86731f2afcd51c3d2272029bf036553 [file] [log] [blame]
Joachim Steigerb1a81c12019-07-26 22:13:51 +02001
2#include "board.h"
3#include "utils.h"
4#include "osmocom/core/timer.h"
5
6extern void gpio_test_init(void);
7
8/* returns '1' in case we should break any endless loop */
9static void check_exec_dbg_cmd(void)
10{
11 int ch;
12
13 if (!UART_IsRxReady())
14 return;
15
16 ch = UART_GetChar();
17
18 board_exec_dbg_cmd(ch);
19}
20
21
22extern int main(void)
23{
24 led_init();
25 led_blink(LED_RED, BLINK_ALWAYS_ON);
26 led_blink(LED_GREEN, BLINK_ALWAYS_ON);
27
28 /* Enable watchdog for 2000 ms, with no window */
29 WDT_Enable(WDT, WDT_MR_WDRSTEN | WDT_MR_WDDBGHLT | WDT_MR_WDIDLEHLT |
30 (WDT_GetPeriod(2000) << 16) | WDT_GetPeriod(2000));
31
32 PIO_InitializeInterrupts(0);
33
34
35 printf("\n\r\n\r"
36 "=============================================================================\n\r"
37 "GPIO Test firmware " GIT_VERSION " (C) 2019 Sysmocom GmbH\n\r"
38 "=============================================================================\n\r");
39
40 board_main_top();
41
42 TRACE_INFO("starting gpio test...\n\r");
43 gpio_test_init();
44
45 TRACE_INFO("entering main loop...\n\r");
46 while (1) {
47 WDT_Restart(WDT);
48
49 check_exec_dbg_cmd();
50 osmo_timers_prepare();
51 osmo_timers_update();
52 }
53
54}