static bool ArmAll() { List <PADE> Slaves = PADE_explorer.getallPADE(PADE.type_of_PADE.slave); List <PADE> Master = PADE_explorer.getallPADE(PADE.type_of_PADE.crate_master); //need to check there is only one! foreach (PADE thisPADE in Slaves) { TB4.activatePADE(thisPADE); //PADE_explorer.registerLookup("CONTROL_REG").RegWrite(0x240); //PADE_explorer.registerLookup("CONTROL_REG").RegWrite(0x2c0); PADE_explorer.registerLookup("CONTROL_REG").RegWrite(0x0240); PADE_explorer.registerLookup("CONTROL_REG").RegWrite(0x02c0); PADE_explorer.registerLookup("SOFTWARE_RESET").RegWrite(1); //???this resets the ping and pong pointers, I guess PADE_explorer.registerLookup("TRIG_ARM").RegWrite(1); TB4_Exception.logConsoleOnly("slave(s) armed"); } foreach (PADE thisPADE in Master) { TB4.activatePADE(thisPADE); //PADE_explorer.registerLookup("CONTROL_REG").RegWrite(0x340); //PADE_explorer.registerLookup("CONTROL_REG").RegWrite(0x3c0); PADE_explorer.registerLookup("CONTROL_REG").RegWrite(0x0340); PADE_explorer.registerLookup("CONTROL_REG").RegWrite(0x03c0); PADE_explorer.registerLookup("SOFTWARE_RESET").RegWrite(1); //???this resets the ping and pong pointers, I guess Console.WriteLine("master " + Convert.ToString(PADE_explorer.registerLookup("STATUS_REG").RegRead(), 16)); PADE_explorer.registerLookup("TRIG_ARM").RegWrite(1); TB4_Exception.logConsoleOnly("master armed "); } return(true); }
static bool ReadAll() { List <PADE> Slaves = PADE_explorer.getallPADE(PADE.type_of_PADE.slave); List <PADE> Master = PADE_explorer.getallPADE(PADE.type_of_PADE.crate_master); //need to check there is only one! foreach (PADE thisPADE in Master) { TB4.activatePADE(thisPADE); UInt16 max_trig_count = PADE_explorer.registerLookup("MEM_TRIG_COUNT").RegRead(); for (UInt16 i = 0; i < max_trig_count; i++) { PADE_explorer.registerLookup("READ_TRIG_NUM").RegWrite(i); PADE_explorer.registerLookup("READ_ENABLE").RegWrite(1); PADE_explorer.registerLookup("READ_ENABLE").RegWrite(0); } } foreach (PADE thisPADE in Slaves) { TB4.activatePADE(thisPADE); UInt16 max_trig_count = PADE_explorer.registerLookup("MEM_TRIG_COUNT").RegRead(); for (UInt16 i = 0; i < max_trig_count; i++) { PADE_explorer.registerLookup("READ_TRIG_NUM").RegWrite(i); PADE_explorer.registerLookup("READ_ENABLE").RegWrite(1); PADE_explorer.registerLookup("READ_ENABLE").RegWrite(0); } } return(true); }
static bool Trig() { List <PADE> Master = PADE_explorer.getallPADE(PADE.type_of_PADE.crate_master); //need to check there is only one! foreach (PADE thisPADE in Master) { TB4.activatePADE(thisPADE); PADE_explorer.registerLookup("SOFTWARE_TRIGGER").RegWrite(1); TB4_Exception.logConsoleOnly("software trig "); } return(true); }
static bool ClearAll() { List <PADE> Slaves = PADE_explorer.getallPADE(PADE.type_of_PADE.slave); List <PADE> Master = PADE_explorer.getallPADE(PADE.type_of_PADE.crate_master); //need to check there is only one! foreach (PADE thisPADE in Master) { TB4.activatePADE(thisPADE); PADE_explorer.registerLookup("MEM_CLEAR").RegWrite(1); } foreach (PADE thisPADE in Slaves) { TB4.activatePADE(thisPADE); PADE_explorer.registerLookup("MEM_CLEAR").RegWrite(1); } TB4_Exception.logConsoleOnly("all cleared "); return(true); }
static bool DisArmAll() { List <PADE> Slaves = PADE_explorer.getallPADE(PADE.type_of_PADE.slave); List <PADE> Master = PADE_explorer.getallPADE(PADE.type_of_PADE.crate_master); //need to check there is only one! foreach (PADE thisPADE in Master) { TB4.activatePADE(thisPADE, true); PADE_explorer.registerLookup("CONTROL_REG").RegWrite(0x0340); PADE_explorer.registerLookup("TRIG_ARM").RegWrite(0); TB4_Exception.logConsoleOnly("master disarmed"); } foreach (PADE thisPADE in Slaves) { TB4.activatePADE(thisPADE, true); PADE_explorer.registerLookup("TRIG_ARM").RegWrite(0); PADE_explorer.registerLookup("CONTROL_REG").RegWrite(0x0240); TB4_Exception.logConsoleOnly("slave(s) disarmed "); } return(true); }
static string ReportStatus() { List <PADE> Slaves = PADE_explorer.getallPADE(PADE.type_of_PADE.slave); List <PADE> Master = PADE_explorer.getallPADE(PADE.type_of_PADE.crate_master); //need to check there is only one! UInt16 stat = 0; UInt16 arm = 0; UInt16 trig_in_mem = 0; UInt16 mem_error_count = 0; UInt16 current_trig = 0; UInt16 pade_temp = 0; UInt16 sib_temp = 0; UInt16 num_pade = 0; string message = ""; foreach (PADE thisPADE in Master) { TB4.activatePADE(thisPADE); stat = PADE_explorer.registerLookup("STATUS_REG").RegRead(); arm = PADE_explorer.registerLookup("TRIG_ARM").RegRead(); trig_in_mem = PADE_explorer.registerLookup("MEM_TRIG_COUNT").RegRead(); mem_error_count = PADE_explorer.registerLookup("MEM_ERROR_COUNT").RegRead(); current_trig = PADE_explorer.registerLookup("READ_TRIG_NUM").RegRead(); pade_temp = PADE_explorer.registerLookup("PADE_TEMP").RegRead(); sib_temp = PADE_explorer.registerLookup("SIB_TEMP").RegRead(); num_pade++; message += "Master " + thisPADE.PADE_sn + " "; message += stat.ToString("X4") + " "; message += arm.ToString("X4") + " "; message += trig_in_mem.ToString("X4") + " "; message += mem_error_count.ToString("X4") + " "; message += current_trig.ToString("X4") + " "; message += pade_temp.ToString("X4") + " "; message += sib_temp.ToString("X4") + " "; } foreach (PADE thisPADE in Slaves) { TB4.activatePADE(thisPADE); stat = PADE_explorer.registerLookup("STATUS_REG").RegRead(); arm = PADE_explorer.registerLookup("TRIG_ARM").RegRead(); trig_in_mem = PADE_explorer.registerLookup("MEM_TRIG_COUNT").RegRead(); mem_error_count = PADE_explorer.registerLookup("MEM_ERROR_COUNT").RegRead(); current_trig = PADE_explorer.registerLookup("READ_TRIG_NUM").RegRead(); pade_temp = PADE_explorer.registerLookup("PADE_TEMP").RegRead(); sib_temp = PADE_explorer.registerLookup("SIB_TEMP").RegRead(); num_pade++; message += "Slave " + thisPADE.PADE_sn + " "; message += stat.ToString("X4") + " "; message += arm.ToString("X4") + " "; message += trig_in_mem.ToString("X4") + " "; message += mem_error_count.ToString("X4") + " "; message += current_trig.ToString("X4") + " "; message += pade_temp.ToString("X4") + " "; message += sib_temp.ToString("X4") + " "; } TB4_Exception.logConsoleOnly("reported status "); TB4_Exception.logConsoleOnly(message); message = num_pade.ToString() + " " + message; return(message); }