1 /* MSPDebug - debugging tool for MSP430 MCUs
2  * Copyright (C) 2009-2011 Daniel Beer
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17  */
18 
19 #ifndef GDB_PROTO_H_
20 #define GDB_PROTO_H_
21 
22 #define GDB_MAX_XFER    8192
23 #define GDB_BUF_SIZE	(GDB_MAX_XFER * 2 + 64)
24 
25 struct gdb_data {
26 	int             sock;
27 	int             error;
28 
29 	char            xbuf[1024];
30 	int             head;
31 	int             tail;
32 
33 	char            outbuf[GDB_BUF_SIZE];
34 	int             outlen;
35 };
36 
37 void gdb_init(struct gdb_data *d, int sock);
38 void gdb_printf(struct gdb_data *data, const char *fmt, ...);
39 int gdb_send(struct gdb_data *data, const char *msg);
40 void gdb_packet_start(struct gdb_data *data);
41 void gdb_packet_end(struct gdb_data *data);
42 int gdb_peek(struct gdb_data *data, int timeout_ms);
43 int gdb_getc(struct gdb_data *data);
44 int gdb_flush_ack(struct gdb_data *data);
45 int gdb_read_packet(struct gdb_data *data, char *buf);
46 
47 #endif
48