#include "project.h"
int time_known;
static void cmd_dispatch()
{
uint8_t c;
while (!ring_read_byte (&rx1_ring, &c)) {
printf ("KEY> %c\r\n", c);
switch (c) {
case 'R':
scb_reset_system();
break;
case 'G':
gps_reset();
break;
case 'A':
gps_almanac();
break;
}
}
}
static void
board_setup (void)
{
rcc_clock_setup_hse_3v3 (&hse_8mhz_3v3[CLOCK_3V3_168MHZ]);
rcc_periph_clock_enable (RCC_SYSCFG);
rcc_periph_clock_enable (RCC_GPIOA);
rcc_periph_clock_enable (RCC_GPIOB);
rcc_periph_clock_enable (RCC_GPIOC);
rcc_periph_clock_enable (RCC_GPIOD);
rcc_periph_clock_enable (RCC_GPIOE);
rcc_periph_clock_enable (RCC_USART1);
rcc_periph_clock_enable (RCC_USART3);
rcc_periph_clock_enable (RCC_ETHMAC);
rcc_periph_clock_enable (RCC_ETHMACTX);
rcc_periph_clock_enable (RCC_ETHMACRX);
rcc_periph_clock_enable (RCC_ETHMACPTP);
nvic_set_priority (NVIC_EXTI2_IRQ, 0x0);
nvic_set_priority (NVIC_EXTI0_IRQ, 0x10);
nvic_set_priority (NVIC_EXTI15_10_IRQ, 0x20);
nvic_set_priority (NVIC_USART1_IRQ, 0x30);
nvic_set_priority (NVIC_USART3_IRQ, 0x30);
nvic_set_priority (NVIC_ETH_IRQ, 0x40);
nvic_set_priority (NVIC_SYSTICK_IRQ, 0x50);
}
static void
system_init (void)
{
board_setup();
led_init();
ticker_init();
usart_init();
msf_init();
dcf77_init();
printf ("LWIP\r\n");
start_lwip();
printf ("STETH\r\n");
steth_init();
gps_init();
}
int
main (void)
{
system_init();
printf ("Boot\r\n");
#if 0
while (1) {
uint32_t now = SCS_DWT_CYCCNT;
uint64_t abs= abs_extend (now);
EPOCH e = pll_decompose (abs);
time_print_epoch ("TEST: ", e);
delay_ms(100);
}
#endif
while (1) {
#if 0
{
uint32_t now = SCS_DWT_CYCCNT;
uint64_t abs= abs_extend (now);
EPOCH e = pll_decompose (abs);
time_print_epoch ("TEST: ", e);
delay_ms(100);
}
abs_meh();
#endif
msf_dispatch();
dcf77_dispatch();
gps_dispatch();
cmd_dispatch();
dispatch_lwip();
}
return 0;
}
/upstream/commit/target/linux/bcm4908/image/Makefile?h=v22.03.0'>commitdiffstats
|
blob: 7116c2a9f1fb2355dd29707d251be9c85a4ee124 (
plain)