An application can register condition(s) to be monitored by the firmware.
When a callback handler is defined, the condition(s) is(are) reported to the application asynchronously from the firmware to the handler.
The way to define an handler is as follows:
After this registration, the application can read acquisition data as usual and/or receive asynchronous events through the callback handler.
The receive queue can also be read from the callback handler if necessary.
List of conditions
The event conditions that can be monitored are as follows:
Condition | Description |
MXF_ASYNCEVENT_COND_RXACQ_BUFFER_THRESHOLD | Acquisition buffer threshold exceeded. |
MXF_ASYNCEVENT_COND_RX_ERROR | Receive errors on the RX port. |
Example
hfce_buffer_threshold.c
Example
In the example below a condition handler is defined for monitoring the MXF_ASYNCEVENT_COND_RXACQ_BUFFER_THRESHOLD condition and a HFCE RX acquisition channel is started to receive data.
uint32 asyncEventHandler(HMXF_ASYNCEVENT asyncEvent, void *param)
{
HMXF_CHANNEL channel;
uint64 i, maxCount=64, pendingCount, status;
uint64 interruptID;
uint32 rc=MAXT_SUCCESS;
uint64 dev, mod, port;
for (i=0; i < pendingCount && !rc; i++)
{
switch(pendingList[i].condID)
{
case MXF_ASYNCEVENT_COND_RXACQ_BUFFER_THRESHOLD:
{
HMXF_BUFFER buffer;
uint64 status;
uint64 msgCount, byteCount;
uint32 rc=MAXT_SUCCESS;
rc =
mxfHFCERxAcqRead(buffer, 0, BUFFER_SIZE, &status, &msgCount, &byteCount, recHfce);
break;
}
case MXF_ASYNCEVENT_COND_RX_ERROR:
if(!rc)
printf("Status 0x%08llx received on channel %llu.%llu.%llu\n", status, dev, mod, port);
break;
default:
printf("Unknown condID 0x%llx)", pendingList[i].condID);
break;
}
}
return rc;
}
#define BUFFER_SIZE 1*1024*1024 // 1 MB
int main()
{
HMXF_SERVER server;
HMXF_CHANNEL channel;
HMXF_BUFFER buffer;
HMXF_ASYNCEVENT asyncEvent;
uint32 rc;
...
if (!rc)
if(!rc)
{
if(!hostBuffer)
rc = MAXT_ERROR_MEM;
}
if (!rc)
memset(&asyncEventInfo, 0, sizeof(asyncEventInfo));
asyncEventInfo[0].
condID = MXF_ASYNCEVENT_COND_RXACQ_BUFFER_THRESHOLD;
asyncEventInfo[1].
condID = MXF_ASYNCEVENT_COND_RX_ERROR;
if (!rc)
if (!rc)
if (!rc)
...
if (!rc)
if (!rc)
if (!rc)
if (hostBuffer)
free(hostBuffer);
...
}