This file contains definitions and functions for the receive-side CDI test application logic.
More...
#include "test_receiver.h"
#include <assert.h>
#include <inttypes.h>
#include <stdbool.h>
#include "cdi_avm_api.h"
#include "cdi_avm_payloads_api.h"
#include "cdi_core_api.h"
#include "cdi_logger_api.h"
#include "cdi_test.h"
#include "fifo_api.h"
#include "riff.h"
#include "test_common.h"
#include "test_control.h"
#include "utilities_api.h"
|
static void | UnpacketizeAncCallback (void *user_data_ptr, CdiFieldKind field_kind, const CdiAvmAncillaryDataPacket *packet_ptr, bool has_parity_error, bool has_checksum_error) |
|
static bool | UnpacketizeAncPayload (TestConnectionInfo *connection_info_ptr, CdiSgList *sgl_ptr) |
|
static TestCheckStatus | WritePayloadToFile (CdiSgList *sgl_ptr, TestConnectionInfo *connection_info_ptr, int stream_index) |
|
static TestCheckStatus | TestRxBufferCheck (CdiSgList *sgl_ptr, TestConnectionInfo *connection_info_ptr, int stream_index) |
| Check a received data buffer (in scatter gather list form) against expected received data based on provided test parameters.
|
|
static bool | TestRxVerify (TestConnectionInfo *connection_info_ptr) |
|
static void | TestRxProcessCoreCallbackData (const CdiCoreCbData *core_cb_data_ptr, int stream_index, int payload_size) |
|
static void | RxCoreCallbackCleanup (const CdiCoreCbData *core_cb_data_ptr, const CdiSgList *sgl_ptr, int stream_index) |
|
static void | TestRawRxCallback (const CdiRawRxCbData *cb_data_ptr) |
|
static void | VerifyAvmAudioConfiguration (TestConnectionInfo *connection_info_ptr, const CdiAvmAudioConfig *audio_config_ptr, const StreamSettings *stream_settings_ptr) |
|
static void | VerifyAvmAncillaryDataConfiguration (TestConnectionInfo *connection_info_ptr, const CdiAvmAncillaryDataConfig *anc_config_ptr, const StreamSettings *stream_settings_ptr) |
|
static void | VerifyAvmVideoConfiguration (TestConnectionInfo *connection_info_ptr, const CdiAvmVideoConfig *video_config_ptr, const StreamSettings *stream_settings_ptr, int stream_index) |
|
static void | VerifyAvmConfiguration (const CdiAvmRxCbData *cb_data_ptr, CdiAvmBaselineConfig *baseline_config_ptr, int stream_index) |
|
static int | GetStreamSettingsIndexFromStreamId (const TestConnectionInfo *connection_info_ptr, int stream_identifier) |
|
static void | TestAvmRxCallback (const CdiAvmRxCbData *cb_data_ptr) |
|
CDI_THREAD | TestRxCreateThread (void *arg_ptr) |
|
This file contains definitions and functions for the receive-side CDI test application logic.
See CDI Test Application Architecture Receive Logic for diagrams and detailed description of the receive-side program flow.
◆ TestCheckStatus
Enum indicating severity of check failures. For fatal failures the test should be aborted.
Enumerator |
---|
kTestStatusOk | No check failed.
|
kTestStatusNonFatalFailure | A check failed.
|
kTestStatusFatalFailure | A check failed and it does not make sense to continue testing.
|
◆ GetStreamSettingsIndexFromStreamId()
static int GetStreamSettingsIndexFromStreamId |
( |
const TestConnectionInfo * | connection_info_ptr, |
|
|
int | stream_identifier ) |
|
static |
This function finds the index of the stream in the stream_settings array using the specified endpoint handle.
- Parameters
-
connection_info_ptr | Pointer to test connection information. |
stream_identifier | The stream identifier to search for. |
- Returns
- The index of the selected stream_settings array. If an index is not found, return -1.
◆ RxCoreCallbackCleanup()
static void RxCoreCallbackCleanup |
( |
const CdiCoreCbData * | core_cb_data_ptr, |
|
|
const CdiSgList * | sgl_ptr, |
|
|
int | stream_index ) |
|
static |
Perform any cleanup operation for the Rx callback. Currently, this function increments the payload count and writes the SGL to its thread-specific FIFO.
- Parameters
-
core_cb_data_ptr | Pointer to a CdiCoreCbData callback structure. |
sgl_ptr | Pointer to the received SGL. |
stream_index | The stream identifier. |
◆ TestAvmRxCallback()
Handle the RX callback for AVM data payloads. This callback will check AVM specific configuration data before calling TestRxProcessCoreCallbackData().
- Parameters
-
cb_data_ptr | Pointer to rx callback data for AVM payloads. |
◆ TestRawRxCallback()
Handle the Rx callback for RAW data payloads. This immediately calls TestRxProcessCoreCallbackData().
- Parameters
-
cb_data_ptr | Pointer to rx callback data for raw payloads. |
◆ TestRxBufferCheck()
Check a received data buffer (in scatter gather list form) against expected received data based on provided test parameters.
- Parameters
-
sgl_ptr | Pointer to scatter-gather list of received payload data. |
connection_info_ptr | Pointer to data structure representing the connection parameters and associated test parameters. |
stream_index | Index of stream. |
- Returns
- Return code indicating check failures.
◆ TestRxCreateThread()
- Parameters
-
arg_ptr | Void pointer to the connection_info data structure for this connection. |
- Returns
- True if no errors; false if errors;
◆ TestRxProcessCoreCallbackData()
static void TestRxProcessCoreCallbackData |
( |
const CdiCoreCbData * | core_cb_data_ptr, |
|
|
int | stream_index, |
|
|
int | payload_size ) |
|
static |
This function is called when a payload is received in the callback function. This function does some validation of the payload by checking things like payload number and SGL payload size. Then the SGL is placed in a FIFO for additional verification by TestRxVerify(). This function is used in both the RAW and AVM receive payload flow.
- Parameters
-
core_cb_data_ptr | Pointer to a CdiCoreCbData callback structure. |
stream_index | The stream index. |
payload_size | Payload size in bytes. |
◆ TestRxVerify()
Wait for receive data from receive data FIFO. If error, print error message and mark the connection as fail. If no error, then check the received payload against expected test parameters.
- Parameters
-
connection_info_ptr | Pointer to the connection info for this thread's associated connection. |
- Returns
- True if success; false if failure.
◆ UnpacketizeAncCallback()
◆ UnpacketizeAncPayload()
Check that the data can be unpacketized successfully.
- Parameters
-
connection_info_ptr | Pointer to connection info data. For TEST_LOG_CONNECTION macro. |
sgl_ptr | Pointer to user data buffer. |
- Returns
- Success or failure.
◆ VerifyAvmAncillaryDataConfiguration()
This function validates an audio AVM ancillary data payload. The pass_status of the TestConnectionInfo will be set to 'false' if there is an error in the payload.
- Parameters
-
connection_info_ptr | Pointer to the test connection info structure. |
anc_config_ptr | Pointer to the ancillary data configuration structure received through the SDK. |
stream_settings_ptr | Pointer to the selected stream's StreamSettings structure. |
◆ VerifyAvmAudioConfiguration()
This function validates an audio AVM payload. The pass_status of the TestConnectionInfo will be set to 'false' if there is an error in the payload.
- Parameters
-
connection_info_ptr | Pointer to the test connection info structure. |
audio_config_ptr | Pointer to the audio configuration structure received through the SDK. |
stream_settings_ptr | Pointer to the selected stream's StreamSettings structure. |
◆ VerifyAvmConfiguration()
This function validates an AVM baseline configuration. The pass_status of the TestConnectionInfo will be set to false if there is an error in the configuration.
- Parameters
-
cb_data_ptr | Pointer to the CdiAvmRxCbData. |
baseline_config_ptr | Pointer to the baseline configuration structure. |
stream_index | Index of the streams settings array for this particular stream. |
◆ VerifyAvmVideoConfiguration()
This function validates a video AVM payload. The pass_status of the TestConnectionInfo will be set to 'false' if there is an error in the payload.
- Parameters
-
connection_info_ptr | Pointer to the test connection info structure. |
video_config_ptr | Pointer to the video configuration structure received through the SDK. |
stream_settings_ptr | Pointer to the selected stream's StreamSettings structure. |
stream_index | Index of the stream_settings array for this particular stream. |
◆ WritePayloadToFile()
Check that the data can be unpacketized successfully.
- Parameters
-
sgl_ptr | Pointer to user data buffer. |
connection_info_ptr | Pointer to connection info data. For TEST_LOG_CONNECTION macro. |
stream_index | Index of stream. |
- Returns
- Return code indicating check failures.