#include "example.h"
#define LOCAL
int main(void)
{
uint32 rc;
uint64 deviceCount=0;
uint64 moduleCount=0;
uint64 channelCount=0;
HMXF_SERVER server;
HMXF_DEVICE device=0;
HMXF_MODULE module=0;
HMXF_CHANNEL bm=0;
HMXF_BUFFER rx=0;
uint32 rxBufferSize=0;
uint64 rxAcqStatus;
uint64 msgCount;
uint64 byteCount;
uint64 rxRec;
uint32 loop=0;
uint64 address, subAddress, dir, wordCount;
uint64 card=0, mod=0, port=0;
uint32 data;
char errorString[200];
#ifdef LOCAL
#else
#endif
if(!rc)
{
if(rc == MAXT_ERROR_ANOTHER_PROCESS_RUNNING)
{
}
}
if(!rc)
if (!rc && deviceCount)
{
if (!rc && !moduleCount)
}
if(!rc && moduleCount)
if(!rc && !channelCount)
rc = MAXT_ERROR_NOT_FOUND;
if(!rc)
if (!rc)
printf("BM location is Device:%llu Module:%llu Port:%llu\n\r", card, mod, port);
#ifdef LOOPBACK
if(!rc)
#endif
if(!rc)
{
rxBufferSize = 100*1024;
if(rc == MAXT_ERROR_BUFFER_ALLOCATED)
if(!rc)
{
if(!rxBuffer)
rc = MAXT_ERROR_MEM;
}
}
if(!rc)
if(!rc)
{
printf("Starting BM\n\r");
}
if(!rc)
{
do
{
if(rc)
break;
for(rxRec=0; rxRec<msgCount && !rc; rxRec++)
{
if(!rc)
{
if(!rc)
{
printf(
"\n\r%llu:\t", rxRec1553->
timeTag);
{
case MXF_MIL1553_MSGINFO_TYPE_BCRT:
printf(
"BC to RT%llu SA%llu WC%llu (0x%04x)\n\r", address, subAddress, wordCount, rxRec1553->
data[0]);
printf("\t\tBC data:");
for(data=0; data<msgInfo.dataWordCount; data++)
{
if(data && !(data%4))
printf("\n\r\t\t\t");
}
printf("\n\r");
printf(
"\t\tRT status: 0x%04x\n\r", rxRec1553->
data[msgInfo.
statusIndex[0]]);
break;
case MXF_MIL1553_MSGINFO_TYPE_RTBC:
printf(
"RT%llu SA%llu WC%llu to BC (0x%04x)\n\r", address, subAddress, wordCount, rxRec1553->
data[0]);
{
printf(
"\t\tRT status: 0x%04x\n\r", rxRec1553->
data[msgInfo.
statusIndex[0]]);
printf("\t\tRT data:");
for(data=0; data<msgInfo.dataWordCount; data++)
{
if(data && !(data%4))
printf("\n\r\t\t\t");
}
printf("\n\r");
}
break;
case MXF_MIL1553_MSGINFO_TYPE_MODECODE_TXDATA:
printf(
"BC Mode Command %llu to RT%llu SA%llu (0x%04x)\n\r", wordCount, address, subAddress, rxRec1553->
data[0]);
{
printf(
"\t\tRT status: 0x%04x\n\r", rxRec1553->
data[msgInfo.
statusIndex[0]]);
printf(
"\t\tRT data: 0x%04x\n\r", rxRec1553->
data[msgInfo.
dataIndex]);
}
break;
}
}
}
}
loop++;
}while(loop < 200);
}
if(!rc)
{
printf("Stopping BM\n\r");
}
if(rxBuffer)
free(rxBuffer);
if(rc)
{
sprintf (errorString,"ERROR # 0x%08X", rc);
printf("%s\n\r", errorString);
}
if (rx)
{
if (rc)
printf("Free buffer failed !\n\r");
}
if (rc == MAXT_ERROR_ANOTHER_PROCESS_RUNNING)
{
}
printf("\n\rPress enter to terminate\n\r");
getchar();
return 0;
}