#include "example.h"
#include <string.h>
#define MAX_RX_RECORDS_TO_RECEIVE 1000
#define RX_BUFFER_SIZE MAX_RX_RECORDS_TO_RECEIVE*sizeof(MXF_A629_DATAREC)
#define MAX_TX_RECORDS_TO_TRANSMIT 1
#define TX_BUFFER_SIZE MAX_TX_RECORDS_TO_TRANSMIT*sizeof(MXF_A629_DATAREC)
int main(void)
{
HMXF_CHANNEL ahChn[120], ahBM=0;
int iMsg,
iCnt;
HMXF_SERVER server=0;
HMXF_BUFFER txBuffer[14]={0,0,0,0,0,0,0,0,0,0,0,0,0,0};
HMXF_BUFFER rxBuffer=0;
uint32 rc = 0;
HMXF_DEVICE device=0;
uint64 count=0, module=0, NbCh, NbBM, index, iTI=0;
uint64 status, msgsCount, bytesCount, indexBuffer;
char szBuffer[128];
#ifdef LOCAL
#else
#endif
if (!rc)
{
printf("Starting ...\n");
}
if (!rc)
if (!rc)
if (!rc)
if (!rc)
if (!rc)
#ifdef TTL
if (!rc)
#else
if (!rc)
#endif
if (!rc)
for(index=0; index<8 && !rc; index++)
for(index=8; index<14 && !rc; index++)
if (!rc)
{
if (!hostBuffer)
rc = MAXT_ERROR_MEM;
}
if (!rc)
if (!rc)
if (!rc)
{
if (!rc)
printf("\nAcquisition started\n\r");
}
while (!rc)
{
printf("\n\rPress ENTER to switch to RT #0, or 'Q' to Quit! ");
fgets(szBuffer, sizeof(szBuffer), stdin);
if (*szBuffer=='q' || *szBuffer=='Q')
rc = (uint32)-1;
if(!rc)
if(!rc)
if(!rc)
if(!rc)
if (!rc)
{
iMsg = 0;
aMsg629[iMsg].
buffer = txBuffer[0];
aMsg629[iMsg].
options = MXF_A629_TXPERIODIC_MJRFRAME_MSG_OPT_DEFAULT;
aMsg629[iMsg].
label = 0x100;
iMsg = 1;
aMsg629[iMsg].
buffer = txBuffer[1];
aMsg629[iMsg].
options = MXF_A629_TXPERIODIC_MJRFRAME_MSG_OPT_DEFAULT;
aMsg629[iMsg].
label = 0x200;
iMsg = 2;
aMsg629[iMsg].
buffer = txBuffer[2];
aMsg629[iMsg].
options = MXF_A629_TXPERIODIC_MJRFRAME_MSG_OPT_DEFAULT;
aMsg629[iMsg].
label = 0x300;
}
if (!rc)
{
iMsg = 0;
aMsg629[iMsg].
buffer = txBuffer[3];
aMsg629[iMsg].
options = MXF_A629_TXPERIODIC_MJRFRAME_MSG_OPT_DEFAULT;
aMsg629[iMsg].
label = 0x101;
iMsg = 1;
aMsg629[iMsg].
buffer = txBuffer[4];
aMsg629[iMsg].
options = MXF_A629_TXPERIODIC_MJRFRAME_MSG_OPT_DEFAULT;
aMsg629[iMsg].
label = 0x201;
}
if (!rc)
{
iMsg = 0;
aMsg629[iMsg].
options = MXF_A629_TXPERIODIC_MJRFRAME_MSG_OPT_UNUSED;
iMsg = 1;
aMsg629[iMsg].
buffer = txBuffer[5];
aMsg629[iMsg].
options = MXF_A629_TXPERIODIC_MJRFRAME_MSG_OPT_DEFAULT;
aMsg629[iMsg].
label = 0x202;
}
if (!rc)
{
iMsg = 0;
aMsg629[iMsg].
options = MXF_A629_TXPERIODIC_MJRFRAME_MSG_OPT_UNUSED;
iMsg = 1;
aMsg629[iMsg].
buffer = txBuffer[6];
aMsg629[iMsg].
options = MXF_A629_TXPERIODIC_MJRFRAME_MSG_OPT_DEFAULT;
aMsg629[iMsg].
label = 0x203;
}
if (!rc)
{
iMsg = 0;
aMsg629[iMsg].
options = MXF_A629_TXPERIODIC_MJRFRAME_MSG_OPT_UNUSED;
iMsg = 1;
aMsg629[iMsg].
buffer = txBuffer[7];
aMsg629[iMsg].
options = MXF_A629_TXPERIODIC_MJRFRAME_MSG_OPT_DEFAULT;
aMsg629[iMsg].
label = 0x204;
}
if (!rc)
{
}
if (!rc)
{
}
if (!rc)
{
}
if (!rc)
{
p = aRec629;
for (iCnt=0; iCnt<10; iCnt++)
{
p->
data[1] = (uint16)iCnt;
}
}
if (!rc)
{
}
if (!rc)
{
}
if (!rc)
{
}
if (!rc)
{
}
if (!rc)
{
iTI = 25000000;
if (!rc)
}
if(!rc)
{
majorProperties.
mode = MXF_A629_TXPERIODIC_MJRFRAME_PROPERTIES_MODE_INDEPENDENT;
}
if (!rc)
{
printf("\n\rRT #0 started.\n\r");
printf("\n\rPress ENTER to switch to RT #60, or 'Q' to Quit! ");
fgets(szBuffer, sizeof(szBuffer), stdin);
if (*szBuffer=='q' || *szBuffer=='Q')
rc = (uint32)-1;
}
if(!rc)
if(!rc)
if(!rc)
if(!rc)
if (!rc)
{
iMsg = 0;
aMsg629[iMsg].
buffer = txBuffer[8];
aMsg629[iMsg].
options = MXF_A629_TXPERIODIC_MJRFRAME_MSG_OPT_DEFAULT;
aMsg629[iMsg].
label = 0x100;
iMsg = 1;
aMsg629[iMsg].
buffer = txBuffer[9];
aMsg629[iMsg].
options = MXF_A629_TXPERIODIC_MJRFRAME_MSG_OPT_DEFAULT;
aMsg629[iMsg].
label = 0x200;
iMsg = 2;
aMsg629[iMsg].
buffer = txBuffer[10];
aMsg629[iMsg].
options = MXF_A629_TXPERIODIC_MJRFRAME_MSG_OPT_DEFAULT;
aMsg629[iMsg].
label = 0x300;
}
if (!rc)
{
iMsg = 0;
aMsg629[iMsg].
options = MXF_A629_TXPERIODIC_MJRFRAME_MSG_OPT_UNUSED;
iMsg = 1;
aMsg629[iMsg].
buffer = txBuffer[11];
aMsg629[iMsg].
options = MXF_A629_TXPERIODIC_MJRFRAME_MSG_OPT_DEFAULT;
aMsg629[iMsg].
label = 0x201;
iMsg = 2;
aMsg629[iMsg].
buffer = txBuffer[12];
aMsg629[iMsg].
options = MXF_A629_TXPERIODIC_MJRFRAME_MSG_OPT_DEFAULT;
aMsg629[iMsg].
label = 0x301;
}
if (!rc)
{
iMsg = 0;
aMsg629[iMsg].
options = MXF_A629_TXPERIODIC_MJRFRAME_MSG_OPT_UNUSED;
iMsg = 1;
aMsg629[iMsg].
buffer = txBuffer[13];
aMsg629[iMsg].
options = MXF_A629_TXPERIODIC_MJRFRAME_MSG_OPT_DEFAULT;
aMsg629[iMsg].
label = 0x202;
}
if (!rc)
{
}
if (!rc)
{
}
if (!rc)
{
p = aRec629;
for (iCnt=0; iCnt<10; iCnt++)
{
p->
data[1] = (uint16)(220 + iCnt);
}
}
if (!rc)
{
}
if (!rc)
{
}
if (!rc)
{
}
if (!rc)
{
iTI = 25000000;
if (!rc)
}
if(!rc)
{
majorProperties.
mode = MXF_A629_TXPERIODIC_MJRFRAME_PROPERTIES_MODE_INDEPENDENT;
}
if (!rc)
printf("\n\rRT #60 started.\n\r");
}
if (rc==-1)
rc = MAXT_SUCCESS;
if(!rc)
if(!rc)
if (!rc)
if (!rc)
{
rc =
mxfA629RxAcqRead(rxBuffer, 0, RX_BUFFER_SIZE, &status, &msgsCount, &bytesCount, hostBuffer);
DisplayDataArray(msgsCount, hostBuffer);
}
if (!rc)
printf("\n\rTest done.\n\r");
else
{
char errorString[200];
sprintf (errorString,"ERROR # 0x%X", rc);
printf("%s\n\r", errorString);
}
if (rxBuffer)
for (indexBuffer = 0; indexBuffer < 14; indexBuffer++)
{
if (txBuffer[indexBuffer])
}
printf("\n\rPress ENTER to terminate ");
fgets(szBuffer, sizeof(szBuffer), stdin);
return rc;
}
{
uint64 iRec,
iData;
printf("\n");
for(iRec=0; iRec < recNum; iRec++)
{
if(p->
control & MXF_A629_RX_REC_CTRL_STRING_CRC_ERROR)
printf(" CRC error");
if(p->
control & MXF_A629_RX_REC_CTRL_STRING_DATA_SYNC_ERROR)
printf(" Data sync error");
if(p->
control & (MXF_A629_RX_REC_CTRL_STRING_LABEL_MANCHESTER_ERROR|MXF_A629_RX_REC_CTRL_STRING_DATA_MANCHESTER_ERROR))
printf(" Manchester error");
if(p->
control & (MXF_A629_RX_REC_CTRL_STRING_LABEL_PARITY_ERROR|MXF_A629_RX_REC_CTRL_STRING_DATA_PARITY_ERROR))
printf(" Parity error");
if(p->
control & MXF_A629_RX_REC_CTRL_STRING_EOS_ERROR)
printf(" End of String error");
for(iData=0; iData < p->
dataSize/2; iData++)
{
printf(
"%04x ", p->
data[iData]);
if(!((iData+1)%8) && (iData+1 < p->
dataSize/2))
printf("\n ");
}
printf("\n");
}
}