MX Foundation 4
Transmission with Absolute Timing

The option MXF_TXAPERIODIC_FLAG_ABSOLUTE_START_TIME is used for starting a transmission at a specific start time in the future.

ar429_aperiodic.c
In this example, the transmission start time is based on the device clock + 100ms in the future, then the records are sent back-to-back.

#define BUFFER_SIZE 4096 // 4KB
#define MAX_TX_RECORDS_TO_TRANSMIT 8
HMXF_SERVER server;
HMXF_DEVICE device;
HMXF_CHANNEL txChannel;
HMXF_BUFFER txBuffer=0;
MXF_A429_DATAREC *rec429=NULL;
uint32 label, sdi, data, ssm, parity;
uint64 currentTime;
uint32 record;
uint64 delay100ms = 100000;
uint32 rc;
...
// Sets timebase to 64-bit microseconds
if (!rc)
rc = mxfSystemTimeBaseSet(server, MXF_TIMEBASE_DEVICE_USEC);
// Allocates Aperiodic TX static buffer for HIGH priority queue
if (!rc)
rc = mxfTxAperiodicBufferAlloc(txChannel, MXF_TXAPERIODIC_PRIORITY_HIGH, BUFFER_SIZE, &txBuffer, NULL);
// Allocates host buffer
if (!rc)
{
rec429 = (MXF_A429_DATAREC*)malloc(BUFFER_SIZE);
if (!rec429)
rc = MAXT_ERROR_MEM;
}
// Sets the records: ARINC 429 LABEL=006, SDI=1
rec = rec429;
for (record=0; record < MAX_TX_RECORDS_TO_TRANSMIT && !rc; record++)
{
rec->timeTag = 0;
rec->control = 0;
rec->repeatCount = 1;
rec->reserved = 0;
label = 6;
sdi = 1;
data = record*16;
ssm = 0;
parity = VMXF_A429_PARITY_ODD;
rc = mxfA429ArwCompose(label, sdi, data, ssm, parity, &rec->data);
if(!rc)
rc = mxfA429NextDataRecordPtrGet(rec, &rec);
}
// Gets the current time
if(!rc)
rc = mxfDeviceTimerGet(device, &currentTime);
// Transmit the array of records
if (!rc)
rc = mxfA429TxAperiodicWrite(txBuffer, MXF_TXAPERIODIC_FLAG_ABSOLUTE_START_TIME, currentTime+delay100ms, MAX_TX_RECORDS_TO_TRANSMIT, rec429);
if (rec429)
free(rec429);
...
Updated 10/23/2023