Skip to content

Commit a5f91f5

Browse files
committed
feat: add rt_prio support to cpp example
1 parent 0101e6e commit a5f91f5

3 files changed

Lines changed: 10 additions & 5 deletions

File tree

example/demo_cpp/inc/DataHandlerPrint.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ class DataHandlerPrint : public DataHandlerAbstract {
3636
UioMemSgdma& desc,
3737
DmaBufferAbstract& mem,
3838
unsigned int num_bytes_per_beat,
39-
uint64_t num_bytes_expected);
39+
uint64_t num_bytes_expected,
40+
bool rt_prio);
4041

4142
std::pair<uint64_t, uint64_t> operator()();
4243
};

example/demo_cpp/src/DataHandlerPrint.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ DataHandlerPrint::DataHandlerPrint(UioAxiDmaIf& dma,
1818
UioMemSgdma& desc,
1919
DmaBufferAbstract& mem,
2020
unsigned int num_bytes_per_beat,
21-
uint64_t num_bytes_expected)
22-
: DataHandlerAbstract{"DataHandlerPrint", dma, desc, mem}
21+
uint64_t num_bytes_expected,
22+
bool rt_prio)
23+
: DataHandlerAbstract{"DataHandlerPrint", dma, desc, mem, true, rt_prio}
2324
, lfsr{std::nullopt}
2425
, _counter_ok{0}
2526
, _counter_total{0}

example/demo_cpp/src/axi_dma_demo.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "udmaio/UioIf.hpp"
2626
#include "udmaio/UioMemSgdma.hpp"
2727
#include <boost/program_options.hpp>
28+
#include <boost/program_options/value_semantic.hpp>
2829

2930
#define TARGET_HW_ZUP 1
3031
#define TARGET_HW_Z7IO 2
@@ -50,7 +51,7 @@ void signal_handler([[maybe_unused]] int signal) {
5051

5152
int main(int argc, char* argv[]) {
5253
bpo::options_description desc("AXI DMA demo");
53-
bool debug, trace;
54+
bool debug, trace, rt_prio;
5455
uint16_t pkt_pause;
5556
uint16_t nr_pkts;
5657
uint32_t pkt_len;
@@ -63,6 +64,7 @@ int main(int argc, char* argv[]) {
6364
("mode", bpo::value<DmaMode>(&mode)->multitoken()->required(), "select operation mode (xdma or uio) - see docs for details")
6465
("debug", bpo::bool_switch(&debug), "enable verbose output (debug level)")
6566
("trace", bpo::bool_switch(&trace), "enable even more verbose output (trace level)")
67+
("rt_prio", bpo::bool_switch(&rt_prio), "enable RT priority for I/O thread")
6668
("pkt_pause", bpo::value<uint16_t>(&pkt_pause)->default_value(10), "pause between pkts - see AXI TG user's manual")
6769
("nr_pkts", bpo::value<uint16_t>(&nr_pkts)->default_value(1), "number of packets to generate - see AXI TG user's manual")
6870
("pkt_len", bpo::value<uint32_t>(&pkt_len)->default_value(1024), "packet length - see AXI TG user's manual")
@@ -132,7 +134,8 @@ int main(int argc, char* argv[]) {
132134
*mem_sgdma,
133135
*udmabuf,
134136
target_hw_consts::lfsr_bytes_per_beat,
135-
nr_pkts * pkt_size};
137+
nr_pkts * pkt_size,
138+
rt_prio};
136139
auto fut = std::async(std::launch::async, std::ref(data_handler));
137140

138141
constexpr int nr_buffers = 32;

0 commit comments

Comments
 (0)