aboutsummaryrefslogtreecommitdiff
path: root/riscv/htif.h
diff options
context:
space:
mode:
authorAndrew Waterman <waterman@s141.Millennium.Berkeley.EDU>2011-06-19 20:47:29 -0700
committerAndrew Waterman <waterman@s141.Millennium.Berkeley.EDU>2011-06-19 20:47:29 -0700
commit77452a26e7d95d29dbaa797595ae683f03a3345b (patch)
treee7aaae682f73a20ceb4d3366528b0cd38378f49d /riscv/htif.h
parent740f981cfd55604d46598144dccac26dd53f643c (diff)
downloadspike-77452a26e7d95d29dbaa797595ae683f03a3345b.zip
spike-77452a26e7d95d29dbaa797595ae683f03a3345b.tar.gz
spike-77452a26e7d95d29dbaa797595ae683f03a3345b.tar.bz2
temporary undoing of renaming
Diffstat (limited to 'riscv/htif.h')
-rw-r--r--riscv/htif.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/riscv/htif.h b/riscv/htif.h
new file mode 100644
index 0000000..0106695
--- /dev/null
+++ b/riscv/htif.h
@@ -0,0 +1,35 @@
+#ifndef _HTIF_H
+#define _HTIF_H
+
+#include <stdint.h>
+
+class sim_t;
+struct packet;
+
+// this class implements the host-target interface for program loading, etc.
+class htif_t
+{
+public:
+ htif_t(int _tohost_fd, int _fromhost_fd);
+ ~htif_t();
+ void init(sim_t* _sim);
+
+ // wait for host to send start command
+ void wait_for_start();
+
+ // we block on the host if the target machine reads the fromhost register,
+ // which provides determinism in tohost/fromhost communication.
+ void wait_for_fromhost_write();
+
+private:
+ sim_t* sim;
+ int tohost_fd;
+ int fromhost_fd;
+ uint16_t seqno;
+
+ void nack(uint16_t seqno);
+ void send_packet(packet* p);
+ int wait_for_packet();
+};
+
+#endif