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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
|
/* led.c */
extern void led_init(void);
extern void led1_set(int v);
extern void led2_set(int v);
extern void led3_set(int v);
extern void led_clear(void);
extern void led_set(void);
extern void led_blink(unsigned ms);
extern void led_tick(void);
extern void led_slow_tick(void);
/* ticker.c */
extern volatile uint32_t ticks;
extern void delay_us(uint32_t d);
extern void sys_tick_handler(void);
extern void delay_ms(uint32_t d);
extern void ticker_init(void);
/* ring.c */
extern void ring_init(volatile ring_t *r, uint8_t *buf, size_t len);
extern int ring_write_byte(volatile ring_t *r, uint8_t c);
extern int ring_read_byte(volatile ring_t *r, uint8_t *c);
extern int ring_write(volatile ring_t *r, uint8_t *buf, size_t len, int blocking);
extern int ring_empty(volatile ring_t *r);
/* usart.c */
extern volatile ring_t usart2_rx_ring;
extern volatile ring_t usart2_tx_ring;
extern volatile ring_t usart1_rx_ring;
extern volatile ring_t usart1_tx_ring;
extern void usart2_isr(void);
extern void usart2_queue(uint8_t d);
extern void usart2_drain(void);
extern int usart2_write(char *ptr, int len, int blocking);
extern void usart1_isr(void);
extern void usart1_queue(uint8_t d);
extern void usart1_drain(void);
extern int usart1_write(char *ptr, int len, int blocking);
extern void usart_rings_init(void);
extern void usart_init(void);
/* stdio.c */
extern int _open(const char *name, int flags, int mode);
extern int _close(int file);
extern int _write(int file, char *buf, int nbytes);
extern int _read(int file, char *buf, int nbytes);
extern int _fstat(int file, struct stat *st);
extern int _lseek(int file, int offset, int whence);
extern int isatty(int file);
extern void stdio_drain(void);
/* lwip_glue.c */
extern struct netif if0;
extern uint32_t sys_now(void);
extern void dispatch_lwip(void);
extern void start_lwip(void);
/* steth.c */
extern void steth_calculate_mac(void);
extern void eth_isr(void);
extern void steth_isr(void);
extern err_t steth_lwip_init(struct netif *netif);
extern void steth_init(void);
extern void steth_slow_tick(void);
/* msf.c */
extern uint64_t msf_last_happy;
extern void exti1_isr(void);
extern void msf_dispatch(void);
extern void msf_init(void);
/* abs.c */
/* pll.c */
extern void pll_set_offset(EPOCH epoch, uint64_t abs, uint64_t ptp);
extern void pll_dispatch(uint64_t happy, uint64_t edge, uint64_t ptp_edge, const char *src);
extern void pll_check(void);
/* main.c */
extern int time_known;
extern int main(void);
/* time_fn.c */
extern UTC time_epoch_to_utc(EPOCH epoch);
extern EPOCH time_utc_to_epoch(UTC u);
extern void utc_to_str(char *dst, UTC u);
extern void time_print_utc(const char *p, UTC u, const char *t);
extern void time_print_epoch(const char *p, EPOCH e, const char *t);
extern double time_utc_to_tjd(UTC u);
extern double time_utc_to_ra(UTC u);
extern ST time_ra_to_st(double ra);
extern ST time_utc_to_lst(UTC u, double lon);
/* ntp.c */
extern void ntp_init(void);
/* dcf77.c */
extern uint64_t dcf77_last_happy;
extern void exti2_isr(void);
extern void dcf77_dispatch(void);
extern void dcf77_init(void);
/* util.c */
extern int check_parity(uint8_t *d, unsigned s, unsigned e, uint8_t p);
extern unsigned bcd(uint8_t *d, unsigned s, unsigned e);
extern unsigned le_bcd(uint8_t *d, unsigned s, unsigned e);
/* stats.c */
/* gps.c */
extern unsigned gps_sats_searching;
extern unsigned gps_sats_inop;
extern unsigned gps_sats_locked;
extern unsigned gps_sats_with_e;
extern int gps_initting;
extern uint64_t gps_last_happy;
extern void exti9_5_isr(void);
extern double gps_lat;
extern double gps_lon;
extern int gps_utc_diff;
extern int gps_wday;
extern void gps_dispatch(void);
extern int gps_init(void);
extern int gps_almanac(void);
extern void gps_dump_almanac(void);
extern int gps_bs(void);
extern void gps_reset(void);
/* hexdump.c */
extern void hexdump(void *_d, int len);
/* bits.c */
extern void dump_bits(char *wot, uint8_t *bits);
/* max7219.c */
extern void max7219_init(int on);
extern void max7219_report_fix(char fix, char fix2);
extern void max7219_report_svin(int valid, int active);
extern void max7219_dispatch(void);
/* report.c */
extern void report_time(const char *src, EPOCH e, uint64_t abs, const char *info);
/* sysclk.c */
extern void sysclk_event(void);
extern uint64_t sysclk_extend(uint32_t now);
extern void sysclk_dispatch(void);
/* cdcacm.c */
extern ring_t cdcacm_rx_ring;
extern ring_t cdcacm_tx_ring;
extern const struct usb_interface_descriptor comm_iface;
extern const struct usb_interface_descriptor data_iface;
extern const struct usb_iface_assoc_descriptor cdc_iface_assoc;
extern int cdcacm_control_request(usbd_device *usbd_dev, struct usb_setup_data *req, uint8_t **buf, uint16_t *len, usbd_control_complete_callback *complete);
extern void cdcacm_tick(void);
extern int cdcacm_write(char *ptr, int len, int blocking);
extern void cdcacm_set_config(usbd_device *usbd_dev, uint16_t wValue);
extern void cdcacm_rings_init(void);
/* usb.c */
extern uint8_t usbd_control_buffer[128];
extern usbd_device *usb_device;
extern void otg_fs_isr(void);
extern void usb_init(void);
/* dfu.c */
extern const struct usb_dfu_descriptor dfu_function;
extern const struct usb_interface_descriptor dfu_iface;
extern const struct usb_iface_assoc_descriptor dfu_iface_assoc;
extern int dfu_control_request(usbd_device *usbd_dev, struct usb_setup_data *req, uint8_t **buf, uint16_t *len, usbd_control_complete_callback *complete);
/* adc.c */
extern uint8_t pot_brightness;
extern void adc_dispatch(void);
extern void adc_init(void);
/* dummy_kb.c */
extern const struct usb_interface_descriptor dummy_kb_iface;
extern const struct usb_iface_assoc_descriptor dummy_kb_iface_assoc;
/* ref.c */
extern uint64_t ref_last_update;
extern int ref_valid;
extern int ref_offset_known;
extern uint64_t ref_extend_irq(uint32_t now);
extern uint64_t ref_extend(uint32_t now);
extern uint64_t ref_get_irq(void);
extern uint64_t ref_get(void);
extern void ref_slow_tick(void);
extern uint64_t make_happy(uint64_t abs, int64_t shift);
extern void ref_dispatch(uint64_t edge, const char *src);
extern void ref_set_offset(EPOCH epoch, uint64_t abs);
extern EPOCH ref_decompose_diff(int64_t diff);
extern EPOCH ref_decompose(uint64_t abs);
/* ptp.c */
extern int ptp_offset_known;
extern uint64_t ptp_to_u64(uint32_t l, uint32_t h);
extern uint64_t ptp_get(void);
extern void ptp_dispatch(uint64_t edge, const char *src);
extern void ptp_set_offset(EPOCH epoch, uint64_t abs);
extern EPOCH ptp_decompose_diff(int64_t diff);
extern EPOCH ptp_decompose(uint64_t abs);
extern void ptp_slow_tick(void);
|