#include "example.h"
#define EXT_LOOPBACK FALSE
#define LOCAL
int main(void)
{
uint32 rc;
HMXF_SERVER server=0;
HMXF_DEVICE device=0;
uint64 result=0;
char info[256]="";
char diagnostic[256]="";
uint64 zone=0;
uint64 port;
int testCnt=0;
int failCnt=0;
#ifdef LOCAL
#else
#endif
if(rc!=MAXT_SUCCESS)
{
printf("Failed to connect; rc=0x%08x", rc);
getchar();
return 0;
}
if (!rc)
printf("Starting ...\n\n");
if (!rc)
if(!rc)
{
printf("mxfSelfTestMEMORY(EXHAUSTIVE) ... ");
rc=
mxfSelfTestMEMORY(device, MXF_SELFTEST_LEVEL_EXHAUSTIVE, &result, info, diagnostic);
printf("\n");
testCnt++; if(rc || result) failCnt++;
if(rc)
{
printf(" ERROR = 0x%08X \n", rc);
}
else
{
printf(" info = %s \n", info);
printf(" Result = %s \n", result?"FAILED":"PASSED");
if(result)
printf(" diagnostic = %s \n", diagnostic);
}
printf(" \n");
for(port=0; !rc; port++)
{
printf("mxfSelfTestMILSTD1553(port #%"PRIu64") ... ", port);
rc=
mxfSelfTestMILSTD1553(device, port, MXF_SELFTEST_LEVEL_QUICK, EXT_LOOPBACK, &result, info, diagnostic);
if(rc==MAXT_ERROR_PORT_NOT_FOUND) { rc=0; printf("\r \r"); break; }
printf("\n");
testCnt++; if(rc || result) failCnt++;
if(rc)
{
printf(" ERROR = 0x%08X \n", rc);
}
else
{
printf(" info = %s \n", info);
printf(" Result = %s \n", result?"FAILED":"PASSED");
if(result)
printf(" diagnostic = %s \n", diagnostic);
}
printf(" \n");
}
for(port=0; !rc; port++)
{
printf("mxfSelfTestEBR1553(port #%"PRIu64") ... ", port);
rc=
mxfSelfTestEBR1553(device, port, MXF_SELFTEST_LEVEL_QUICK, EXT_LOOPBACK, &result, info, diagnostic);
if((rc==MAXT_ERROR_PORT_NOT_FOUND) || (rc == MAXT_ERROR_MODULE_OPT_NOT_SUPPORTED)) { rc=0; printf("\r \r"); break; }
printf("\n");
testCnt++; if(rc || result) failCnt++;
if(rc)
{
printf(" ERROR = 0x%08X \n", rc);
}
else
{
printf(" info = %s \n", info);
printf(" Result = %s \n", result?"FAILED":"PASSED");
if(result)
printf(" diagnostic = %s \n", diagnostic);
}
printf(" \n");
}
for(port=0; !rc; port++)
{
printf("mxfSelfTestSERIALASYNC(port #%"PRIu64") ... ", port);
if(rc==MAXT_ERROR_PORT_NOT_FOUND) { rc=0; printf("\r \r"); break; }
printf("\n");
testCnt++; if(rc || result) failCnt++;
if(rc)
{
printf(" ERROR = 0x%08X \n", rc);
}
else
{
printf(" info = %s \n", info);
printf(" Result = %s \n", result?"FAILED":"PASSED");
if(result)
printf(" diagnostic = %s \n", diagnostic);
}
printf(" \n");
}
for(port=0; !rc; port++)
{
printf("mxfSelfTestARINC429(port #%"PRIu64") ... ", port);
rc=
mxfSelfTestARINC429(device, port, MXF_SELFTEST_LEVEL_QUICK, EXT_LOOPBACK, &result, info, diagnostic);
if(rc==MAXT_ERROR_PORT_NOT_FOUND) { rc=0; printf("\r \r"); break; }
printf("\n");
testCnt++; if(rc || result) failCnt++;
if(rc)
{
printf(" ERROR = 0x%08X \n", rc);
}
else
{
printf(" info = %s \n", info);
printf(" Result = %s \n", result?"FAILED":"PASSED");
if(result)
printf(" diagnostic = %s \n", diagnostic);
}
printf(" \n");
}
for(port=0; !rc; port++)
{
printf("mxfSelfTestARINC717(port #%"PRIu64") ... ", port);
rc=
mxfSelfTestARINC717(device, port, MXF_SELFTEST_LEVEL_QUICK, EXT_LOOPBACK, &result, info, diagnostic);
if(rc==MAXT_ERROR_PORT_NOT_FOUND) { rc=0; printf("\r \r"); break; }
printf("\n");
testCnt++; if(rc || result) failCnt++;
if(rc)
{
printf(" ERROR = 0x%08X \n", rc);
}
else
{
printf(" info = %s \n", info);
printf(" Result = %s \n", result?"FAILED":"PASSED");
if(result)
printf(" diagnostic = %s \n", diagnostic);
}
printf(" \n");
}
for(port=0; !rc; port++)
{
printf("mxfSelfTestHDLC(port #%"PRIu64") ... ", port);
rc=
mxfSelfTestHDLC(device, port, MXF_SELFTEST_LEVEL_QUICK, EXT_LOOPBACK, &result, info, diagnostic);
if(rc==MAXT_ERROR_PORT_NOT_FOUND) { rc=0; printf("\r \r"); break; }
printf("\n");
testCnt++; if(rc || result) failCnt++;
if(rc)
{
printf(" ERROR = 0x%08X \n", rc);
}
else
{
printf(" info = %s \n", info);
printf(" Result = %s \n", result?"FAILED":"PASSED");
if(result)
printf(" diagnostic = %s \n", diagnostic);
}
printf(" \n");
}
for(port=0; !rc; port++)
{
printf("mxfSelfTestCSDB(port #%"PRIu64") ... ", port);
rc=
mxfSelfTestCSDB(device, port, MXF_SELFTEST_LEVEL_QUICK, EXT_LOOPBACK, &result, info, diagnostic);
if(rc==MAXT_ERROR_PORT_NOT_FOUND) { rc=0; printf("\r \r"); break; }
printf("\n");
testCnt++; if(rc || result) failCnt++;
if(rc)
{
printf(" ERROR = 0x%08X \n", rc);
}
else
{
printf(" info = %s \n", info);
printf(" Result = %s \n", result?"FAILED":"PASSED");
if(result)
printf(" diagnostic = %s \n", diagnostic);
}
printf(" \n");
}
for(port=0; !rc; port++)
{
printf("mxfSelfTestARINC629(port #%"PRIu64") ... ", port);
rc=
mxfSelfTestARINC629(device, port, MXF_SELFTEST_LEVEL_QUICK, EXT_LOOPBACK, &result, info, diagnostic);
if(rc==MAXT_ERROR_PORT_NOT_FOUND) { rc=0; printf("\r \r"); break; }
printf("\n");
testCnt++; if(rc || result) failCnt++;
if(rc)
{
printf(" ERROR = 0x%08X \n", rc);
}
else
{
printf(" info = %s \n", info);
printf(" Result = %s \n", result?"FAILED":"PASSED");
if(result)
printf(" diagnostic = %s \n", diagnostic);
}
printf(" \n");
}
for(port=0; !rc; port++)
{
printf("mxfSelfTestDISCRETE(port #%"PRIu64") ... ", port);
rc=
mxfSelfTestDISCRETE(device, port, MXF_SELFTEST_LEVEL_QUICK, EXT_LOOPBACK, &result, info, diagnostic);
if(rc==MAXT_ERROR_PORT_NOT_FOUND) { rc=0; printf("\r \r"); break; }
printf("\n");
testCnt++; if(rc || result) failCnt++;
if(rc)
{
printf(" ERROR = 0x%08X \n", rc);
}
else
{
printf(" info = %s \n", info);
printf(" Result = %s \n", result?"FAILED":"PASSED");
if(result)
printf(" diagnostic = %s \n", diagnostic);
}
printf(" \n");
}
for(port=0; !rc; port++)
{
printf("mxfSelfTestARINC708(port #%"PRIu64") ... ", port);
rc=
mxfSelfTestARINC708(device, port, MXF_SELFTEST_LEVEL_QUICK, EXT_LOOPBACK, &result, info, diagnostic);
if(rc==MAXT_ERROR_PORT_NOT_FOUND) { rc=0; printf("\r \r"); break; }
printf("\n");
testCnt++; if(rc || result) failCnt++;
if(rc)
{
printf(" ERROR = 0x%08X \n", rc);
}
else
{
printf(" info = %s \n", info);
printf(" Result = %s \n", result?"FAILED":"PASSED");
if(result)
printf(" diagnostic = %s \n", diagnostic);
}
printf(" \n");
}
for(port=0; !rc; port++)
{
printf("mxfSelfTestASCB(port #%"PRIu64") ... ", port);
rc=
mxfSelfTestASCB(device, port, MXF_SELFTEST_LEVEL_QUICK, EXT_LOOPBACK, &result, info, diagnostic);
if(rc==MAXT_ERROR_PORT_NOT_FOUND) { rc=0; printf("\r \r"); break; }
printf("\n");
testCnt++; if(rc || result) failCnt++;
if(rc)
{
printf(" ERROR = 0x%08X \n", rc);
}
else
{
printf(" info = %s \n", info);
printf(" Result = %s \n", result?"FAILED":"PASSED");
if(result)
printf(" diagnostic = %s \n", diagnostic);
}
printf(" \n");
}
for(port=0; !rc; port++)
{
printf("mxfSelfTestHFCE(port #%"PRIu64") ... ", port);
rc=
mxfSelfTestHFCE(device, port, MXF_SELFTEST_LEVEL_QUICK, EXT_LOOPBACK, &result, info, diagnostic);
if(rc==MAXT_ERROR_PORT_NOT_FOUND) { rc=0; printf("\r \r"); break; }
printf("\n");
testCnt++; if(rc || result) failCnt++;
if(rc)
{
printf(" ERROR = 0x%08X \n", rc);
}
else
{
printf(" info = %s \n", info);
printf(" Result = %s \n", result?"FAILED":"PASSED");
if(result)
printf(" diagnostic = %s \n", diagnostic);
}
printf(" \n");
}
for(port=0; !rc; port++)
{
printf("mxfSelfTestCANBUS(port #%"PRIu64") ... ", port);
rc=
mxfSelfTestCANBUS(device, port, MXF_SELFTEST_LEVEL_QUICK, EXT_LOOPBACK, &result, info, diagnostic);
if(rc==MAXT_ERROR_PORT_NOT_FOUND) { rc=0; printf("\r \r"); break; }
printf("\n");
testCnt++; if(rc || result) failCnt++;
if(rc)
{
printf(" ERROR = 0x%08X \n", rc);
}
else
{
printf(" info = %s \n", info);
printf(" Result = %s \n", result?"FAILED":"PASSED");
if(result)
printf(" diagnostic = %s \n", diagnostic);
}
printf(" \n");
}
for(port = 0; !rc; port++)
{
printf("mxfSelfTestFLEXDIO(port #%"PRIu64") ... ", port);
rc =
mxfSelfTestFLEXDIO(device, port, MXF_SELFTEST_LEVEL_QUICK, EXT_LOOPBACK, &result, info, diagnostic);
if(rc == MAXT_ERROR_PORT_NOT_FOUND) { rc = 0; printf("\r \r"); break; }
printf("\n");
testCnt++; if(rc || result) failCnt++;
if(rc)
{
printf(" ERROR = 0x%08X \n", rc);
}
else
{
printf(" info = %s \n", info);
printf(" Result = %s \n", result ? "FAILED" : "PASSED");
if(result)
printf(" diagnostic = %s \n", diagnostic);
}
printf(" \n");
}
for(zone=0; !rc; zone++)
{
double value;
printf("mxfSelfTestVOLTAGE(%"PRIu64") ... ", zone);
if(rc==MAXT_ERROR_ZONE) { rc=0; printf("\r \r"); break; }
printf("\n");
testCnt++; if(rc || result) failCnt++;
if(rc)
{
printf(" ERROR = 0x%08X \n", rc);
}
else
{
printf(" info = %s \n", info);
printf(" Result = %s \n", result?"FAILED":"PASSED");
printf(" value = %.2f \n", value);
if(result)
printf(" diagnostic = %s \n", diagnostic);
}
printf(" \n");
}
for(zone=0; !rc; zone++)
{
double value;
printf("mxfSelfTestCURRENT(%"PRIu64") ... ", zone);
if(rc==MAXT_ERROR_ZONE) { rc=0; printf("\r \r"); break; }
printf("\n");
testCnt++; if(rc || result) failCnt++;
if(rc)
{
printf(" ERROR = 0x%08X \n", rc);
}
else
{
printf(" info = %s \n", info);
printf(" Result = %s \n", result?"FAILED":"PASSED");
printf(" value = %.2f \n", value);
if(result)
printf(" diagnostic = %s \n", diagnostic);
}
printf(" \n");
}
for(zone=0; !rc; zone++)
{
double value;
printf("mxfSelfTestTEMPERATURE(%"PRIu64") ... ", zone);
if(rc==MAXT_ERROR_ZONE) { rc=0; printf("\r \r"); break; }
printf("\n");
testCnt++; if(rc || result) failCnt++;
if(rc)
{
printf(" ERROR = 0x%08X \n", rc);
}
else
{
printf(" info = %s \n", info);
printf(" Result = %s \n", result?"FAILED":"PASSED");
printf(" value = %.2f \n", value);
if(result)
printf(" diagnostic = %s \n", diagnostic);
}
printf(" \n");
}
if(!rc)
{
printf("mxfSelfTestRTCLK() ... ");
rc=
mxfSelfTestRTCLK(device, MXF_SELFTEST_LEVEL_QUICK, &result, info, diagnostic);
if(rc == MAXT_ERROR_NOT_SUPPORTED)
{
rc = MAXT_SUCCESS;
printf("\r \r");
}
else
{
printf("\n");
testCnt++; if(rc || result) failCnt++;
if(rc)
{
printf(" ERROR = 0x%08X \n", rc);
}
else
{
printf(" info = %s \n", info);
printf(" Result = %s \n", result?"FAILED":"PASSED");
if(result)
printf(" diagnostic = %s \n", diagnostic);
}
printf(" \n");
}
}
if(!rc)
{
printf("mxfSelfTestDEBUGCOMPORT() ... ");
if(rc == MAXT_ERROR_NOT_SUPPORTED)
{
rc = MAXT_SUCCESS;
printf("\r \r");
}
else
{
printf("\n");
testCnt++; if(rc || result) failCnt++;
if(rc)
{
printf(" ERROR = 0x%08X \n", rc);
}
else
{
printf(" info = %s \n", info);
printf(" Result = %s \n", result?"FAILED":"PASSED");
if(result)
printf(" diagnostic = %s \n", diagnostic);
}
printf(" \n");
}
}
if(!rc)
{
printf("mxfSelfTestNVSTORAGE() ...");
if((rc == MAXT_ERROR_NVSTORAGE_NOT_FOUND) || (rc == MAXT_ERROR_FUNCTION_NOT_IMPLEMENTED))
{
rc = MAXT_SUCCESS;
printf("\r \r");
}
else
{
printf("\n");
testCnt++; if(rc || result) failCnt++;
if(rc)
{
printf(" ERROR = 0x%08X \n", rc);
}
else
{
printf(" info = %s \n", info);
printf(" Result = %s \n", result?"FAILED":"PASSED");
if(result)
printf(" diagnostic = %s \n", diagnostic);
}
printf(" \n");
}
}
if(!rc)
{
printf("mxfSelfTestSYNCIO() ... \n");
rc=
mxfSelfTestSYNCIO(device, MXF_SELFTEST_LEVEL_QUICK, EXT_LOOPBACK, &result, info, diagnostic);
testCnt++; if(rc || result) failCnt++;
if(rc)
{
printf(" ERROR = 0x%08X \n", rc);
}
else
{
printf(" info = %s \n", info);
printf(" Result = %s \n", result?"FAILED":"PASSED");
if(result)
printf(" diagnostic = %s \n", diagnostic);
}
printf(" \n");
}
if(!rc)
{
printf("mxfSelfTestIRIGB(Digital) ... \n");
rc=
mxfSelfTestIRIGB(device, MXF_SELFTEST_IRIGB_SIGNAL_DIGITAL, MXF_SELFTEST_LEVEL_QUICK, EXT_LOOPBACK, &result, info, diagnostic);
testCnt++; if(rc || result) failCnt++;
if(rc)
{
printf(" ERROR = 0x%08X \n", rc);
}
else
{
printf(" info = %s \n", info);
printf(" Result = %s \n", result?"FAILED":"PASSED");
if(result)
printf(" diagnostic = %s \n", diagnostic);
}
printf(" \n");
}
#if EXT_LOOPBACK
if(!rc)
{
printf("mxfSelfTestIRIGB(AM) ... \n");
rc=
mxfSelfTestIRIGB(device, MXF_SELFTEST_IRIGB_SIGNAL_AM, MXF_SELFTEST_LEVEL_QUICK, EXT_LOOPBACK, &result, info, diagnostic);
testCnt++; if(rc || result) failCnt++;
if(rc)
{
printf(" ERROR = 0x%08X \n", rc);
}
else
{
printf(" info = %s \n", info);
printf(" Result = %s \n", result?"FAILED":"PASSED");
if(result)
printf(" diagnostic = %s \n", diagnostic);
}
printf(" \n");
}
if(!rc)
{
printf("mxfSelfTestIRIGB(AM+1PPS External Signal) ... \n");
rc=
mxfSelfTestIRIGB(device, MXF_SELFTEST_IRIGB_SIGNAL_AM_1PPS, MXF_SELFTEST_LEVEL_QUICK, EXT_LOOPBACK, &result, info, diagnostic);
testCnt++; if(rc || result) failCnt++;
if(rc)
{
printf(" ERROR = 0x%08X \n", rc);
}
else
{
printf(" info = %s \n", info);
printf(" Result = %s \n", result?"FAILED":"PASSED");
printf(" diagnostic = %s \n", diagnostic);
}
printf(" \n");
}
#endif
#ifdef LOCAL
if(!rc)
{
rc=
mxfSelfTestETHERNET(device, 0, MXF_SELFTEST_LEVEL_QUICK, EXT_LOOPBACK, &result, info, diagnostic);
if(rc != MAXT_ERROR_NOT_SUPPORTED)
{
printf("mxfSelfTestETHERNET() ... \n");
testCnt++; if(rc || result) failCnt++;
if(rc)
{
printf(" ERROR = 0x%08X \n", rc);
}
else
{
printf(" info = %s \n", info);
printf(" Result = %s \n", result?"FAILED":"PASSED");
if(result)
printf(" diagnostic = %s \n", diagnostic);
}
printf(" \n");
}
else
{
rc = MAXT_SUCCESS;
}
}
#endif
printf(" --------------------------------------- \n");
printf(" TEST %s ", failCnt?"FAILED":"PASSED");
if(failCnt)
printf("(%u of %u tests failed) \n", failCnt, testCnt);
else
printf("\n");
printf(" --------------------------------------- \n");
printf("\n");
}
if(rc)
{
char errorString[256];
printf("\n");
sprintf (errorString,"ERROR # 0x%X", rc);
printf("%s\n\r", errorString);
}
printf("\nPress a key to terminate\n");
getchar();
return rc;
}