EVE 1.0
debug-uart.h
1 #ifndef NRF52_DEBUG_INTERFACE_H_INCLUDED
2 #define NRF52_DEBUG_INTERFACE_H_INCLUDED
3 
4 #include <nrf_soc.h>
5 #include <nrf52.h>
6 
7 struct uart_t;
8 
9 #ifndef NRF52_DEBUG_STUB
10 void dbg_setup(void);
11 
12 void dbg_force_enabled(void);
13 
14 void dbg_set_input_handler(void (*handler)(const char *inp, unsigned int len));
15 
16 unsigned int dbg_send_bytes(const unsigned char *seq, unsigned int len);
17 
18 void dbg_putchar(const char ch);
19 
20 void dbg_blocking_putchar(const char ch);
21 
22 void dbg_drain(void);
23 
24 void dbg_panic(void);
25 
26 static inline bool dbg_connected(void)
27 {
28  return ((CoreDebug->DHCSR & CoreDebug_DHCSR_C_DEBUGEN_Msk) != 0);
29 }
30 
31 void dbg_uart_set_uart(const struct uart_t *uart);
32 
33 #else /* NRF52_DEBUG_STUB */
34 
35 #define dbg_setup_uart() do {} while (0)
36 #define dbg_set_input_handler(handler, inp, len) do {} while (0)
37 #define dbg_send_bytes(seq, len) do {} while (0)
38 #define dbg_putchar(ch) do {} while (0)
39 #define dbg_blocking_putchar(ch) do {} while (0)
40 #define dbg_drain() do {} while (0)
41 #define dbg_panic() do {} while (0)
42 #define dbg_connected() (false)
43 
44 #endif /* NRF52_DEBUG_STUB */
45 
46 #endif /* NRF52_DEBUG_INTERFACE_H_INCLUDED */
Definition: uart.h:222
uint32_t seq
Definition: usbnet.h:140