MGFWrapper::MGFWrapper() { unsetWindowProperties(); // Force setWindowProperties to be called before init. disableTyping(); setInstanceType(MGFSINGLEPLAYERINSTANCE); disableLogging(); }
INT frontend_init() { /* hardware initialization */ INT status; // have simulator start last after master / readout to make sure readout gets all data/triggers cm_set_transition_sequence( TR_START, 501); // have simulator stop first before master / readout to make sure readout gets all data/triggers cm_set_transition_sequence( TR_STOP, 499); // MIDAS thread //TG pthread_mutex_lock( &mutex_midas ); #ifdef USE_CALO_SIMULATOR if ( calo_simulator_init() != 0 ) { cm_msg(MERROR, __FILE__, "Cannot start calorimeter simulator"); return FE_ERR_HW; } #endif #ifdef USE_GPU if ( gpu_thread_init() != 0 ) { cm_msg(MERROR, __FILE__, "Cannot start gpu thread"); return FE_ERR_HW; } #endif // initialize TCP simulator settings from ODB if ( amc13_ODB_init() != SUCCESS ) { return FE_ERR_ODB; } // get TCP readout settings from ODB if ( amc13_ODB_get() != SUCCESS ) { return FE_ERR_ODB; } /* disabled for AMC13 based readout // initialize TCP Calo emulator (TCP server) status = tcp_server_init(); if ( status != 0 ) { cm_msg(MERROR, __FILE__, "TCP initialization failed, err = %i", status); return FE_ERR_HW; } dbprintf("%s(%d): TCP initialization done \n", __func__, __LINE__); */ // initialize RPC communication interface with master status = frontend_rpc_init(); if ( status != SUCCESS ) { cm_msg(MERROR, __FILE__, "RPC initialization failed, err = %i", status); return FE_ERR_HW; } dbprintf("%s(%d): RPC initialization done \n", __func__, __LINE__); //initialize AMC13 disableLogging();//disable uHal logging int serialNo =1; //int serialNo =33; int slot = 13; int usingControlHub= 0; /* std::string T2ip = "192.168.1.252"; std::string T1ip = "192.168.1.253"; std::string addrTab1="/home/gohn/gm2daq/amc13/map/AMC13_AddressTable_S6.xml"; std::string addrTab2="/home/gohn/gm2daq/amc13/map/AMC13_AddressTable_K7.xml"; */ std::string T2ip = "192.168.1.252"; std::string T1ip = "192.168.1.253"; std::string addrTab1="/home/daq/gm2daq/amc13/map/AMC13_AddressTable_S6.xml"; std::string addrTab2="/home/daq/gm2daq/amc13/map/AMC13_AddressTable_K7.xml"; Aeo = new AMC13_env(&Auo, serialNo, slot, usingControlHub); Aeo->setIPAddresses(T2ip,T1ip); Aeo->setAddressTables(addrTab1,addrTab2); amc13 = new cms::AMC13(Aeo); return SUCCESS; }
INT frontend_init() { /* hardware initialization */ INT status; // have readout stop last to ensure it get data from simulator cm_set_transition_sequence ( TR_STOP, 501); //initialize AMC13 RHF disableLogging();//disable uHal logging // initalize amc13 settings from ODB std::cout << "about to do amc13_ODB_init()\n"; if ( amc13_ODB_init() != SUCCESS ) { return FE_ERR_ODB; } std::cout << "finished amc13_ODB_init()\n"; if( ! amc13_settings_odb.simulate_data){ //int serialNo =1; //int serialNo =33; //int slot = 13; //int usingControlHub= 0; //std::string T2ip = "192.168.1.188"; //std::string T1ip = "192.168.1.189"; //std::string addrTab1="/home/daq/DAQ/amc13/map/AMC13_AddressTable_S6.xml"; //std::string addrTab2="/home/daq/DAQ/amc13/map/AMC13_AddressTable_K7.xml"; int serialNo = amc13_amc13_odb.serialNo; int slot = amc13_amc13_odb.slot; int usingControlHub = amc13_amc13_odb.usingControlHub; std::string T2ip = amc13_amc13_odb.T2ip; std::string T1ip = amc13_amc13_odb.T1ip; std::string addrTab1 = amc13_amc13_odb.addrTab1; std::string addrTab2 = amc13_amc13_odb.addrTab2; //std::string addrTab2 = "/home/gohn/gm2daq/amc13/map/AMC13_AddressTable_K7.xml"; std::cout <<std::endl<< "AMC13 settings from ODB\n"; std::cout << serialNo<< " "<<slot<<" "<<usingControlHub<<" "<<T2ip<<" "<<T1ip<<std::endl; std::cout << addrTab1 << std::endl; std::cout << addrTab2 << std::endl<<std::endl; Aeo = new AMC13_env(&Auo, serialNo, slot, usingControlHub); std::cout << "Setting IP addresses ... "; Aeo->setIPAddresses(T2ip,T1ip); std::cout << "Setting address tables ... "; Aeo->setAddressTables(addrTab1,addrTab2); std::cout << "... new cms::AMC13 ...\n"; amc13 = new cms::AMC13(Aeo); int riders_enabled = channel_calc(); std::cout << "Channels read " << std::hex<<riders_enabled<<std::endl; int setup_stat; if(amc13_amc13_odb.enableSoftwareTrigger) AMC13_FAKE_DATA = TRUE; else AMC13_FAKE_DATA = FALSE; // this configures registers in the rider if(!AMC13_FAKE_DATA ) frontend_init_wfd(); // this configures registers in the amc13 amc13lib.AMC13_rg(amc13);//general reset of both chips if(AMC13_FAKE_DATA) setup_stat = amc13lib.AMC13_FD_Setup(amc13); else setup_stat = amc13lib.AMC13_Rider_Setup(amc13,riders_enabled); printf(" AMC13 Setup commands issued \n"); if (setup_stat==0){ printf("STOP! AMC13 setup failed!\n"); return FE_ERR_HW; } } // initalize TCP settings from ODB if ( amc13simulator_ODB_get() != SUCCESS ) { return FE_ERR_ODB; } // MIDAS thread lock pthread_mutex_lock( &mutex_midas ); // create/initialize TCP calo readout (TCP client) status = tcp_client_init(); if ( status != 0 ) { cm_msg(MERROR, __FILE__, "TCP initialization failed, err = %i", status); return FE_ERR_HW; } dbprintf("%s(%d): TCP initialization done \n", __func__, __LINE__); // create/initialize GPU thread if ( gpu_thread_init() != 0 ) { cm_msg(MERROR, __FILE__, "Cannot start gpu thread"); return FE_ERR_HW; } dbprintf("%s(%d): GPU initialization done \n", __func__, __LINE__); // create/initialize parallel port communications #ifdef USE_PARALLEL_PORT printf("initialize parallel port address 0x%08x\n", pp_addr); if ( ioperm(pp_addr,1,1) != 0 ) { cm_msg(MERROR, __FILE__, "Cannot connect to parallel port"); return FE_ERR_HW; } #endif // create/initialize RPC communications status = frontend_rpc_init(); if ( status != SUCCESS ) { cm_msg(MERROR, __FILE__, "RPC initialization failed, err = %i", status); return FE_ERR_HW; } dbprintf("%s(%d): RPC initialization done \n", __func__, __LINE__); return SUCCESS; }
bool MGMap::runConsoleCommand(const char *c, MGFramework *w, MGSymbolTable *s) { char cmd[MGF_SCRIPTLINE_MAXLENGTH]; strcpy(cmd, c); std::vector<std::string> cmdvec = MGFramework::split(cmd, " "); switch(detectMGComponentConsoleCommand(cmdvec)) { case MGComponent_UNDEFINED: MGFLOG_ERROR("MGMap::runConsoleCommand received MGComponent_UNDEFINED from MGMap::detectMGComponentConsoleCommand"); break; case MGComponent_MAP_HELP: { std::cout << "-----------------------------------------------------------------------------" << std::endl << std::endl; std::cout << "map help - Displays help information for console commands implemented in the" << std::endl; std::cout << " map object." << std::endl; return true; } case MGComponent_MAP_PATH_INT_INT_INT_INT: { int x1 = w->toInt(cmdvec[2], s); int y1 = w->toInt(cmdvec[3], s); int x2 = w->toInt(cmdvec[4], s); int y2 = w->toInt(cmdvec[5], s); MGFLOG_INFO("Calculating closest path from (" << x1 << "," << y1 << ") to (" << x2 << "," << y2 << ")."); calculatePath(MGFBASICPATH1, x1, y1, x2, y2); return true; } case MGComponent_MAP_SETSIZE_INT_INT_INT_INT: { int x = w->toInt(cmdvec[2], s); int y = w->toInt(cmdvec[3], s); int tx = w->toInt(cmdvec[4], s); int ty = w->toInt(cmdvec[5], s); reInit(x, y, tx, ty); return true; } case MGComponent_MAP_LOGGING_ON: { enableLogging(); MGFLOG_INFO("Logging enabled."); return true; } case MGComponent_MAP_LOGGING_OFF: { disableLogging(); MGFLOG_INFO("Logging disabled."); return true; } default: MGFLOG_ERROR("MGMap::detectComponentConsoleCommand returned a bad value"); return true; } std::cout << "Unknown command" << std::endl; return true; }