@@ -52,6 +52,71 @@ void gdb_do_break(void);
5252 */
5353bool gdb_present (void );
5454
55+ // If gdbstub has these set true, then we will disable our own
56+ // usage of them, but use gdbstub's callbacks for them instead
57+ /**
58+ * @brief Check if GDB is installing a putc1 callback.
59+ *
60+ * By default, this function returns false. When GDBStub library is linked,
61+ * this function is overriden and returns true.
62+ *
63+ * @return true if GDB is installing a putc1 callback
64+ */
65+ bool gdbstub_has_putc1_control (void );
66+
67+ /**
68+ * @brief Register a putc1 callback with GDB.
69+ * @param func function GDB will proxy putc1 data to
70+ *
71+ * By default, this function is a no-op. When GDBStub library is linked,
72+ * this function is overriden and sets GDB stub's secondary putc1 callback to
73+ * func. When GDB stub is linked, but a GDB session is not current attached,
74+ * then GDB stub will pass putc1 chars directly to this function.
75+ */
76+ void gdbstub_set_putc1_callback (void (* func )(char ));
77+
78+ /**
79+ * @brief Check if GDB is installing a uart0 isr callback.
80+ *
81+ * By default, this function returns false. When GDBStub library is linked,
82+ * this function is overriden and returns true.
83+ *
84+ * @return true if GDB is installing a uart0 isr callback
85+ */
86+ bool gdbstub_has_uart_isr_control (void );
87+
88+ /**
89+ * @brief Register a uart0 isr callback with GDB.
90+ * @param func function GDB will proxy uart0 isr data to
91+ *
92+ * By default, this function is a no-op. When GDBStub library is linked,
93+ * this function is overriden and sets GDB stub's secondary uart0 isr callback
94+ * to func. When GDB stub is linked, but a GDB session is not current attached,
95+ * then GDB stub will pass uart0 isr data back to this function.
96+ */
97+ void gdbstub_set_uart_isr_callback (void (* func )(void * , uint8_t ), void * arg );
98+
99+ /**
100+ * @brief Write a character for output to a GDB session on uart0.
101+ * @param c character to write
102+ *
103+ * By default, this function is a no-op. When GDBStub library is linked,
104+ * this function is overriden and writes a char to either the GDB session on
105+ * uart0 or directly to uart0 if not GDB session is attached.
106+ */
107+ void gdbstub_write_char (char c );
108+
109+ /**
110+ * @brief Write a char buffer for output to a GDB session on uart0.
111+ * @param buf buffer of data to write
112+ * @param size length of buffer
113+ *
114+ * By default, this function is a no-op. When GDBStub library is linked,
115+ * this function is overriden and writes a buffer to either the GDB session on
116+ * uart0 or directly to uart0 if not GDB session is attached.
117+ */
118+ void gdbstub_write (const char * buf , size_t size );
119+
55120#ifdef __cplusplus
56121}
57122#endif
0 commit comments