CDI SDK
SDK for transporting chunks of data reliably and with low latency using a polled mode network driver.
Loading...
Searching...
No Matches
test_minimal_transmitter.c File Reference

This file contains definitions and functions for the transmit-side CDI minimal test application. More...

#include <assert.h>
#include <inttypes.h>
#include <stdbool.h>
#include "cdi_baseline_profile_01_00_api.h"
#include "cdi_baseline_profile_02_00_api.h"
#include "cdi_core_api.h"
#include "cdi_raw_api.h"
#include "test_common.h"

Data Structures

struct  TestSettings
 A structure that holds all the test settings for a connection as set from the command line. More...
 
struct  TestConnectionInfo
 A structure for storing all info related to a specific connection, including test settings, connection configuration data from the SDK, and state information for the test connection. More...
 

Macros

#define DEFAULT_RATE_NUMERATOR   (60)
 Default rate numerator.
 
#define DEFAULT_RATE_DENOMINATOR   (1)
 Default rate denominator.
 
#define DEFAULT_TX_TIMEOUT   (16666)
 Default Tx timeout.
 
#define TestConsoleLog   SimpleConsoleLog
 Define TestConsoleLog.
 

Functions

void PrintHelp (void)
 
static bool ParseCommandLine (int argc, const char **argv, TestSettings *test_settings_ptr)
 
static void TestConnectionCallback (const CdiCoreConnectionCbData *cb_data_ptr)
 
static void ProcessCoreTxCallback (TestConnectionInfo *connection_info_ptr, const CdiCoreCbData *core_cb_data_ptr)
 
static void TestAvmTxCallback (const CdiAvmTxCbData *cb_data_ptr)
 
static CdiReturnStatus MakeAvmConfig (const TestConnectionInfo *connection_info_ptr, CdiAvmConfig *avm_config_ptr, int *payload_unit_size_ptr)
 
static CdiReturnStatus SendAvmPayload (TestConnectionInfo *connection_info_ptr, CdiSgList *sgl_ptr, CdiPtpTimestamp *timestamp_ptr, CdiAvmConfig *avm_config_ptr, int stream_identifier)
 
static void TestRawTxCallback (const CdiRawTxCbData *cb_data_ptr)
 
static CdiReturnStatus SendRawPayload (TestConnectionInfo *connection_info_ptr, CdiSgList *sgl_ptr, CdiPtpTimestamp *timestamp_ptr)
 
int main (int argc, const char **argv)
 

Detailed Description

This file contains definitions and functions for the transmit-side CDI minimal test application.

Function Documentation

◆ main()

int main ( int argc,
const char ** argv )

C main entry function.

Parameters
argcNumber of command line arguments.
argvPointer to array of pointers to command line arguments.
Returns
0 on success, otherwise 1 indicating a failure occurred.

◆ MakeAvmConfig()

static CdiReturnStatus MakeAvmConfig ( const TestConnectionInfo * connection_info_ptr,
CdiAvmConfig * avm_config_ptr,
int * payload_unit_size_ptr )
static

Creates the generic configuration structure to use when sending AVM payloads.

Parameters
connection_info_ptrPointer to a structure containing user settings needed for the configuration.
avm_config_ptrAddress of where to write the generated generic configuration structure.
payload_unit_size_ptrPointer to the location into which the payload unit size is to be written. This value needs to be set in payload_config_ptr->core_config_data.unit_size for calls to CdiAvmTxPayload().
Returns
CdiReturnStatus kCdiStatusOk if the configuration structure was created successfully, kCdiStatusFatal if not.

◆ ParseCommandLine()

static bool ParseCommandLine ( int argc,
const char ** argv,
TestSettings * test_settings_ptr )
static

Parse command line and write to the specified TestSettings structure.

Parameters
argcNumber of command line arguments.
argvPointer to array of pointers to command line arguments.
test_settings_ptrAddress where to write returned settings.
Returns
true if successful, otherwise false.

◆ PrintHelp()

void PrintHelp ( void )

Output command line help message.

◆ ProcessCoreTxCallback()

static void ProcessCoreTxCallback ( TestConnectionInfo * connection_info_ptr,
const CdiCoreCbData * core_cb_data_ptr )
static

Process core Tx callback, that is common to both AVM and RAW Tx payload callbacks.

Parameters
connection_info_ptrPointer to test connection state data.
core_cb_data_ptrPointer to core callback data.

◆ SendAvmPayload()

static CdiReturnStatus SendAvmPayload ( TestConnectionInfo * connection_info_ptr,
CdiSgList * sgl_ptr,
CdiPtpTimestamp * timestamp_ptr,
CdiAvmConfig * avm_config_ptr,
int stream_identifier )
static

Send a payload using an AVM API function.

Parameters
connection_info_ptrPointer to connection info structure.
sgl_ptrPointer to SGL.
timestamp_ptrPointer to timestamp.
avm_config_ptrPointer to the generic configuration structure to use for the stream.
stream_identifierStream identifer.
Returns
A value from the CdiReturnStatus enumeration.

◆ SendRawPayload()

static CdiReturnStatus SendRawPayload ( TestConnectionInfo * connection_info_ptr,
CdiSgList * sgl_ptr,
CdiPtpTimestamp * timestamp_ptr )
static

Send a payload using a RAW API function.

Parameters
connection_info_ptrPointer to connection info structure.
sgl_ptrPointer to SGL.
timestamp_ptrPointer to timestamp.
Returns
A value from the CdiReturnStatus enumeration.

◆ TestAvmTxCallback()

static void TestAvmTxCallback ( const CdiAvmTxCbData * cb_data_ptr)
static

Handle the Tx AVM callback. NOTE: Only used by the AVM API functions.

Parameters
cb_data_ptrPointer to Tx AVM callback data.

◆ TestConnectionCallback()

static void TestConnectionCallback ( const CdiCoreConnectionCbData * cb_data_ptr)
static

Handle the connection callback.

Parameters
cb_data_ptrPointer to CdiCoreConnectionCbData callback data.

◆ TestRawTxCallback()

static void TestRawTxCallback ( const CdiRawTxCbData * cb_data_ptr)
static

Handle the Tx RAW callback. NOTE: Only used by the RAW API functions.

Parameters
cb_data_ptrPointer to Tx RAW callback data.