MX Foundation 4
Periodic Update Message Service

The BC channel of ASCB modules supports this service (Logical channel 4).

The Periodic Update Message Service allows a message for a specified buffer to be refreshed. The mxfASCBTxPeriodicUpdateMsgWrite() function is used to refresh the data of a specific buffer.

For the BC, each message must be associated with a buffer. The TX Periodic Update Message Service is useful to update the data of this buffer. The message queue is also useful for error injection. It is possible to allocate a 0 byte buffer which can be useful for message (like user request or start) that will not have to be updated for error injection, that way no memory is used to allocate the queue. It is also possible to link more than one message to the same 0 byte buffer.

Every time a BC transmits a message, the associate message in the message queue will be sent. By default, the messages for all buffers are initialized to zero. If the message is not updated, 0 will be sent on the bus. When all messages of buffer queue have been sent, the last message will be repeated indefinitely while the message queue is no longer updated.

Refer to the MXF_ASCB_DATAREC structure for data updating.

Periodic message updating step:

MXF_ASYNCEVENT_COND_TXPERIODIC_UPDATEMSG_BUFFER_THRESHOLD event condition can be registered so a callback handler can be automatically called when the number of messages of a buffer falls below a determined threshold.

HMXF_CHANNEL bc=0;
HMXF_BUFFER tx=0;
size_t txBufferSize=0;
MXF_ASCB_DATAREC* txBuffer=NULL;
MXF_ASCB_DATAREC* txRecAscb;
...
// Allocates 4 KB buffer for BC update
if(!rc)
{
txBufferSize = 4*1024;
// Allocates BC update buffer
rc=mxfTxPeriodicUpdateMsgBufferAlloc(bc, 0, txBufferSize, &tx, NULL);
// Host buffer allocation
if(!rc)
{
txBuffer = (MXF_ASCB_DATAREC*)malloc(txBufferSize);
if(!txBuffer)
rc = MAXT_ERROR_MEM;
}
}
// Set default data for buffer 0
if(!rc)
{
txRecAscb = (MXF_ASCB_DATAREC *)txBuffer;
memset(txRecAscb, 0, sizeof(MXF_ASCB_DATAREC));
txRecAscb->repeatCount = 1;
txRecAscb->dataSize = 4;
txRecAscb->data[0] = 0x0000;
txRecAscb->data[1] = 0x0000;
rc = mxfASCBTxPeriodicUpdateMsgWrite(tx, 1, txBuffer);
}
...

ascb_bc.c

Updated 10/23/2023