Loading...
Searching...
No Matches
uhd::transport::vrt Namespace Reference

## Classes

struct | if_packet_info_t

## Functions

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)

## Function Documentation

## if_hdr_pack_be()

UHD_API void uhd::transport::vrt::if_hdr_pack_be | ( | uint32_t * | packet_buff,
|  | if_packet_info_t & | if_packet_info )

Pack a vrt header from metadata (big endian format).

# Packing contract

## Requirements:

- packet_buff points to a valid address space with enough space to write the entire buffer, regardless of its length. At the very least, it must be able to hold an entire header.
- if_packet_info has the following members set to correct values:
  - has_* members all set accordingly
  - For every true has_* member, the corresponding variable holds a valid value (e.g. if has_sid is true, sid contains a valid SID)
  - num_payload_bytes and num_payload_words32 are both set to the correct values

## Result:

- packet_buff now points to a valid header that can be sent over the transport without further modification
- The following members on if_packet_info are set:
  - num_header_words32
  - num_packet_words32

Parameters

  packet_buff | memory to write the packed vrt header
  if_packet_info | the if packet info (read/write)

## if_hdr_pack_le()

UHD_API void uhd::transport::vrt::if_hdr_pack_le | ( | uint32_t * | packet_buff,
|  | if_packet_info_t & | if_packet_info )

Pack a vrt header from metadata (little endian format).

See Packing contract.

Parameters

  packet_buff | memory to write the packed vrt header
  if_packet_info | the if packet info (read/write)

## if_hdr_unpack_be()

UHD_API void uhd::transport::vrt::if_hdr_unpack_be | ( | const uint32_t * | packet_buff,
|  | if_packet_info_t & | if_packet_info )

Unpack a vrt header to metadata (big endian format).

# Unpacking contract

## Requirements

- packet_buff points to a readable address space with a CHDR packet, starting at the header. packet_buff[0] must always point to a valid first word of the header. This implies that num_packet_words32 must be at least 1.
- if_packet_info has the following members set to correct values:
  - num_packet_words32. This means all values packet_buff[0] through packet_buff[if_packet_info.num_packet_words32-1] are readable words from this packet.
  - link_type

## Result

- if_packet_info now has the following values set to correct values:
  - packet_type
  - num_payload_bytes
  - num_payload_words32
  - num_header_words32
  - has_*
  - sob, eob, error, cid, sid (if applicable)
  - tsf, tsi (if applicable)

## Exceptions

- If the header is invalid, but the requirements are still met, will throw a uhd::value_error.

Parameters

  packet_buff | memory to read the packed vrt header
  if_packet_info | the if packet info (read/write)

## if_hdr_unpack_le()

UHD_API void uhd::transport::vrt::if_hdr_unpack_le | ( | const uint32_t * | packet_buff,
|  | if_packet_info_t & | if_packet_info )

Unpack a vrt header to metadata (little endian format).

See Unpacking contract.

Parameters

  packet_buff | memory to read the packed vrt header
  if_packet_info | the if packet info (read/write)