Exemplo n.º 1
0
def i2c_op(mode,
           gbt,
           sca,
           bus,
           addr,
           sub_addr,
           size,
           i2c_type,
           i2c_freq,
           scl=0,
           filepath=None,
           data=None):
    cmd = ','.join(
        map(str, (mode, gbt, sca, bus, addr, sub_addr, size, i2c_type,
                  i2c_freq, scl)))
    if filepath:
        cmd += ',{}'.format(filepath)

    if not data:
        data = '0'
    # Note that the input parameter 'data' should be hex numbers in string
    # e.g. 'abad1dea', note that there's no '0x' prefix!
    data = hex_to_bytes(data)

    args = (cmd, data)

    ret = pydim.dic_sync_cmnd_service(
        '{}/{}/CmndI2COperation'.format(GBT_PREF, GBT_SERV), args, 'C:128;C')
    dim_cmd_err(ret)
Exemplo n.º 2
0
def mem_mon_fiber_write(fiber, tell40=TELL40):
    fiber = fiber_channel(fiber)
    ret = pydim.dic_sync_cmnd_service(
        '{}/{}/CmndOperation/{}.top_tell40.monitoring_fiber'.format(
            GBT_PREF, GBT_SERV, tell40), (FPGA_REG_OP_MODE['write'], fiber),
        'C:1;C')
    dim_cmd_err(ret)
Exemplo n.º 3
0
def mem_mon_options_read(tell40=TELL40, regulator=ddr):
    ret = pydim.dic_sync_cmnd_service(
        '{}/{}/CmndOperation/{}.top_tell40.monitoring_options'.format(
            GBT_PREF, GBT_SERV, tell40), (FPGA_REG_OP_MODE['read'], '0'),
        'C:1;C')
    dim_cmd_err(ret)

    ret = pydim.dic_sync_info_service(
        '{}/{}/SrvcReadings/{}.top_tell40.monitoring_options'.format(
            GBT_PREF, GBT_SERV, tell40), 'I:1;C')
    return dim_dic_err(regulator(ret), FPGA_REG_ERR_CODE)
Exemplo n.º 4
0
def gpio_op(mode, gbt, sca, addr, data=None):
    cmd = ','.join(map(str,
                       (mode, gbt, sca, addr)))

    if not data:
        data = '0'
    data = hex_to_bytes(data)

    args = (cmd, data)
    ret = pydim.dic_sync_cmnd_service(
        '{}/{}/CmndGPIOOperation'.format(GBT_PREF, GBT_SERV),
        args, 'C:128;C')
    dim_cmd_err(ret)
Exemplo n.º 5
0
def mem_mon_options_write(opts=b'\x00\x00\x00\x1c', tell40=TELL40):
    ret = pydim.dic_sync_cmnd_service(
        '{}/{}/CmndOperation/{}.top_tell40.monitoring_options'.format(
            GBT_PREF, GBT_SERV, tell40), (FPGA_REG_OP_MODE['write'], opts),
        'C:1;C')
    dim_cmd_err(ret)