diff options
author | Lane Kolbly <lane.kolbly@ni.com> | 2022-03-18 15:46:50 -0500 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2022-03-23 16:14:07 -0500 |
commit | 91b6110210f353fd2e92efad18d361cf4436d69d (patch) | |
tree | 11368f5ae6caf7759a16ae2e46848e6459491858 /host/tests | |
parent | 37987a87f49866b2d0b8b4aa90b20197ddcdad8d (diff) | |
download | uhd-91b6110210f353fd2e92efad18d361cf4436d69d.tar.gz uhd-91b6110210f353fd2e92efad18d361cf4436d69d.tar.bz2 uhd-91b6110210f353fd2e92efad18d361cf4436d69d.zip |
host: devtest: Add GPIO tests for reading back ATR settings
Diffstat (limited to 'host/tests')
-rw-r--r-- | host/tests/devtest/devtest_x4x0.py | 8 | ||||
-rwxr-xr-x | host/tests/devtest/gpio_test.py | 23 |
2 files changed, 30 insertions, 1 deletions
diff --git a/host/tests/devtest/devtest_x4x0.py b/host/tests/devtest/devtest_x4x0.py index c0b8bf4aa..d1add6a66 100644 --- a/host/tests/devtest/devtest_x4x0.py +++ b/host/tests/devtest/devtest_x4x0.py @@ -71,5 +71,13 @@ from test_pps_test import uhd_test_pps_test # from gpio_test import gpio_test # from bitbang_test import bitbang_test +from gpio_test import gpio_atr_readback_test +gpio_atr_readback_test.test_params = [ + ("GPIOA", "DB0_RF0"), + ("GPIOA", "DB0_RF1"), + ("GPIOB", "DB1_RF0"), + ("GPIOB", "DB1_RF1"), +] + from list_sensors_test import list_sensors_test from python_api_test import uhd_python_api_test diff --git a/host/tests/devtest/gpio_test.py b/host/tests/devtest/gpio_test.py index 31a6d5e1d..179ace5b3 100755 --- a/host/tests/devtest/gpio_test.py +++ b/host/tests/devtest/gpio_test.py @@ -7,7 +7,7 @@ """ Test for gpio. """ import re -from uhd_test_base import uhd_example_test_case +from uhd_test_base import uhd_example_test_case, uhd_test_case, UHDPythonTestCase class gpio_test(uhd_example_test_case): """ Run gpio. """ @@ -37,3 +37,24 @@ class gpio_test(uhd_example_test_case): print(app.stderr) self.report_example_results(test_name, run_results) return run_results + + +class gpio_atr_readback_test(UHDPythonTestCase): + test_params = [] + + def test_all(self): + import uhd + usrp = uhd.usrp.MultiUSRP(self.args_str) + + for gpio, source in self.test_params: + usrp.set_gpio_src("GPIO0", [source] * 12) + + usrp.set_gpio_attr(gpio, "ATR_0X", 0xABC, 0xFFF) + usrp.set_gpio_attr(gpio, "ATR_RX", 0xCAB, 0xFFF) + usrp.set_gpio_attr(gpio, "ATR_TX", 0xABA, 0xFFF) + usrp.set_gpio_attr(gpio, "ATR_XX", 0xBAB, 0xFFF) + + assert usrp.get_gpio_attr(gpio, "ATR_0X") == 0xABC + assert usrp.get_gpio_attr(gpio, "ATR_RX") == 0xCAB + assert usrp.get_gpio_attr(gpio, "ATR_TX") == 0xABA + assert usrp.get_gpio_attr(gpio, "ATR_XX") == 0xBAB |