rogue
Loading...
Searching...
No Matches
Xvc.h
Go to the documentation of this file.
1
17#ifndef __ROGUE_PROTOCOLS_XILINX_XVC_H__
18#define __ROGUE_PROTOCOLS_XILINX_XVC_H__
19#include "rogue/Directives.h"
20
21#include <netdb.h>
22#include <netinet/in.h>
23#include <netinet/ip.h>
24#include <stdint.h>
25#include <sys/socket.h>
26
27#include <memory>
28#include <thread>
29
30#include "rogue/GeneralError.h"
31#include "rogue/Logging.h"
32#include "rogue/Queue.h"
38
39namespace rogue {
40namespace protocols {
41namespace xilinx {
43const unsigned int kMaxArgs = 3;
44
61 protected:
62 unsigned mtu_;
63
64 // Use rogue frames to exchange data with other rogue objects
66
67 // Log
68 std::shared_ptr<rogue::Logging> log_;
69
70 // Background server thread.
71 std::thread* thread_;
73
74 // Lock
75 std::mutex mtx_;
76
77 // TCP server thread entry point for Vivado clients.
78 void runThread();
79
80 public:
94 static std::shared_ptr<rogue::protocols::xilinx::Xvc> create(uint16_t port);
95
97 static void setup_python();
98
108 explicit Xvc(uint16_t port);
109
111 ~Xvc();
112
116 void start();
117
121 void stop();
122
131 void acceptFrame(std::shared_ptr<rogue::interfaces::stream::Frame> frame);
132
141 uint64_t getMaxVectorSize() final;
142
158 int xfer(uint8_t* txBuffer,
159 unsigned txBytes,
160 uint8_t* hdBuffer,
161 unsigned hdBytes,
162 uint8_t* rxBuffer,
163 unsigned rxBytes) final;
164};
165
166// Convenience
167typedef std::shared_ptr<rogue::protocols::xilinx::Xvc> XvcPtr;
168} // namespace xilinx
169} // namespace protocols
170} // namespace rogue
171
172#endif
Thread-safe bounded queue with optional busy threshold.
Definition Queue.h:38
Stream master endpoint.
Definition Master.h:65
static std::shared_ptr< rogue::interfaces::stream::Master > create()
Creates a stream master.
Definition Master.cpp:40
Stream slave endpoint and default frame pool.
Definition Slave.h:72
Base transport driver for the AxisToJtag firmware protocol.
Definition JtagDriver.h:68
Rogue XVC bridge between TCP XVC clients and Rogue stream transport.
Definition Xvc.h:60
rogue::Queue< std::shared_ptr< rogue::interfaces::stream::Frame > > queue_
Definition Xvc.h:65
uint64_t getMaxVectorSize() final
Returns maximum vector size supported by this XVC bridge.
Definition Xvc.cpp:121
int xfer(uint8_t *txBuffer, unsigned txBytes, uint8_t *hdBuffer, unsigned hdBytes, uint8_t *rxBuffer, unsigned rxBytes) final
Executes one protocol transfer over Rogue frame transport.
Definition Xvc.cpp:128
void runThread()
Run driver initialization and XVC thread.
Definition Xvc.cpp:98
~Xvc()
Destroys the XVC bridge instance.
Definition Xvc.cpp:61
void start()
Starts XVC server thread and enables bridge operation.
Definition Xvc.cpp:66
std::shared_ptr< rogue::Logging > log_
Definition Xvc.h:68
std::thread * thread_
Definition Xvc.h:71
void acceptFrame(std::shared_ptr< rogue::interfaces::stream::Frame > frame)
Receives reply frame from downstream Rogue transport.
Definition Xvc.cpp:111
void stop()
Stops XVC server thread and drains frame queue.
Definition Xvc.cpp:76
static void setup_python()
Registers Python bindings for this class.
Definition Xvc.cpp:184
std::shared_ptr< rogue::protocols::xilinx::Xvc > XvcPtr
Definition Xvc.h:167
const unsigned int kMaxArgs
Maximum supported argument count for XVC command parsing helpers.
Definition Xvc.h:43