#include "example.h"
#define LOOPBACK
#define LOCAL
#define BUFFER_SIZE 4096 // 4KB
#define LABEL 5
#define SDI 0
uint32 RXmsgTotal = 0;
uint32 asyncEventHandler(HMXF_ASYNCEVENT asyncEvent, void* param);
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, txChannel = 0;
HMXF_ASYNCEVENT asyncEvent = 0;
HMXF_BUFFER rxBuffer = 0, txBuffer[2];
uint64 count=0, type=0, indexBuffer;
#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)
{
asyncEventInfo[0].
condID = MXF_ASYNCEVENT_COND_RX_MSG;
asyncEventInfo[1].
condID = MXF_ASYNCEVENT_COND_RX_ERROR;
}
if (!rc)
{
}
if (!rc)
if (!rc)
printf("Sampling started\n\r");
if (!rc)
if (!rc)
if (!rc)
TX429PeriodicScheduling(txChannel, txBuffer, hostBuffer);
if (!rc)
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;
}
uint32 asyncEventHandler(HMXF_ASYNCEVENT asyncEvent, void* param)
{
HMXF_CHANNEL channel;
uint64 pendingCount;
uint64 label, sdi, status;
uint64 i;
uint32 rc = MAXT_SUCCESS;
uint64 dev, mod, port;
HMXF_BUFFER sampBuffer;
(void)param;
for (i = 0; !rc && i < pendingCount; i++)
{
switch (pendingList[i].condID)
{
case MXF_ASYNCEVENT_COND_RX_MSG:
{
memset(&rec, 0, sizeof(rec));
if (!rc)
if (!rc)
printf(
"Msg %02d received with label=%llu sdi=%llu (0x%08x)\n", RXmsgTotal++, label, sdi, rec.
data);
if (rc)
printf("Error getting latest value rc = 0x%08x\n", rc);
break;
}
case MXF_ASYNCEVENT_COND_RX_ERROR:
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;
}
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 = LABEL;
sdi = SDI;
data = 0x7fe;
parity = VMXF_A429_PARITY_ODD;
ssm = 1;
if (!rc)
}
if (!rc)
{
label = LABEL + 1;
sdi = SDI;
data = 0x12;
parity = VMXF_A429_PARITY_ODD;
ssm = 1;
if (!rc)
}
if (!rc)
{
printf("Running periodic transmission, please wait...\n\r");
}
if (!rc)
{
}
if (!rc)
printf("\n\rTransmission stopped\n\r");
return rc;
}