628c3a30d566d52e612aa3832d6d2f199ead2295
[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 void wait_for_start();
18 int wait_for_packet();
19
20 private:
21 sim_t* sim;
22 int tohost_fd;
23 int fromhost_fd;
24 bool reset;
25 uint8_t seqno;
26
27 void nack(uint8_t seqno);
28 void send_packet(packet* p);
29 };
30
31 #endif