#include <mil.h>
#include <milfpga.h>
int MosMain(void)
{
MIL_ID MilApplication;
MIL_ID MilSystem ;
MIL_TEXT_PTR ConfigurationString = NULL;
MIL_TEXT_PTR FpgaPackageString = NULL;
MIL_INT* ProcessingUnitList = NULL;
MIL_INT BoardType = 0;
MIL_INT i = 0;
MIL_INT Count = 0;
MappAllocDefault(M_DEFAULT, &MilApplication, &MilSystem, M_NULL,
M_NULL, M_NULL);
MsysInquire(MilSystem, M_BOARD_TYPE, &BoardType);
if(!(BoardType & M_PF))
{
MosPrintf(MIL_TEXT("Error, this example needs a processing FPGA installed on\n"));
MosPrintf(MIL_TEXT("your board to continue.\n"));
MosPrintf(MIL_TEXT("Press <Enter> to quit.\n"));
MosGetch();
MsysFree(MilSystem);
MappFree(MilApplication);
return 0;
}
MosPrintf(MIL_TEXT("Detecting processing FPGA configuration\n"));
MfpgaInquire(MilSystem, M_DEV0, M_FPGA_PACKAGE_NAME_LENGTH, &Count);
FpgaPackageString = new MIL_TEXT_CHAR[Count+1];
MfpgaInquire(MilSystem, M_DEV0, M_FPGA_PACKAGE_NAME, FpgaPackageString);
MosPrintf(MIL_TEXT("FPGA package: %s\n"), FpgaPackageString);
MfpgaInquire(MilSystem, M_DEV0, M_FPGA_CONFIGURATION_FILENAME_LENGTH, &Count);
ConfigurationString = new MIL_TEXT_CHAR[Count+1];
MfpgaInquire(MilSystem, M_DEV0, M_FPGA_CONFIGURATION_FILENAME, ConfigurationString);
MosPrintf(MIL_TEXT("FPGA config file: %s\n"), ConfigurationString);
MfpgaInquire(MilSystem, M_DEV0, M_NUMBER_OF_PU, &Count);
ProcessingUnitList = new MIL_INT[Count];
MfpgaInquire(MilSystem, M_DEV0, M_PU_LIST, ProcessingUnitList);
MosPrintf(MIL_TEXT("\nListing FunctionId's of all detected units\n"));
MosPrintf(MIL_TEXT("Detected %d Processing units:\n"), Count);
for(i=0; i<Count; i++)
MosPrintf(MIL_TEXT("0x%.4X\t"), ProcessingUnitList[i]);
MosPrintf(MIL_TEXT("\n\nPress a key to quit.\n"));
MosGetch();
delete [] FpgaPackageString;
delete [] ConfigurationString;
delete [] ProcessingUnitList;
MappFreeDefault(MilApplication, MilSystem, M_NULL, M_NULL, M_NULL);
return 0;
}