| USRP Hardware Driver and Device Manual Version: 4.10.0.0 UHD and USRP Manual |

Loading...
Searching...
No Matches
chdr_types.hpp
Go to the documentation of this file.
1//
2// Copyright 2019 Ettus Research, a National Instruments Brand
3//
4// SPDX-License-Identifier: GPL-3.0-or-later
5//
6
7#pragma once
8
9#include <uhd/rfnoc/rfnoc_types.hpp>
10#include <uhd/types/endianness.hpp>
11#include <uhd/utils/byteswap.hpp>
12#include <cstdint>
13#include <deque>
14#include <functional>
15#include <list>
16#include <memory>
17#include <optional>
18#include <string>
19#include <vector>
20
21 namespace uhd { namespace rfnoc { namespace chdr {
22
23 enum packet_type_t {
24 PKT_TYPE_MGMT = 0x0,
25 PKT_TYPE_STRS = 0x1,
26 PKT_TYPE_STRC = 0x2,
27 PKT_TYPE_CTRL = 0x4,
28 PKT_TYPE_DATA_NO_TS = 0x6,
29 PKT_TYPE_DATA_WITH_TS = 0x7,
30};
31
32//----------------------------------------------------
33// CHDR Header
34//----------------------------------------------------
35
36 class UHD_API chdr_header
37{
38 public: // Functions
39 chdr_header() = default;
40 chdr_header(const chdr_header& rhs) = default;
41 chdr_header(chdr_header&& rhs) = default;
42
44 chdr_header(uint64_t flat_hdr) : _flat_hdr(flat_hdr) {}
45
47 inline uint8_t get_vc() const
48 {
49 return get_field<uint8_t>(_flat_hdr, VC_OFFSET, VC_WIDTH);
50 }
51
53 inline void set_vc(uint8_t vc)
54 {
55 _flat_hdr = set_field(_flat_hdr, vc, VC_OFFSET, VC_WIDTH);
56 }
57
59 inline bool get_eob() const
60 {
61 return get_field<bool>(_flat_hdr, EOB_OFFSET, EOB_WIDTH);
62 }
63
65 inline void set_eob(bool eob)
66 {
67 _flat_hdr = set_field(_flat_hdr, eob, EOB_OFFSET, EOB_WIDTH);
68 }
69
71 inline bool get_eov() const
72 {
73 return get_field<bool>(_flat_hdr, EOV_OFFSET, EOV_WIDTH);
74 }
75
77 inline void set_eov(bool eov)
78 {
79 _flat_hdr = set_field(_flat_hdr, eov, EOV_OFFSET, EOV_WIDTH);
80 }
81
83 inline packet_type_t get_pkt_type() const
84 {
85 return get_field<packet_type_t>(_flat_hdr, PKT_TYPE_OFFSET, PKT_TYPE_WIDTH);
86 }
87
89 inline void set_pkt_type(packet_type_t pkt_type)
90 {
91 _flat_hdr = set_field(_flat_hdr, pkt_type, PKT_TYPE_OFFSET, PKT_TYPE_WIDTH);
92 }
93
95 inline uint8_t get_num_mdata() const
96 {
97 return get_field<uint8_t>(_flat_hdr, NUM_MDATA_OFFSET, NUM_MDATA_WIDTH);
98 }
99
101 inline void set_num_mdata(uint8_t num_mdata)
102 {
103 _flat_hdr = set_field(_flat_hdr, num_mdata, NUM_MDATA_OFFSET, NUM_MDATA_WIDTH);
104 }
105
107 inline uint16_t get_seq_num() const
108 {
109 return get_field<uint16_t>(_flat_hdr, SEQ_NUM_OFFSET, SEQ_NUM_WIDTH);
110 }
111
113 inline void set_seq_num(uint16_t seq_num)
114 {
115 _flat_hdr = set_field(_flat_hdr, seq_num, SEQ_NUM_OFFSET, SEQ_NUM_WIDTH);
116 }
117
119 inline uint16_t get_length() const
120 {
121 return get_field<uint16_t>(_flat_hdr, LENGTH_OFFSET, LENGTH_WIDTH);
122 }
123
125 inline void set_length(uint16_t length)
126 {
127 _flat_hdr = set_field(_flat_hdr, length, LENGTH_OFFSET, LENGTH_WIDTH);
128 }
129
131 inline uint16_t get_dst_epid() const
132 {
133 return get_field<uint16_t>(_flat_hdr, DST_EPID_OFFSET, DST_EPID_WIDTH);
134 }
135
137 inline void set_dst_epid(uint16_t dst_epid)
138 {
139 _flat_hdr = set_field(_flat_hdr, dst_epid, DST_EPID_OFFSET, DST_EPID_WIDTH);
140 }
141
143 inline uint64_t pack() const
144 {
145 return _flat_hdr;
146 }
147
149 inline operator uint64_t() const
150 {
151 return pack();
152 }
153
155 inline bool operator==(const chdr_header& rhs) const
156 {
157 return _flat_hdr == rhs._flat_hdr;
158 }
159
161 inline bool operator!=(const chdr_header& rhs) const
162 {
163 return _flat_hdr != rhs._flat_hdr;
164 }
165
167 inline const chdr_header& operator=(const chdr_header& rhs)
168 {
169 _flat_hdr = rhs._flat_hdr;
170 return *this;
171 }
172
174 inline const chdr_header& operator=(const uint64_t& rhs)
175 {
176 _flat_hdr = rhs;
177 return *this;
178 }
179
181 const std::string to_string() const;
182
183 private:
184 // The flattened representation of the header stored in host order
185 uint64_t _flat_hdr = 0;
186
187 static constexpr size_t VC_WIDTH = 6;
188 static constexpr size_t EOB_WIDTH = 1;
189 static constexpr size_t EOV_WIDTH = 1;
190 static constexpr size_t PKT_TYPE_WIDTH = 3;
191 static constexpr size_t NUM_MDATA_WIDTH = 5;
192 static constexpr size_t SEQ_NUM_WIDTH = 16;
193 static constexpr size_t LENGTH_WIDTH = 16;
194 static constexpr size_t DST_EPID_WIDTH = 16;
195
196 static constexpr size_t VC_OFFSET = 58;
197 static constexpr size_t EOB_OFFSET = 57;
198 static constexpr size_t EOV_OFFSET = 56;
199 static constexpr size_t PKT_TYPE_OFFSET = 53;
200 static constexpr size_t NUM_MDATA_OFFSET = 48;
201 static constexpr size_t SEQ_NUM_OFFSET = 32;
202 static constexpr size_t LENGTH_OFFSET = 16;
203 static constexpr size_t DST_EPID_OFFSET = 0;
204
205 static inline uint64_t mask(const size_t width)
206 {
207 return ((uint64_t(1) << width) - 1);
208 }
209
210 template <typename field_t>
211 static inline field_t get_field(
212 const uint64_t flat_hdr, const size_t offset, const size_t width)
213 {
214 return static_cast<field_t>((flat_hdr >> offset) & mask(width));
215 }
216
217 template <typename field_t>
218 static inline uint64_t set_field(const uint64_t old_val,
219 const field_t field,
220 const size_t offset,
221 const size_t width)
222 {
223 return (old_val & ~(mask(width) << offset))
224 | ((static_cast<uint64_t>(field) & mask(width)) << offset);
225 }
226};
227
228
229//----------------------------------------------------
230// CHDR Control Packet Payload
231//----------------------------------------------------
232
233 enum ctrl_status_t {
234 CMD_OKAY = 0x0,
235 CMD_CMDERR = 0x1,
236 CMD_TSERR = 0x2,
237 CMD_WARNING = 0x3,
238};
239
240 enum ctrl_opcode_t {
241 OP_SLEEP = 0x0,
242 OP_WRITE = 0x1,
243 OP_READ = 0x2,
244 OP_READ_WRITE = 0x3,
245 OP_BLOCK_WRITE = 0x4,
246 OP_BLOCK_READ = 0x5,
247 OP_POLL = 0x6,
248 OP_USER1 = 0xA,
249 OP_USER2 = 0xB,
250 OP_USER3 = 0xC,
251 OP_USER4 = 0xD,
252 OP_USER5 = 0xE,
253 OP_USER6 = 0xF,
254};
255
256 class UHD_API ctrl_payload
257{
258 public: // Members
260 uint16_t dst_port = 0;
262 uint16_t src_port = 0;
264 uint8_t seq_num = 0;
266 std::optional<uint64_t> timestamp{};
268 bool is_ack = false;
270 uint16_t src_epid = 0;
272 uint32_t address = 0;
274 std::vector<uint32_t> data_vtr = {0};
276 uint8_t byte_enable = 0xF;
278 ctrl_opcode_t op_code = OP_SLEEP;
280 ctrl_status_t status = CMD_OKAY;
281
282 public: // Functions
283 ctrl_payload() = default;
284 ctrl_payload(const ctrl_payload& rhs) = default;
285 ctrl_payload(ctrl_payload&& rhs) = default;
286
287 ctrl_payload& operator=(const ctrl_payload& rhs) = default;
288
290 void populate_header(chdr_header& header) const;
291
293 size_t serialize(uint64_t* buff,
294 size_t max_size_bytes,
295 const std::function<uint64_t(uint64_t)>& conv_byte_order) const;
296
298 template <endianness_t endianness>
299 size_t serialize(uint64_t* buff, size_t max_size_bytes) const
300 {
301 auto conv_byte_order = [](uint64_t x) -> uint64_t {
302 return (endianness == uhd::ENDIANNESS_BIG) ? uhd::htonx<uint64_t>(x)
303 : uhd::htowx<uint64_t>(x);
304 };
305 return serialize(buff, max_size_bytes, conv_byte_order);
306 }
307
312 void deserialize(const uint64_t* buff,
313 size_t buff_size,
314 const std::function<uint64_t(uint64_t)>& conv_byte_order);
315
319 template <endianness_t endianness>
320 void deserialize(const uint64_t* buff, size_t buff_size)
321 {
322 auto conv_byte_order = [](uint64_t x) -> uint64_t {
323 return (endianness == uhd::ENDIANNESS_BIG) ? uhd::ntohx<uint64_t>(x)
324 : uhd::wtohx<uint64_t>(x);
325 };
326 deserialize(buff, buff_size, conv_byte_order);
327 }
328
330 size_t get_length() const;
331
332 // Return whether or not we have a valid timestamp
333 bool has_timestamp() const
334 {
335 return bool(timestamp);
336 }
337
339 bool operator==(const ctrl_payload& rhs) const;
340
342 inline bool operator!=(const ctrl_payload& rhs) const
343 {
344 return !(*this == rhs);
345 }
346
348 std::string to_string() const;
349
350 private:
351 static constexpr size_t DST_PORT_WIDTH = 10;
352 static constexpr size_t SRC_PORT_WIDTH = 10;
353 static constexpr size_t NUM_DATA_WIDTH = 4;
354 static constexpr size_t SEQ_NUM_WIDTH = 6;
355 static constexpr size_t HAS_TIME_WIDTH = 1;
356 static constexpr size_t IS_ACK_WIDTH = 1;
357 static constexpr size_t SRC_EPID_WIDTH = 16;
358 static constexpr size_t ADDRESS_WIDTH = 20;
359 static constexpr size_t BYTE_ENABLE_WIDTH = 4;
360 static constexpr size_t OPCODE_WIDTH = 4;
361 static constexpr size_t STATUS_WIDTH = 2;
362
363 // Offsets assume 64-bit alignment
364 static constexpr size_t DST_PORT_OFFSET = 0;
365 static constexpr size_t SRC_PORT_OFFSET = 10;
366 static constexpr size_t NUM_DATA_OFFSET = 20;
367 static constexpr size_t SEQ_NUM_OFFSET = 24;
368 static constexpr size_t HAS_TIME_OFFSET = 30;
369 static constexpr size_t IS_ACK_OFFSET = 31;
370 static constexpr size_t SRC_EPID_OFFSET = 32;
371 static constexpr size_t ADDRESS_OFFSET = 0;
372 static constexpr size_t BYTE_ENABLE_OFFSET = 20;
373 static constexpr size_t OPCODE_OFFSET = 24;
374 static constexpr size_t STATUS_OFFSET = 30;
375 static constexpr size_t LO_DATA_OFFSET = 0;
376 static constexpr size_t HI_DATA_OFFSET = 32;
377};
378
379//----------------------------------------------------
380// CHDR Stream Status Packet Payload
381//----------------------------------------------------
382
383 enum strs_status_t {
384 STRS_OKAY = 0x0,
385 STRS_CMDERR = 0x1,
386 STRS_SEQERR = 0x2,
387 STRS_DATAERR = 0x3,
388 STRS_RTERR = 0x4,
389};
390
391 class UHD_API strs_payload
392{
393 public: // Members
395 uint16_t src_epid = 0;
397 strs_status_t status = STRS_OKAY;
399 uint64_t capacity_bytes = 0;
401 uint32_t capacity_pkts = 0;
403 uint64_t xfer_count_bytes = 0;
405 uint64_t xfer_count_pkts = 0;
407 uint16_t buff_info = 0;
409 union {
410 uint64_t info = 0;
411 struct
412 {
413 uint16_t last_control_seq_num : 16;
414 uint16_t expected_seq_num : 16;
415 uint16_t reserved_1 : 12;
416 bool stop_on_seq_error_enabled : 1;
417 bool seq_error_occoured : 1;
418 bool reserved_2 : 1;
419 bool flow_control_due : 1;
420 } status;
421 struct
422 {
423 uint16_t current_seq_num : 16;
424 uint16_t expected_seq_num : 16;
425 uint8_t chdr_packet_type : 3;
426 uint16_t reserved_1 : 9;
427 bool stop_on_seq_error_enabled : 1;
428 bool seq_error_occoured : 1;
429 bool reserved_2 : 1;
430 bool reserved_3 : 1;
431 } sequence_error;
432 struct
433 {
434 uint16_t dest_epid : 16;
435 uint16_t this_epid : 16;
436 uint32_t reserved_1 : 32;
437 } routing_error;
438 } status_info;
439
440 public: // Functions
441 strs_payload() = default;
442 strs_payload(const strs_payload& rhs) = default;
443 strs_payload(strs_payload&& rhs) = default;
444
445 strs_payload& operator=(const strs_payload& rhs) = default;
446
448 void populate_header(chdr_header& header) const;
449
451 size_t serialize(uint64_t* buff,
452 size_t max_size_bytes,
453 const std::function<uint64_t(uint64_t)>& conv_byte_order) const;
454
456 template <endianness_t endianness>
457 size_t serialize(uint64_t* buff, size_t max_size_bytes) const
458 {
459 auto conv_byte_order = [](uint64_t x) -> uint64_t {
460 return (endianness == uhd::ENDIANNESS_BIG) ? uhd::htonx<uint64_t>(x)
461 : uhd::htowx<uint64_t>(x);
462 };
463 return serialize(buff, max_size_bytes, conv_byte_order);
464 }
465
470 void deserialize(const uint64_t* buff,
471 size_t buff_size,
472 const std::function<uint64_t(uint64_t)>& conv_byte_order);
473
477 template <endianness_t endianness>
478 void deserialize(const uint64_t* buff, size_t buff_size)
479 {
480 auto conv_byte_order = [](uint64_t x) -> uint64_t {
481 return (endianness == uhd::ENDIANNESS_BIG) ? uhd::ntohx<uint64_t>(x)
482 : uhd::wtohx<uint64_t>(x);
483 };
484 deserialize(buff, buff_size, conv_byte_order);
485 }
486
488 size_t get_length() const;
489
491 bool operator==(const strs_payload& rhs) const;
492
494 inline bool operator!=(const strs_payload& rhs) const
495 {
496 return !(*this == rhs);
497 }
498
500 std::string to_string() const;
501
502 private:
503 static constexpr size_t SRC_EPID_WIDTH = 16;
504 static constexpr size_t STATUS_WIDTH = 4;
505 static constexpr size_t CAPACITY_BYTES_WIDTH = 40;
506 static constexpr size_t CAPACITY_PKTS_WIDTH = 24;
507 static constexpr size_t XFER_COUNT_PKTS_WIDTH = 40;
508 static constexpr size_t BUFF_INFO_WIDTH = 16;
509 static constexpr size_t STATUS_INFO_WIDTH = 48;
510
511 // Offsets assume 64-bit alignment
512 static constexpr size_t SRC_EPID_OFFSET = 0;
513 static constexpr size_t STATUS_OFFSET = 16;
514 static constexpr size_t CAPACITY_BYTES_OFFSET = 24;
515 static constexpr size_t CAPACITY_PKTS_OFFSET = 0;
516 static constexpr size_t XFER_COUNT_PKTS_OFFSET = 24;
517 static constexpr size_t BUFF_INFO_OFFSET = 0;
518 static constexpr size_t STATUS_INFO_OFFSET = 16;
519};
520
521//----------------------------------------------------
522// CHDR Stream Command Packet Payload
523//----------------------------------------------------
524
525 enum strc_op_code_t {
526 STRC_INIT = 0x0,
527 STRC_PING = 0x1,
528 STRC_RESYNC = 0x2,
529};
530
531 class UHD_API strc_payload
532{
533 public: // Members
535 uint16_t src_epid = 0;
537 strc_op_code_t op_code = STRC_INIT;
539 uint8_t op_data = 0;
541 uint64_t num_pkts = 0;
543 uint64_t num_bytes = 0;
545 static constexpr size_t MAX_PACKET_SIZE = 128;
546
547 public: // Functions
548 strc_payload() = default;
549 strc_payload(const strc_payload& rhs) = default;
550 strc_payload(strc_payload&& rhs) = default;
551
552 strc_payload& operator=(const strc_payload& rhs) = default;
553
555 void populate_header(chdr_header& header) const;
556
558 size_t serialize(uint64_t* buff,
559 size_t max_size_bytes,
560 const std::function<uint64_t(uint64_t)>& conv_byte_order) const;
561
563 template <endianness_t endianness>
564 size_t serialize(uint64_t* buff, size_t max_size_bytes) const
565 {
566 auto conv_byte_order = [](uint64_t x) -> uint64_t {
567 return (endianness == uhd::ENDIANNESS_BIG) ? uhd::htonx<uint64_t>(x)
568 : uhd::htowx<uint64_t>(x);
569 };
570 return serialize(buff, max_size_bytes, conv_byte_order);
571 }
572
577 void deserialize(const uint64_t* buff,
578 size_t buff_size,
579 const std::function<uint64_t(uint64_t)>& conv_byte_order);
580
584 template <endianness_t endianness>
585 void deserialize(const uint64_t* buff, size_t buff_size)
586 {
587 auto conv_byte_order = [](uint64_t x) -> uint64_t {
588 return (endianness == uhd::ENDIANNESS_BIG) ? uhd::ntohx<uint64_t>(x)
589 : uhd::wtohx<uint64_t>(x);
590 };
591 deserialize(buff, buff_size, conv_byte_order);
592 }
593
595 size_t get_length() const;
596
598 bool operator==(const strc_payload& rhs) const;
599
601 inline bool operator!=(const strc_payload& rhs) const
602 {
603 return !(*this == rhs);
604 }
605
607 std::string to_string() const;
608
609 private:
610 static constexpr size_t SRC_EPID_WIDTH = 16;
611 static constexpr size_t OP_CODE_WIDTH = 4;
612 static constexpr size_t OP_DATA_WIDTH = 4;
613 static constexpr size_t NUM_PKTS_WIDTH = 40;
614
615 // Offsets assume 64-bit alignment
616 static constexpr size_t SRC_EPID_OFFSET = 0;
617 static constexpr size_t OP_CODE_OFFSET = 16;
618 static constexpr size_t OP_DATA_OFFSET = 20;
619 static constexpr size_t NUM_PKTS_OFFSET = 24;
620};
621
622//----------------------------------------------------
623// CHDR Management Packet Payload
624//----------------------------------------------------
625
627// An operation consists of an operation code and some
628// payload associated with that operation.
629 class UHD_API mgmt_op_t
630{
631 public:
632 // Operation code
633 // Note that a management packet has 8 bits available for op codes. The
634 // values for these enums are used to construct the packets, so these values
635 // must match the values in rfnoc_chdr_internal_utils.vh.
636 enum op_code_t {
638 MGMT_OP_NOP = 0,
640 MGMT_OP_ADVERTISE = 1,
642 MGMT_OP_SEL_DEST = 2,
644 MGMT_OP_RETURN = 3,
646 MGMT_OP_INFO_REQ = 4,
648 MGMT_OP_INFO_RESP = 5,
650 MGMT_OP_CFG_WR_REQ = 6,
652 MGMT_OP_CFG_RD_REQ = 7,
654 MGMT_OP_CFG_RD_RESP = 8
655 };
656
658 using payload_t = uint64_t;
659
661 struct sel_dest_payload
662 {
663 const uint16_t dest;
664
665 sel_dest_payload(uint16_t dest_) : dest(dest_) {}
666 sel_dest_payload(payload_t payload_) : dest(static_cast<uint16_t>(payload_)) {}
667 operator payload_t() const
668 {
669 return static_cast<payload_t>(dest);
670 }
671 };
672
675 struct cfg_payload
676 {
677 const uint16_t addr;
678 const uint32_t data;
679
680 cfg_payload(uint16_t addr_, uint32_t data_ = 0) : addr(addr_), data(data_) {}
681 cfg_payload(payload_t payload_)
682 : addr(static_cast<uint16_t>(payload_ >> 0))
683 , data(static_cast<uint32_t>(payload_ >> 16))
684 {
685 }
686 operator payload_t() const
687 {
688 return ((static_cast<payload_t>(data) << 16) | static_cast<payload_t>(addr));
689 }
690 };
691
693 struct node_info_payload
694 {
695 const uint16_t device_id;
696 const uint8_t node_type;
697 const uint16_t node_inst;
698 const uint32_t ext_info;
699
700 node_info_payload(uint16_t device_id_,
701 uint8_t node_type_,
702 uint16_t node_inst_,
703 uint32_t ext_info_)
704 : device_id(device_id_)
705 , node_type(node_type_)
706 , node_inst(node_inst_)
707 , ext_info(ext_info_)
708 {
709 }
710 node_info_payload(payload_t payload_)
711 : device_id(static_cast<uint16_t>(payload_ >> 0))
712 , node_type(static_cast<uint8_t>((payload_ >> 16) & 0xF))
713 , node_inst(static_cast<uint16_t>((payload_ >> 20) & 0x3FF))
714 , ext_info(static_cast<uint32_t>((payload_ >> 30) & 0x3FFFF))
715 {
716 }
717 operator payload_t() const
718 {
719 return ((static_cast<payload_t>(device_id) << 0)
720 | (static_cast<payload_t>(node_type & 0xF) << 16)
721 | (static_cast<payload_t>(node_inst & 0x3FF) << 20)
722 | (static_cast<payload_t>(ext_info & 0x3FFFF) << 30));
723 }
724 };
725
726 mgmt_op_t(const op_code_t op_code,
727 const payload_t op_payload = 0,
728 const uint8_t ops_pending = 0)
729 : _op_code(op_code), _op_payload(op_payload), _ops_pending(ops_pending)
730 {
731 }
732
733 mgmt_op_t(const mgmt_op_t& rhs) = default;
734 mgmt_op_t& operator=(const mgmt_op_t& rhs) = default;
735
736
738 // Note that ops_pending is not used by UHD, since it can infer this value
739 // from the ops vector in mgmt_hop_t. It is needed only by the CHDR
740 // dissector.
741 inline uint8_t get_ops_pending() const
742 {
743 return _ops_pending;
744 }
745
747 inline op_code_t get_op_code() const
748 {
749 return _op_code;
750 }
751
753 inline uint64_t get_op_payload() const
754 {
755 return _op_payload;
756 }
757
759 inline bool operator==(const mgmt_op_t& rhs) const
760 {
761 return (_op_code == rhs._op_code) && (_op_payload == rhs._op_payload);
762 }
763
765 std::string to_string() const;
766
767 private:
768 op_code_t _op_code;
769 payload_t _op_payload;
770 uint8_t _ops_pending;
771};
772
774// A hop is a collection for management transactions for
775// a single node.
776 class UHD_API mgmt_hop_t
777{
778 public:
779 mgmt_hop_t() = default;
780 mgmt_hop_t(const mgmt_hop_t& rhs) = default;
781
783 // Operations are added to the hop in FIFO order and executed in FIFO order.
784 inline void add_op(const mgmt_op_t& op)
785 {
786 _ops.push_back(op);
787 }
788
790 inline size_t get_num_ops() const
791 {
792 return _ops.size();
793 }
794
796 inline const mgmt_op_t& get_op(size_t i) const
797 {
798 return _ops.at(i);
799 }
800
802 // The RFNoC Specification section 2.2.6 specifies that for chdr widths
803 // greater than 64, all MSBs are 0, so we pad out the hop based on the width
804 size_t serialize(std::vector<uint64_t>& target,
805 const std::function<uint64_t(uint64_t)>& conv_byte_order,
806 const size_t padding_size) const;
807
809 // The RFNoC Specification section 2.2.6 specifies that for chdr widths
810 // greater than 64, all MSBs are 0, so we remove padding based on the width
811 void deserialize(std::list<uint64_t>& src,
812 const std::function<uint64_t(uint64_t)>& conv_byte_order,
813 const size_t padding_size);
814
816 inline bool operator==(const mgmt_hop_t& rhs) const
817 {
818 return _ops == rhs._ops;
819 }
820
822 std::string to_string() const;
823
824 private:
825 std::vector<mgmt_op_t> _ops;
826};
827
829// A transaction is a collection of hops, where each hop is a collection
830// of management transactions.
831 class UHD_API mgmt_payload
832{
833 public:
834 mgmt_payload() = default;
835 mgmt_payload(const mgmt_payload& rhs) = default;
836 mgmt_payload(mgmt_payload&& rhs) = default;
837
838 mgmt_payload& operator=(const mgmt_payload& rhs) = default;
839
840 inline void set_header(sep_id_t src_epid, uint16_t protover, chdr_w_t chdr_w)
841 {
842 set_src_epid(src_epid);
843 set_chdr_w(chdr_w);
844 set_proto_ver(protover);
845 }
846
848 // Hops are added to the hop in FIFO order and executed in FIFO order.
849 inline void add_hop(const mgmt_hop_t& hop)
850 {
851 _hops.push_back(hop);
852 }
853
855 inline size_t get_num_hops() const
856 {
857 return _hops.size();
858 }
859
861 inline const mgmt_hop_t& get_hop(size_t i) const
862 {
863 return _hops.at(i);
864 }
865
867 inline mgmt_hop_t pop_hop()
868 {
869 auto hop = _hops.front();
870 _hops.pop_front();
871 return hop;
872 }
873
874 inline size_t get_size_bytes() const
875 {
876 size_t num_lines = 1; /* header */
877 for (const auto& hop : _hops) {
878 num_lines += hop.get_num_ops();
879 }
880 return num_lines * (chdr_w_to_bits(_chdr_w) / 8);
881 }
882
884 void populate_header(chdr_header& header) const;
885
887 size_t serialize(uint64_t* buff,
888 size_t max_size_bytes,
889 const std::function<uint64_t(uint64_t)>& conv_byte_order) const;
890
892 template <endianness_t endianness>
893 size_t serialize(uint64_t* buff, size_t max_size_bytes) const
894 {
895 auto conv_byte_order = [](uint64_t x) -> uint64_t {
896 return (endianness == uhd::ENDIANNESS_BIG) ? uhd::htonx<uint64_t>(x)
897 : uhd::htowx<uint64_t>(x);
898 };
899 return serialize(buff, max_size_bytes, conv_byte_order);
900 }
901
906 void deserialize(const uint64_t* buff,
907 size_t buff_size,
908 const std::function<uint64_t(uint64_t)>& conv_byte_order);
909
913 template <endianness_t endianness>
914 void deserialize(const uint64_t* buff, size_t buff_size)
915 {
916 auto conv_byte_order = [](uint64_t x) -> uint64_t {
917 return (endianness == uhd::ENDIANNESS_BIG) ? uhd::ntohx<uint64_t>(x)
918 : uhd::wtohx<uint64_t>(x);
919 };
920 deserialize(buff, buff_size, conv_byte_order);
921 }
922
924 size_t get_length() const;
925
927 std::string to_string() const;
928
930 std::string hops_to_string() const;
931
933 inline sep_id_t get_src_epid() const
934 {
935 return _src_epid;
936 }
937
939 inline void set_src_epid(sep_id_t src_epid)
940 {
941 _src_epid = src_epid;
942 }
943
945 bool operator==(const mgmt_payload& rhs) const;
946
948 inline chdr_w_t get_chdr_w() const
949 {
950 return _chdr_w;
951 }
952
954 inline void set_chdr_w(chdr_w_t chdr_w)
955 {
956 _chdr_w = chdr_w;
957 _padding_size = (chdr_w_to_bits(_chdr_w) / 64) - 1;
958 }
959
961 inline uint16_t get_proto_ver() const
962 {
963 return _protover;
964 }
965
967 inline void set_proto_ver(uint16_t proto_ver)
968 {
969 _protover = proto_ver;
970 }
971
972 private:
973 sep_id_t _src_epid = 0;
974 uint16_t _protover = 0;
975 chdr_w_t _chdr_w = CHDR_W_64;
976 size_t _padding_size = 0;
977 std::deque<mgmt_hop_t> _hops;
978};
979
981 template <typename payload_t>
982 constexpr packet_type_t payload_to_packet_type();
983
984 template <>
985 constexpr packet_type_t payload_to_packet_type<ctrl_payload>()
986{
987 return PKT_TYPE_CTRL;
988}
989
990 template <>
991 constexpr packet_type_t payload_to_packet_type<mgmt_payload>()
992{
993 return PKT_TYPE_MGMT;
994}
995
996 template <>
997 constexpr packet_type_t payload_to_packet_type<strc_payload>()
998{
999 return PKT_TYPE_STRC;
1000}
1001
1002 template <>
1003 constexpr packet_type_t payload_to_packet_type<strs_payload>()
1004{
1005 return PKT_TYPE_STRS;
1006}
1007
1008}}} // namespace uhd::rfnoc::chdr
byteswap.hpp
uhd::rfnoc::chdr::chdr_header
Definition chdr_types.hpp:37
uhd::rfnoc::chdr::chdr_header::set_vc
void set_vc(uint8_t vc)
Set the virtual channel field (6 bits).
Definition chdr_types.hpp:53
uhd::rfnoc::chdr::chdr_header::set_eob
void set_eob(bool eob)
Set the end-of-burst flag (1 bit).
Definition chdr_types.hpp:65
uhd::rfnoc::chdr::chdr_header::get_vc
uint8_t get_vc() const
Get the virtual channel field (6 bits).
Definition chdr_types.hpp:47
uhd::rfnoc::chdr::chdr_header::set_pkt_type
void set_pkt_type(packet_type_t pkt_type)
Set the packet type field (3 bits).
Definition chdr_types.hpp:89
uhd::rfnoc::chdr::chdr_header::to_string
const std::string to_string() const
Return a string representation of this object.
uhd::rfnoc::chdr::chdr_header::chdr_header
chdr_header(const chdr_header &rhs)=default
uhd::rfnoc::chdr::chdr_header::chdr_header
chdr_header(uint64_t flat_hdr)
Unpack the header from a uint64_t.
Definition chdr_types.hpp:44
uhd::rfnoc::chdr::chdr_header::set_length
void set_length(uint16_t length)
Set the packet length field (16 bits).
Definition chdr_types.hpp:125
uhd::rfnoc::chdr::chdr_header::operator!=
bool operator!=(const chdr_header &rhs) const
Comparison operator (!=).
Definition chdr_types.hpp:161
uhd::rfnoc::chdr::chdr_header::pack
uint64_t pack() const
Pack the header into a uint64_t.
Definition chdr_types.hpp:143
uhd::rfnoc::chdr::chdr_header::get_seq_num
uint16_t get_seq_num() const
Get the sequence number field (16 bits).
Definition chdr_types.hpp:107
uhd::rfnoc::chdr::chdr_header::set_dst_epid
void set_dst_epid(uint16_t dst_epid)
Set the destination EPID field (16 bits).
Definition chdr_types.hpp:137
uhd::rfnoc::chdr::chdr_header::get_length
uint16_t get_length() const
Get the packet length field (16 bits).
Definition chdr_types.hpp:119
uhd::rfnoc::chdr::chdr_header::chdr_header
chdr_header(chdr_header &&rhs)=default
uhd::rfnoc::chdr::chdr_header::get_eov
bool get_eov() const
Get the end-of-vector flag (1 bit).
Definition chdr_types.hpp:71
uhd::rfnoc::chdr::chdr_header::get_pkt_type
packet_type_t get_pkt_type() const
Get the packet type field (3 bits).
Definition chdr_types.hpp:83
uhd::rfnoc::chdr::chdr_header::chdr_header
chdr_header()=default
uhd::rfnoc::chdr::chdr_header::get_eob
bool get_eob() const
Get the end-of-burst flag (1 bit).
Definition chdr_types.hpp:59
uhd::rfnoc::chdr::chdr_header::get_num_mdata
uint8_t get_num_mdata() const
Get number of metadata words field (5 bits).
Definition chdr_types.hpp:95
uhd::rfnoc::chdr::chdr_header::set_eov
void set_eov(bool eov)
Set the end-of-vector flag (1 bit).
Definition chdr_types.hpp:77
uhd::rfnoc::chdr::chdr_header::get_dst_epid
uint16_t get_dst_epid() const
Get the destination EPID field (16 bits).
Definition chdr_types.hpp:131
uhd::rfnoc::chdr::chdr_header::set_num_mdata
void set_num_mdata(uint8_t num_mdata)
Set number of metadata words field (5 bits).
Definition chdr_types.hpp:101
uhd::rfnoc::chdr::chdr_header::set_seq_num
void set_seq_num(uint16_t seq_num)
Set the sequence number field (16 bits).
Definition chdr_types.hpp:113
uhd::rfnoc::chdr::chdr_header::operator=
const chdr_header & operator=(const chdr_header &rhs)
Assignment operator (=) from a chdr_header.
Definition chdr_types.hpp:167
uhd::rfnoc::chdr::chdr_header::operator=
const chdr_header & operator=(const uint64_t &rhs)
Assignment operator (=) from a uint64_t.
Definition chdr_types.hpp:174
uhd::rfnoc::chdr::chdr_header::operator==
bool operator==(const chdr_header &rhs) const
Comparison operator (==).
Definition chdr_types.hpp:155
uhd::rfnoc::chdr::ctrl_payload::operator=
ctrl_payload & operator=(const ctrl_payload &rhs)=default
uhd::rfnoc::chdr::ctrl_payload::has_timestamp
bool has_timestamp() const
Definition chdr_types.hpp:333
uhd::rfnoc::chdr::ctrl_payload::get_length
size_t get_length() const
Get the serialized size of this payload in 64 bit words.
uhd::rfnoc::chdr::ctrl_payload::serialize
size_t serialize(uint64_t *buff, size_t max_size_bytes, const std::function< uint64_t(uint64_t)> &conv_byte_order) const
Serialize the payload to a uint64_t buffer.
uhd::rfnoc::chdr::ctrl_payload::is_ack
bool is_ack
Is Acknowledgment Flag (1 bit).
Definition chdr_types.hpp:268
uhd::rfnoc::chdr::ctrl_payload::deserialize
void deserialize(const uint64_t *buff, size_t buff_size)
Definition chdr_types.hpp:320
uhd::rfnoc::chdr::ctrl_payload::to_string
std::string to_string() const
Return a string representation of this object.
uhd::rfnoc::chdr::ctrl_payload::src_port
uint16_t src_port
Source port for transaction (10 bits).
Definition chdr_types.hpp:262
uhd::rfnoc::chdr::ctrl_payload::serialize
size_t serialize(uint64_t *buff, size_t max_size_bytes) const
Serialize the payload to a uint64_t buffer (no conversion function).
Definition chdr_types.hpp:299
uhd::rfnoc::chdr::ctrl_payload::src_epid
uint16_t src_epid
Source endpoint ID of transaction (16 bits).
Definition chdr_types.hpp:270
uhd::rfnoc::chdr::ctrl_payload::ctrl_payload
ctrl_payload(const ctrl_payload &rhs)=default
uhd::rfnoc::chdr::ctrl_payload::timestamp
std::optional< uint64_t > timestamp
Has Time Flag (1 bit) and timestamp (64 bits).
Definition chdr_types.hpp:266
uhd::rfnoc::chdr::ctrl_payload::status
ctrl_status_t status
Transaction status (4 bits).
Definition chdr_types.hpp:280
uhd::rfnoc::chdr::ctrl_payload::operator==
bool operator==(const ctrl_payload &rhs) const
Comparison operator (==).
uhd::rfnoc::chdr::ctrl_payload::deserialize
void deserialize(const uint64_t *buff, size_t buff_size, const std::function< uint64_t(uint64_t)> &conv_byte_order)
uhd::rfnoc::chdr::ctrl_payload::address
uint32_t address
Address for transaction (20 bits).
Definition chdr_types.hpp:272
uhd::rfnoc::chdr::ctrl_payload::seq_num
uint8_t seq_num
Sequence number (6 bits).
Definition chdr_types.hpp:264
uhd::rfnoc::chdr::ctrl_payload::operator!=
bool operator!=(const ctrl_payload &rhs) const
Comparison operator (!=).
Definition chdr_types.hpp:342
uhd::rfnoc::chdr::ctrl_payload::op_code
ctrl_opcode_t op_code
Operation code (4 bits).
Definition chdr_types.hpp:278
uhd::rfnoc::chdr::ctrl_payload::dst_port
uint16_t dst_port
Destination port for transaction (10 bits).
Definition chdr_types.hpp:260
uhd::rfnoc::chdr::ctrl_payload::populate_header
void populate_header(chdr_header &header) const
Populate the header for this type of packet.
uhd::rfnoc::chdr::ctrl_payload::data_vtr
std::vector< uint32_t > data_vtr
Data for transaction (vector of 32 bits).
Definition chdr_types.hpp:274
uhd::rfnoc::chdr::ctrl_payload::ctrl_payload
ctrl_payload()=default
uhd::rfnoc::chdr::ctrl_payload::ctrl_payload
ctrl_payload(ctrl_payload &&rhs)=default
uhd::rfnoc::chdr::ctrl_payload::byte_enable
uint8_t byte_enable
Byte-enable mask for transaction (4 bits).
Definition chdr_types.hpp:276
uhd::rfnoc::chdr::mgmt_hop_t
A class that represents a single management hop.
Definition chdr_types.hpp:777
uhd::rfnoc::chdr::mgmt_hop_t::deserialize
void deserialize(std::list< uint64_t > &src, const std::function< uint64_t(uint64_t)> &conv_byte_order, const size_t padding_size)
Deserialize the payload from a uint64_t buffer.
uhd::rfnoc::chdr::mgmt_hop_t::operator==
bool operator==(const mgmt_hop_t &rhs) const
Comparison operator (==).
Definition chdr_types.hpp:816
uhd::rfnoc::chdr::mgmt_hop_t::get_op
const mgmt_op_t & get_op(size_t i) const
Get the n'th operation in the hop.
Definition chdr_types.hpp:796
uhd::rfnoc::chdr::mgmt_hop_t::serialize
size_t serialize(std::vector< uint64_t > &target, const std::function< uint64_t(uint64_t)> &conv_byte_order, const size_t padding_size) const
Serialize the payload to a uint64_t buffer.
uhd::rfnoc::chdr::mgmt_hop_t::add_op
void add_op(const mgmt_op_t &op)
Add a management operation to this hop.
Definition chdr_types.hpp:784
uhd::rfnoc::chdr::mgmt_hop_t::to_string
std::string to_string() const
Return a string representation of this object.
uhd::rfnoc::chdr::mgmt_hop_t::mgmt_hop_t
mgmt_hop_t(const mgmt_hop_t &rhs)=default
uhd::rfnoc::chdr::mgmt_hop_t::get_num_ops
size_t get_num_ops() const
Get the number of management operations in this hop.
Definition chdr_types.hpp:790
uhd::rfnoc::chdr::mgmt_hop_t::mgmt_hop_t
mgmt_hop_t()=default
uhd::rfnoc::chdr::mgmt_op_t
A class that represents a single management operation.
Definition chdr_types.hpp:630
uhd::rfnoc::chdr::mgmt_op_t::mgmt_op_t
mgmt_op_t(const op_code_t op_code, const payload_t op_payload=0, const uint8_t ops_pending=0)
Definition chdr_types.hpp:726
uhd::rfnoc::chdr::mgmt_op_t::mgmt_op_t
mgmt_op_t(const mgmt_op_t &rhs)=default
uhd::rfnoc::chdr::mgmt_op_t::op_code_t
op_code_t
Definition chdr_types.hpp:636
uhd::rfnoc::chdr::mgmt_op_t::MGMT_OP_INFO_RESP
@ MGMT_OP_INFO_RESP
A response to an information request.
Definition chdr_types.hpp:648
uhd::rfnoc::chdr::mgmt_op_t::MGMT_OP_NOP
@ MGMT_OP_NOP
Do nothing.
Definition chdr_types.hpp:638
uhd::rfnoc::chdr::mgmt_op_t::MGMT_OP_CFG_WR_REQ
@ MGMT_OP_CFG_WR_REQ
Perform a configuration write on the node.
Definition chdr_types.hpp:650
uhd::rfnoc::chdr::mgmt_op_t::MGMT_OP_RETURN
@ MGMT_OP_RETURN
Return the management packet back to its source.
Definition chdr_types.hpp:644
uhd::rfnoc::chdr::mgmt_op_t::MGMT_OP_ADVERTISE
@ MGMT_OP_ADVERTISE
Advertise this operation to the outside logic.
Definition chdr_types.hpp:640
uhd::rfnoc::chdr::mgmt_op_t::MGMT_OP_CFG_RD_RESP
@ MGMT_OP_CFG_RD_RESP
A response to a configuration read.
Definition chdr_types.hpp:654
uhd::rfnoc::chdr::mgmt_op_t::MGMT_OP_INFO_REQ
@ MGMT_OP_INFO_REQ
Request information about the current node.
Definition chdr_types.hpp:646
uhd::rfnoc::chdr::mgmt_op_t::MGMT_OP_SEL_DEST
@ MGMT_OP_SEL_DEST
Select the next destination for routing.
Definition chdr_types.hpp:642
uhd::rfnoc::chdr::mgmt_op_t::MGMT_OP_CFG_RD_REQ
@ MGMT_OP_CFG_RD_REQ
Perform a configuration read on the node.
Definition chdr_types.hpp:652
uhd::rfnoc::chdr::mgmt_op_t::to_string
std::string to_string() const
Return a string representation of this object.
uhd::rfnoc::chdr::mgmt_op_t::get_op_code
op_code_t get_op_code() const
Get the op-code for this transaction.
Definition chdr_types.hpp:747
uhd::rfnoc::chdr::mgmt_op_t::operator=
mgmt_op_t & operator=(const mgmt_op_t &rhs)=default
uhd::rfnoc::chdr::mgmt_op_t::get_ops_pending
uint8_t get_ops_pending() const
Get the ops pending for this transaction.
Definition chdr_types.hpp:741
uhd::rfnoc::chdr::mgmt_op_t::get_op_payload
uint64_t get_op_payload() const
Get the payload for this transaction.
Definition chdr_types.hpp:753
uhd::rfnoc::chdr::mgmt_op_t::payload_t
uint64_t payload_t
The payload for an operation is 48 bits wide.
Definition chdr_types.hpp:658
uhd::rfnoc::chdr::mgmt_op_t::operator==
bool operator==(const mgmt_op_t &rhs) const
Comparison operator (==).
Definition chdr_types.hpp:759
uhd::rfnoc::chdr::mgmt_payload::get_num_hops
size_t get_num_hops() const
Get the number of management hops in this hop.
Definition chdr_types.hpp:855
uhd::rfnoc::chdr::mgmt_payload::set_proto_ver
void set_proto_ver(uint16_t proto_ver)
Set the protocol version for this transaction.
Definition chdr_types.hpp:967
uhd::rfnoc::chdr::mgmt_payload::get_chdr_w
chdr_w_t get_chdr_w() const
Return the CHDR_W for this transaction.
Definition chdr_types.hpp:948
uhd::rfnoc::chdr::mgmt_payload::deserialize
void deserialize(const uint64_t *buff, size_t buff_size, const std::function< uint64_t(uint64_t)> &conv_byte_order)
uhd::rfnoc::chdr::mgmt_payload::set_src_epid
void set_src_epid(sep_id_t src_epid)
Set the source EPID for this transaction.
Definition chdr_types.hpp:939
uhd::rfnoc::chdr::mgmt_payload::set_chdr_w
void set_chdr_w(chdr_w_t chdr_w)
Set the CHDR_W for this transaction.
Definition chdr_types.hpp:954
uhd::rfnoc::chdr::mgmt_payload::mgmt_payload
mgmt_payload(const mgmt_payload &rhs)=default
uhd::rfnoc::chdr::mgmt_payload::set_header
void set_header(sep_id_t src_epid, uint16_t protover, chdr_w_t chdr_w)
Definition chdr_types.hpp:840
uhd::rfnoc::chdr::mgmt_payload::get_length
size_t get_length() const
Get the serialized size of this payload in 64 bit words.
uhd::rfnoc::chdr::mgmt_payload::pop_hop
mgmt_hop_t pop_hop()
Pop the first hop of the transaction and return it.
Definition chdr_types.hpp:867
uhd::rfnoc::chdr::mgmt_payload::operator=
mgmt_payload & operator=(const mgmt_payload &rhs)=default
uhd::rfnoc::chdr::mgmt_payload::add_hop
void add_hop(const mgmt_hop_t &hop)
Add a management hop to this transaction.
Definition chdr_types.hpp:849
uhd::rfnoc::chdr::mgmt_payload::populate_header
void populate_header(chdr_header &header) const
Populate the header for this type of packet.
uhd::rfnoc::chdr::mgmt_payload::deserialize
void deserialize(const uint64_t *buff, size_t buff_size)
Definition chdr_types.hpp:914
uhd::rfnoc::chdr::mgmt_payload::hops_to_string
std::string hops_to_string() const
Return a string representaiton of the hops contained by this object.
uhd::rfnoc::chdr::mgmt_payload::get_size_bytes
size_t get_size_bytes() const
Definition chdr_types.hpp:874
uhd::rfnoc::chdr::mgmt_payload::serialize
size_t serialize(uint64_t *buff, size_t max_size_bytes) const
Serialize the payload to a uint64_t buffer (no conversion function).
Definition chdr_types.hpp:893
uhd::rfnoc::chdr::mgmt_payload::get_src_epid
sep_id_t get_src_epid() const
Return the source EPID for this transaction.
Definition chdr_types.hpp:933
uhd::rfnoc::chdr::mgmt_payload::get_proto_ver
uint16_t get_proto_ver() const
Return the protocol version for this transaction.
Definition chdr_types.hpp:961
uhd::rfnoc::chdr::mgmt_payload::to_string
std::string to_string() const
Return a string representation of this object.
uhd::rfnoc::chdr::mgmt_payload::mgmt_payload
mgmt_payload(mgmt_payload &&rhs)=default
uhd::rfnoc::chdr::mgmt_payload::mgmt_payload
mgmt_payload()=default
uhd::rfnoc::chdr::mgmt_payload::get_hop
const mgmt_hop_t & get_hop(size_t i) const
Get the n'th hop in the transaction.
Definition chdr_types.hpp:861
uhd::rfnoc::chdr::mgmt_payload::serialize
size_t serialize(uint64_t *buff, size_t max_size_bytes, const std::function< uint64_t(uint64_t)> &conv_byte_order) const
Serialize the payload to a uint64_t buffer.
uhd::rfnoc::chdr::mgmt_payload::operator==
bool operator==(const mgmt_payload &rhs) const
Comparison operator (==).
uhd::rfnoc::chdr::strc_payload::src_epid
uint16_t src_epid
The source EPID for the stream (16 bits).
Definition chdr_types.hpp:535
uhd::rfnoc::chdr::strc_payload::operator==
bool operator==(const strc_payload &rhs) const
Comparison operator (==).
uhd::rfnoc::chdr::strc_payload::deserialize
void deserialize(const uint64_t *buff, size_t buff_size, const std::function< uint64_t(uint64_t)> &conv_byte_order)
uhd::rfnoc::chdr::strc_payload::strc_payload
strc_payload(const strc_payload &rhs)=default
uhd::rfnoc::chdr::strc_payload::MAX_PACKET_SIZE
static constexpr size_t MAX_PACKET_SIZE
Worst-case size of a strc packet (including header).
Definition chdr_types.hpp:545
uhd::rfnoc::chdr::strc_payload::op_code
strc_op_code_t op_code
Operation code for the command (4 bits).
Definition chdr_types.hpp:537
uhd::rfnoc::chdr::strc_payload::strc_payload
strc_payload(strc_payload &&rhs)=default
uhd::rfnoc::chdr::strc_payload::serialize
size_t serialize(uint64_t *buff, size_t max_size_bytes) const
Serialize the payload to a uint64_t buffer (no conversion function).
Definition chdr_types.hpp:564
uhd::rfnoc::chdr::strc_payload::to_string
std::string to_string() const
Return a string representation of this object.
uhd::rfnoc::chdr::strc_payload::get_length
size_t get_length() const
Get the serialized size of this payload in 64 bit words.
uhd::rfnoc::chdr::strc_payload::num_bytes
uint64_t num_bytes
Number of bytes to use for operation (64 bits).
Definition chdr_types.hpp:543
uhd::rfnoc::chdr::strc_payload::num_pkts
uint64_t num_pkts
Number of packets to use for operation (40 bits).
Definition chdr_types.hpp:541
uhd::rfnoc::chdr::strc_payload::serialize
size_t serialize(uint64_t *buff, size_t max_size_bytes, const std::function< uint64_t(uint64_t)> &conv_byte_order) const
Serialize the payload to a uint64_t buffer.
uhd::rfnoc::chdr::strc_payload::populate_header
void populate_header(chdr_header &header) const
Populate the header for this type of packet.
uhd::rfnoc::chdr::strc_payload::op_data
uint8_t op_data
Data associated with the operation (4 bits).
Definition chdr_types.hpp:539
uhd::rfnoc::chdr::strc_payload::deserialize
void deserialize(const uint64_t *buff, size_t buff_size)
Definition chdr_types.hpp:585
uhd::rfnoc::chdr::strc_payload::operator!=
bool operator!=(const strc_payload &rhs) const
Comparison operator (!=).
Definition chdr_types.hpp:601
uhd::rfnoc::chdr::strc_payload::operator=
strc_payload & operator=(const strc_payload &rhs)=default
uhd::rfnoc::chdr::strc_payload::strc_payload
strc_payload()=default
uhd::rfnoc::chdr::strs_payload::capacity_bytes
uint64_t capacity_bytes
Buffer capacity in bytes (40 bits).
Definition chdr_types.hpp:399
uhd::rfnoc::chdr::strs_payload::src_epid
uint16_t src_epid
The source EPID for the stream (16 bits).
Definition chdr_types.hpp:395
uhd::rfnoc::chdr::strs_payload::serialize
size_t serialize(uint64_t *buff, size_t max_size_bytes, const std::function< uint64_t(uint64_t)> &conv_byte_order) const
Serialize the payload to a uint64_t buffer.
uhd::rfnoc::chdr::strs_payload::operator!=
bool operator!=(const strs_payload &rhs) const
Comparison operator (!=).
Definition chdr_types.hpp:494
uhd::rfnoc::chdr::strs_payload::seq_error_occoured
bool seq_error_occoured
Definition chdr_types.hpp:417
uhd::rfnoc::chdr::strs_payload::current_seq_num
uint16_t current_seq_num
Definition chdr_types.hpp:423
uhd::rfnoc::chdr::strs_payload::reserved_3
bool reserved_3
Definition chdr_types.hpp:430
uhd::rfnoc::chdr::strs_payload::operator==
bool operator==(const strs_payload &rhs) const
Comparison operator (==).
uhd::rfnoc::chdr::strs_payload::deserialize
void deserialize(const uint64_t *buff, size_t buff_size)
Definition chdr_types.hpp:478
uhd::rfnoc::chdr::strs_payload::to_string
std::string to_string() const
Return a string representation of this object.
uhd::rfnoc::chdr::strs_payload::buff_info
uint16_t buff_info
Buffer info (16 bits).
Definition chdr_types.hpp:407
uhd::rfnoc::chdr::strs_payload::last_control_seq_num
uint16_t last_control_seq_num
Definition chdr_types.hpp:413
uhd::rfnoc::chdr::strs_payload::operator=
strs_payload & operator=(const strs_payload &rhs)=default
uhd::rfnoc::chdr::strs_payload::reserved_1
uint16_t reserved_1
Definition chdr_types.hpp:415
uhd::rfnoc::chdr::strs_payload::strs_payload
strs_payload()=default
uhd::rfnoc::chdr::strs_payload::info
uint64_t info
Definition chdr_types.hpp:410
uhd::rfnoc::chdr::strs_payload::serialize
size_t serialize(uint64_t *buff, size_t max_size_bytes) const
Serialize the payload to a uint64_t buffer (no conversion function).
Definition chdr_types.hpp:457
uhd::rfnoc::chdr::strs_payload::flow_control_due
bool flow_control_due
Definition chdr_types.hpp:419
uhd::rfnoc::chdr::strs_payload::strs_payload
strs_payload(strs_payload &&rhs)=default
uhd::rfnoc::chdr::strs_payload::deserialize
void deserialize(const uint64_t *buff, size_t buff_size, const std::function< uint64_t(uint64_t)> &conv_byte_order)
uhd::rfnoc::chdr::strs_payload::xfer_count_bytes
uint64_t xfer_count_bytes
Transfer count in bytes (64 bits).
Definition chdr_types.hpp:403
uhd::rfnoc::chdr::strs_payload::this_epid
uint16_t this_epid
Definition chdr_types.hpp:435
uhd::rfnoc::chdr::strs_payload::strs_payload
strs_payload(const strs_payload &rhs)=default
uhd::rfnoc::chdr::strs_payload::expected_seq_num
uint16_t expected_seq_num
Definition chdr_types.hpp:414
uhd::rfnoc::chdr::strs_payload::reserved_2
bool reserved_2
Definition chdr_types.hpp:418
uhd::rfnoc::chdr::strs_payload::get_length
size_t get_length() const
Get the serialized size of this payload in 64 bit words.
uhd::rfnoc::chdr::strs_payload::chdr_packet_type
uint8_t chdr_packet_type
Definition chdr_types.hpp:425
uhd::rfnoc::chdr::strs_payload::capacity_pkts
uint32_t capacity_pkts
Buffer capacity in packets (24 bits).
Definition chdr_types.hpp:401
uhd::rfnoc::chdr::strs_payload::status
strs_status_t status
The status of the stream (4 bits).
Definition chdr_types.hpp:397
uhd::rfnoc::chdr::strs_payload::xfer_count_pkts
uint64_t xfer_count_pkts
Transfer count in packets (40 bits).
Definition chdr_types.hpp:405
uhd::rfnoc::chdr::strs_payload::dest_epid
uint16_t dest_epid
Definition chdr_types.hpp:434
uhd::rfnoc::chdr::strs_payload::stop_on_seq_error_enabled
bool stop_on_seq_error_enabled
Definition chdr_types.hpp:416
uhd::rfnoc::chdr::strs_payload::populate_header
void populate_header(chdr_header &header) const
Populate the header for this type of packet.
UHD_API
#define UHD_API
Definition config.h:87
uhd::rfnoc::chdr
Definition chdr_types.hpp:21
uhd::rfnoc::chdr::strs_status_t
strs_status_t
Definition chdr_types.hpp:383
uhd::rfnoc::chdr::STRS_CMDERR
@ STRS_CMDERR
No error.
Definition chdr_types.hpp:385
uhd::rfnoc::chdr::STRS_OKAY
@ STRS_OKAY
Definition chdr_types.hpp:384
uhd::rfnoc::chdr::STRS_DATAERR
@ STRS_DATAERR
Packet out of sequence (sequence error).
Definition chdr_types.hpp:387
uhd::rfnoc::chdr::STRS_RTERR
@ STRS_RTERR
Data integrity check failed.
Definition chdr_types.hpp:388
uhd::rfnoc::chdr::STRS_SEQERR
@ STRS_SEQERR
A stream command signalled an error.
Definition chdr_types.hpp:386
uhd::rfnoc::chdr::payload_to_packet_type< mgmt_payload >
constexpr packet_type_t payload_to_packet_type< mgmt_payload >()
Definition chdr_types.hpp:991
uhd::rfnoc::chdr::payload_to_packet_type< strs_payload >
constexpr packet_type_t payload_to_packet_type< strs_payload >()
Definition chdr_types.hpp:1003
uhd::rfnoc::chdr::strc_op_code_t
strc_op_code_t
Definition chdr_types.hpp:525
uhd::rfnoc::chdr::STRC_RESYNC
@ STRC_RESYNC
Trigger a stream status response.
Definition chdr_types.hpp:528
uhd::rfnoc::chdr::STRC_INIT
@ STRC_INIT
Definition chdr_types.hpp:526
uhd::rfnoc::chdr::STRC_PING
@ STRC_PING
Initialize stream.
Definition chdr_types.hpp:527
uhd::rfnoc::chdr::payload_to_packet_type< strc_payload >
constexpr packet_type_t payload_to_packet_type< strc_payload >()
Definition chdr_types.hpp:997
uhd::rfnoc::chdr::ctrl_opcode_t
ctrl_opcode_t
Definition chdr_types.hpp:240
uhd::rfnoc::chdr::OP_WRITE
@ OP_WRITE
Definition chdr_types.hpp:242
uhd::rfnoc::chdr::OP_SLEEP
@ OP_SLEEP
Definition chdr_types.hpp:241
uhd::rfnoc::chdr::OP_USER1
@ OP_USER1
Definition chdr_types.hpp:248
uhd::rfnoc::chdr::OP_POLL
@ OP_POLL
Definition chdr_types.hpp:247
uhd::rfnoc::chdr::OP_USER2
@ OP_USER2
Definition chdr_types.hpp:249
uhd::rfnoc::chdr::OP_BLOCK_WRITE
@ OP_BLOCK_WRITE
Definition chdr_types.hpp:245
uhd::rfnoc::chdr::OP_USER6
@ OP_USER6
Definition chdr_types.hpp:253
uhd::rfnoc::chdr::OP_READ
@ OP_READ
Definition chdr_types.hpp:243
uhd::rfnoc::chdr::OP_READ_WRITE
@ OP_READ_WRITE
Definition chdr_types.hpp:244
uhd::rfnoc::chdr::OP_BLOCK_READ
@ OP_BLOCK_READ
Definition chdr_types.hpp:246
uhd::rfnoc::chdr::OP_USER3
@ OP_USER3
Definition chdr_types.hpp:250
uhd::rfnoc::chdr::OP_USER4
@ OP_USER4
Definition chdr_types.hpp:251
uhd::rfnoc::chdr::OP_USER5
@ OP_USER5
Definition chdr_types.hpp:252
uhd::rfnoc::chdr::ctrl_status_t
ctrl_status_t
Definition chdr_types.hpp:233
uhd::rfnoc::chdr::CMD_TSERR
@ CMD_TSERR
Slave asserted a command error.
Definition chdr_types.hpp:236
uhd::rfnoc::chdr::CMD_OKAY
@ CMD_OKAY
Definition chdr_types.hpp:234
uhd::rfnoc::chdr::CMD_CMDERR
@ CMD_CMDERR
Transaction successful.
Definition chdr_types.hpp:235
uhd::rfnoc::chdr::CMD_WARNING
@ CMD_WARNING
Slave asserted a time stamp error.
Definition chdr_types.hpp:237
uhd::rfnoc::chdr::payload_to_packet_type< ctrl_payload >
constexpr packet_type_t payload_to_packet_type< ctrl_payload >()
Definition chdr_types.hpp:985
uhd::rfnoc::chdr::payload_to_packet_type
constexpr packet_type_t payload_to_packet_type()
Conversion from payload_t to pkt_type.
uhd::rfnoc::chdr::packet_type_t
packet_type_t
Definition chdr_types.hpp:23
uhd::rfnoc::chdr::PKT_TYPE_DATA_WITH_TS
@ PKT_TYPE_DATA_WITH_TS
Data Packet without TimeStamp.
Definition chdr_types.hpp:29
uhd::rfnoc::chdr::PKT_TYPE_DATA_NO_TS
@ PKT_TYPE_DATA_NO_TS
Control Transaction.
Definition chdr_types.hpp:28
uhd::rfnoc::chdr::PKT_TYPE_MGMT
@ PKT_TYPE_MGMT
Definition chdr_types.hpp:24
uhd::rfnoc::chdr::PKT_TYPE_STRS
@ PKT_TYPE_STRS
Management packet.
Definition chdr_types.hpp:25
uhd::rfnoc::chdr::PKT_TYPE_CTRL
@ PKT_TYPE_CTRL
Stream Command.
Definition chdr_types.hpp:27
uhd::rfnoc::chdr::PKT_TYPE_STRC
@ PKT_TYPE_STRC
Stream status.
Definition chdr_types.hpp:26
uhd::rfnoc
Definition actions.hpp:25
uhd::rfnoc::sep_id_t
uint16_t sep_id_t
Stream Endpoint ID Type.
Definition rfnoc_types.hpp:73
uhd::rfnoc::chdr_w_t
chdr_w_t
Type that indicates the CHDR Width in bits.
Definition rfnoc_types.hpp:19
uhd::rfnoc::CHDR_W_64
@ CHDR_W_64
Definition rfnoc_types.hpp:19
uhd::rfnoc::chdr_w_to_bits
constexpr size_t chdr_w_to_bits(chdr_w_t chdr_w)
Conversion from chdr_w_t to a number of bits.
Definition rfnoc_types.hpp:22
uhd
Definition build_info.hpp:12
uhd::ntohx
T ntohx(T)
network to host: short, long, or long-long
Definition byteswap.ipp:111
uhd::htowx
T htowx(T)
host to worknet: short, long, or long-long
Definition byteswap.ipp:141
uhd::wtohx
T wtohx(T)
worknet to host: short, long, or long-long
Definition byteswap.ipp:131
uhd::htonx
T htonx(T)
host to network: short, long, or long-long
Definition byteswap.ipp:121
rfnoc_types.hpp
uhd::rfnoc::chdr::mgmt_op_t::cfg_payload::cfg_payload
cfg_payload(payload_t payload_)
Definition chdr_types.hpp:681
uhd::rfnoc::chdr::mgmt_op_t::cfg_payload::data
const uint32_t data
Definition chdr_types.hpp:678
uhd::rfnoc::chdr::mgmt_op_t::cfg_payload::cfg_payload
cfg_payload(uint16_t addr_, uint32_t data_=0)
Definition chdr_types.hpp:680
uhd::rfnoc::chdr::mgmt_op_t::cfg_payload::addr
const uint16_t addr
Definition chdr_types.hpp:677
uhd::rfnoc::chdr::mgmt_op_t::node_info_payload::node_inst
const uint16_t node_inst
Definition chdr_types.hpp:697
uhd::rfnoc::chdr::mgmt_op_t::node_info_payload::node_info_payload
node_info_payload(payload_t payload_)
Definition chdr_types.hpp:710
uhd::rfnoc::chdr::mgmt_op_t::node_info_payload::node_type
const uint8_t node_type
Definition chdr_types.hpp:696
uhd::rfnoc::chdr::mgmt_op_t::node_info_payload::ext_info
const uint32_t ext_info
Definition chdr_types.hpp:698
uhd::rfnoc::chdr::mgmt_op_t::node_info_payload::device_id
const uint16_t device_id
Definition chdr_types.hpp:695
uhd::rfnoc::chdr::mgmt_op_t::node_info_payload::node_info_payload
node_info_payload(uint16_t device_id_, uint8_t node_type_, uint16_t node_inst_, uint32_t ext_info_)
Definition chdr_types.hpp:700
uhd::rfnoc::chdr::mgmt_op_t::sel_dest_payload::sel_dest_payload
sel_dest_payload(uint16_t dest_)
Definition chdr_types.hpp:665
uhd::rfnoc::chdr::mgmt_op_t::sel_dest_payload::dest
const uint16_t dest
Definition chdr_types.hpp:663
uhd::rfnoc::chdr::mgmt_op_t::sel_dest_payload::sel_dest_payload
sel_dest_payload(payload_t payload_)
Definition chdr_types.hpp:666
uhd::routing_error
Definition exception.hpp:291