MX Foundation 4
Periodic Frame Service

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

The Major Frame that can be set on BC channel contains a matrix of rows and columns where a row is a minor frame and a column is a message bus slot of n-order in a minor frame. The intersection of a row and a column is a unique message bus slot.

A typical ASCB major frame is 8 by 15, but the major frame service allows a schedule of any size. The larger possible schedule is 1024 by 4022, which would use all the memory available for a schedule.

In order to build an ASCB major frame, the user must enter each intersection of a row and a column in the major frame. This is done for each row by initializing an array of message records, then calling mxfASCBTxPeriodicMajorFrameSet() with a pointer to this array as a parameter. The message record has a structure of type MXF_ASCB_TXPERIODIC_MJRFRAME_MSG and its primary function is to memorize the attributes assigned to a message bus slot.

Remember, the MXF_ASCB_TXPERIODIC_MJRFRAME_MSG record has a double function:

  • It describes the total bus time of a message bus slot in micro-seconds.
  • It holds the bit stream of the BC message that has to be transmitted at the beginning of the bus slot.

Another important piece of information contained in the record is the address field of the BC message. For example, if the message bus slot is allocated for a frame start sequence message, the address that should be passed to mxfASCBTxPeriodicMajorFrameSet() is 128 (80h). That way, a frame start sequence will be transmitted at the beginning of the slot and the total bus time attribute will cause a certain “time gap” before the next message bus slot.

If the total bus time is smaller than the time it takes to actually transmit the message, the transmission will not be truncated, but no idle time will occur before the next slot is processed. If several successive messages are entered that way, they will be transmitted back-to-back.

Note
Before setting the Major Frame with mxfASCBTxPeriodicMajorFrameSet(), it is suggested to clear it by using the mxfTxPeriodicMajorFrameClear() function.

For each BC message, an FC (freshness counter) can be enabled or disabled. By default, it is disabled. The default data may also be set. By default, all messages are set to zero. Refer to the mxfASCBMsgFreshnessCounterSet() and mxfASCBTxPeriodicUpdateMsgWrite() functions.

Building a major frame:

HMXF_SERVER server;
HMXF_CHANNEL bc;
HMXF_BUFFER tx=0;
HMXF_BUFFER tx2=0;
size_t txBufferSize=0;
MXF_ASCB_DATAREC* txBuffer=NULL;
MXF_ASCB_DATAREC* txRecAscb;
...
// Sets timebase to RTC usec
if(!rc)
rc = mxfSystemTimeBaseSet(server, MXF_TIMEBASE_DEVICE_USEC);
// Allocates 4KB buffer for tx data
if(!rc)
{
txBufferSize = 4096;
// Device allocation
rc = mxfTxPeriodicUpdateMsgBufferAlloc(bc, 0, txBufferSize, &tx, NULL);
if(!rc)
rc = mxfTxPeriodicUpdateMsgBufferAlloc(bc, 1, 0, &tx2, NULL);
// Host allocation
if(!rc)
{
txBuffer = (MXF_ASCB_DATAREC*)malloc(txBufferSize);
if(!txBuffer)
rc = MAXT_ERROR_MEM;
}
}
// Clears the major frame
if(!rc)
// Sets the minor frame #0 using 3 Commands
if(!rc)
{
memset(minorFrame, 0, sizeof(minorFrame));
// Command #0 : START
minorFrame[0].address = 0x80;
minorFrame[0].type = MXF_ASCB_TXPERIODIC_MJRFRAME_MSG_TYPE_FRAME_START;
minorFrame[0].busSelect = MXF_ASCB_TXPERIODIC_MJRFRAME_MSG_BUS_P1 |
MXF_ASCB_TXPERIODIC_MJRFRAME_MSG_BUS_P2;
minorFrame[0].totalBusTime = 224;
minorFrame[0].buffer = tx2;
// Command #1 : CONTROL
minorFrame[1].address = 0x81;
minorFrame[1].type = MXF_ASCB_TXPERIODIC_MJRFRAME_MSG_TYPE_FRAME_CTRL;
minorFrame[1].busSelect = MXF_ASCB_TXPERIODIC_MJRFRAME_MSG_BUS_P1 |
MXF_ASCB_TXPERIODIC_MJRFRAME_MSG_BUS_P2;
minorFrame[1].totalBusTime = 239;
minorFrame[1].buffer = tx;
// Command #2 : User Request
minorFrame[2].address = 0x9B;
minorFrame[2].type = MXF_ASCB_TXPERIODIC_MJRFRAME_MSG_TYPE_USER_REQ;
minorFrame[2].busSelect = MXF_ASCB_TXPERIODIC_MJRFRAME_MSG_BUS_P1;
minorFrame[2].totalBusTime = 970;
minorFrame[2].buffer = tx2;
if(!rc)
rc = mxfASCBTxPeriodicMajorFrameSet(bc, 0, 0, 3, minorFrame, NULL);
}
// Sets default data for address 0x81
if(!rc)
{
txRecAscb = (MXF_ASCB_DATAREC *)txBuffer;
memset(txRecAscb, 0, sizeof(MXF_ASCB_DATAREC));
txRecAscb->repeatCount = 1;
txRecAscb->dataSize = 4;
txRecAscb->data[0] = 0x0081;
txRecAscb->data[1] = 0x0000;
rc = mxfASCBTxPeriodicUpdateMsgWrite(bc, 1, txBuffer);
}
// Enables Control Frame Number
if (!rc)
{
fc.position = 0;
fc.mask = 0x0700;
fc.enable = TRUE;
rc = mxfASCBMsgFreshnessCounterSet(bc, 0x81, &fc);
}
// Disables Control checksum
if (!rc)
rc = mxfASCBMsgChecksumEnableSet(bc, 0x81, FALSE);
// Disables Control software CRC
if (!rc)
rc = mxfASCBMsgCrcEnableSet(bc, 0x81, FALSE);
// Starts the major frame with 25 msec rate
if(!rc)
rc = mxfTxPeriodicMajorFrameStart(bc, 0, 250000, NULL);
...
// Stops the major frame
if(!rc)
if(!rc)
...

ascb_bc.c

Updated 10/23/2023