#include "example.h"
#define LOOPBACK
#define LOCAL
#define BUFFER_SIZE 4096 // 4KB
#define LABEL 3
#define SDI 0
int main(void)
{
uint32 rc;
HMXF_SERVER server;
HMXF_DEVICE device = 0;
HMXF_MODULE module = 0;
HMXF_CHANNEL rxChannel = 0, txChannel = 0;
HMXF_BUFFER rxBuffer = 0, txBuffer[2];
uint64 count = 0, type = 0;
HMXF_SCHED schedule = 0;
HMXF_SCHED_MSG msg = 0;
uint64 i, j;
uint64 msgsCount, bytesCount, indexBuffer;
uint64 label = LABEL, sdi, data, ssm, parity;
#ifdef LOCAL
#else
#endif
if (rc != MAXT_SUCCESS)
{
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)
rc =
mxfChannelAllGet(server, MXF_CLASS_A429, MXF_SCLASS_RX_CHANNEL, MXF_MODULE_ALL, 1, &count, &rxChannel);
if (!rc && count)
rc =
mxfChannelAllGet(server, MXF_CLASS_A429, MXF_SCLASS_TX_CHANNEL, MXF_MODULE_ALL, 1, &count, &txChannel);
if (!rc && !count)
rc = MAXT_ERROR_NOT_FOUND;
if (!rc)
if (!rc)
if (!rc && type == MXF_MODULE_A429E)
{
if (!rc)
if (!rc)
}
else
{
if (!rc)
if (!rc)
}
#ifdef LOOPBACK
if (!rc)
#endif
if (!rc)
if (!rc)
{
if (!hostBuffer)
rc = MAXT_ERROR_MEM;
}
if (!rc)
if (!rc)
if (!rc)
if (!rc)
printf("Sampling started\n\r");
if (!rc)
if (!rc)
if (!rc)
if (!rc)
if (!rc)
if (!rc)
{
if (!rc)
}
if (!rc)
{
if (!rc)
}
if (!rc)
{
printf("Running periodic transmission, please wait...\n\r");
}
for (i = 0; i < 10 && !rc; i++)
{
rc =
mxfA429RxSamplingRead(rxBuffer, MXF_RXSAMPLING_FLAG_DEFAULT, 0, BUFFER_SIZE, &msgsCount, &bytesCount, hostBuffer);
if (!rc)
{
printf("Read %llu messages\n\r", msgsCount);
for (j = 0; !rc && j < msgsCount; j++)
{
if (!rc)
{
printf("%02llu: Timetag %llu - ARINC word=[%03llo,%lld,%05llX,%lld,%s]\n",
j, recSamp->
timeTag, label, sdi, data, ssm, (parity == VMXF_A429_PARITY_ODD) ?
"ODD" :
"EVEN");
if (!rc)
}
}
}
if (rc)
printf("Sampling read failed; rc=0x%08x\n", rc);
else
}
if (!rc)
if (!rc)
if (rc)
{
char buffer[256];
sprintf(buffer, "ERROR # 0x%08X", rc);
printf("%s\n\r", buffer);
}
if (rxBuffer)
for (indexBuffer = 0; indexBuffer < 2; indexBuffer++)
{
if (txBuffer[indexBuffer])
}
if (hostBuffer)
free(hostBuffer);
printf("\nPress enter to terminate\n");
getchar();
return rc;
}