diff options
author | Andrew Waterman <andrew@sifive.com> | 2019-03-31 00:49:57 -0700 |
---|---|---|
committer | Andrew Waterman <andrew@sifive.com> | 2019-03-31 00:50:15 -0700 |
commit | f49618ca9d674ec7e596118f85027c4b503862ac (patch) | |
tree | 3b6ad73cbe8760309f930b743950a2853ad17668 /fesvr/htif_pthread.h | |
parent | 61cb96df00067ba61cf3816c74c18aef5677197a (diff) | |
download | spike-static-link.zip spike-static-link.tar.gz spike-static-link.tar.bz2 |
Add fesvr; only globally install fesvr headers/libsstatic-link
Diffstat (limited to 'fesvr/htif_pthread.h')
-rw-r--r-- | fesvr/htif_pthread.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/fesvr/htif_pthread.h b/fesvr/htif_pthread.h new file mode 100644 index 0000000..c00c382 --- /dev/null +++ b/fesvr/htif_pthread.h @@ -0,0 +1,38 @@ +// See LICENSE for license details. + +#ifndef _HTIF_PTHREAD_H +#define _HTIF_PTHREAD_H + +#include "htif.h" +#include "context.h" +#include <deque> + +class htif_pthread_t : public htif_t +{ + public: + htif_pthread_t(int argc, char** argv); + virtual ~htif_pthread_t(); + + // target inteface + void send(const void* buf, size_t size); + void recv(void* buf, size_t size); + bool recv_nonblocking(void* buf, size_t size); + + protected: + // host interface + virtual ssize_t read(void* buf, size_t max_size); + virtual ssize_t write(const void* buf, size_t size); + + virtual size_t chunk_align() { return 64; } + virtual size_t chunk_max_size() { return 1024; } + + private: + context_t host; + context_t* target; + std::deque<char> th_data; + std::deque<char> ht_data; + + static void thread_main(void* htif); +}; + +#endif |