Exemplo n.º 1
0
def CAL(cobras, timeout=0):
    if not cobrasAreType(cobras, 'Cal'):
        return True  # error
    board = cobras[0].board
    short_log.log("--- ISSUE CAL & VERIFY (%d) ---" % board)
    full_log.log(cobras2Str(cobras))

    # Get Timeout by finding largest freq range to test
    if timeout == 0:
        fRngCob = []
        for c in cobras:
            f0rng = (c.p.m0Range[1] - c.p.m0Range[0])
            f1rng = (c.p.m1Range[1] - c.p.m1Range[0])
            fRngCob.append(max(f0rng, f1rng))
        tPerCobra = int(7.0 * max(fRngCob))  # assume <=7ms per freq
        timeout = math.ceil(1200 + tPerCobra * len(cobras))

    medium_log.log("Timeout:%d" % timeout)

    payload = []
    for c in cobras:
        payload += c.p.toList(c.board, c.cobra)

    cmd = CMD_cal(payload, cmds=len(cobras), timeout=timeout)
    sock.send(cmd, eth_hex_logger, 'h')

    error = False
    for i in range(2):
        resp = sock.recv(TLM_LEN, eth_hex_logger, 'h')
        error |= tlm_chk(resp)
    return error
Exemplo n.º 2
0
def HK(cobras):
    if not cobrasAreType(cobras, 'Hk'):
        return True  # error
    board = cobras[0].board

    short_log.log("--- ISSUE HK & VERIFY (brd:%d) ---" % board)

    cmd = CMD_hk(board, timeout=2000)
    sock.send(cmd, eth_hex_logger, 'h')

    resp = sock.recv(TLM_LEN, eth_hex_logger, 'h')
    er1 = tlm_chk(resp)

    resp = sock.recv(HK_TLM_LEN, eth_hex_logger, 'h')
    er2 = hk_chk(resp, cobras)

    return er1 or er2
Exemplo n.º 3
0
def POW(sec_pwr=255):
    short_log.log("--- POWER ---")

    sectors_off = []
    for i in range(0, 6):
        if not sec_pwr & (0x01 << i):
            sectors_off.append(i)

    medium_log.log("Sectors Without Power: %s" % sectors_off)

    cmd = CMD_pow(sec_pwr, 0)
    sock.send(cmd, eth_hex_logger, 'h')
    resp = sock.recv(TLM_LEN, eth_hex_logger, 'h')
    error = tlm_chk(resp)
    return error
Exemplo n.º 4
0
def DIA():
    short_log.log("--- DIAGNOSTIC INFO ---")
    cmd = CMD_dia()
    sock.send(cmd, eth_hex_logger, 'h')
    resp = sock.recv(DIA_TLM_LEN, eth_hex_logger, 'h')

    boards_per_sector = [
        int(resp[2]),
        int(resp[3]),
        int(resp[4]),
        int(resp[5]),
        int(resp[6]),
        int(resp[7])
    ]
    short_log.log("Board Counts: %s" % (boards_per_sector))
    return boards_per_sector
Exemplo n.º 5
0
def RST():
    short_log.log("--- RESET ---")
    sec_rst = 255

    sectors_reseting = []
    for i in range(0, 6):
        if sec_rst & (0x01 << i):
            sectors_reseting.append(i)

    medium_log.log("Sectors Reseting: %s" % sectors_reseting)

    cmd = CMD_pow(255, sec_rst)
    sock.send(cmd, eth_hex_logger, 'h')
    resp = sock.recv(TLM_LEN, eth_hex_logger, 'h')
    error = tlm_chk(resp)
    return error
Exemplo n.º 6
0
def SET(cobras):
    if not cobrasAreType(cobras, 'Set'):
        return True  # error
    board = cobras[0].board

    short_log.log("--- ISSUE SETFREQ & VERIFY (brd:%d) ---" % board)

    payload = []
    for c in cobras:
        payload += c.p.toList(c.board, c.cobra)

    cmd = CMD_set(payload, cmds=len(cobras), timeout=2000)
    sock.send(cmd, eth_hex_logger, 'h')

    error = False
    for i in range(2):
        resp = sock.recv(TLM_LEN, eth_hex_logger, 'h')
        error |= tlm_chk(resp)
    return error
Exemplo n.º 7
0
def RUN(cobras, timeout=0, inter=0):
    if not cobrasAreType(cobras, 'Run'):
        return True  # error
    board = cobras[0].board
    short_log.log("--- ISSUE RUN & VERIFY (%d) ---" % board)
    full_log.log(cobras2Str(cobras))

    # Get timeout by finding longest runtime
    if timeout == 0:
        tCob = []
        for c in cobras:
            t0 = (c.p.steps[0] + c.p.sleeps[0]) * c.p.pulses[0]
            t1 = (c.p.steps[1] + c.p.sleeps[1]) * c.p.pulses[1]
            tCob.append(max(t0, t1))
        timeout = math.ceil(1000 + 20 * len(cobras) * (max(tCob) / 1000))

    # Get interleave by finding longest pulsetime
    if inter == 0:
        puCob = []
        for c in cobras:
            puCob.append(max(c.p.pulses))
        # * 9/15ths for max 10% duty cycle
        inter = math.ceil(max(puCob) * 9 / 15)

    medium_log.log("Timeout:%d, inter:%d" % (timeout, inter))

    payload = []
    for c in cobras:
        payload += c.p.toList(c.board, c.cobra)

    cmd = CMD_run(payload, cmds=len(cobras), timeout=timeout, inter=inter)
    sock.send(cmd, eth_hex_logger, 'h')

    error = False
    for i in range(2):
        resp = sock.recv(TLM_LEN, eth_hex_logger, 'h')
        error |= tlm_chk(resp)
    return error