Beispiel #1
0
def create_scope_dbg(axi4_bus_name, i2c_bus_name):
    scope_dbg = Scope002006Debuger()

    if axi4_bus_name == '':
        daqt1 = MIXDAQT1SGREmulator(axi4_bus=None,
                                    ad717x_chip='AD7175',
                                    ad717x_mvref=2500,
                                    use_spi=False,
                                    use_gpio=False)
        ad7175 = None
    elif 'MIX_Scope' in axi4_bus_name:
        daqt1_axi4_bus = AXI4LiteBus(axi4_bus_name, 0x8000)
        daqt1 = MIXDAQT1SGR(axi4_bus=daqt1_axi4_bus,
                            ad717x_chip='AD7175',
                            ad717x_mvref=2500,
                            use_spi=False,
                            use_gpio=False)
        ad7175 = None
    elif 'MIX_DAQT' in axi4_bus_name:
        daqt1_axi4_bus = AXI4LiteBus(axi4_bus_name, 0x8000)
        daqt1 = MIXDAQT1SGR(axi4_bus=daqt1_axi4_bus,
                            ad717x_chip='AD7175',
                            ad717x_mvref=2500,
                            use_spi=False,
                            use_gpio=False)
        ad7175 = None
    else:
        daqt1 = None
        ad717x_axi4_bus = AXI4LiteBus(axi4_bus_name, 0x8192)
        ad7175 = MIXAd7175SG(ad717x_axi4_bus, 2500)

    if i2c_bus_name == '':
        i2c_bus = None
    else:
        i2c_bus = I2C(i2c_bus_name)

    scope_dbg.scope002006 = Scope002006(i2c=i2c_bus,
                                        ad7175=ad7175,
                                        ipcore=daqt1)
    return scope_dbg
Beispiel #2
0
    def __init__(self,
                 i2c,
                 ipcore,
                 eeprom_dev_addr=KarmaDef.EEPROM_DEV_ADDR,
                 sensor_dev_addr=KarmaDef.SENSOR_DEV_ADDR,
                 range_table=karma_range_table):

        if (i2c and ipcore):
            if isinstance(ipcore, basestring):
                axi4_bus = AXI4LiteBus(ipcore, KarmaDef.REG_SIZE)
                self.ipcore = MIXBT001SGR(axi4_bus=axi4_bus,
                                          ad717x_chip='AD7175',
                                          ad717x_mvref=KarmaDef.ADC_VREF,
                                          use_spi=True,
                                          use_gpio=True)
            else:
                self.ipcore = ipcore

            self.ad7175 = self.ipcore.ad717x
            self.ad7175.config = {
                'ch0': {
                    'P': 'AIN0',
                    'N': 'AIN1'
                },
                'ch1': {
                    'P': 'AIN2',
                    'N': 'AIN3'
                }
            }
            self.vx_ix_select_pin = Pin(self.ipcore.gpio,
                                        KarmaDef.VX_IX_SELECT_PIN)
            self.cur_set1_pin = Pin(self.ipcore.gpio, KarmaDef.CUR_SET1_PIN)
            self.cur_set2_pin = Pin(self.ipcore.gpio, KarmaDef.CUR_SET2_PIN)
            self.discharge_pin = Pin(self.ipcore.gpio, KarmaDef.DISCHARGE_PIN)
            self.lpf_select_pin = Pin(self.ipcore.gpio,
                                      KarmaDef.LPF_SELECT_PIN)
            self.reset_l_pin = Pin(self.ipcore.gpio, KarmaDef.RESET_L_PIN)
            self.trigger_l_pin = Pin(self.ipcore.gpio, KarmaDef.TRIGGER_L_PIN)
            self.ad9106 = AD9106(self.ipcore.spi, KarmaDef.AD9106_MCLK,
                                 KarmaDef.AD9106_DEFAULT_VREF)
            self.eeprom = CAT24C32(eeprom_dev_addr, i2c)
            self.sensor = NCT75(sensor_dev_addr, i2c)
            self.line_path = ""
            self.sine_data_length = 0
            self.cosine_data_length = 0
            self.cycle_count = 2
            super(KarmaBase, self).__init__(self.eeprom,
                                            self.sensor,
                                            range_table=range_table)

        else:
            raise KarmaException('Parameter error')
Beispiel #3
0
def create_psu001003_dbg(i2c_bus_name):
    psu001003_dbg = Psu001003Debugger()
    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)
    psu001003_dbg.psu = PSU001003(i2c_bus)
    psu001003_dbg.psu.board_init()
    return psu001003_dbg
Beispiel #4
0
def create_ad9628_dbg(dev_name, pdwn_ctrl, oeb_ctrl, cs_ctrl, use_cs):
    ad9628_dbg = AD9628Debuger()
    if dev_name == '':
        spi_bus = None
    else:
        if utility.is_pl_device(dev_name):
            axi4_bus = AXI4LiteBus(dev_name, PLSPIDef.REG_SIZE)
            spi_bus = MIXQSPISG(axi4_bus)
            spi_bus.mode = 'MODE1'
        else:
            raise NotImplementedError('ps spi bus not support')
    ad9628_dbg.ad9628 = AD9628(spi_bus, pdwn_ctrl, oeb_ctrl, cs_ctrl, use_cs)
    return ad9628_dbg
Beispiel #5
0
def create_adg2128_dbg(dev_name, dev_addr):
    adg2128_dbg = ADG2128Debuger()
    if dev_name == '':
        i2c_bus = None
    else:
        if utility.is_pl_device(dev_name):
            axi4_bus = AXI4LiteBus(dev_name, PLI2CDef.REG_SIZE)
            i2c_bus = MIXI2CSG(axi4_bus)
        else:
            i2c_bus = I2C(dev_name)

    adg2128_dbg.adg2128 = ADG2128(dev_addr, i2c_bus)
    return adg2128_dbg
Beispiel #6
0
 def __init__(self, axi4_bus, use_gpio=True):
     if not axi4_bus:
         self.signal_source = MIXSignalSourceSGEmulator('mix_signal_source_sg_emulator')
         self.gpio = MIXGPIOSGEmulator('mix_gpio_sg_emulator', MIXSGT1SGRDef.MIX_GPIO_REG_SIZE)
     else:
         if isinstance(axi4_bus, basestring):
             axi4_bus = AXI4LiteBus(axi4_bus, MIXSGT1SGRDef.REG_SIZE)
         if use_gpio is True:
             axi4_sub_bus = AXI4LiteSubBus(axi4_bus, MIXSGT1SGRDef.MIX_GPIO_ADDR, MIXSGT1SGRDef.MIX_GPIO_REG_SIZE)
             self.gpio = MIXGPIOSG(axi4_sub_bus)
         axi4_sub_bus = AXI4LiteSubBus(axi4_bus, MIXSGT1SGRDef.MIX_SIGNAL_SOURCE_ADDR,
                                       MIXSGT1SGRDef.MIX_SIGNAL_SOURCE_REG_SIZE)
         self.signal_source = MIXSignalSourceSG(axi4_sub_bus)
Beispiel #7
0
def create_negasonic_dbg(fftrt_dev, i2s_rx_en_pin, adc_rst_pin, gpio_dev,
                         signal_source_dev, i2s_tx_en_pin, dac_rst_pin,
                         i2c_dev, mix_aut1_dev):

    negasonic_dbg = NegasonicDebuger()

    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 mix_aut1_dev != '':
        axi4 = AXI4LiteBus(mix_aut1_dev, 0x8000)
        mix_aut1 = MIXAUT1(axi4)
        negasonic_dbg.audio = Negasonic(i2c_bus, ip=mix_aut1)
    else:
        axi4 = AXI4LiteBus(fftrt_dev, 256)
        analyzer = MIXFftAnalyzerSG(axi4)

        axi4 = AXI4LiteBus(signal_source_dev, 256)
        signal_source = MIXSignalSourceSG(axi4)

        axi4 = AXI4LiteBus(gpio_dev, 256)
        gpio = MIXGPIOSG(axi4)
        analyzer_rst = Pin(gpio, adc_rst_pin)
        analyzer_en = Pin(gpio, i2s_rx_en_pin)
        signal_source_rst = Pin(gpio, dac_rst_pin)
        signal_source_en = Pin(gpio, i2s_tx_en_pin)
        negasonic_dbg.audio = Negasonic(i2c_bus, analyzer=analyzer, signal_sourc=signal_source,
                                        analyzer_rst=analyzer_rst, analyzer_en=analyzer_en,
                                        signal_source_rst=signal_source_rst,
                                        signal_source_en=signal_source_en,
                                        ip=mix_aut1)

    return negasonic_dbg
def create_sg2238_dbg(i2c1):
    sg2238_dbg = Sg2238sp02pcaDebuger()
    if i2c1 == '':
        i2c1 = None
    else:
        if utility.is_pl_device(i2c1):
            axi4_bus = AXI4LiteBus(i2c1, 256)
            i2c_bus = MIXI2CSG(axi4_bus)
        else:
            i2c_bus = I2C(i2c1)
    sg2238_dbg.sg223802 = SG2238SP02PCA(i2c_bus)

    return sg2238_dbg
Beispiel #9
0
def create_ad9833_dbg(dev_name):
    ad9833_dbg = AD9833Debuger()
    if dev_name == '':
        spi_bus = None
    else:
        if utility.is_pl_device(dev_name):
            axi4_bus = AXI4LiteBus(dev_name, PLSPIDef.REG_SIZE)
            spi_bus = MIXQSPISG(axi4_bus)
            spi_bus.set_mode('MODE1')
        else:
            raise NotImplementedError('ps spi bus not support')
    ad9833_dbg.ad9833 = AD9833(spi_bus)
    return ad9833_dbg
Beispiel #10
0
    def __init__(self, i2c=None, ipcore=None, ad7175=None):
        if i2c:
            self.eeprom = CAT24C32(DMM003004Def.EEPROM_DEV_ADDR, i2c)
            self.sensor = NCT75(DMM003004Def.SENSOR_DEV_ADDR, i2c)
            self.cat9555 = CAT9555(DMM003004Def.CAT9555_DEV_ADDR, i2c)
        else:
            self.eeprom = EepromEmulator('eeprom_emulator')
            self.sensor = NCT75Emulator('nct75_emulator')
            self.cat9555 = CAT9555Emulator(DMM003004Def.CAT9555_DEV_ADDR, None,
                                           None)

        if ipcore:
            if isinstance(ipcore, basestring):
                daqt1_axi4_bus = AXI4LiteBus(ipcore,
                                             DMM003004Def.MIXDAQT1_REG_SIZE)
                self.ip = MIXDAQT1SGR(
                    axi4_bus=daqt1_axi4_bus,
                    ad717x_chip='AD7175',
                    ad717x_mvref=DMM003004Def.ADC_VREF_VOLTAGE_5000mV,
                    use_spi=True,
                    use_gpio=False)
                self.ad7175 = self.ip.ad717x
            else:
                self.ip = ipcore
                self.ad7175 = self.ip.ad717x
        elif ad7175:
            self.ad7175 = ad7175
        else:
            self.ad7175 = MIXAd7175SGEmulator('mix_ad7175_sg_emulator',
                                              DMM003004Def.EMULATOR_REG_SIZE)

        self.ad7175.config = {
            'ch0': {
                'P': 'AIN0',
                'N': 'AIN1'
            },
            'ch1': {
                'P': 'AIN2',
                'N': 'AIN3'
            }
        }
        self.mode = 'cal'
        self.measure_path = dict()

        super(Mimic, self).__init__(self.eeprom,
                                    self.sensor,
                                    cal_table=dmm003004_calibration_info,
                                    range_table=dmm003004_range_table)

        self.function_info = dmm003004_function_info
        self.module_calibration_info = dmm003004_calibration_info
Beispiel #11
0
def create_se2300_dbg(gpio_device, i2c_bus_1, i2c_bus_2, ps_ipcore,
                      trigger_ipcore):
    se2300_dbg = Se2300ps01pcbDebuger()

    if gpio_device == '':
        gpio = None
    else:
        axi4_bus = AXI4LiteBus(gpio_device, 256)
        gpio = MIXGPIOSG(axi4_bus)
    ads5231_oea = Pin(gpio, 1)
    data_upload = Pin(gpio, 4)
    if i2c_bus_1 == '':
        iic_1 = None
    else:
        axi4_bus = AXI4LiteBus(i2c_bus_1, 256)
        iic_1 = MIXI2CSG(axi4_bus)

    if i2c_bus_2 == '':
        iic_2 = None
    else:
        axi4_bus = AXI4LiteBus(i2c_bus_2, 256)
        iic_2 = MIXI2CSG(axi4_bus)

    if ps_ipcore == '':
        power_sequency = None
    else:
        axi4_bus = AXI4LiteBus(ps_ipcore, 1024)
        power_sequency = MIXPowerSequenceSG(axi4_bus)

    if trigger_ipcore == '':
        trigger_core = None
    else:
        axi4_bus = AXI4LiteBus(trigger_ipcore, 1024)
        trigger_core = MIXPowerSequenceSG(axi4_bus)

    se2300_dbg.se2300 = SE2300PS01PCB(ads5231_oea, data_upload, iic_1, iic_2,
                                      power_sequency, trigger_core)
    return se2300_dbg
Beispiel #12
0
def create_mimic_dbg(ipcore_name, ad7175_bus_name, vref, i2c_bus_name):
    mimic_dbg = DMM003004Debuger()
    daqt1 = None
    ad7175 = None
    if ipcore_name != '':
        axi4_bus = AXI4LiteBus(ipcore_name, 9548)
        daqt1 = MIXDAQT1SGR(axi4_bus, ad717x_mvref=vref, use_spi=False, use_gpio=False)
    elif ad7175_bus_name != '':
        axi4_bus = AXI4LiteBus(ad7175_bus_name, 256)
        ad7175 = MIXAd7175SG(axi4_bus, vref)

    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)

    mimic_dbg.mimic = DMM003004(i2c_bus, daqt1, ad7175)
    mimic_dbg.mimic.module_init()
    return mimic_dbg
Beispiel #13
0
def create_armor_dbg(dac_i2c_bus_name, eeprom_i2c_bus_name):
    armor_dbg = ArmorDebuger()

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

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

    armor_dbg.armor = Armor(dac_i2c_bus, eeprom_i2c_bus)
    return armor_dbg
Beispiel #14
0
def create_dmm003004A_dbg(ipcore_name, vref, i2c_bus_name):
    dmm003004A_dbg = DMM003004ADebuger()
    daqt1 = None
    if ipcore_name != '':
        axi4_bus = AXI4LiteBus(ipcore_name, 9548)
        daqt1 = MIXDAQT1SGR(axi4_bus,
                            ad717x_chip='AD7175',
                            ad717x_mvref=vref,
                            use_spi=False,
                            use_gpio=False)

    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)

    dmm003004A_dbg.dmm003004A = DMM003004A(i2c_bus, daqt1)
    dmm003004A_dbg.dmm003004A.post_power_on_init()
    return dmm003004A_dbg
Beispiel #15
0
    def __init__(self,
                 axi4_bus=None,
                 use_signalmeter_p=True,
                 use_signalmeter_n=True,
                 use_signalsource=True):
        if isinstance(axi4_bus, basestring):
            self.axi4_bus = AXI4LiteBus(axi4_bus, MIXWCT001001SGRDef.REG_SIZE)
        else:
            self.axi4_bus = axi4_bus

        self.signalmeter_p = None
        self.signalmeter_n = None
        self.signalsource = None
        self.open(use_signalmeter_p, use_signalmeter_n, use_signalsource)
Beispiel #16
0
    def __init__(self, i2c, ad7177=None, ipcore=None):
        if ipcore:
            if isinstance(ipcore, basestring):
                axi4_bus = AXI4LiteBus(ipcore, CloakDef.MIX_DAQT1_REG_SIZE)
                ipcore = MIXDAQT1SGR(
                    axi4_bus,
                    'AD7177',
                    ad717x_mvref=CloakDef.AD7177_MVREF,
                    code_polar=CloakDef.AD7177_CODE_POLAR,
                    reference=CloakDef.AD7177_REFERENCE_SOURCE,
                    buffer_flag=CloakDef.AD7177_BUFFER_FLAG,
                    clock=CloakDef.AD7177_CLOCK,
                    use_spi=False,
                    use_gpio=True)
            self.gpio = ipcore.gpio
            self.tag_pins = [
                Pin(self.gpio, CloakDef.TAG_BASE_PIN + x,
                    CloakDef.GPIO_OUTPUT_DIR) for x in xrange(4)
            ]
        elif ad7177:
            if isinstance(ad7177, basestring):
                axi4_bus = AXI4LiteBus(ad7177, CloakDef.AD7177_REG_SIZE)
                ad7177 = MIXAd7177SG(
                    axi4_bus,
                    mvref=CloakDef.AD7177_MVREF,
                    code_polar=CloakDef.AD7177_CODE_POLAR,
                    reference=CloakDef.AD7177_REFERENCE_SOURCE,
                    buffer_flag=CloakDef.AD7177_BUFFER_FLAG,
                    clock=CloakDef.AD7177_CLOCK)
        else:
            ad7177 = MIXAd7177SGEmulator('mix_ad7177_sg_emulator', 2500)

        super(Cloak,
              self).__init__(i2c, ad7177, ipcore, CloakDef.EEPROM_DEV_ADDR,
                             CloakDef.SENSOR_DEV_ADDR, cloak_calibration_info,
                             cloak_range_table)
Beispiel #17
0
def create_omega_dbg(axi4_bus_name, spi_axi4_bus_name, i2c_bus_name):
    omega = OmegaDebuger()

    if axi4_bus_name == '':
        daqt1 = MIXDAQT1SGREmulator(axi4_bus=None, ad717x_chip='AD7175', ad717x_mvref=5000,
                                    use_spi=True, use_gpio=False)
        ad7175 = None
        spi_bus = None
    elif 'DAQT1' in axi4_bus_name:
        daqt1_axi4_bus = AXI4LiteBus(axi4_bus_name, 0x8000)
        daqt1 = MIXDAQT1SGR(axi4_bus=daqt1_axi4_bus, ad717x_chip='AD7175', ad717x_mvref=5000,
                            use_spi=True, use_gpio=False)
        ad7175 = None
        spi_bus = None
    else:
        daqt1 = None
        ad717x_axi4_bus = AXI4LiteBus(axi4_bus_name, 0x8192)
        ad7175 = MIXAd7175SG(ad717x_axi4_bus, 5000)

        if spi_axi4_bus_name == '':
            spi_bus = None
        else:
            spi_axi4_bus = AXI4LiteBus(spi_axi4_bus_name, 0x8192)
            spi_bus = PLSPIBus(spi_axi4_bus)

    if i2c_bus_name == '':
        i2c_bus = None
    else:
        axi4_bus = AXI4LiteBus(i2c_bus_name, 256)
        i2c_bus = MIXI2CSG(axi4_bus)

    omega.omega = Omega(i2c=i2c_bus,
                        ip=daqt1,
                        ad7175=ad7175,
                        spi=spi_bus)
    return omega
Beispiel #18
0
    def __init__(self, axi4_bus=None):
        if axi4_bus is None:
            self.axi4_bus = AXI4LiteBusEmulator(
                "pl_spi_dac_emulator", PLSPIDACDef.REG_SIZE)
        elif isinstance(axi4_bus, basestring):
            # device path passed in; create axi4litebus here.
            self.axi4_bus = AXI4LiteBus(axi4_bus, PLSPIDACDef.REG_SIZE)
        else:
            self.axi4_bus = axi4_bus
        self.dev_name = self.axi4_bus._dev_name
        self.reg_num = 256
        self.axi4_clk_frequency = 125000000
        self.data_deal = DataOperate()
        self.sclk_frequency = 10000000

        self.open()
Beispiel #19
0
    def __init__(self, axi4_bus=None, channel_num=None):
        if axi4_bus:
            if isinstance(axi4_bus, basestring):
                # device path; create axi4lite bus here
                self.axi4_bus = AXI4LiteBus(axi4_bus, 8192)
            else:
                self.axi4_bus = axi4_bus
            if channel_num not in [4, 6, 8]:
                raise MIXAd760xSGException(
                    'MIXAd760xSG channel number invalid')
            self.channel_num = channel_num
        else:
            self.axi4_bus = AXI4LiteBusEmulator("mix_ad760x_sg_emulator", 8192)
            self.channel_num = MIXAd760xSGDef.AD7608_CHANNEL_NUM

        self._enable()
Beispiel #20
0
    def __init__(self,
                 ps8409_i2c,
                 eeprom_i2c,
                 hpd_io,
                 signal_source_io,
                 signal_ctrol_io,
                 ipcore=None,
                 init_file='hdmi2_0.bin'):
        self.ps8409_i2c = ps8409_i2c
        self.eeprom_i2c = eeprom_i2c
        self.hpd_io = hpd_io
        self.signal_source_io = signal_source_io
        self.signal_ctrol_io = signal_ctrol_io
        self.hpd_io.set_dir('output')
        self.signal_source_io.set_dir('output')
        self.signal_ctrol_io.set_dir('output')
        self.eeprom = CAT24C32(SG2700SU09PCADef.EEPROM_ADDR, self.eeprom_i2c)
        self.nct75 = NCT75(SG2700SU09PCADef.NTC_ADDR, self.eeprom_i2c)

        if isinstance(ipcore, basestring):
            axi4_bus = AXI4LiteBus(ipcore, SG2700SU09PCADef.REG_SIZE)
            self.ipcore = MIXHDMISinkEmulateSG(axi4_bus)
        else:
            self.ipcore = ipcore

        if ipcore is not None:
            # init edid and scdc eeprom
            self.config_eeprom_emulate("EDID_eeprom",
                                       SG2700SU09PCADef.EDID_EEPROM_SPEED,
                                       SG2700SU09PCADef.EDID_EEPROM_ADDR,
                                       SG2700SU09PCADef.EDID_EEPROM_REG_LEN,
                                       SG2700SU09PCADef.EDID_EEPROM_DATA_WIDTH)
            self.config_eeprom_emulate("SCDC_eeprom",
                                       SG2700SU09PCADef.SCDC_EEPROM_SPEED,
                                       SG2700SU09PCADef.SCDC_EEPROM_ADDR,
                                       SG2700SU09PCADef.SCDC_EEPROM_REG_LEN,
                                       SG2700SU09PCADef.SCDC_EEPROM_DATA_WIDTH)
            self.config_SCDC_eeprom()

            # init hdmi info to hdmi2.0
            self.init_eeprom_emulate("EDID_eeprom",
                                     SG2700SU09PCADef.FILE_PATH + init_file)
            self.hpd_level(1)
            self.signal_source_switch('ICI')
            self.signal_ctrol('enable')

        super(SG2700SU09PCA, self).__init__(self.eeprom, self.nct75)
Beispiel #21
0
    def __init__(self, i2c, ipcore=None):

        if i2c:
            self.eeprom = CAT24C32(WolverineiiDef.EEPROM_DEV_ADDR, i2c)
            self.sensor = NCT75(WolverineiiDef.SENSOR_DEV_ADDR, i2c)
            self.pca9536 = PCA9536(WolverineiiDef.IO_EXP_DEV_ADDR, i2c)
        else:
            self.eeprom = EepromEmulator('eeprom_emulator')
            self.sensor = NCT75Emulator('nct75_emulator')
            self.pca9536 = PCA9536Emulator('pca9536_emulator')
        if ipcore:
            if isinstance(ipcore, basestring):
                axi4_bus = AXI4LiteBus(ipcore,
                                       WolverineiiDef.MIXDAQT1_REG_SIZE)
                ipcore = MIXDAQT1SGR(
                    axi4_bus,
                    'AD7175',
                    ad717x_mvref=WolverineiiDef.AD7175_MVREF,
                    code_polar=WolverineiiDef.AD7175_CODE_POLAR,
                    reference=WolverineiiDef.AD7175_REFERENCE,
                    clock=WolverineiiDef.AD7175_CLOCK)
                self.ipcore = ipcore
            else:
                self.ipcore = ipcore
            self.ad7175 = self.ipcore.ad717x
            self.ad7175.config = {
                'ch0': {
                    'P': 'AIN0',
                    'N': 'AIN1'
                },
                'ch1': {
                    'P': 'AIN2',
                    'N': 'AIN3'
                }
            }
        else:
            self.ad7175 = MIXAd7175SGEmulator('mix_ad7175_sg_emulator',
                                              WolverineiiDef.EMULATOR_REG_SIZE)

        self.mode = 'cal'
        self.measure_path = dict()

        super(WolverineII,
              self).__init__(self.eeprom,
                             self.sensor,
                             cal_table=wolverineii_calibration_info,
                             range_table=wolverineii_range_table)
Beispiel #22
0
    def __init__(self, i2c, ipcore=None, analyzer=None, adc_rst_pin=None, adc_ovfl_l_pin=None, i2s_rx_en_pin=None,
                 i2s_ch_select_pin=None, tone_detect_pin=None, upload_ch_select_pin=None, sample_rate=48000):

        assert sample_rate > 0 and sample_rate <= WarlockDef.MAX_SAMPLING_RATE

        if (i2c and analyzer and adc_rst_pin and adc_ovfl_l_pin and i2s_rx_en_pin and
                i2s_ch_select_pin and tone_detect_pin and upload_ch_select_pin):
            self.i2c = i2c

            if isinstance(analyzer, basestring):
                self.analyzer = MIXFftAnalyzerSG(analyzer)
            else:
                self.analyzer = analyzer

            self.adc_rst_pin = adc_rst_pin
            self.adc_ovfl_l_pin = adc_ovfl_l_pin
            self.i2s_rx_en_pin = i2s_rx_en_pin
            self.i2s_ch_select_pin = i2s_ch_select_pin
            self.tone_detect_pin = tone_detect_pin
            self.upload_ch_select_pin = upload_ch_select_pin
        elif (ipcore and i2c):
            self.i2c = i2c
            if isinstance(ipcore, basestring):
                axi4_bus = AXI4LiteBus(ipcore, WarlockDef.MIX_MIK002_REG_SIZE)
                self.ipcore = MIXMIK002SGR(axi4_bus)
            else:
                self.ipcore = ipcore
            self.analyzer = self.ipcore.analyzer
            self.adc_rst_pin = Pin(self.ipcore.gpio, WarlockDef.ADC_RST_PIN)
            self.adc_ovfl_l_pin = Pin(self.ipcore.gpio, WarlockDef.ADC_OVFL_L_PIN)
            self.i2s_rx_en_pin = Pin(self.ipcore.gpio, WarlockDef.I2S_RX_EN_PIN)
            self.i2s_ch_select_pin = Pin(self.ipcore.gpio, WarlockDef.I2S_CH_SELECT_PIN)
            self.tone_detect_pin = Pin(self.ipcore.gpio, WarlockDef.TONE_DETECT_PIN)
            self.upload_ch_select_pin = Pin(self.ipcore.gpio, WarlockDef.UPLOAD_CH_SELECT_PIN)
        else:
            raise WarlockException("Parameter error")

        self.eeprom = CAT24C32(WarlockDef.EEPROM_DEV_ADDR, i2c)
        self.nct75 = NCT75(WarlockDef.SENSOR_DEV_ADDR, i2c)
        self.cat9555 = CAT9555(WarlockDef.CAT9555_DEV_ADDR, i2c)

        super(Warlock, self).__init__(self.eeprom, self.nct75,
                                      cal_table={}, range_table=warlock_range_table)

        self.sampling_rate = sample_rate
        self.scope = ""
        self.mode = ""
Beispiel #23
0
    def __init__(self, axi4_bus, fft_data_cnt=None):
        if isinstance(axi4_bus, basestring):
            # device path; create axi4lite instance
            axi4_bus = AXI4LiteBus(axi4_bus, MIXMIK002SGRDef.REG_SIZE)
        else:
            axi4_bus = axi4_bus

        self.fft_analyzer_axi4_bus = AXI4LiteSubBus(
            axi4_bus, MIXMIK002SGRDef.MIX_FFT_ANAYLZER_IPCORE_ADDR,
            MIXMIK002SGRDef.MIX_FFT_REG_SIZE)
        self.analyzer = MIXXtalkMeasureSG(self.fft_analyzer_axi4_bus,
                                          fft_data_cnt)

        self.gpio_axi4_bus = AXI4LiteSubBus(
            axi4_bus, MIXMIK002SGRDef.MIX_GPIO_IPCORE_ADDR,
            MIXMIK002SGRDef.MIX_GPIO_REG_SIZE)
        self.gpio = MIXGPIOSG(self.gpio_axi4_bus)
    def __init__(self, axi4_bus):
        if isinstance(axi4_bus, basestring):
            # device path; create axi4lite instance
            self.axi4_bus = AXI4LiteBus(axi4_bus, MIXSolarisSGRDef.REG_SIZE)
        else:
            self.axi4_bus = axi4_bus

        if self.axi4_bus is not None:
            self.open()
        else:
            self.meter = MIXSignalMeterSGEmulator("mix_signalmeter_sg_emulator")
            self.spi_adc = PLSPIADCEmulator("pl_spi_adc_emulator", 256)
            self.audio = MIXFftAnalyzerSGEmulator("mix_fftanalyzer_sg_emulator")
            self.spi_bus = MIXQSPISGEmulator("mix_qspi_sg_emulator", 256)
            self.source = MIXSignalSourceSGEmulator("mix_signalsource_sg_emulator")
            self.gpio = MIXGPIOSGEmulator('mix_gpio_sg_emulator', 256)
            self.spi_dac = PLSPIDACEmulator("pl_spi_dac_emulator")
Beispiel #25
0
 def __init__(self, i2c, spi, gpio_switch=None):
     self.i2c = i2c
     if isinstance(spi, basestring):
         axi4_bus = AXI4LiteBus(spi, LuggageDef.MIX_QSPI_REG_SIZE)
         self.spi = MIXQSPISG(axi4_bus)
     else:
         self.spi = spi
     self.gpio_switch = gpio_switch
     self.cat9555 = CAT9555(LuggageDef.CAT9555_ADDR, i2c)
     self.eeprom = CAT24C64(LuggageDef.EEPROM_DEV_ADDR, i2c)
     self.sensor = MAX6642(LuggageDef.SENSOR_DEV_ADDR, i2c)
     self.ads1119 = ADS1119(LuggageDef.ADS1119_DEV_ADDR, self.i2c,
                            LuggageDef.ADS1119_REF_MODE,
                            LuggageDef.ADS1119_MVREF,
                            LuggageDef.ADS1119_SAMPLE_RATE)
     super(Luggage, self).__init__(eeprom=self.eeprom,
                                   range_table=luggage_range_table)
Beispiel #26
0
    def __init__(self,
                 axi4_bus=None,
                 baud_rate=115200,
                 data_bits=8,
                 parity='none',
                 stop_bits=1,
                 timestamp=False):

        if axi4_bus is None:
            self.axi4_bus = AXI4LiteBusEmulator("mix_uart_sg_emulator",
                                                PLUARTDef.REG_SIZE)
        elif isinstance(axi4_bus, basestring):
            # device path; create axi4litebus instance here.
            self.axi4_bus = AXI4LiteBus(axi4_bus, PLUARTDef.REG_SIZE)
        else:
            self.axi4_bus = axi4_bus

        self.config(baud_rate, data_bits, parity, stop_bits, timestamp)
Beispiel #27
0
    def __init__(self, i2c=None, ipcore=None):

        if isinstance(ipcore, basestring):
            daqt1_axi4_bus = AXI4LiteBus(ipcore, DMM003004ADef.MIXDAQT1_REG_SIZE)
            self.ip = MIXDAQT1SGR(axi4_bus=daqt1_axi4_bus, ad717x_chip='AD7175',
                                  ad717x_mvref=DMM003004ADef.ADC_VREF_VOLTAGE_5000mV,
                                  use_spi=False, use_gpio=False)
            self.ad7175 = self.ip.ad717x
        else:
            self.ip = ipcore
            self.ad7175 = self.ip.ad717x

        super(DMM003004, self).__init__(i2c, ipcore, ad7175=None,
                                        eeprom_dev_addr=DMM003004ADef.EEPROM_DEV_ADDR,
                                        sensor_dev_addr=DMM003004ADef.SENSOR_DEV_ADDR,
                                        cat9555_dev_addr=DMM003004ADef.CAT9555_DEV_ADDR,
                                        range_table=dmm003004A_range_table)
        self.function_info = dmm003004A_function_info
    def __init__(self, axi4_bus):
        if isinstance(axi4_bus, basestring):
            # device path; create axi4lite instance
            self.axi4_bus = AXI4LiteBus(axi4_bus, MIXBMUPWMSGRDef.REG_SIZE)
        else:
            self.axi4_bus = axi4_bus

        axi4_gpio = AXI4LiteSubBus(self.axi4_bus,
                                   MIXBMUPWMSGRDef.MIX_GPIO_IPCORE_ADDR,
                                   MIXBMUPWMSGRDef.GPIO_REG_SIZE)
        axi4_signalsource = AXI4LiteSubBus(self.axi4_bus,
                                           MIXBMUPWMSGRDef.MIX_SS_IPCORE_ADDR,
                                           MIXBMUPWMSGRDef.SS_REG_SIZE)

        self.gpio = MIXGPIOSG(axi4_gpio)
        self.signalsource = MIXSignalSourceSG(axi4_signalsource)
        self.gpio.set_pin_dir(MIXBMUPWMSGRDef.CHANNEL_SELECT_BIT0, 'output')
        self.gpio.set_pin_dir(MIXBMUPWMSGRDef.CHANNEL_SELECT_BIT1, 'output')
Beispiel #29
0
    def __init__(self,
                 axi4_bus=None,
                 mvref=2500,
                 code_polar="bipolar",
                 reference="extern",
                 buffer_flag="enable",
                 clock="crystal"):
        if axi4_bus is None:
            self.axi4_bus = AXI4LiteBusEmulator("mix_ad717x_sg_emulator",
                                                MIXAD717XSGDef.REG_SIZE)
        elif isinstance(axi4_bus, basestring):
            # dev path; create axi4lite bus here.
            self.axi4_bus = AXI4LiteBus(axi4_bus, MIXAD717XSGDef.REG_SIZE)
        else:
            self.axi4_bus = axi4_bus
        self.mvref = mvref
        self.clock = AD717XDef.CLOCKSEL[clock]
        self.sample_rate_table = AD717XDef.SAMPLING_CONFIG_TABLE_AD7175
        self.axi4_bus.write_8bit_inc(MIXAD717XSGDef.ENABLE_REGISTER, [0x00])
        self.axi4_bus.write_8bit_inc(MIXAD717XSGDef.ENABLE_REGISTER, [0x01])

        wr_data = [0xFF, 0x01]
        self.axi4_bus.write_8bit_inc(0x24, wr_data)
        self.resolution = 24
        self.samples = 1

        self.config = {
            "ch0": {
                "P": "AIN0",
                "N": "AIN1"
            },
            "ch1": {
                "P": "AIN2",
                "N": "AIN3"
            }
        }
        self.max_chan = 3
        self.continue_sampling_mode_ch_state = "all"
        self.chip_id = AD717XDef.AD7175_CHIP_ID
        self.sampling_rates = {}
        self.code_polar = code_polar
        self.reference = reference
        self.buffer_flag = buffer_flag
        self.channel_init()
Beispiel #30
0
    def __init__(self, i2c_ext, i2c_power, ipcore):

        if i2c_ext and i2c_power and ipcore:
            eeprom = CAT24C32(PSU001014Def.EEPROM_DEV_ADDR, i2c_ext)
            nct75 = NCT75(PSU001014Def.NCT75_DEV_ADDR, i2c_ext)
            self.tca9538 = TCA9538(PSU001014Def.TCA9538_ADDR, i2c_ext)
            self.ad5667_batt = AD5667R(PSU001014Def.DAC_BATT_ADDR,
                                       i2c_power,
                                       ref_mode=PSU001014Def.DAC_REF_MODE,
                                       mvref=PSU001014Def.DAC_VREF)
            self.ad5667_charge = AD5667R(PSU001014Def.DAC_CHARGE_ADDR,
                                         i2c_power,
                                         ref_mode=PSU001014Def.DAC_REF_MODE,
                                         mvref=PSU001014Def.DAC_VREF)
            self.mcp4725 = MCP4725(PSU001014Def.DAC_MCP4725_ADDR,
                                   i2c_power,
                                   mvref=PSU001014Def.MCP4725_VREF)

            if isinstance(ipcore, basestring):
                axi4_bus = AXI4LiteBus(ipcore,
                                       PSU001014Def.MIX_PSU001_REG_SIZE)
                self.ipcore = MIXPSU001SGR(
                    axi4_bus,
                    'AD7175',
                    ad717x_mvref=PSU001014Def.MVREF,
                    code_polar=PSU001014Def.POLAR,
                    reference=PSU001014Def.AD7175_REF_MODE,
                    clock=PSU001014Def.CLOCK,
                    use_gpio=False)
            else:
                self.ipcore = ipcore
            self.ad7175 = self.ipcore.ad717x
            super(PSU001014, self).__init__(eeprom,
                                            nct75,
                                            range_table=psu001_range_table)
        else:
            raise PSU001014Exception("Invalid parameter, please check")
        self.ch1_output_config = dict()
        self.ch2_output_config = dict()
        self.ch1_input_config = dict()
        self.ch2_input_config = dict()
        self.volt_diff = 3000.0
        self.charge_current_vdac = 0
        self.battery_current_vdac = 0