#include "example.h"
#define BUF_SA3_RX 0
#define RT_ADRS 20
#define RT_SUBADRS 3
#define RT_ADRS_ERROR 5
#define LOCAL
int main(void)
{
HMXF_SERVER server;
HMXF_DEVICE device=0;
HMXF_MODULE module=0;
HMXF_CHANNEL bc=0;
HMXF_CHANNEL rt=0;
HMXF_BUFFER bcBufferTx[1];
HMXF_BUFFER bcBufferRx=0;
HMXF_BUFFER rtBuffer[1];
uint32 txBufferSize=0;
uint32 rxBufferSize=0;
char errorString[256];
uint64 bus=MXF_MIL1553_BUS_A|MXF_MIL1553_BUS_B;
uint64 rxAcqStatus;
uint64 msgCount;
uint64 byteCount, indexBuffer;
uint64 rxRec;
uint32 loop=0;
uint64 address, subAddress, dir, wordCount;
uint32 msg;
uint64 deviceCount=0;
uint64 moduleCount=0;
uint64 channelCount=0;
uint32 rc;
#ifdef LOCAL
#else
#endif
if(!rc)
{
printf("Starting ...\n\r");
}
if(!rc)
if(!rc && deviceCount)
if(!rc && moduleCount)
if(!rc && !channelCount)
rc = MAXT_ERROR_NOT_FOUND;
if(!rc)
#ifdef LOOPBACK
if(!rc)
#endif
if(!rc)
{
txBufferSize = 1024;
for(msg=0; msg<1 && !rc; msg++)
{
if(!rc)
if(!rc)
}
if(!rc)
{
if(!txBuffer)
rc = MAXT_ERROR_MEM;
}
}
if(!rc)
{
rxBufferSize = 10*1024;
if(!rc)
if(!rc)
{
if(!rxBuffer)
rc = MAXT_ERROR_MEM;
}
}
if(!rc)
if(!rc)
if(!rc)
if(!rc)
{
memset(&err, 0, sizeof(err));
if (!rc)
}
if(!rc)
{
err.
errors[0] = MXF_MIL1553_ERRORID_PAR;
}
if(!rc)
{
memset(minorFrame, 0, sizeof(minorFrame));
if (!rc)
{
minorFrame[0].
buffer = bcBufferTx[BUF_SA3_RX];
minorFrame[0].
retryHaltOptions = MXF_MIL1553_TXPERIODIC_MJRFRAME_MSG_RETRY_ERROR_ENABLE |MXF_MIL1553_TXPERIODIC_MJRFRAME_MSG_RETRY_ALT_BUS;
}
}
if(!rc)
{
txRec1553->
control = MXF_MIL1553_TXPERIODIC_REC_CTRL_ERROR_INJ;
txRec1553->
data[0] = 0x0000;
txRec1553->
data[1] = 0x0000;
txRec1553->
data[2] = 0x1111;
txRec1553->
data[3] = 0x2222;
}
if(!rc)
{
txRec1553->
control = MXF_MIL1553_TXPERIODIC_REC_CTRL_ERROR_INJ;
}
if(!rc)
{
printf("Starting BC - RT\n\r");
}
if(!rc)
if(!rc)
if(!rc)
{
do
{
rc =
mxfMIL1553RxAcqRead(bcBufferRx, 0, rxBufferSize, &rxAcqStatus, &msgCount, &byteCount, rxBuffer);
if (rc)
printf("mxfMIL1553RxAcqRead() error; rc=0x%08x\n\r", rc);
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 Bus%s (0x%04x)\n\r", address, subAddress, wordCount, rxRec1553->
control & MXF_MIL1553_RX_REC_CTRL_MSG_BUS_B?
"B":
"A", rxRec1553->
data[0]);
printf(
"\t\tRT status: 0x%04x\n\r", rxRec1553->
data[msgInfo.
statusIndex[0]]);
printf(
"\t\tParity %s\n\r", rxRec1553->
control&MXF_MIL1553_RX_REC_CTRL_MSG_PARITY_ERROR?
"Error":
"OK");
break;
}
}
}
}
loop++;
} while(loop < 10);
}
if(!rc)
{
if (!rc)
}
if(!rc)
{
printf("Stopping BC - RT\n\r");
}
if(!rc)
if(!rc)
{
memset(&transGlobal, 0, sizeof(transGlobal));
if(!rc)
printf("Total number of transactions: %u\n\r", transGlobal.totalCount);
}
if(!rc)
{
memset(&errorGlobal, 0, sizeof(errorGlobal));
if(!rc)
printf(
"Total number of errors: %u\n\r", errorGlobal.
totalError);
}
if(txBuffer)
free(txBuffer);
if(rxBuffer)
free(rxBuffer);
if(rc)
{
sprintf (errorString,"ERROR # 0x%08x", rc);
printf("%s\n\r", errorString);
}
for(indexBuffer = 0; indexBuffer < 1; indexBuffer++)
{
if (bcBufferTx[indexBuffer])
{
if (rc)
printf("Free buffer failed !\n\r");
}
}
for(indexBuffer = 0; indexBuffer < 1; indexBuffer++)
{
if (rtBuffer[indexBuffer])
{
if (rc)
printf("Free buffer failed !\n\r");
}
}
if(bcBufferRx)
{
if (rc)
printf("Free buffer failed !\n\r");
}
printf("\n\rPress enter to terminate\n\r");
getchar();
return 0;
}