예제 #1
0
def create_magneto003002_dbg(i2c, spi, led1642_bus, pwm_gck_led, pwm_output, uart_rs485,
                             green_led_en, signal_out_en, spk_shdn_en, ringer_dir_pin,
                             acc1_relay, acc2_relay, relay1_res, relay2_res):

    i2c = I2C(i2c)
    axi4 = AXI4LiteBus(spi, 256)
    spi = MIXQSPISG(axi4)
    led1642_bus = AXI4LiteBus(led1642_bus, 256)
    pwm_gck_led = MIXPWMSG(pwm_gck_led, 1024)
    pwm_output = MIXPWMSG(pwm_output, 1024)

    uart_rs485 = UART(uart_rs485)

    green_led_en = GPIO(int(green_led_en))
    signal_out_en = GPIO(int(signal_out_en))
    spk_shdn_en = GPIO(int(spk_shdn_en))
    ringer_dir_pin = GPIO(int(ringer_dir_pin))
    acc1_relay = GPIO(int(acc1_relay))
    acc2_relay = GPIO(int(acc2_relay))
    relay1_res = GPIO(int(relay1_res))
    relay2_res = GPIO(int(relay2_res))

    magneto003002 = MAGNETO003002(i2c, spi, led1642_bus=led1642_bus, pwm_gck_led=pwm_gck_led,
                                  pwm_output=pwm_output, uart_rs485=uart_rs485, green_led_en=green_led_en,
                                  signal_out_en=signal_out_en, spk_shdn_en=spk_shdn_en,
                                  ringer_dir_pin=ringer_dir_pin, acc1_relay=acc1_relay, acc2_relay=acc2_relay,
                                  relay1_res=relay1_res, relay2_res=relay2_res)

    magneto003002_dbg = MAGNETO003002Debuger()
    magneto003002.module_init()
    magneto003002_dbg.magneto003002 = magneto003002
    return magneto003002_dbg
예제 #2
0
def create_uel001003a_dbg(i2c_bus_name, spi_bus_name, gpio_device_name,
                          switch_pin_id):
    uel001003a_dbg = UEL001003ADebuger()

    if i2c_bus_name == '':
        i2c_bus = None
    else:
        if utility.is_pl_device(i2c_bus_name):
            axi4_bus = AXI4LiteBus(i2c_bus_name, 256)
            i2c_bus = MIXI2CSG(axi4_bus)
        else:
            i2c_bus = I2C(i2c_bus_name)

    if spi_bus_name == '':
        spi_bus_name = None
    else:
        axi4_bus = AXI4LiteBus(spi_bus_name, 8192)
        spi_bus = MIXQSPISG(axi4_bus)

    if gpio_device_name == '':
        gpio_switch = GPIO(int(switch_pin_id), "output")
    else:
        axi4_bus = AXI4LiteBus(gpio_device_name, 256)
        gpio = MIXGPIOSG(axi4_bus)
        gpio_switch = Pin(gpio, int(switch_pin_id))

    uel001003a_dbg.uel001003a = UEL001003A(i2c=i2c_bus,
                                           spi=spi_bus,
                                           gpio_switch=gpio_switch)

    return uel001003a_dbg
예제 #3
0
def create_led1642_dbg(led1642, signal_out_pin):
    led1642_dbg = LED1642Debuger()

    led1642_bus = AXI4LiteBus(led1642, 256)
    signal_out_en = GPIO(int(signal_out_pin))
    led1642_dbg.led1642 = LED1642(led1642_bus, signal_out_en)
    return led1642_dbg
예제 #4
0
def create_dbg(file, gpio_number, spi_bus_name, adc_channel,
               i2c_bus_name, uart_drv, ad5667r_drv):
    dbg = DarkBeastFDebuger()

    firmware_path = file
    aid_connect = GPIO(int(gpio_number))

    if spi_bus_name == '':
        ad5592r = None
    else:
        axi4_bus = AXI4LiteBus(spi_bus_name, 256)
        spi_bus = MIXQSPISG(axi4_bus)
        ad5592r = AD5592R(spi_bus, 2500, 'internal', 1, 2)

    if i2c_bus_name == '':
        i2c_bus = None
    else:
        if utility.is_pl_device(i2c_bus_name):
            axi4_bus = AXI4LiteBus(i2c_bus_name, 256)
            i2c_bus = MIXI2CSG(axi4_bus)
        else:
            i2c_bus = I2C(i2c_bus_name)

    pl_uart_drv_ko_file = uart_drv
    ad5667r_drv_ko_file = ad5667r_drv
    dbg.darkbeastf = DarkBeastF(firmware_path, aid_connect, ad5592r, adc_channel,
                                i2c_bus, pl_uart_drv_ko_file, ad5667r_drv_ko_file)
    return dbg
예제 #5
0
def create_warlock_dbg(ipcore_name, i2c_dev, analyzer_dev, adc_rst_pin,
                       adc_ovfl_l_pin, i2s_rx_en_pin, i2s_ch_select_pin,
                       tone_detect_pin):

    warlock_dbg = WarlockDebuger()

    if i2c_dev != '':
        if utility.is_pl_device(i2c_dev):
            axi4_bus = AXI4LiteBus(i2c_dev, 256)
            i2c_bus = MIXI2CSG(axi4_bus)
        else:
            i2c_bus = I2C(i2c_dev)
    else:
        i2c_bus = None

    if ipcore_name != '':
        ipcore = MIXMIK002SGR(ipcore_name)
        warlock_dbg.warlock = Warlock(i2c_bus, ipcore=ipcore)
    else:
        axi4 = AXI4LiteBus(analyzer_dev, 65535)
        analyzer = MIXFftAnalyzerSG(axi4)

        adc_rst_pin = GPIO(int(adc_rst_pin),
                           'output') if adc_rst_pin != "" else None
        adc_ovfl_l_pin = GPIO(int(adc_ovfl_l_pin),
                              'output') if adc_ovfl_l_pin != "" else None
        i2s_rx_en_pin = GPIO(int(i2s_rx_en_pin),
                             'output') if i2s_rx_en_pin != "" else None
        i2s_ch_select_pin = GPIO(int(i2s_ch_select_pin),
                                 'output') if i2s_ch_select_pin != "" else None
        tone_detect_pin = GPIO(int(tone_detect_pin),
                               'output') if tone_detect_pin != "" else None
        warlock_dbg.warlock = Warlock(i2c=i2c_bus,
                                      ipcore=None,
                                      analyzer=analyzer,
                                      adc_rst_pin=adc_rst_pin,
                                      adc_ovfl_l_pin=adc_ovfl_l_pin,
                                      i2s_rx_en_pin=i2s_rx_en_pin,
                                      i2s_ch_select_pin=i2s_ch_select_pin,
                                      tone_detect_pin=tone_detect_pin,
                                      upload_ch_select_pin=None,
                                      sample_rate=48000)

    return warlock_dbg
예제 #6
0
def create_wolverine_dbg(i2c_dev_name, ad7175, range_ctrl_pin, meter_ctrl_pin,
                         ipcore):
    '''
    cmd: python dmm001003_map_tool.py  -i2c /dev/i2c-0 -rp 86 -mp 87 -ip /dev/MIX_DAQT1_0
    '''
    if utility.is_pl_device(i2c_dev_name):
        axi4_bus = AXI4LiteBus(i2c_dev_name, 256)
        i2c_bus = MIXI2CSG(axi4_bus)
    else:
        i2c_bus = I2C(i2c_dev_name)

    if range_ctrl_pin and meter_ctrl_pin:
        range_ctrl_pin = GPIO(pin_id=int(range_ctrl_pin), default_dir='output')
        meter_ctrl_pin = GPIO(pin_id=int(meter_ctrl_pin), default_dir='output')
    else:
        print "Invalid parameter, please check"

    wolverine_dbg = WolverineDebugger(
        Wolverine(i2c_bus, ad7175, range_ctrl_pin, meter_ctrl_pin, ipcore))
    return wolverine_dbg
예제 #7
0
def create_dbg(file, uart, i2c_bus_name, plgpio, pull_up_pin_num,
               pull_down_pin_num, tx_en_pin_num, removal_det_pin_num,
               connect_det_pin_num, a0_pin_id, a1_pin_id, a2_pin_id,
               elaod_en_pin_id):
    dbg = DarkBeastDebuger()

    firmware_path = file
    pl_uart_drv_ko_file = uart

    if i2c_bus_name == '':
        i2c_bus = None
    else:
        if utility.is_pl_device(i2c_bus_name):
            axi4_bus = AXI4LiteBus(i2c_bus_name, 256)
            i2c_bus = MIXI2CSG(axi4_bus)
        else:
            i2c_bus = I2C(i2c_bus_name)

    if plgpio == '':
        gpio = None
    else:
        axi4_bus = AXI4LiteBus(plgpio, 256)
        gpio = MIXGPIOSG(axi4_bus)

    pull_up_pin = GPIO(int(pull_up_pin_num))
    pull_down_pin = GPIO(int(pull_down_pin_num))
    tx_en_pin = GPIO(int(tx_en_pin_num))
    removal_det_pin = GPIO(int(removal_det_pin_num))
    connect_det_pin = GPIO(int(connect_det_pin_num))

    cat9555 = CAT9555(0x20, i2c_bus)
    a0_pin = Pin(cat9555, a0_pin_id)
    a1_pin = Pin(cat9555, a1_pin_id)
    a2_pin = Pin(cat9555, a2_pin_id)
    elaod_en_pin = Pin(cat9555, elaod_en_pin_id)
    dbg.darkbeast = DarkBeast(firmware_path, pl_uart_drv_ko_file, i2c_bus,
                              gpio, pull_up_pin, pull_down_pin, tx_en_pin,
                              removal_det_pin, connect_det_pin, a0_pin, a1_pin,
                              a2_pin, elaod_en_pin)
    return dbg
예제 #8
0
def create_elektra_dbg(i2c_name, spi_name, ad760x_name, gpio_id, volt_ch_1,
                       volt_ch_2, curr_ch_1, curr_ch_2):
    scope_dbg = ElektraDebuger()
    if i2c_name == '':
        i2c_bus = None
    else:
        if utility.is_pl_device(i2c_name):
            axi4_bus = AXI4LiteBus(i2c_name, 256)
            i2c_bus = MIXI2CSG(axi4_bus)
        else:
            i2c_bus = I2C(i2c_name)

    if spi_name == '':
        spi_bus = None
    else:
        axi4_bus = AXI4LiteBus(spi_name, 8192)
        spi_bus = MIXQSPISG(axi4_bus)

    if ad760x_name == '':
        ad7608_ip = None
    else:
        axi4 = AXI4LiteBus(ad760x_name, 8192)
        ad7608_ip = MIXAd7608SG(axi4)

    if gpio_id == '':
        gpio_bus = None
    else:
        io = GPIO(gpio_id, "output")
        gpio_bus = Pin(io, gpio_id, "output")

    volt_1 = int(volt_ch_1)
    volt_2 = int(volt_ch_2)
    curr_1 = int(curr_ch_1)
    curr_2 = int(curr_ch_2)
    scope_dbg.elektra = Elektra(i2c=i2c_bus,
                                spi=spi_bus,
                                ad7608=ad7608_ip,
                                gpio=gpio_bus,
                                volt_ch1=volt_1,
                                volt_ch2=volt_2,
                                curr_ch1=curr_1,
                                curr_ch2=curr_2)
    return scope_dbg
예제 #9
0
def create_warlock_dbg(ipcore_name, i2c_dev, analyzer_dev, adc_rst_pin, adc_ovfl_l_pin,
                       i2s_left_select_pin, i2s_right_select_pin, i2s_both_select_pin,
                       tone_detect_pin, upload_enable_pin, measure_enable_pin, sample_rate):

    warlock_dbg = MIK002004Debuger()

    if i2c_dev != '':
        if utility.is_pl_device(i2c_dev):
            axi4_bus = AXI4LiteBus(i2c_dev, 256)
            i2c_bus = MIXI2CSG(axi4_bus)
        else:
            i2c_bus = I2C(i2c_dev)
    else:
        i2c_bus = None

    if ipcore_name != '':
        ipcore = MIXMIK002SGR(ipcore_name)
        warlock_dbg.warlock = MIK002004(i2c_bus, ipcore=ipcore)
    else:
        axi4 = AXI4LiteBus(analyzer_dev, 65535)
        analyzer = MIXXtalkMeasureSG(axi4)

        adc_rst_pin = GPIO(int(adc_rst_pin), 'output') if adc_rst_pin != "" else None
        adc_ovfl_l_pin = GPIO(int(adc_ovfl_l_pin), 'input') if adc_ovfl_l_pin != "" else None
        i2s_left_select_pin = GPIO(int(i2s_left_select_pin), 'output') if i2s_left_select_pin != "" else None
        i2s_right_select_pin = GPIO(int(i2s_right_select_pin), 'output') if i2s_right_select_pin != "" else None
        i2s_both_select_pin = GPIO(int(i2s_both_select_pin), 'output') if i2s_both_select_pin != "" else None
        tone_detect_pin = GPIO(int(tone_detect_pin), 'input') if tone_detect_pin != "" else None
        upload_enable_pin = GPIO(int(upload_enable_pin), 'output') if upload_enable_pin != "" else None
        measure_enable_pin = GPIO(int(measure_enable_pin), 'output') if measure_enable_pin != "" else None
        sample_rate = int(sample_rate)
        warlock_dbg.warlock = MIK002004(i2c=i2c_bus, ipcore=None,
                                        analyzer=analyzer, adc_rst_pin=adc_rst_pin,
                                        adc_ovfl_l_pin=adc_ovfl_l_pin, i2s_left_select_pin=i2s_left_select_pin,
                                        i2s_right_select_pin=i2s_right_select_pin,
                                        i2s_both_select_pin=i2s_both_select_pin,
                                        tone_detect_pin=tone_detect_pin, upload_enable_pin=upload_enable_pin,
                                        measure_enable_pin=measure_enable_pin, sample_rate=sample_rate)

    return warlock_dbg
예제 #10
0
def create_elektra_dbg(i2c_name, spi_name, ad717x_name, gpio_id, ipcore_name):
    scope_dbg = ElektraDebuger()
    if i2c_name == '':
        i2c_bus = None
    else:
        if utility.is_pl_device(i2c_name):
            axi4_bus = AXI4LiteBus(i2c_name, 256)
            i2c_bus = MIXI2CSG(axi4_bus)
        else:
            i2c_bus = I2C(i2c_name)

    if spi_name == '':
        spi_bus = None
    else:
        axi4_bus = AXI4LiteBus(spi_name, 8192)
        spi_bus = MIXQSPISG(axi4_bus)

    ipcore = None
    ad7175 = None
    vref = 5000
    if ipcore_name != '':
        axi4_bus = AXI4LiteBus(ipcore_name, 9548)
        ipcore = MIXDAQT1SGR(axi4_bus,
                             ad717x_mvref=vref,
                             use_spi=True,
                             use_gpio=False)
    elif ad717x_name != '':
        axi4_bus = AXI4LiteBus(ad717x_name, 256)
        ad7175 = MIXAd7175SG(axi4_bus, vref)

    if gpio_id == '':
        gpio_bus = None
    else:
        io = GPIO(gpio_id, "output")
        gpio_bus = Pin(io, gpio_id, "output")

    scope_dbg.elektra = EL004002A(i2c=i2c_bus,
                                  spi=spi_bus,
                                  ad7175=ad7175,
                                  gpio=gpio_bus,
                                  ipcore=ipcore)
    return scope_dbg
예제 #11
0
def create_hppsu001002_dbg(i2c_bus_name, axi4_bus_name, gpio_device_name,
                           fault_pin_id):
    hppsu001002_dbg = HPPSU001002Debugger()
    if i2c_bus_name == '':
        i2c_bus = None
    else:
        i2c_bus = I2C(i2c_bus_name)

    if gpio_device_name == '':
        fault_pin = GPIO(int(fault_pin_id))
    else:
        axi4_bus = AXI4LiteBus(gpio_device_name, 256)
        gpio = PLGPIO(axi4_bus)
        fault_pin = Pin(gpio, int(fault_pin_id))

    if axi4_bus_name == '':
        daqt1 = MIXDAQT1Emulator(axi4_bus=None,
                                 ad717x_chip='AD7175',
                                 ad717x_mvref=5000,
                                 use_spi=False,
                                 use_gpio=False)
        ad7175 = None
    elif 'MIX_DAQT' in axi4_bus_name or 'MIX_AD717X_SG' in axi4_bus_name:
        daqt1_axi4_bus = AXI4LiteBus(axi4_bus_name, 65535)
        daqt1 = MIXDAQT1SGR(axi4_bus=daqt1_axi4_bus,
                            ad717x_chip='AD7175',
                            ad717x_mvref=5000,
                            use_spi=False,
                            use_gpio=False)
        ad7175 = None
    else:
        daqt1 = None
        ad717x_axi4_bus = AXI4LiteBus(axi4_bus_name, 0x4000)
        ad7175 = MIXAd7175SG(ad717x_axi4_bus, 5000)

    hppsu001002_dbg.hppsu = HPPSU001002(i2c=i2c_bus,
                                        ad7175=ad7175,
                                        fault_pin=fault_pin,
                                        ipcore=daqt1)
    hppsu001002_dbg.hppsu.module_init()
    return hppsu001002_dbg
예제 #12
0
def create_magneto002002_dbg(i2c_bus0, led1642_bus, pwm_gck_led, pwm_output,
                             uart_rs485, ad5592r_spi, ad9833_spi, analyzer,
                             gpio_state_pin, pwm1_en_pin, pwm2_en_pin,
                             pwm3_en_pin, pwm4_en_pin, pwm5_en_pin,
                             pwm6_en_pin, pwm7_en_pin, pwm8_en_pin,
                             signal_out_en, iis_rx_en, iis_rx_ovfl,
                             iis_rx_rst):

    i2c = I2C(i2c_bus0)

    led1642_bus = AXI4LiteBus(led1642_bus, 256)
    pwm_gck_led = MIXPWMSG(pwm_gck_led, 1024)
    pwm_output = MIXPWMSG(pwm_output, 1024)

    uart_rs485 = UART(uart_rs485)

    axi4 = AXI4LiteBus(ad5592r_spi, 256)
    ad5592r_spi = MIXQSPISG(axi4)

    axi4 = AXI4LiteBus(ad9833_spi, 256)
    ad9833_spi = MIXQSPISG(axi4)

    analyzer = MIXFftAnalyzerSG(analyzer)

    gpio_state_pin = GPIO(int(gpio_state_pin))
    pwm1_en_pin = GPIO(int(pwm1_en_pin))
    pwm2_en_pin = GPIO(int(pwm2_en_pin))
    pwm3_en_pin = GPIO(int(pwm3_en_pin))
    pwm4_en_pin = GPIO(int(pwm4_en_pin))
    pwm5_en_pin = GPIO(int(pwm5_en_pin))
    pwm6_en_pin = GPIO(int(pwm6_en_pin))
    pwm7_en_pin = GPIO(int(pwm7_en_pin))
    pwm8_en_pin = GPIO(int(pwm8_en_pin))
    signal_out_en = GPIO(int(signal_out_en))
    iis_rx_en = GPIO(int(iis_rx_en))
    iis_rx_ovfl = GPIO(int(iis_rx_ovfl))
    iis_rx_rst = GPIO(int(iis_rx_rst))

    magneto002002 = MAGNETO002002(
        i2c, led1642_bus, pwm_gck_led, pwm_output, uart_rs485, ad5592r_spi,
        ad9833_spi, analyzer, gpio_state_pin, pwm1_en_pin, pwm2_en_pin,
        pwm3_en_pin, pwm4_en_pin, pwm5_en_pin, pwm6_en_pin, pwm7_en_pin,
        pwm8_en_pin, signal_out_en, iis_rx_en, iis_rx_ovfl, iis_rx_rst)

    magneto002002_dbg = MAGNETO002002Debuger()
    magneto002002.module_init()
    magneto002002_dbg.magneto002002 = magneto002002
    return magneto002002_dbg
예제 #13
0
def create_blade_dbg(i2c_dev_name, adc_dev_name, xadc_dev_name,
                     adc_signal_meter_dev_name, ac_signal_meter_dev_name,
                     fsk_signal_meter_dev_name, ask_code_dev_name,
                     fsk_decode_dev_name):
    blade_dbg = BladeDebuger()

    if i2c_dev_name is '':
        i2c = None
    else:
        i2c = I2C(i2c_dev_name)

    if adc_dev_name is '':
        ad7608 = None
    else:
        axi4_bus = AXI4LiteBus(adc_dev_name, 8192)
        ad7608 = MIXAd7608SG(axi4_bus)

    if xadc_dev_name is '':
        xadc = None
    else:
        axi4_bus = AXI4LiteBus(xadc_dev_name, 2048)
        xadc = MIXXADCSG(axi4_bus)

    if adc_signal_meter_dev_name is '':
        adc_signal_meter = None
    else:
        axi4_bus = AXI4LiteBus(adc_signal_meter_dev_name, 1024)
        adc_signal_meter = MIXSignalMeterSG(axi4_bus)

    if ac_signal_meter_dev_name is '':
        ac_signal_meter = None
    else:
        axi4_bus = AXI4LiteBus(ac_signal_meter_dev_name, 1024)
        ac_signal_meter = MIXSignalMeterSG(axi4_bus)

    if fsk_signal_meter_dev_name is '':
        fsk_signal_meter = None
    else:
        axi4_bus = AXI4LiteBus(fsk_signal_meter_dev_name, 1024)
        fsk_signal_meter = MIXSignalMeterSG(axi4_bus)

    if ask_code_dev_name is '':
        ask_code = None
    else:
        axi4_bus = AXI4LiteBus(ask_code_dev_name, 8192)
        ask_code = MIXQIASKLinkEncodeSG(axi4_bus)

    if fsk_decode_dev_name is '':
        fsk_decode = None
    else:
        axi4_bus = AXI4LiteBus(fsk_decode_dev_name, 8192)
        fsk_decode = MIXQIFSKLinkDecodeSG(axi4_bus)

    adc_ctrl_pin = GPIO(92)
    fsk_ctrl_pin = GPIO(94)
    fsk_cic_ctrl_pin = GPIO(93)
    adc_filter_pin_0 = GPIO(86)
    adc_filter_pin_1 = GPIO(87)
    adc_filter_pin_2 = GPIO(88)

    blade_dbg.blade = Blade(i2c=i2c,
                            adc=ad7608,
                            xadc=xadc,
                            adc_signal_meter=adc_signal_meter,
                            ac_signal_meter=ac_signal_meter,
                            fsk_signal_meter=fsk_signal_meter,
                            ask_code=ask_code,
                            fsk_decode=fsk_decode,
                            adc_ctrl_pin=adc_ctrl_pin,
                            fsk_ctrl_pin=fsk_ctrl_pin,
                            fsk_cic_ctrl_pin=fsk_cic_ctrl_pin,
                            adc_filter_pin_0=adc_filter_pin_0,
                            adc_filter_pin_1=adc_filter_pin_1,
                            adc_filter_pin_2=adc_filter_pin_2)
    return blade_dbg