Пример #1
0
    def __init__(self, axi4_bus=None, gpio=None, gpio_id=0):
        if gpio is None:
            self.gpio = MIXGPIOSGEmulator('dm634_gpio_emulator',
                                          PLGPIODef.REG_SIZE)
        elif isinstance(gpio, basestring):
            # device path; create MIXGPIOSG instance here.
            self.gpio = MIXGPIOSG(gpio)
        else:
            self.gpio = gpio

        self.gpio_id = gpio_id

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

        self.channel_value_list = [[i, 0]
                                   for i in range(0, DM634Def.MAX_CHAN_NUM)]

        self.set_mode('normal')
Пример #2
0
    def __init__(self,
                 axi4_bus,
                 ad717x_chip,
                 ad717x_mvref=5000,
                 code_polar="bipolar",
                 reference="extern",
                 buffer_flag="enable",
                 clock="crystal",
                 use_spi=False,
                 use_gpio=False):
        if axi4_bus is None:
            self.axi4_bus = AXI4LiteBusEmulator('axi4_bus_emulator',
                                                MIXDAQT1SGRDef.REG_SIZE)
        elif isinstance(axi4_bus, basestring):
            # device path; create axi4lite instance
            self.axi4_bus = AXI4LiteBus(axi4_bus, MIXDAQT1SGRDef.REG_SIZE)
        else:
            self.axi4_bus = axi4_bus

        self.ad717x_chip = ad717x_chip
        self.ad717x_mvref = ad717x_mvref
        self.code_polar = code_polar
        self.reference = reference
        self.buffer_flag = buffer_flag
        self.clock = clock
        self.open(use_spi, use_gpio)
Пример #3
0
    def __init__(self,
                 axi4_bus=None,
                 fft_data_cnt=None,
                 fft_point_number=MIXFftAnalyzerSGDef.FFT_POINT_NUMBER_8K):
        if axi4_bus is None:
            self.axi4_bus = AXI4LiteBusEmulator(
                "axi4_mix_fftanalyzer_sg_emulator",
                MIXFftAnalyzerSGDef.REG_SIZE)
        elif isinstance(axi4_bus, basestring):
            self.axi4_bus = AXI4LiteBus(axi4_bus, MIXFftAnalyzerSGDef.REG_SIZE)
        else:
            self.axi4_bus = axi4_bus

        self.dev_name = self.axi4_bus._dev_name

        # for measure configuration
        self.sample_rate = 0
        self.freq_resolution = 0
        self.bandwidth_index = 0
        self.harmonic_count = 5
        self.freq_point = 1000
        self.fft_point_number = fft_point_number
        self.fft_point_number_half = int(self.fft_point_number / 2)
        if self.fft_point_number == MIXFftAnalyzerSGDef.FFT_POINT_NUMBER_8K:
            self.envelope = MIXFftAnalyzerSGDef.ENELOPE_4
        elif self.fft_point_number == MIXFftAnalyzerSGDef.FFT_POINT_NUMBER_16K:
            self.envelope = MIXFftAnalyzerSGDef.ENELOPE_8

        # for measure result
        self._fft_data_cnt = fft_data_cnt
        self._vpp_by_freq = 0
        self._frequency = 0
        self._vpp = 0
        self._thdn = 0
        self._thd = 0
Пример #4
0
 def __init__(self, axi4_bus=None):
     if axi4_bus is None:
         self._axi4_bus = AXI4LiteBusEmulator('mix_aidslave_sg_emulator',
                                              MIXAidSlaveSGDef.REG_SIZE)
     elif isinstance(axi4_bus, basestring):
         self._axi4_bus = AXI4LiteBus(axi4_bus, MIXAidSlaveSGDef.REG_SIZE)
     else:
         self.axi4_bus = axi4_bus
Пример #5
0
 def __init__(self, axi4_bus=None):
     if axi4_bus is None:
         self._axi4_bus = AXI4LiteBusEmulator("mix_gpio_sg_emulator",
                                              PLGPIODef.REG_SIZE)
     elif isinstance(axi4_bus, basestring):
         # device path; create axi4litebus instance here.
         self._axi4_bus = AXI4LiteBus(axi4_bus, PLGPIODef.REG_SIZE)
     else:
         self._axi4_bus = axi4_bus
Пример #6
0
    def __init__(self, axi4_bus=None):
        if axi4_bus is None:
            self.axi4_bus = AXI4LiteBusEmulator('axi4_bus_emulator',
                                                MIXSWDSGDef.REG_SIZE)
        elif isinstance(axi4_bus, basestring):
            self.axi4_bus = AXI4LiteBus(axi4_bus, MIXSWDSGDef.REG_SIZE)
        else:
            self.axi4_bus = axi4_bus

        self._enable()
    def __init__(self, axi4_bus=None):

        if axi4_bus is None:
            self.axi4_bus = AXI4LiteBusEmulator(
                "mix_axilitetostream_sg_emulator", MIXAxiLiteToStreamSGDef.REGISTER_SIZE)
        elif isinstance(axi4_bus, basestring):
            # device path passed in; create axi4litebus here.
            self.axi4_bus = AXI4LiteBus(axi4_bus, MIXAxiLiteToStreamSGDef.REGISTER_SIZE)
        else:
            self.axi4_bus = axi4_bus
        self.__data_deal = DataOperate()
Пример #8
0
    def __init__(self, axi4_bus=None, speed_hz=PLI2CDef.DEFAULT_RATE):
        if axi4_bus is None:
            self._axi4_bus = AXI4LiteBusEmulator("mix_i2c_sg_emulator",
                                                 PLI2CDef.REG_SIZE)
        else:
            self._axi4_bus = axi4_bus

        self._dev_name = self._axi4_bus._dev_name
        self.lock = Lock()
        self._speed_hz = speed_hz

        self.open()
Пример #9
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()
Пример #10
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()
Пример #11
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)
Пример #12
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()
Пример #13
0
    def __init__(self,
                 axi4_bus,
                 ad717x_chip,
                 ad717x_mvref=5000,
                 use_spi=False,
                 use_gpio=False):

        self._dev_name = "MIXDAQT1SGR"
        self.ad717x_chip = ad717x_chip
        self.ad717x_mvref = ad717x_mvref

        self.axi4_bus = AXI4LiteBusEmulator("axi4_bus_emulator", 0x8000)

        self.ad717x_axi4_bus = AXI4LiteSubBusEmulator(
            "axi4_bus_emulator", MIXDAQT1SGRDef.AD717X_REG_SIZE)
        if self.ad717x_chip is "AD7175":
            self.ad717x = MIXAd7175SGEmulator("mix_ad7175_sg_emulator",
                                              self.ad717x_mvref)
        elif self.ad717x_chip is "AD7177":
            self.ad717x = MIXAd7177SGEmulator("mix_ad7177_sg_emulator",
                                              self.ad717x_mvref)
        else:
            raise RuntimeError("Unsupported AD717x type %s." %
                               (self.ad717x_chip))

        if use_gpio is True:
            self.gpio_axi4_bus = AXI4LiteSubBusEmulator(
                "axi4_bus_emulator", MIXDAQT1SGRDef.GPIO_REG_SIZE)
            self.gpio = MIXGPIOSGEmulator("mix_gpio_sg_emulator",
                                          MIXDAQT1SGRDef.EMULATOR_REG_SIZE)

        if use_spi is True:
            self.spi_axi4_bus = AXI4LiteSubBusEmulator(
                "axi4_bus_emulator", MIXDAQT1SGRDef.SPI_REG_SIZE)
            self.spi = MIXQSPISGEmulator("mix_qspi_sg_emulator",
                                         MIXDAQT1SGRDef.EMULATOR_REG_SIZE)

        self._recorder = Recorder()
        add_recorder(self._recorder)

        self.open()
    def __init__(self,
                 axi4_bus=None,
                 use_signal_meter0=True,
                 use_signal_meter1=True,
                 use_spi=True,
                 use_gpio=True):

        self._dev_name = "MIXDAQT2SGR"
        self.axi4_bus = AXI4LiteBusEmulator("axi4_bus_emulator", 0x8000)

        # pl_signal_meter 0
        if use_signal_meter0 is True:
            self.signal_meter0_axi4_bus = AXI4LiteSubBusEmulator(
                "axi4_bus_emulator", MIXDAQT2SGRDef.SIGNAL_METER_REG_SIZE)
            self.signal_meter0 = MIXSignalMeterSGEmulator(
                "mix_signalmeter_sg_emulator",
                MIXDAQT2SGRDef.EMULATOR_REG_SIZE)
        # pl_signal_meter 1
        if use_signal_meter1 is True:
            self.signal_meter1_axi4_bus = AXI4LiteSubBusEmulator(
                "axi4_bus_emulator", MIXDAQT2SGRDef.SIGNAL_METER_REG_SIZE)
            self.signal_meter1 = MIXSignalMeterSGEmulator(
                "mix_signalmeter_sg_emulator",
                MIXDAQT2SGRDef.EMULATOR_REG_SIZE)
        # gpio
        if use_gpio is True:
            self.gpio_axi4_bus = AXI4LiteSubBusEmulator(
                "axi4_bus_emulator", MIXDAQT2SGRDef.GPIO_REG_SIZE)
            self.gpio = MIXGPIOSGEmulator("mix_gpio_sg_emulator",
                                          MIXDAQT2SGRDef.EMULATOR_REG_SIZE)
        # spi
        if use_spi is True:
            self.spi_axi4_bus = AXI4LiteSubBusEmulator(
                "axi4_bus_emulator", MIXDAQT2SGRDef.SPI_REG_SIZE)
            self.spi = MIXQSPISGEmulator("mix_qspi_sg_emulator",
                                         MIXDAQT2SGRDef.EMULATOR_REG_SIZE)

        self._recorder = Recorder()
        add_recorder(self._recorder)

        self.open(use_signal_meter0, use_signal_meter1, use_spi, use_gpio)
Пример #15
0
 def __init__(self, emulator=False):
     if emulator:
         self._axi4_bus = AXI4LiteBusEmulator('pl_utc_emulator',
                                              AXI4UTCDef.REGISTER_SIZE)
     else:
         self._axi4_bus = AXI4LiteBus('/dev/MIX_SysReg_0', 256)