temporary undoing of renaming
[riscv-isa-sim.git] / riscv / htif.h
1 #ifndef _HTIF_H
2 #define _HTIF_H
3
4 #include <stdint.h>
5
6 class sim_t;
7 struct packet;
8
9 // this class implements the host-target interface for program loading, etc.
10 class htif_t
11 {
12 public:
13 htif_t(int _tohost_fd, int _fromhost_fd);
14 ~htif_t();
15 void init(sim_t* _sim);
16
17 // wait for host to send start command
18 void wait_for_start();
19
20 // we block on the host if the target machine reads the fromhost register,
21 // which provides determinism in tohost/fromhost communication.
22 void wait_for_fromhost_write();
23
24 private:
25 sim_t* sim;
26 int tohost_fd;
27 int fromhost_fd;
28 uint16_t seqno;
29
30 void nack(uint16_t seqno);
31 void send_packet(packet* p);
32 int wait_for_packet();
33 };
34
35 #endif