MX Foundation 4
Basic Acquisition

The way to setup a basic acquisition receive application is as follows:

  • A receive channel must be obtained using the mxfModuleChannelGet() function or with the mxfModuleChannelAllGet() function by specifying the MXF_SCLASS_RXACQ_SRV 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 mxfASCBRxAcqRead() function.

The MXF_ASCB_DATAREC structure must be used to read ASCB messages with acquisition service.

Example

ascb_bm.c
The example below shows how to configure the bus monitor and record a chunk of 100 ASCB messages.

#define MAX_MSG 100
HMXF_SERVER server=0;
HMXF_DEVICE device=0;
HMXF_MODULE module=0;
HMXF_CHANNEL bm=0;
HMXF_BUFFER buffer=0;
uint32 rc;
uint64 deviceCount=0;
uint64 deviceType = MXF_DEVICE_PCIE502; // PCIe502 device
uint64 moduleIndex = 0; // First module
uint64 channelIndex = 0; // First BM channel
MXF_ASCB_DATAREC AcqASCB[MAX_MSG]; // ASCB acquisition buffer
MXF_ASCB_DATAREC *rec; // ASCB message pointer
uint64 startTime = 0; // Start now
uint64 duration = 0; // Forever
uint64 status, msgCount, byteCount;
uint64 i;
uint32 w;
rc = mxfServerConnect("0.0.0.0", "", "", FALSE, &server);
if(rc == MAXT_SUCCESS)
rc = mxfSystemDeviceAllGet(server, deviceType, 1, &deviceCount, &device);
if(rc == MAXT_SUCCESS && deviceCount == 1)
{
rc = mxfDeviceModuleGet(device, moduleIndex, &module);
if(rc == MAXT_SUCCESS)
rc = mxfModuleChannelGet(module, channelIndex, &bm);
if(rc == MAXT_SUCCESS)
{
rc = mxfRxAcqBufferAlloc(bm, sizeof(AcqASCB), &buffer, NULL); // Allocate acquisition buffer
if(rc == MAXT_SUCCESS)
rc = mxfRxAcqStart(buffer, MXF_RXACQ_FLAG_DEFAULT, startTime, duration);
if(rc == MAXT_SUCCESS)
rc = mxfASCBRxAcqRead(buffer, MAX_MSG, sizeof(AcqASCB), &status, &msgCount, &byteCount, AcqASCB);
else
{
printf("Error code=0x%lX\n", rc);
return rc;
}
printf("ASCB Bus Monitor Acquisition Queue: %lld messages received\n", msgCount);
rec = AcqASCB;
for(i=0; i<msgCount; i++)
{
printf("| %llu | %08x | %4.4i |",
rec->timeTag,
rec->control,
rec->dataSize);
for(w=0; w<rec->dataSize/2; w++)
{
printf(" %04x ", rec->data[w]);
}
printf("\n");
}
rc = mxfRxAcqStop(buffer);
if(rc != MAXT_SUCCESS)
{
printf("Error code=0x%lX\n", rc);
return rc;
}
printf("Acquisition stopped\n");
}
}
Updated 10/23/2023