Code:
int CKartentestprogDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDialog::OnCreate(lpCreateStruct) == -1)
return -1;
//connect the fpga and load the .hap file
microenable *board;
fpga_design *design;
volatile unsigned long *fpga;
int rCode;
int PlxClk = 40;
int FpgaClk = 100;
char DesignName[128] = "kartentester.hap";
// -------------------------------------------------------------------
// initialization of hardware
// -------------------------------------------------------------------
board = initialize_microenable();
if (board==NULL) {
//intf ("hardware initialization failed (code %d) : %s\n",
// Me_GetErrCode(NULL),Me_GetErrMsg(NULL));
MessageBox( "Hardwareinizialisation failed", "Error", MB_OK );
return -1;
}
//printf ("hardware initialization ok\n");
MessageBox( "Hardware inizialisation is ok", "No Error", MB_OK );
// -------------------------------------------------------------------
// load a design
// -------------------------------------------------------------------
design = load_design(board,DesignName); // available in standard path
if (design == NULL) {
//printf ("load design %s failed (code %d) : %s\n",
// DesignName,Me_GetErrCode(board),Me_GetErrMsg(board));
MessageBox( "Load of the Design failed", "Error", MB_OK );
return -1;
}
//printf ("load design ok\n");
MessageBox( "Load of the Design is ok", "No Error", MB_OK );
// -------------------------------------------------------------------
// set clocks
// -------------------------------------------------------------------
rCode = set_plx_clk (board,design, PlxClk);
if (rCode) {
//intf ("setting plx clock to %d Mhz failed: error code %d)\n",PlxClk,rCode);
MessageBox( "Clock Settings failed", "Error", MB_OK );
return -1;
}
rCode = set_fpga_clk (board,design, FpgaClk);
if (rCode) {
//printf ("setting fpga clock to %d Mhz failed: error code %d)\n",FpgaClk,rCode);
MessageBox( "Clock Settings failed", "Error", MB_OK );
return -1;
}
//printf ("clock setting ok (plx: %d Mhz, Fpga: %d Mhz)\n",PlxClk,FpgaClk);
MessageBox( "Clock Settings are ok", "No Error", MB_OK );
// -------------------------------------------------------------------
// configure FPGA
// -------------------------------------------------------------------
rCode = configure_fpga(board,design);
if (rCode) {
//printf ("configuration design %s failed: error code %d)\n",DesignName,rCode);
MessageBox( "configuration design failed", "Error", MB_OK );
return -1;
}
//printf ("configuration design %s ok\n",DesignName);
MessageBox( "configuration design is ok", "No Error", MB_OK );
// -------------------------------------------------------------------
// get the access pointer
// -------------------------------------------------------------------
fpga = (volatile unsigned long *) GetAccessPointer (board);
if (fpga == NULL) {
//printf ("memory map failed: error code %d (%s))\n",Me_GetErrCode(board),Me_GetErrMsg(board));
MessageBox( "memory map failed", "Error", MB_OK );
return -1;
}
MessageBox( "Memory Map ok", "No Error", MB_OK );
return 0;
}
SO i hope someone could tell my what this error is all about and where it might come from.