rogue
Loading...
Searching...
No Matches
XvcConnection.h
Go to the documentation of this file.
1
18#ifndef __ROGUE_PROTOCOLS_XILINX_XVC_CONNECTION_H__
19#define __ROGUE_PROTOCOLS_XILINX_XVC_CONNECTION_H__
20#include "rogue/Directives.h"
21
22#include <netinet/in.h>
23#include <sys/socket.h>
24
25#include <cstdint>
26#include <vector>
27
28#include "rogue/GeneralError.h"
30
31namespace rogue {
32namespace protocols {
33namespace xilinx {
43 int sd_;
44 int wakeFd_; // shutdown self-pipe (read end); owned by Xvc. -1 disables wake path.
45 JtagDriver* drv_;
46 struct sockaddr_in peer_{};
47
48 // just use vectors to back raw memory; DONT use 'size/resize'
49 // (unfortunately 'resize' fills elements beyond the current 'size'
50 // with zeroes)
51
52 uint8_t* rp_ = nullptr;
53 std::vector<uint8_t> rxb_;
54 uint64_t rl_ = 0;
55 uint64_t tl_ = 0;
56
57 std::vector<uint8_t> txb_;
58 uint64_t maxVecLen_;
59 uint64_t supVecLen_;
60 uint64_t chunk_ = 0;
61 int lastErrno_ = 0;
62
63 public:
74 XvcConnection(int sd, int wakeFd, JtagDriver* drv, uint64_t maxVecLen = 32768);
75
81 virtual void fill(uint64_t n);
82
86 virtual void flush();
87
93 virtual void bump(uint64_t n);
94
98 virtual void allocBufs();
99
103 virtual void run();
104
115 ssize_t readTo(void* buf, size_t count);
116
118 int lastErrno() const { return lastErrno_; }
119
121 virtual ~XvcConnection();
122};
123} // namespace xilinx
124} // namespace protocols
125} // namespace rogue
126
127#endif
Base transport driver for the AxisToJtag firmware protocol.
Definition JtagDriver.h:60
Manages one TCP client connection speaking the XVC protocol.
ssize_t readTo(void *buf, size_t count)
Reads up to count bytes, blocking in select() until either data is available on the peer socket OR th...
virtual void flush()
Flushes pending TX buffer bytes to socket.
virtual void fill(uint64_t n)
Ensures at least n bytes are available in RX buffer.
virtual void run()
Runs command processing loop for this connection.
virtual ~XvcConnection()
Closes this XVC TCP sub-connection.
virtual void bump(uint64_t n)
Marks n RX bytes as consumed.
int lastErrno() const
Returns errno from the most recent readTo() failure (-2 return).
virtual void allocBufs()
Allocates/reinitializes internal RX/TX buffers.