MX Foundation 4
Basic Transmission

In order to transmit data using an AFDX COM Queuing port you must:

  • Create the transmission virtual link using the mxfA664VlCreate() function.
  • Create the queuing port using the mxfA664PortCreate() function.
  • The messages to be sent must be stored in a MXF_A664_DATAREC structure.
  • Start transmission using the mxfA664TxAperiodicWrite() function with the port handle. No timing option is available, the transmission timing is controlled by the VL BAG scheduler.

Example

ar664_com_queuing_basic.c
The code snippets below demonstrate the basic steps needed to setup a COM port transmission.

// Create the transmission (TX) virtual link
if (!rc)
{
memset(&vlParam, 0, sizeof(MXF_A664_VL_PARAM));
vlParam.direction = MXF_A664_VL_DIR_TX;
vlParam.VLId = vlid;
vlParam.frameType = MXF_A664_FRAME_TYPE_ARINC664;
vlParam.frameSizeMax = 512;
vlParam.dir.Tx.subVlNumber = 1;
vlParam.dir.Tx.bag = 1 * 1000 * 1000; // 1ms
vlParam.dir.Tx.netSelection = MXF_A664_NETSELECT_ALL;
vlParam.dir.Tx.Ede.enable = FALSE;
vlParam.dir.Tx.subVl[0].bufferSize = vlParam.frameSizeMax;
vlParam.dir.Tx.subVl[0].maxBuffers = maxTxRecords;
rc = mxfA664VlCreate(phyChn, &vlParam, &vlTx);
}
// Create the transmission COM port
if (!rc)
{
inet_pton(AF_INET, DST_IP_ADRS, &srcIpAdrs);
inet_pton(AF_INET, SRC_IP_ADRS, &dstIpAdrs);
memset(&portParam, 0, sizeof(MXF_A664_PORT_PARAM));
portParam.portType = MXF_A664_PORT_TYPE_COM;
portParam.family = MXF_A664_PORT_FAMILY_IPV4;
portParam.mode = MXF_A664_PORT_MODE_QUEUING;
portParam.type.COM.destAddress.port = DST_UDP_PORT;
portParam.type.COM.destAddress.version.IPv4.address = ntohl(dstIpAdrs);
portParam.type.COM.srcAddress.port = SRC_UDP_PORT;
portParam.type.COM.srcAddress.version.IPv4.address = ntohl(srcIpAdrs);
rc = mxfA664PortCreate(vlTx, &portParam, &portTx);
}
if (!rc)
{
txRec = malloc(DATARECS_BUFFER_SIZE_MAX);
memset(txRec, 0, DATARECS_BUFFER_SIZE_MAX);
if (!txRec)
rc = MAXT_ERROR_MEM;
}
// Build the Transmit Records
for (iRecord = 0, data = txRec; iRecord < maxTxRecords && !rc; iRecord++)
{
data->control = 0;
data->dataSize = TEST_DATASIZE;
data->repeatCount = 1;
for (iData = 0; iData < TEST_DATASIZE; iData++)
data->data[iData] = (uint8)((iData + ((iRecord*TEST_DATASIZE) & 0xff)));
rc = mxfA664NextDataRecordPtrGet(data, &data);
}
// Transmit the data
if (!rc)
{
rc = mxfA664TxAperiodicWrite(portTx, MXF_TXAPERIODIC_FLAG_DEFAULT, 0, maxTxRecords, txRec, &count);
printf("%llu frames transmitted\n\n", count);
// Wait for complete transmission
mxfSleep(500);
}
...
if (!rc)
rc = mxfA664PortRelease(portTx);
...
Updated 10/23/2023