CDI SDK
SDK for transporting chunks of data reliably and with low latency using a polled mode network driver.
Loading...
Searching...
No Matches
test_control.h
Go to the documentation of this file.
1// -------------------------------------------------------------------------------------------
2// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
3// This file is part of the AWS CDI-SDK, licensed under the BSD 2-Clause "Simplified" License.
4// License details at: https://github.com/aws/aws-cdi-sdk/blob/mainline/LICENSE
5// -------------------------------------------------------------------------------------------
6
13#ifndef TEST_CONTROL_H__
14#define TEST_CONTROL_H__
15
16#include <stdbool.h>
17#include <stdint.h>
18
19#include "fifo_api.h"
20#include "cdi_pool_api.h"
21#include "cdi_raw_api.h"
22#include "test_args.h"
23
24//*********************************************************************************************************************
25//***************************************** START OF DEFINITIONS AND TYPES ********************************************
26//*********************************************************************************************************************
27
30#define MAX_LOG_FILENAME_LENGTH (1024)
31
35#define MAX_SGL_ENTRIES_PER_PAYLOAD (7)
36
38
40#define TEST_LOG_CONNECTION(log_level, ...) \
41 CdiLogger(connection_info_ptr->app_file_log_handle, kLogComponentGeneric, log_level, __FUNCTION__, __LINE__, \
42 __VA_ARGS__)
43
45#define BYTES_PER_PATTERN_WORD (sizeof(uint64_t))
46
48#define MAX_TEST_PAYLOAD_COUNT (0x00FFFFFF)
49
51#define CDI_BYTES_PER_AUDIO_SAMPLE (3)
52
57
77
124
129struct TestConnectionInfo {
132
135
139
142
144 union {
148
151
155
160
163
166
169
172
176
179
182
185
188
191
194
198
201
204
207
210
213
216
219
222
225
228
231
234};
235
236//*********************************************************************************************************************
237//******************************************* START OF PUBLIC FUNCTIONS ***********************************************
238//*********************************************************************************************************************
239
248bool TestWaitForConnection(TestConnectionInfo* connection_info_ptr, int timeout_seconds);
249
255void TestConnectionCallback(const CdiCoreConnectionCbData* cb_data_ptr);
256
262void TestStatisticsCallback(const CdiCoreStatsCbData* cb_data_ptr);
263
270void TestIncPayloadCount(TestConnectionInfo* connection_info_ptr, int stream_index);
271
284bool PreparePayloadData(StreamSettings* stream_settings_ptr, int payload_buffer_size, CdiFileID* read_file_handle_ptr,
285 void* buffer_ptr);
286
299bool GetNextPayloadDataSgl(const TestConnectionInfo* connection_info_ptr, const StreamSettings* stream_settings_ptr,
300 int payload_id, CdiFileID read_file_handle, CdiSgList* sgl_ptr);
301
312bool GetNextPayloadDataLinear(const TestConnectionInfo* connection_info_ptr, const StreamSettings* stream_settings_ptr,
313 TestConnectionStreamInfo* stream_info_ptr);
314
325bool TestCreateConnectionLogFiles(TestConnectionInfo* connection_info_ptr, CdiLogMethodData* log_method_data_ptr,
326 char* sdk_log_filename_buffer_str);
327
337bool IsPayloadNumLessThanTotal(int current_payload_num, int total_payloads);
338
349 const TestConnectionStreamInfo* stream_info_ptr, int ptp_rate_count);
350
360CdiPtpTimestamp GetAudioPtpTimestamp(const StreamSettings* stream_settings_ptr,
361 TestConnectionStreamInfo* stream_info_ptr, int audio_data_size);
362
370void LogTimestamps(const StreamSettings* stream_settings_ptr, TestConnectionStreamInfo* stream_info_ptr,
371 CdiPtpTimestamp current_ptp_timestamp);
372
373#endif // TEST_CONTROL_H__
CdiConnectionStatus
This enumeration is used to indicate the current state of a connection. NOTE: Any changes made here M...
Definition cdi_core_api.h:368
#define CDI_MAX_ENDPOINTS_PER_CONNECTION
Define to limit the max number of allowable Tx or Rx endpoints for a single connection that can be cr...
Definition cdi_core_api.h:101
#define CDI_MAX_SIMULTANEOUS_TX_PAYLOADS_PER_CONNECTION
Define to limit the max number of allowable payloads that can be simultaneously sent on a single conn...
Definition cdi_core_api.h:105
struct CdiSignalType_t * CdiSignalType
Define portable signal type. Don't use void* here, which prevents the compiler from type checking.
Definition cdi_os_api.h:189
pthread_mutex_t * CdiCsID
Define portable critical section.
Definition cdi_os_api.h:192
FILE * CdiFileID
Define portable File ID type.
Definition cdi_os_api.h:195
struct CdiThreadID_t * CdiThreadID
Define portable thread type. Separate name from type, otherwise the typedef that follows it will gene...
Definition cdi_os_api.h:312
This file declares the public API data types, structures and functions that comprise the CDI Pool Uti...
This file declares the public API data types, structures and functions that comprise the CDI Raw payl...
The declarations in this header file correspond to the definitions in fifo.c.
Structure that aggregates the audio, video, and ancillary data structures into a single structure.
Definition cdi_baseline_profile_01_00_api.h:189
Structure definition behind the connection handles shared with the user's application program....
Definition private.h:371
A structure of this type is passed as the parameter to CdiCoreConnectionCallback()....
Definition cdi_core_api.h:377
A structure of this type is passed as the parameter to CdiCoreStatsCallback(). It contains data relat...
Definition cdi_core_api.h:589
Structure definition behind the connection handles shared with the user's application program....
Definition private.h:330
Structure used to hold state data for a single FIFO.
Definition fifo.c:32
A structure of this type is used to configure the type of log method that is being used....
Definition cdi_log_api.h:63
Structure used to hold state data for a single log of any type (stdout, callback or file).
Definition logger.c:79
Structure used to hold state data for a single logger.
Definition logger.c:43
Transfer statistics data specific to payloads that contain counters that increment for the duration o...
Definition cdi_core_api.h:504
This structure represents the current state of a memory pool.
Definition pool.c:46
A structure for holding a PTP timestamp defined in seconds and nanoseconds. This PTP time as defined ...
Definition cdi_core_api.h:331
Configuration data used by one of the Cdi...RxCreate() API functions.
Definition cdi_core_api.h:760
This structure defines a scatter-gather list (SGL) which is used to represent an array of data compri...
Definition cdi_core_api.h:728
Configuration data used by one of the Cdi...TxCreate() API functions.
Definition cdi_core_api.h:624
A structure that holds all the settings for a stream as set from the command line.
Definition test_args.h:121
A structure for storing all info related to a specific connection, including test settings,...
Definition ndi_test.h:73
int total_poll_thread_load
Total CPU load for all endpoints associated with this connection.
Definition test_control.h:224
CdiThreadID thread_id
Thread ID for this connection.
Definition test_control.h:181
int total_payloads
The total number of requested payloads.
Definition test_control.h:165
CdiTxConfigData tx
Tx Configuration data.
Definition test_control.h:146
CdiLogHandle sdk_file_callback_log_handle
SDK Log file handle for this connection.
Definition test_control.h:203
uint32_t transfer_time_max_overall
Overall maximum time in microseconds to transmit a payload.
Definition test_control.h:212
uint32_t transfer_time_min_overall
Overall minimum time in microseconds to transmit a payload.
Definition test_control.h:215
CdiEndpointHandle tx_stream_endpoint_handle_array[CDI_MAX_ENDPOINTS_PER_CONNECTION]
Definition test_control.h:138
CdiSignalType payload_done_signal
Definition test_control.h:159
uint64_t num_payload_errors
Definition test_control.h:175
CdiRxConfigData rx
Rx Configuration data.
Definition test_control.h:145
CdiSignalType connection_state_change_signal
Signal used for connection state changes.
Definition ndi_test.h:83
CdiConnectionStatus connection_status_stream_array[CDI_MAX_ENDPOINTS_PER_CONNECTION]
Current status of the streams in a connection.
Definition test_control.h:193
int number_stats
Number of payload counter stats in payload_counter_stats_array.
Definition test_control.h:218
CdiPayloadCounterStats payload_counter_stats_array[CDI_MAX_ENDPOINTS_PER_CONNECTION]
A copy of the last stats. Updated at the end of TestStatisticsCallback().
Definition test_control.h:221
CdiPoolHandle tx_user_data_pool_handle
Handle of memory pool used to hold TestTxUserData structures.
Definition test_control.h:206
CdiSignalType connection_shutdown_signal
Shutdown signal for this thread.
Definition test_control.h:184
volatile CdiConnectionStatus connection_status
Current status of the connection.
Definition ndi_test.h:84
TestDynamicHandle test_dynamic_handle
Instance of test dynamic component related to this connection.
Definition test_control.h:233
TestConnectionStreamInfo stream_info[CDI_MAX_SIMULTANEOUS_TX_PAYLOADS_PER_CONNECTION]
Array of stream info data structures for storing stream-specific variables.
Definition test_control.h:227
CdiLogHandle app_file_log_handle
Test application Log file handle for this connection.
Definition test_control.h:200
CdiFifoHandle fifo_handle
Definition test_control.h:197
union TestConnectionInfo::@47 config_data
The config data structure returned by the CdiRawTxCreate or CdiRawRxCreate functions.
int my_index
This connection's index;.
Definition test_control.h:141
uint64_t pattern_count
Pattern counter used to generate unique value in each payload.
Definition test_control.h:230
void * local_data_ptr
Pointer to thread-local storage.
Definition test_control.h:150
int current_stream_count
The current stream counter. We will use this to track which stream we are operating on at a give time...
Definition test_control.h:168
TestSettings * test_settings_ptr
Definition test_control.h:154
CdiSignalType done_signal
Signal to indicate when this connection is done testing (when payload_count matches total_payloads).
Definition test_control.h:178
uint64_t tx_late_payload_count
Number of payloads that were transmitted late.
Definition test_control.h:209
CdiConnectionHandle connection_handle
The connection handle returned by CdiRawTxCreate().
Definition ndi_test.h:76
CdiCsID connection_handle_lock
Lock used to protect access to connection connection_handle.
Definition test_control.h:131
bool pass_status
Flag to indicate if this connection has passed or failed its testing.
Definition test_control.h:171
int payload_count
The current total payload count.
Definition test_control.h:162
A structure for storing all connection info related to a specific stream, such as data buffer pointer...
Definition test_control.h:82
int next_payload_size
Definition test_control.h:91
CdiAvmBaselineConfig last_baseline_config
For receiver, the last AVM baseline configuration received. Used to log to output when AVM changes.
Definition test_control.h:117
void * rx_expected_data_buffer_ptr
Rx expected payload data buffer pointer.
Definition test_control.h:94
uint64_t total_audio_samples
Total number of audio samples processed.
Definition test_control.h:122
int payload_count
The current payload count for this stream.
Definition test_control.h:110
CdiPtpTimestamp connection_start_time
Definition test_control.h:114
CdiFileID user_data_read_file_handle
File handle for file for reading payload data.
Definition test_control.h:84
int tx_pool_buffer_size
Tx payload memory pool buffer size in bytes required to hold all Tx payload buffers.
Definition test_control.h:100
int payload_buffer_size
Payload buffer size in bytes (rounded-up from payload data size to allow for pattern creation).
Definition test_control.h:97
int config_payload_skip_count
Definition test_control.h:107
CdiPoolHandle tx_pool_handle
Handle of memory pool used to hold Tx payloads.
Definition test_control.h:103
CdiFileID user_data_write_file_handle
File handle for file to write received payload data to.
Definition test_control.h:87
CdiPtpTimestamp last_ptp_timestamp
Last PTP origination timestamp.
Definition test_control.h:120
Structure used to hold state data for dynamic tests.
Definition test_dynamic.c:84
A structure that holds all the test settings for a connection as set from the command line.
Definition ndi_test.h:44
A structure for storing data to be sent with a payload as user_cb_data.
Definition test_control.h:61
CdiSgList * tx_payload_sgl_ptr
Pointer to SGL from the pool tx_pool_handle (see above) which describes the current Tx payload buffer...
Definition test_control.h:75
uint64_t tx_payload_start_time
Time payload transmission started.
Definition test_control.h:66
int stream_index
Zero-based stream index.
Definition test_control.h:69
TestConnectionInfo * test_connection_info_ptr
Pointer to the TestConnection info data structure that holds state information for the given connecti...
Definition test_control.h:63
CdiPoolHandle tx_pool_handle
Memory pool for Tx payload pointed to by tx_payload_sgl_ptr (see below).
Definition test_control.h:72
The declarations in this header file correspond to the definitions in test_args.c.
bool TestWaitForConnection(TestConnectionInfo *connection_info_ptr, int timeout_seconds)
Definition test_control.c:124
CdiLoggerHandle test_app_logger_handle
Handle to log for test.
Definition cdi_test.c:97
bool GetNextPayloadDataSgl(const TestConnectionInfo *connection_info_ptr, const StreamSettings *stream_settings_ptr, int payload_id, CdiFileID read_file_handle, CdiSgList *sgl_ptr)
Definition test_control.c:347
struct TestDynamicState * TestDynamicHandle
Forward reference.
Definition test_control.h:56
void TestIncPayloadCount(TestConnectionInfo *connection_info_ptr, int stream_index)
Definition test_control.c:292
bool GetNextPayloadDataLinear(const TestConnectionInfo *connection_info_ptr, const StreamSettings *stream_settings_ptr, TestConnectionStreamInfo *stream_info_ptr)
Definition test_control.c:401
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.
Definition test_control.c:524
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.
Definition test_control.c:546
bool IsPayloadNumLessThanTotal(int current_payload_num, int total_payloads)
Definition test_control.c:518
void TestStatisticsCallback(const CdiCoreStatsCbData *cb_data_ptr)
Definition test_control.c:219
bool TestCreateConnectionLogFiles(TestConnectionInfo *connection_info_ptr, CdiLogMethodData *log_method_data_ptr, char *sdk_log_filename_buffer_str)
Definition test_control.c:421
bool PreparePayloadData(StreamSettings *stream_settings_ptr, int payload_buffer_size, CdiFileID *read_file_handle_ptr, void *buffer_ptr)
Definition test_control.c:313
void LogTimestamps(const StreamSettings *stream_settings_ptr, TestConnectionStreamInfo *stream_info_ptr, CdiPtpTimestamp current_ptp_timestamp)
Log timestamp, if enabled.
Definition test_control.c:582
void TestConnectionCallback(const CdiCoreConnectionCbData *cb_data_ptr)
Definition ndi_test.c:314