4 * gdb_stub/connection --
6 * Definition of external connectivity for the GDB server stub
8 * (c) 2011-2013 Björn Döbel <doebel@os.inf.tu-dresden.de>,
9 * economic rights: Technische Universität Dresden (Germany)
10 * This file is part of TUD:OS and distributed under the terms of the
11 * GNU General Public License 2.
12 * Please see the COPYING-GPL-2 file for details.
17 #include <l4/sys/compiler.h>
20 #include <l4/ankh/client-c.h>
21 #include <l4/ankh/lwip-ankh.h>
24 #include "netif/etharp.h"
25 #include "lwip/tcpip.h"
26 #include "lwip/inet.h"
27 #include "lwip/sockets.h"
28 #include "lwip/netdb.h"
30 #include <semaphore.h>
40 bool startup(unsigned long base);
42 int get_char(bool blocking = true) const;
43 int char_avail() const;
44 void out_char(char c) const;
45 int write_uart(char const* s, unsigned long count) const;
52 virtual ~Connection() { }
54 virtual void setup_and_wait() = 0;
55 virtual void disconnect() = 0;
56 virtual int wait_for_cmd(char * const buf, unsigned bufsize) = 0;
57 virtual int senddata(char const * const buf, unsigned bufsize) = 0;
61 class TCPConnection : public Connection
64 unsigned _port; // local port to listen on
65 struct sockaddr_in _inet, _clnt; // connection info - mine and the client's
66 int _socket; // socket id
67 int _socket_fd; // socket fd
71 TCPConnection(unsigned port)
80 unsigned port() const { return _port; }
83 * remote connection handling
85 virtual void setup_and_wait();
86 virtual void disconnect();
87 virtual int wait_for_cmd(char * const packetbuf, unsigned bufsize);
88 virtual int senddata(char const * const buf, unsigned size);
92 class SerialConnection : public Connection
96 void get_vbus_resources();
102 get_vbus_resources();
105 virtual void setup_and_wait();
106 virtual void disconnect();
107 virtual int wait_for_cmd(char * const buf, unsigned bufsize);
108 virtual int senddata(char const * const buf, unsigned bufsize);