blob: fcf16ce628664595c802931c48ccfd19431c77fb (
plain)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
#include <stdio.h>
#include <errno.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <inttypes.h>
/* Core */
#include <libopencm3/cm3/systick.h>
#include <libopencm3/cm3/nvic.h>
#include <libopencm3/cm3/cortex.h>
#include <libopencm3/cm3/scs.h>
#include <libopencm3/cm3/scb.h>
/* SoC */
#include <libopencm3/stm32/rcc.h>
#include <libopencm3/stm32/gpio.h>
#include <libopencm3/stm32/usart.h>
#include <libopencm3/stm32/dma.h>
#include <libopencm3/stm32/flash.h>
#include <libopencm3/stm32/i2c.h>
#include <libopencm3/stm32/spi.h>
#include <libopencm3/stm32/adc.h>
#include <libopencm3/stm32/exti.h>
#include <libopencm3/stm32/pwr.h>
#include <libopencm3/stm32/timer.h>
#include <libopencm3/stm32/syscfg.h>
#include <libopencm3/stm32/otg_common.h>
#include <libopencm3/stm32/otg_fs.h>
#include <libopencm3/stm32/desig.h>
/* Drivers */
#include <libopencm3/ethernet/mac_stm32fxx7.h>
#include <libopencm3/ethernet/phy.h>
#include <libopencm3/usb/usbd.h>
#include <libopencm3/usb/cdc.h>
#include <libopencm3/usb/dfu.h>
#include <libopencm3/usb/hid.h>
#include "id.h"
#include <lwip/init.h>
#include <lwip/sys.h>
#include <lwip/udp.h>
#include <lwip/mem.h>
#include <lwip/memp.h>
#include <lwip/timers.h>
#include <lwip/dhcp.h>
#include <netif/etharp.h>
#include "time_fn.h"
#include "pins.h"
#include "events.h"
#include "ring.h"
#include "ubx.h"
#include "gps.h"
#include "prototypes.h"
//#define HZ 10000000
#define HW_CLOCK_HZ 10000000
#define PTP_CLOCK_HZ 168000000
//#define HZ 167999973
//#define HZ 168000000
//#define HZ 167968615
//#define HZ 165925490
//#define HZ 167996682
//
#if 0
#define HW_CLOCK_REG SCS_DWT_CYCCNT
#define HW_CLOCK_LEN 32
#elif 0
#define HW_CLOCK_REG ETH_PTPTSLR
#define HW_CLOCK_LEN 31
#else
#define HW_CLOCK_REG TIM2_CNT
#define HW_CLOCK_LEN 32
#endif
#define TRACE do { stdio_drain(); printf("%s:%d\r\n",__FUNCTION__,__LINE__); } while (0)
static inline void compiler_mb (void)
{
asm volatile ("":::"memory");
}
extern const unsigned char almanac_alp[];
extern unsigned int almanac_alp_len;
extern uint32_t dfu_flag;
|