CDI SDK
SDK for transporting chunks of data reliably and with low latency using a polled mode network driver.
|
This file contains common cdi_test definitions and functions used by both receiver connections and transmitter connections. More...
#include "test_control.h"
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include "cdi_logger_api.h"
#include "cdi_avm_payloads_api.h"
#include "cdi_test.h"
#include "curses.h"
#include "riff.h"
#include "run_test.h"
#include "test_console.h"
#include "utilities_api.h"
Functions | |
static bool | TestPayloadPatternSet (uint64_t seed_value, TestPatternType pattern_type, int payload_word_size, void *pattern_buffer_ptr) |
bool | TestWaitForConnection (TestConnectionInfo *connection_info_ptr, int timeout_seconds) |
void | TestConnectionCallback (const CdiCoreConnectionCbData *cb_data_ptr) |
void | TestStatisticsCallback (const CdiCoreStatsCbData *cb_data_ptr) |
void | TestIncPayloadCount (TestConnectionInfo *connection_info_ptr, int stream_index) |
bool | PreparePayloadData (StreamSettings *stream_settings_ptr, int payload_buffer_size, CdiFileID *read_file_handle_ptr, void *buffer_ptr) |
bool | GetNextPayloadDataSgl (const TestConnectionInfo *connection_info_ptr, const StreamSettings *stream_settings_ptr, int payload_id, CdiFileID read_file_handle, CdiSgList *sgl_ptr) |
bool | GetNextPayloadDataLinear (const TestConnectionInfo *connection_info_ptr, const StreamSettings *stream_settings_ptr, TestConnectionStreamInfo *stream_info_ptr) |
bool | TestCreateConnectionLogFiles (TestConnectionInfo *connection_info_ptr, CdiLogMethodData *log_method_data_ptr, char *sdk_log_filename_buffer_str) |
bool | IsPayloadNumLessThanTotal (int current_payload_num, int total_payloads) |
CdiPtpTimestamp | GetVideoPtpTimestamp (const TestConnectionInfo *connection_info_ptr, const TestConnectionStreamInfo *stream_info_ptr, int ptp_rate_count) |
Get the next video PTP timestamp to use in the payload origination_ptp_timestamp. | |
CdiPtpTimestamp | GetAudioPtpTimestamp (const StreamSettings *stream_settings_ptr, TestConnectionStreamInfo *stream_info_ptr, int audio_data_size) |
Get the next audio PTP timestamp to use in the payload origination_ptp_timestamp. | |
void | LogTimestamps (const StreamSettings *stream_settings_ptr, TestConnectionStreamInfo *stream_info_ptr, CdiPtpTimestamp current_ptp_timestamp) |
Log timestamp, if enabled. | |
This file contains common cdi_test definitions and functions used by both receiver connections and transmitter connections.
CdiPtpTimestamp GetAudioPtpTimestamp | ( | const StreamSettings * | stream_settings_ptr, |
TestConnectionStreamInfo * | stream_info_ptr, | ||
int | audio_data_size ) |
Get the next audio PTP timestamp to use in the payload origination_ptp_timestamp.
stream_settings_ptr | Pointer to stream settings info. |
stream_info_ptr | Pointer to stream info. |
audio_data_size | Size of audio data in bytes. |
bool GetNextPayloadDataLinear | ( | const TestConnectionInfo * | connection_info_ptr, |
const StreamSettings * | stream_settings_ptr, | ||
TestConnectionStreamInfo * | stream_info_ptr ) |
Prepare next set of payload data. This is either reading the next payload from the file or incrementing the payload identifier value when using patterns.
connection_info_ptr | Pointer to test connection information. |
stream_settings_ptr | Pointer to stream settings. |
stream_info_ptr | Pointer to stream state. |
bool GetNextPayloadDataSgl | ( | const TestConnectionInfo * | connection_info_ptr, |
const StreamSettings * | stream_settings_ptr, | ||
int | payload_id, | ||
CdiFileID | read_file_handle, | ||
CdiSgList * | sgl_ptr ) |
Prepare next set of payload data. This is either reading the next payload from the file or incrementing the payload identifier value when using patterns.
connection_info_ptr | Pointer to test connection information. |
stream_settings_ptr | Pointer to stream settings. |
payload_id | Payload identifier. |
read_file_handle | The file handle for reading the next pattern from, if the pattern type is from file. |
sgl_ptr | Pointer to an SGL describing the buffer to be filled with payload data. |
CdiPtpTimestamp GetVideoPtpTimestamp | ( | const TestConnectionInfo * | connection_info_ptr, |
const TestConnectionStreamInfo * | stream_info_ptr, | ||
int | ptp_rate_count ) |
Get the next video PTP timestamp to use in the payload origination_ptp_timestamp.
connection_info_ptr | Pointer to test connection information. |
stream_info_ptr | Pointer to stream info. |
ptp_rate_count | Current PTP rate counter value. |
bool IsPayloadNumLessThanTotal | ( | int | current_payload_num, |
int | total_payloads ) |
Check whether the current payload number is less that the total payloads allowed.
current_payload_num | Number that represents the current payload number. |
total_payloads | Number that represents the total number of payloads for this connection (0 is infinite). |
void LogTimestamps | ( | const StreamSettings * | stream_settings_ptr, |
TestConnectionStreamInfo * | stream_info_ptr, | ||
CdiPtpTimestamp | current_ptp_timestamp ) |
Log timestamp, if enabled.
stream_settings_ptr | Pointer to stream settings. |
stream_info_ptr | Pointer to stream info. |
current_ptp_timestamp | Current PTP timestamp value to log. |
bool PreparePayloadData | ( | StreamSettings * | stream_settings_ptr, |
int | payload_buffer_size, | ||
CdiFileID * | read_file_handle_ptr, | ||
void * | buffer_ptr ) |
Prepare next set of payload data. This is either reading the next payload from the file or incrementing the payload identifier value when using patterns. This function is shared for managing both Tx and Rx buffer patterns.
stream_settings_ptr | Pointer to stream settings. |
payload_buffer_size | Payload buffer size, rounded up to multiple of 8 bytes. |
read_file_handle_ptr | Pointer to the user read data file handle which this function will set. |
buffer_ptr | Pointer to buffer of payload size to be filled with initial pattern words if using patterns. |
void TestConnectionCallback | ( | const CdiCoreConnectionCbData * | cb_data_ptr | ) |
Handle the connection callback.
cb_data_ptr | Pointer to core connection callback data. |
bool TestCreateConnectionLogFiles | ( | TestConnectionInfo * | connection_info_ptr, |
CdiLogMethodData * | log_method_data_ptr, | ||
char * | sdk_log_filename_buffer_str ) |
Create a unique log file name for this application's connection and associate it with the current thread. This allows use of the CDI_LOG_THREAD() macro to direct log messages to the logger.
connection_info_ptr | Pointer to test connection information. |
log_method_data_ptr | Pointer to log method data. |
sdk_log_filename_buffer_str | Pointer to buffer for return SDK log filename. |
void TestIncPayloadCount | ( | TestConnectionInfo * | connection_info_ptr, |
int | stream_index ) |
Increment the connection's payload counter and mark done if we hit the user-specified total_payloads.
connection_info_ptr | Pointer to connection info data for which we want to increment the payload count. |
stream_index | Stream index. |
|
static |
Initializes a buffer the size of a single payload to use when using test patterns. This buffer is used to efficiently send the payload by the test_transmitter and is used for comparing the receive data buffer in test_receiver.
seed_value | The seed_value to start patterns with. |
pattern_type | The enum (TestPatternTypes) value for the pattern type. |
payload_word_size | Sets how many 64 bit words fit in the buffer pointed to by pattern_buffer_ptr. |
pattern_buffer_ptr | The pointer to a buffer of payload_word_size that will be filled with payload_word_size number of words of pattern pattern_type. |
void TestStatisticsCallback | ( | const CdiCoreStatsCbData * | cb_data_ptr | ) |
Handle the statistics callback.
cb_data_ptr | Pointer to statistics callback data. |
bool TestWaitForConnection | ( | TestConnectionInfo * | connection_info_ptr, |
int | timeout_seconds ) |
Wait until the connection has been established.
connection_info_ptr | Pointer to connection info data for which to wait for a connection. |
timeout_seconds | Timeout in seconds. |