Skip to navigation

hololink::module::LinuxDataChannelInterfaceV1

View as Markdown

Provide support for Linux data receivers.

For systems without hardware accelerated RDMA for delivery of received data, a Linux specific emulator for this is available, which uses the CPU to receive HSB data (via UDP) into a local buffer, and on the frame-end condition, that buffer is copied into the target (usually GPU) memory.

Application code would normally interact with a Linux receiver object, which uses this object to support configuration of the local data receiver socket.

#include <hololink/module/linux_data_channel.hpp>

Inherits from: hololink::module::ConfigurableService< LinuxDataChannelInterfaceV1 > (public)


Methods

configure_socket

virtual hololink_module_status_t hololink::module::LinuxDataChannelInterfaceV1::configure_socket(
int data_socket
)

Prepare a datagram socket to receive this channel’s traffic.

Binds the socket to the host interface that reaches the device. When the channel’s enumeration metadata selects multicast or broadcast delivery, the socket joins that group or accepts that broadcast; otherwise the host assigns it a port, and attach_receiver() programs the device to transmit there.

The application creates the socket and calls this before anything else runs on it.

Returns: HOLOLINK_MODULE_OK or an error status.

Parameters

data_socket
int

Datagram socket to prepare.

attach_receiver

virtual hololink_module_status_t hololink::module::LinuxDataChannelInterfaceV1::attach_receiver(
std::shared_ptr<LinuxReceiverInterfaceV1> receiver
)

Deliver this channel’s frames to a running receiver.

Programs the device to transmit frames to the receiver; the frame layout it transmits – frame size, page size and page count – and the destination port come from the receiver, so the receiver is started, on a socket configure_socket() prepared, before this call. Frames arrive from here on. Pair it with detach_receiver() before tearing the channel down.

Returns: HOLOLINK_MODULE_OK or an error status.

Parameters

receiver
std::shared_ptr<LinuxReceiverInterfaceV1>

The started receiver frames are delivered to.

detach_receiver

virtual hololink_module_status_t hololink::module::LinuxDataChannelInterfaceV1::detach_receiver()

Stop transmitting, clearing the state attach_receiver() set up.

The channel delivers nothing until another attach_receiver(). This writes to the device, so it fails when the device is unreachable.

Returns: HOLOLINK_MODULE_OK or an error status.

frame_end_sequencer

template <typename T = SequencerInterfaceV1>
std::shared_ptr<T> hololink::module::LinuxDataChannelInterfaceV1::frame_end_sequencer(
bool allow_null = false
)

The sequencer this channel triggers at the end of each frame.

The device runs the sequence once per completed frame on this channel. Receivers add the device reads they want taken with every frame.

Returns: The sequencer.

Template parameters

T
typename

The interface version to fetch.

Parameters

allow_null
boolDefaults to false

Return an empty pointer, rather than throwing, when this channel publishes no such sequencer.

template <typename T = HololinkInterfaceV1>
std::shared_ptr<T> hololink::module::LinuxDataChannelInterfaceV1::get_hololink(
bool allow_null = false
)

The device this channel runs on.

The same device DataChannelInterfaceV1::hololink() returns for this channel, for callers holding the software transport.

Returns: The device.

Template parameters

T
typename

The interface version to fetch.

Parameters

allow_null
boolDefaults to false

Return an empty pointer, rather than throwing, when this device is not published.

configure

virtual void hololink::module::ConfigurableService<LinuxDataChannelInterfaceV1>::configure(
)

Use metadata contents to initialize this instance.

This routine is guaranteed to be called the first time a call to get_service(metadata) is called on a specific service instance.

module

std::shared_ptr<Module> hololink::module::ServiceBase::module() const

The Module that this service was published from.

The service holds no strong reference to its Module, so this does not extend the Module’s lifetime.

Returns: The owning Module, or an empty pointer if the service has not been published or its Module no longer exists.


Static methods

get_service

static std::shared_ptr<LinuxDataChannelInterfaceV1> hololink::module::ConfigurableService<LinuxDataChannelInterfaceV1>::get_service(
const EnumerationMetadata &metadata,
bool allow_null = false
)

Fetch a service, configured by EnumerationMetadata.

Module usually caches service objects; so when a specific service instance isn’t found, it will be constructed with the current values in EnumerationMetadata. Later calls to get_service are likely to return that cached instance, ignoring changes to any enumeration metadata that aren’t specifically related to service addressing.

Returns: A shared pointer to the requested service (<Derived>).

Throws: std::runtime_error when allow_null==false and the service lookup (or construction) fails.

Parameters

metadata
const EnumerationMetadata &

Addressing and configuration for the service.

allow_null
boolDefaults to false

Use true to return nullptr when the service cannot be resolved; the default false value raises a std::runtime_error.

for_each_type_id

static bool hololink::module::Service<LinuxDataChannelInterfaceV1>::for_each_type_id(
Callback &&cb
)

Iterate over every type_id supported by this instance.

The callback signature is bool(const char*) — returning false halts the walk; true continues. Iteration is depth-first, so you’ll see the most specific implementation types first.