MX Foundation 4
Acquisition Service

The Acquisition Receive service provides the functions to sequentially buffer all the received data on one or several channels. Each receiver channel has an acquisition queue built in the device. The device onboard’s processor stores all the data as they are received with precise time stamping correlated with all channels. A function call is provided for the host application to read from a receiver acquisition queue.

A sequence of detected signal state(s) can be buffered in acquisition mode for reading. Each state is contained in a MXF_FLEXDIO_DATAREC and typically contains the time stamp defining when the sample has been taken.

In edge mode, when the acquisition is started, one record is immediately returned giving the initial state of the discrete input lines. The edge field of the record will be set to 0. The following records are generated according to specified discrete input transitions.

In sampling mode, a record will be returned at each sample rate based on KMXF_FLEXDIO_RX_SAMP_PERIOD attribute.

Example

The example below shows how to start an acquisition on discrete input channel.

flexdio_sampling_acq.c

#define BUFFER_SIZE (1000*sizeof(MXF_FLEXDIO_DATAREC))
uint32 rc;
HMXF_CHANNEL ioChannel=0;
HMXF_BUFFER rxBuffer=0;
MXF_FLEXDIO_DATAREC *recDiscrete=NULL;
int pin;
...
// Allocate RX acquisition buffer
if (!rc)
rc = mxfRxAcqBufferAlloc(ioChannel, BUFFER_SIZE, &rxBuffer, NULL);
// Allocate host buffer
if (!rc)
{
recDiscrete = (MXF_FLEXDIO_DATAREC*)malloc(BUFFER_SIZE);
if (!recDiscrete)
rc = MAXT_ERROR_MEM;
}
// Start the acquisition process
if (!rc)
rc = mxfRxAcqModeSet(rxBuffer, MXF_RXACQ_MODE_LINEAR);
if (!rc)
{
rc = mxfRxAcqStart(rxBuffer, MXF_RXACQ_FLAG_DEFAULT, 0, 0);
if (!rc)
printf("\nAcquisition started\n\r");
}
// Read discrete data in acquisition buffer
if (!rc)
{
rc = mxfSleep(100);
if (!rc)
{
uint64 status, msgsCount, bytesCount;
uint64 j;
MXF_FLEXDIO_DATAREC* rec=recDiscrete;
// Read and display records
rc = mxfRxAcqRead(rxBuffer, 0, BUFFER_SIZE, &status, &msgsCount, &bytesCount, recDiscrete);
for (j=0; j<msgsCount && !rc; j++)
{
printf(" %02llu: Timetag=%012llu, Data=0x%016llx\n", j, rec->timeTag, rec->data);
}
}
}
// Stop and flush unread data
if (!rc)
rc = mxfRxAcqStop(rxBuffer);
if (!rc)
{
rc = mxfRxAcqClear(rxBuffer);
if (!rc)
printf("\nAcquisition stopped\n\r");
}
...
Updated 10/23/2023