Exemplo n.º 1
0
    def do_debug(self, args):
        """Quick read of SBit Clusters. USAGE: debug <OH_NUM>"""
        arglist = args.split()
        if len(arglist) == 1:
            for reg in getNodesContaining('OH' + str(args) + '.DEBUG_LAST'):
                try:
                    cluster = parseInt(readReg(reg))
                except:
                    cluster = 0
                if cluster == 2047:
                    if 'r' in str(reg.permission):
                        print hex(
                            reg.real_address), reg.permission, '\t', tabPad(
                                reg.name, 4), readReg(reg), '(None)'
                else:
                    if 'r' in str(reg.permission):
                        print hex(
                            reg.real_address), reg.permission, '\t', tabPad(
                                reg.name,
                                4), readReg(reg), '(VFAT:', cluster_to_vfat(
                                    cluster), 'SBit:', cluster_to_vfat2_sbit(
                                        cluster), 'Size:', cluster_to_size(
                                            cluster), ')'

        else:
            print "Incorrect number of arguments!"
Exemplo n.º 2
0
    def do_trigger(self, args=''):
        """Read all registers in TRIGGER module. USAGE: trigger <optional OH_NUM>"""
        arglist = args.split()
        if len(arglist) == 1:
            if not arglist[0].isdigit():
                print 'Incorrect usage.'
                return
            elif int(arglist[0]) < 0 or int(arglist[0]) > MAX_OH_NUM:
                print 'Invalid OH number:', arglist[0]
            else:
                if getNodesContaining('GEM_AMC.TRIGGER.OH' + str(arglist[0]) +
                                      '.') is not None:
                    for reg in getNodesContaining('GEM_AMC.TRIGGER.OH' +
                                                  str(arglist[0]) + '.'):
                        address = reg.real_address
                        if 'r' in str(reg.permission):
                            print hex(address).rstrip(
                                'L'), reg.permission, '\t', tabPad(
                                    reg.name, 7), readReg(reg)
                else:
                    print 'Regs not found!'
        elif args == '':
            if getNodesContaining('GEM_AMC.TRIGGER') is not None:
                for reg in getNodesContaining('GEM_AMC.TRIGGER'):
                    address = reg.real_address
                    if 'r' in str(reg.permission):
                        print hex(address).rstrip(
                            'L'), reg.permission, '\t', tabPad(reg.name,
                                                               7), readReg(reg)
            else:
                print 'Regs not found!'

        else:
            print 'Incorrect usage.'
Exemplo n.º 3
0
def getVFATID(OH_NUM, vfat_slot):
    #    try:
    vfat_id1 = 0x000000ff & parseInt(
        readReg(
            getNode('GEM_AMC.OH.OH' + str(OH_NUM) + '.GEB.VFATS.VFAT' +
                    str(vfat_slot) + '.ChipID1')))
    vfat_id2 = 0x000000ff & parseInt(
        readReg(
            getNode('GEM_AMC.OH.OH' + str(OH_NUM) + '.GEB.VFATS.VFAT' +
                    str(vfat_slot) + '.ChipID0')))
    vfat_id = (vfat_id1 << 8) + vfat_id2
    if vfat_id == 0: return 0
    return vfat_id
Exemplo n.º 4
0
 def do_unmask(self, args):
     """Unmask single VFAT to data. If no VFAT provided, will unmask all VFATs. USAGE unmask <OH_NUM> <optional VFAT_SLOT> """
     arglist = args.split()
     if len(arglist) == 1 and isValidOH(arglist[0]):
         print writeReg(
             getNode('GEM_AMC.OH.OH' + str(arglist[0]) +
                     '.CONTROL.VFAT.MASK'), 0x00000000)
     elif len(arglist) == 2 and isValidOH(arglist[0]) and isValidVFAT(
             arglist[1]):
         vfat = int(arglist[1])
         oh = int(arglist[0])
         mask = 0xffffffff ^ (0x1 << vfat)
         try:
             current_mask = parseInt(
                 readReg(
                     getNode('GEM_AMC.OH.OH' + str(oh) +
                             '.CONTROL.VFAT.MASK')))
         except:
             print 'Error reading current mask.'
             return
         new_mask = mask & current_mask
         print writeReg(
             getNode('GEM_AMC.OH.OH' + str(oh) + '.CONTROL.VFAT.MASK'),
             new_mask)
     else:
         print 'Incorrect usage.'
         return
Exemplo n.º 5
0
def T1On(OH_NUM):
    prevent_infiteloop = 0
    while parseInt(
            readReg(
                getNode('GEM_AMC.OH.OH' + str(OH_NUM) +
                        '.T1Controller.MONITOR'))) != 1:
        print 'MONITOR:', readReg(
            getNode('GEM_AMC.OH.OH' + str(OH_NUM) + '.T1Controller.MONITOR'))
        prevent_infiteloop += 1
        print writeReg(
            getNode('GEM_AMC.OH.OH' + str(OH_NUM) + '.T1Controller.TOGGLE'),
            0xffffffff)
        if prevent_infiteloop > 10:
            printRed(
                'T1Controller Error - Will not toggle T1Controller Monitor')
            return False
    return True
Exemplo n.º 6
0
def printClusters(OH_NUM):
    for reg in getNodesContaining('TRIGGER.OH' + str(OH_NUM) + '.CLUSTER'):
        if 'r' in str(reg.permission):
            print displayReg(reg), '=', parseInt(str(readReg(reg)))
    print '\n'
    for reg in getNodesContaining('TRIGGER.OH' + str(OH_NUM) +
                                  '.DEBUG_LAST_CLUSTER'):
        if 'r' in str(reg.permission):
            print displayReg(reg, 'hexbin')
Exemplo n.º 7
0
 def do_ttc(self, args=None):
     """Read all registers in TTC module. USAGE: ttc"""
     if getNodesContaining('GEM_AMC.TTC') is not None:
         for reg in getNodesContaining('GEM_AMC.TTC'):
             address = reg.real_address
             if 'r' in str(reg.permission):
                 print hex(address).rstrip(
                     'L'), reg.permission, '\t', tabPad(reg.name,
                                                        7), readReg(reg)
     else:
         print 'Regs not found!'
Exemplo n.º 8
0
 def do_gemsystem(self, args=None):
     """Read all registers in GEM_SYSTEM module. USAGE: gemsystem"""
     if args == '':
         if getNodesContaining('GEM_AMC.GEM_SYSTEM') is not None:
             for reg in getNodesContaining('GEM_AMC.GEM_SYSTEM'):
                 address = reg.real_address
                 if 'r' in str(reg.permission):
                     print hex(address).rstrip(
                         'L'), reg.permission, '\t', tabPad(reg.name,
                                                            7), readReg(reg)
         else:
             print 'Regs not found!'
Exemplo n.º 9
0
def verifyTCReset(OH_NUM):
    nSbits = readReg(
        getNode('GEM_AMC.TRIGGER.OH' + str(OH_NUM) + '.TRIGGER_CNT'))
    try:
        parseInt(nSbits)
    except:
        return False, nSbits

    if parseInt(nSbits) != 0:  #Hot channels?
        return False, nSbits

    else:
        return True, 0
Exemplo n.º 10
0
 def do_oh(self, args):
     """ Begin command by selecting OH, followed by command. USAGE oh <number> <command> """
     arglist = args.split()
     if len(arglist) < 1: print 'Too few arguments.'
     elif len(arglist) == 1:
         if not arglist[0].isdigit():
             print 'Invalid OH number:', arglist[0]
             return
         elif int(arglist[0]) < 0 or int(arglist[0]) > MAX_OH_NUM:
             print 'Invalid OH number:', arglist[0]
         else:
             if getNodesContaining('GEM_AMC.OH.OH' + str(arglist[0]) +
                                   '.') is not None:
                 for reg in getNodesContaining('GEM_AMC.OH.OH' +
                                               str(arglist[0]) + '.'):
                     address = reg.real_address
                     if 'r' in str(reg.permission):
                         print hex(address).rstrip(
                             'L'), reg.permission, '\t', tabPad(
                                 reg.name, 7), readReg(reg)
             else:
                 print 'Regs not found!'
Exemplo n.º 11
0
 def do_fw(self, args=None):
     """Quick read of all FW-related registers"""
     for reg in getNodesContaining('RELEASE'):
         if 'r' in str(reg.permission):
             print hex(reg.real_address), reg.permission, '\t', tabPad(
                 reg.name, 4), readReg(reg)