#include "example.h"
#define LOOPBACK
#define LOCAL
#define BUFFER_SIZE 4096 // 4KB
#define TX_MSG_LABEL 5
#define TX_MSG_SDI 0
uint32 RX429ReadAcquisitionData(HMXF_BUFFER rxBuffer,
MXF_A429_DATAREC * rec429);
uint32 TX429PeriodicScheduling(HMXF_CHANNEL txChannel, HMXF_BUFFER txBuffer,
MXF_A429_DATAREC* rec429);
int main(void)
{
uint32 rc;
HMXF_SERVER server;
HMXF_DEVICE device = 0;
HMXF_MODULE module = 0;
HMXF_CHANNEL rxChannel = 0;
HMXF_CHANNEL txChannel = 0;
HMXF_BUFFER rxBuffer = 0;
HMXF_BUFFER txBuffer = 0;
uint64 dev, mod, port;
#ifdef LOCAL
#else
#endif
if (rc)
{
printf("Failed to connect; rc=0x%08x", rc);
printf("\nPress a key to terminate\n");
getchar();
return 0;
}
printf("\nStarting\n");
if (!rc)
if (!rc)
if (!rc)
if (!rc)
if (!rc)
if (!rc)
{
if (!rc)
printf("Acquisition Channel (RX) location=%llu.%llu.%llu\n", dev, mod, port);
}
if (!rc)
{
if (!rc)
printf("Transmitter Channel (TX) location=%llu.%llu.%llu\n", dev, mod, port);
}
#ifdef LOOPBACK
if (!rc)
#endif
if (!rc)
if (!rc)
if (!rc)
{
if (!rec429)
rc = MAXT_ERROR_MEM;
}
if (!rc)
if (!rc)
{
if (!rc)
printf("\nAcquisition started\n\r");
}
if (!rc)
{
rc = TX429PeriodicScheduling(txChannel, txBuffer, rec429);
if (!rc)
{
rc = RX429ReadAcquisitionData(rxBuffer, rec429);
if (!rc)
{
uint64 status;
if (!rc && status)
{
if (status & MXF_RX_STATUS_OVERFLOW)
printf("Rx overflow\n\r");
}
}
}
}
if (!rc)
if (!rc)
{
if (!rc)
printf("\nAcquisition stopped\n\r");
}
if (rc)
{
char buffer[256];
printf("%s\n", buffer);
}
printf("\nTerminating\n");
if (rxBuffer)
if (txBuffer)
if (rec429)
free(rec429);
printf("\nPress enter to terminate\n");
getchar();
return rc;
}
{
uint64 status, msgsCount, bytesCount;
uint64 label, sdi, data, ssm, parity;
uint64 j;
uint32 rc;
rc =
mxfA429RxAcqRead(rxBuffer, 0, BUFFER_SIZE, &status, &msgsCount, &bytesCount, rec429);
for (j = 0; j < msgsCount && !rc; j++)
{
if (!rc)
{
printf("%02llu: Timetag %llu - ARINC word=[%03llo,%lld,%05llX,%lld,%s]\n",
j, recPtr->
timeTag, label, sdi, data, ssm, (parity == VMXF_A429_PARITY_ODD) ?
"ODD" :
"EVEN");
if (!rc)
}
}
return rc;
}
uint32 TX429PeriodicScheduling(HMXF_CHANNEL txChannel, HMXF_BUFFER txBuffer,
MXF_A429_DATAREC* rec429)
{
HMXF_SCHED schedule;
HMXF_SCHED_MSG msg = 0;
uint64 label, sdi, data, ssm, parity;
uint32 rc;
if (!rc)
if (!rc)
if (!rc)
{
label = TX_MSG_LABEL;
sdi = TX_MSG_SDI;
data = 0x7fe;
parity = VMXF_A429_PARITY_ODD;
ssm = 1;
if (!rc)
}
if (!rc)
{
printf("Running periodic transmission, please wait...\n\r");
}
if (!rc)
{
uint64 status;
int loop=0;
do
{
if (!rc && status)
{
if (status & MXF_TX_STATUS_OVERLOAD)
printf("Tx overload\n\r");
if (status & MXF_TX_STATUS_TIMING_LOST)
printf("Tx timing lost\n\r");
if (status & MXF_TX_STATUS_OVERFLOW)
printf("Tx overflow\n\r");
}
loop++;
}while(!rc && (loop<10));
}
if (!rc)
printf("\n\rTransmission stopped\n\r");
return rc;
}