debug: Add fence and fence.i to ensure Debug RAM is ready.
[riscv-isa-sim.git] / remote_bitbang.h
1 #ifndef REMOTE_BITBANG_H
2 #define REMOTE_BITBANG_H
3
4 #include <stdint.h>
5
6 #include "jtag_dtm.h"
7
8 class remote_bitbang_t
9 {
10 public:
11 // Create a new server, listening for connections from localhost on the given
12 // port.
13 remote_bitbang_t(uint16_t port, jtag_dtm_t *tap);
14
15 // Do a bit of work.
16 void tick();
17
18 private:
19 jtag_dtm_t *tap;
20
21 int socket_fd;
22 int client_fd;
23
24 static const ssize_t buf_size = 64 * 1024;
25 char recv_buf[buf_size];
26 ssize_t recv_start, recv_end;
27
28 // Check for a client connecting, and accept if there is one.
29 void accept();
30 // Execute any commands the client has for us.
31 void execute_commands();
32 };
33
34 #endif