Skip to content

Commit

Permalink
ad7986: add emulation artifacts
Browse files Browse the repository at this point in the history
Signed-off-by: Trevor Gamblin <[email protected]>
  • Loading branch information
threexc authored and fsylvestre committed May 13, 2024
1 parent 64ca35c commit bec581c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/emu/devices/ad7986.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?xml version="1.0" encoding="utf-8"?><!DOCTYPE context [<!ELEMENT context (device | context-attribute)*><!ELEMENT context-attribute EMPTY><!ELEMENT device (channel | attribute | debug-attribute | buffer-attribute)*><!ELEMENT channel (scan-element?, attribute*)><!ELEMENT attribute EMPTY><!ELEMENT scan-element EMPTY><!ELEMENT debug-attribute EMPTY><!ELEMENT buffer-attribute EMPTY><!ATTLIST context name CDATA #REQUIRED description CDATA #IMPLIED><!ATTLIST context-attribute name CDATA #REQUIRED value CDATA #REQUIRED><!ATTLIST device id CDATA #REQUIRED name CDATA #IMPLIED><!ATTLIST channel id CDATA #REQUIRED type (input|output) #REQUIRED name CDATA #IMPLIED><!ATTLIST scan-element index CDATA #REQUIRED format CDATA #REQUIRED scale CDATA #IMPLIED><!ATTLIST attribute name CDATA #REQUIRED filename CDATA #IMPLIED value CDATA #IMPLIED><!ATTLIST debug-attribute name CDATA #REQUIRED value CDATA #IMPLIED><!ATTLIST buffer-attribute name CDATA #REQUIRED value CDATA #IMPLIED>]><context name="network" description="10.2.5.203 Linux zed-2 6.7.0-rc3-ad7944-00066-gcaa4d5f33137-dirty #12 SMP PREEMPT Wed Feb 14 09:45:10 EST 2024 armv7l" ><context-attribute name="hw_carrier" value="Xilinx Zynq ZED" /><context-attribute name="hw_model" value="EVAL-AD7986FMCZ on Xilinx Zynq ZED" /><context-attribute name="hw_mezzanine" value="EVAL-AD7986FMCZ" /><context-attribute name="hw_name" value="Empty Field" /><context-attribute name="hw_vendor" value="Analog Devices" /><context-attribute name="hw_serial" value="Empty Field" /><context-attribute name="local,kernel" value="6.7.0-rc3-ad7944-00066-gcaa4d5f33137-dirty" /><context-attribute name="uri" value="ip:10.2.5.203" /><context-attribute name="ip,ip-addr" value="10.2.5.203" /><device id="hwmon0" name="e000b000ethernetffffffff00" ><channel id="temp1" type="input" ><attribute name="crit" filename="temp1_crit" value="100000" /><attribute name="input" filename="temp1_input" value="41000" /><attribute name="max_alarm" filename="temp1_max_alarm" value="0" /></channel></device><device id="iio:device0" name="xadc" ><channel id="voltage5" name="vccoddr" type="input" ><attribute name="label" filename="in_voltage5_vccoddr_label" value="vccoddr" /><attribute name="raw" filename="in_voltage5_vccoddr_raw" value="2051" /><attribute name="scale" filename="in_voltage5_vccoddr_scale" value="0.732421875" /></channel><channel id="voltage0" name="vccint" type="input" ><attribute name="label" filename="in_voltage0_vccint_label" value="vccint" /><attribute name="raw" filename="in_voltage0_vccint_raw" value="1395" /><attribute name="scale" filename="in_voltage0_vccint_scale" value="0.732421875" /></channel><channel id="voltage4" name="vccpaux" type="input" ><attribute name="label" filename="in_voltage4_vccpaux_label" value="vccpaux" /><attribute name="raw" filename="in_voltage4_vccpaux_raw" value="2459" /><attribute name="scale" filename="in_voltage4_vccpaux_scale" value="0.732421875" /></channel><channel id="temp0" type="input" ><attribute name="offset" filename="in_temp0_offset" value="-2219" /><attribute name="raw" filename="in_temp0_raw" value="2609" /><attribute name="scale" filename="in_temp0_scale" value="123.040771484" /></channel><channel id="voltage7" name="vrefn" type="input" ><attribute name="label" filename="in_voltage7_vrefn_label" value="vrefn" /><attribute name="raw" filename="in_voltage7_vrefn_raw" value="13" /><attribute name="scale" filename="in_voltage7_vrefn_scale" value="0.732421875" /></channel><channel id="voltage1" name="vccaux" type="input" ><attribute name="label" filename="in_voltage1_vccaux_label" value="vccaux" /><attribute name="raw" filename="in_voltage1_vccaux_raw" value="2462" /><attribute name="scale" filename="in_voltage1_vccaux_scale" value="0.732421875" /></channel><channel id="voltage2" name="vccbram" type="input" ><attribute name="label" filename="in_voltage2_vccbram_label" value="vccbram" /><attribute name="raw" filename="in_voltage2_vccbram_raw" value="1391" /><attribute name="scale" filename="in_voltage2_vccbram_scale" value="0.732421875" /></channel><channel id="voltage3" name="vccpint" type="input" ><attribute name="label" filename="in_voltage3_vccpint_label" value="vccpint" /><attribute name="raw" filename="in_voltage3_vccpint_raw" value="1393" /><attribute name="scale" filename="in_voltage3_vccpint_scale" value="0.732421875" /></channel><channel id="voltage6" name="vrefp" type="input" ><attribute name="label" filename="in_voltage6_vrefp_label" value="vrefp" /><attribute name="raw" filename="in_voltage6_vrefp_raw" value="1717" /><attribute name="scale" filename="in_voltage6_vrefp_scale" value="0.732421875" /></channel><attribute name="sampling_frequency" value="961538" /><attribute name="waiting_for_supplier" value="0" /></device><device id="iio:device1" name="ad7986" ><channel id="voltage0-voltage1" type="input" ><scan-element index="0" format="le:s18/32&gt;&gt;0" scale="0.019073" /><attribute name="raw" filename="in_voltage0-voltage1_raw" value="ERROR" /><attribute name="scale" filename="in_voltage0-voltage1_scale" value="ERROR" /></channel><attribute name="waiting_for_supplier" value="0" /><buffer-attribute name="data_available" value="0.019073486" /><buffer-attribute name="direction" value="0" /><buffer-attribute name="length_align_bytes" value="in" /></device><device id="iio_sysfs_trigger" ><attribute name="add_trigger" value="8" /><attribute name="remove_trigger" value="ERROR" /></device><device id="trigger0" name="44a00000.spi-offload.0-pwm-trigger" ><attribute name="sampling_frequency" value="1000" /></device></context>
28 changes: 28 additions & 0 deletions test/test_ad7986.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import pytest

hardware = "ad7986"
classname = "adi.ad7986"


#########################################
@pytest.mark.iio_hardware(hardware)
@pytest.mark.parametrize("classname", [(classname)])
@pytest.mark.parametrize(
"attr, val",
[
(
"sampling_frequency",
[10000, 50000, 100000, 200000, 500000, 1000000, 2000000, 2500000],
),
],
)
def test_ad7986_attr(test_attribute_multiple_values, iio_uri, classname, attr, val):
test_attribute_multiple_values(iio_uri, classname, attr, val, 1)


#########################################
@pytest.mark.iio_hardware(hardware, True)
@pytest.mark.parametrize("channel", [0])
@pytest.mark.parametrize("classname", [classname])
def test_ad7986_rx_data(test_dma_rx, iio_uri, classname, channel):
test_dma_rx(iio_uri, classname, channel)

0 comments on commit bec581c

Please sign in to comment.