Loading...
Searching...
No Matches
vrt_if_packet.hpp
Go to the documentation of this file.
//
// Copyright 2010-2014 Ettus Research LLC
// Copyright 2018 Ettus Research, a National Instruments Company
//
// SPDX-License-Identifier: GPL-3.0-or-later
//
#pragma once
#include <uhd/config.hpp>
#include <stdint.h>
#include <cstddef> //size_t
namespace uhd { namespace transport { namespace vrt {
static const size_t num_vrl_words32 = 3;
static const size_t max_if_hdr_words32 = 7; // hdr+sid+cid+tsi+tsf
struct UHD_API if_packet_info_t
{
if_packet_info_t(void);
// link layer type - always set for pack and unpack
enum link_type_t {
LINK_TYPE_NONE = 0x0,
LINK_TYPE_CHDR = 0x1,
LINK_TYPE_VRLP = 0x2
} link_type;
// packet type
enum packet_type_t {
// VRT language:
PACKET_TYPE_DATA = 0x0,
PACKET_TYPE_IF_EXT = 0x1,
PACKET_TYPE_CONTEXT = 0x2, // extension context: has_sid = true
// CHDR language:
// PACKET_TYPE_DATA = 0x0, // Data
PACKET_TYPE_FC = 0x1, // Flow control
PACKET_TYPE_ACK = 0x1, // Flow control (ack)
PACKET_TYPE_CMD = 0x2, // Command
PACKET_TYPE_RESP = 0x3, // Command response
PACKET_TYPE_ERROR =
0x3 // Command response: Error (the EOB bit is raised in this case)
} packet_type;
// size fields
size_t num_payload_words32; // required in pack, derived in unpack
size_t num_payload_bytes; // required in pack, derived in unpack
size_t num_header_words32; // derived in pack, derived in unpack
size_t num_packet_words32; // derived in pack, required in unpack
// header fields
size_t packet_count;
bool sob, eob;
bool error;
bool fc_ack;
// optional fields
bool has_sid;
uint32_t sid;
bool has_cid;
uint64_t cid;
bool has_tsi;
uint32_t tsi;
bool has_tsf;
uint64_t tsf;
bool has_tlr;
uint32_t tlr;
};
UHD_API void if_hdr_pack_be(uint32_t* packet_buff, if_packet_info_t& if_packet_info);
UHD_API void if_hdr_unpack_be(
const uint32_t* packet_buff, if_packet_info_t& if_packet_info);
UHD_API void if_hdr_pack_le(uint32_t* packet_buff, if_packet_info_t& if_packet_info);
UHD_API void if_hdr_unpack_le(
const uint32_t* packet_buff, if_packet_info_t& if_packet_info);
UHD_INLINE if_packet_info_t::if_packet_info_t(void)
: link_type(LINK_TYPE_NONE)
, packet_type(PACKET_TYPE_DATA)
, num_payload_words32(0)
, num_payload_bytes(0)
, num_header_words32(0)
, num_packet_words32(0)
, packet_count(0)
, sob(false)
, eob(false)
, error(false)
, fc_ack(false)
, has_sid(false)
, sid(0)
, has_cid(false)
, cid(0)
, has_tsi(false)
, tsi(0)
, has_tsf(false)
, tsf(0)
, has_tlr(false)
, tlr(0)
{
}
}}} // namespace uhd::transport::vrt
UHD_INLINE
#define UHD_INLINE
Definition config.h:65
UHD_API
#define UHD_API
Definition config.h:87
config.hpp
uhd::transport::vrt
Definition vrt_if_packet.hpp:14
uhd::transport::vrt::if_hdr_unpack_be
UHD_API void if_hdr_unpack_be(const uint32_t *packet_buff, if_packet_info_t &if_packet_info)
uhd::transport::vrt::if_hdr_unpack_le
UHD_API void if_hdr_unpack_le(const uint32_t *packet_buff, if_packet_info_t &if_packet_info)
uhd::transport::vrt::if_hdr_pack_be
UHD_API void if_hdr_pack_be(uint32_t *packet_buff, if_packet_info_t &if_packet_info)
uhd::transport::vrt::if_hdr_pack_le
UHD_API void if_hdr_pack_le(uint32_t *packet_buff, if_packet_info_t &if_packet_info)
uhd::transport
Definition adapter_id.hpp:11
uhd
Definition build_info.hpp:12
uhd::transport::vrt::if_packet_info_t
Definition vrt_if_packet.hpp:28
uhd::transport::vrt::if_packet_info_t::has_tsf
bool has_tsf
Fractional timestamp.
Definition vrt_if_packet.hpp:81
uhd::transport::vrt::if_packet_info_t::link_type_t
link_type_t
Definition vrt_if_packet.hpp:32
uhd::transport::vrt::if_packet_info_t::LINK_TYPE_VRLP
@ LINK_TYPE_VRLP
Definition vrt_if_packet.hpp:35
uhd::transport::vrt::if_packet_info_t::LINK_TYPE_CHDR
@ LINK_TYPE_CHDR
Definition vrt_if_packet.hpp:34
uhd::transport::vrt::if_packet_info_t::LINK_TYPE_NONE
@ LINK_TYPE_NONE
Definition vrt_if_packet.hpp:33
uhd::transport::vrt::if_packet_info_t::tsf
uint64_t tsf
Definition vrt_if_packet.hpp:82
uhd::transport::vrt::if_packet_info_t::sid
uint32_t sid
Definition vrt_if_packet.hpp:73
uhd::transport::vrt::if_packet_info_t::if_packet_info_t
if_packet_info_t(void)
Definition vrt_if_packet.hpp:172
uhd::transport::vrt::if_packet_info_t::sob
bool sob
Asserted for start- or end-of-burst.
Definition vrt_if_packet.hpp:64
uhd::transport::vrt::if_packet_info_t::eob
bool eob
Definition vrt_if_packet.hpp:64
uhd::transport::vrt::if_packet_info_t::num_payload_bytes
size_t num_payload_bytes
Definition vrt_if_packet.hpp:57
uhd::transport::vrt::if_packet_info_t::num_packet_words32
size_t num_packet_words32
Definition vrt_if_packet.hpp:59
uhd::transport::vrt::if_packet_info_t::link_type
enum uhd::transport::vrt::if_packet_info_t::link_type_t link_type
uhd::transport::vrt::if_packet_info_t::has_sid
bool has_sid
Stream ID (SID).
Definition vrt_if_packet.hpp:72
uhd::transport::vrt::if_packet_info_t::packet_count
size_t packet_count
Definition vrt_if_packet.hpp:62
uhd::transport::vrt::if_packet_info_t::packet_type_t
packet_type_t
Definition vrt_if_packet.hpp:39
uhd::transport::vrt::if_packet_info_t::PACKET_TYPE_CONTEXT
@ PACKET_TYPE_CONTEXT
Definition vrt_if_packet.hpp:43
uhd::transport::vrt::if_packet_info_t::PACKET_TYPE_CMD
@ PACKET_TYPE_CMD
Definition vrt_if_packet.hpp:49
uhd::transport::vrt::if_packet_info_t::PACKET_TYPE_ERROR
@ PACKET_TYPE_ERROR
Definition vrt_if_packet.hpp:51
uhd::transport::vrt::if_packet_info_t::PACKET_TYPE_IF_EXT
@ PACKET_TYPE_IF_EXT
Definition vrt_if_packet.hpp:42
uhd::transport::vrt::if_packet_info_t::PACKET_TYPE_RESP
@ PACKET_TYPE_RESP
Definition vrt_if_packet.hpp:50
uhd::transport::vrt::if_packet_info_t::PACKET_TYPE_DATA
@ PACKET_TYPE_DATA
Definition vrt_if_packet.hpp:41
uhd::transport::vrt::if_packet_info_t::PACKET_TYPE_ACK
@ PACKET_TYPE_ACK
Definition vrt_if_packet.hpp:48
uhd::transport::vrt::if_packet_info_t::PACKET_TYPE_FC
@ PACKET_TYPE_FC
Definition vrt_if_packet.hpp:47
uhd::transport::vrt::if_packet_info_t::fc_ack
bool fc_ack
This is asserted for flow control packets are ACKS (CHDR only).
Definition vrt_if_packet.hpp:68
uhd::transport::vrt::if_packet_info_t::tlr
uint32_t tlr
Definition vrt_if_packet.hpp:85
uhd::transport::vrt::if_packet_info_t::has_tsi
bool has_tsi
Integer timestamp.
Definition vrt_if_packet.hpp:78
uhd::transport::vrt::if_packet_info_t::has_tlr
bool has_tlr
Trailer.
Definition vrt_if_packet.hpp:84
uhd::transport::vrt::if_packet_info_t::has_cid
bool has_cid
Class ID.
Definition vrt_if_packet.hpp:75
uhd::transport::vrt::if_packet_info_t::tsi
uint32_t tsi
Definition vrt_if_packet.hpp:79
uhd::transport::vrt::if_packet_info_t::packet_type
enum uhd::transport::vrt::if_packet_info_t::packet_type_t packet_type
uhd::transport::vrt::if_packet_info_t::num_payload_words32
size_t num_payload_words32
Definition vrt_if_packet.hpp:56
uhd::transport::vrt::if_packet_info_t::cid
uint64_t cid
Definition vrt_if_packet.hpp:76
uhd::transport::vrt::if_packet_info_t::num_header_words32
size_t num_header_words32
Definition vrt_if_packet.hpp:58
uhd::transport::vrt::if_packet_info_t::error
bool error
This is asserted for command responses that are errors (CHDR only).
Definition vrt_if_packet.hpp:66