MX Foundation 4
Basic RAW mode acquisition

When an AFDX channel is allocated in raw mode a calling application receives the data directly from a physical port (Port-A or Port-B).

The way the channel is allocated is described below;

  • A physical channel must be obtained using the mxfModuleChannelGet() function or with the mxfModuleChannelAllGet() function by specifying the MXF_SCLASS_ALL subclass.
  • The acquisition buffer must be allocated using the mxfRxAcqBufferAlloc() function.
  • The acquisition mode can be set using the mxfRxAcqModeSet() function.

    Two modes of acquisition are defined;

    Condition Description
    MXF_RXACQ_MODE_LINEAR In this mode the acquisition stops when the buffer is full.
    MXF_RXACQ_MODE_CIRCULAR In this mode the acquisition buffer is circular and never stops receiving. Whenever the acquisition queue becomes full, the acquisition process will discard the newest received record.
  • The acquisition must be started using the mxfRxAcqStart() function.
  • A read loop can be implemented using the mxfA664RxAcqRead() function.

The MXF_A664_DATAREC structure must be used for reading an ARINC 664 message with acquisition service.

Example

ar664_raw_rx.c
The example below shows how to implement an ARINC 664 basic receive acquisition application using a Raw port.

#define DATARECS_BUFFER_SIZE_MAX 64*1024
HMXF_CHANNEL phyChn = 0;
MXF_A664_DATAREC* rec664 = NULL;
HMXF_BUFFER rxBuffer = 0;
uint64 usedBytes, freeBytes;
uint64 status, msgsCount, bytesCount;
uint64 recordIdx, dataIdx;
uint32 dataSize;
...
// In RAW mode the acquisition buffer gets the data
// directly from the physical port. This port handle
// is used for acquisition and no COM/SAP port is required.
// In this mode the application will read all the physical
// frames received on the port.
if (!rc)
rc = mxfRxAcqBufferAlloc(phyChn, 20000, &rxBuffer, NULL);
if (!rc)
{
rec664 = malloc(DATARECS_BUFFER_SIZE_MAX);
memset(rec664, 0, DATARECS_BUFFER_SIZE_MAX);
if (!rec664)
rc = MAXT_ERROR_MEM;
}
// Set acquisition mode
if (!rc)
rc = mxfRxAcqModeSet(rxBuffer, MXF_RXACQ_MODE_LINEAR);
// Start acquisition, check status
if (!rc)
rc = mxfRxAcqStart(rxBuffer, MXF_RXACQ_FLAG_DEFAULT, 0, 0);
if (!rc)
{
rc = mxfRxAcqBufferStatusGet(rxBuffer, &status, &msgsCount, &usedBytes, &freeBytes);
if (!rc && (status & MXF_RXACQ_STATUS_RUNNING))
printf("Acquisition Running\n\n");
}
...
// Read and display records
rc = mxfA664RxAcqRead(rxBuffer, 0, DATARECS_BUFFER_SIZE_MAX, &status, &msgsCount, &bytesCount, rec664);
if (!rc)
printf("%llu records received\n\n", msgsCount);
recPtr = rec664;
for (recordIdx = 0; recordIdx < msgsCount && !rc; recordIdx++)
{
printf(" %03llu: timeTag=%012llu, Size=%u", recordIdx, recPtr->timeTag, recPtr->dataSize);
printf("\n data=");
dataSize = recPtr->dataSize;
for (dataIdx = 0; dataIdx < dataSize; dataIdx++)
{
printf("%02X ", recPtr->data[dataIdx]);
if (!((dataIdx + 1) % 8) && (dataIdx + 1 < recPtr->dataSize))
printf("\n ");
}
printf("\n\n");
mxfA664NextDataRecordPtrGet(recPtr, &recPtr);
}
...
Updated 10/23/2023