aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorLane Kolbly <lane.kolbly@ni.com>2021-10-25 15:51:51 -0500
committerAaron Rossetto <aaron.rossetto@ni.com>2021-11-05 12:02:19 -0700
commit0bb02043a3d197b3fc3282bb1b0826dcbbaffe8a (patch)
tree533e2eb9c946f2f529a5a7a3af8e803fc73be995 /host
parent86190b4406b29cdb85d6e9890e04ec9464051498 (diff)
downloaduhd-0bb02043a3d197b3fc3282bb1b0826dcbbaffe8a.tar.gz
uhd-0bb02043a3d197b3fc3282bb1b0826dcbbaffe8a.tar.bz2
uhd-0bb02043a3d197b3fc3282bb1b0826dcbbaffe8a.zip
host: Add RPC calls for GPIO voltage
Diffstat (limited to 'host')
-rw-r--r--host/lib/include/uhdlib/usrp/common/rpc.py9
-rw-r--r--host/tests/rfnoc_block_tests/x4xx_zbx_mpm_mock.hpp22
2 files changed, 30 insertions, 1 deletions
diff --git a/host/lib/include/uhdlib/usrp/common/rpc.py b/host/lib/include/uhdlib/usrp/common/rpc.py
index bef658921..b33ec773b 100644
--- a/host/lib/include/uhdlib/usrp/common/rpc.py
+++ b/host/lib/include/uhdlib/usrp/common/rpc.py
@@ -93,6 +93,15 @@ IFACES = [
fn_from_string("void dio_set_port_mapping(const std::string& mapping)"),
fn_from_string("void dio_set_pin_directions(const std::string& port, uint32_t values)"),
]),
+ Interface("dio_rpc", [
+ fn_from_string("std::vector<std::string> dio_get_supported_voltage_levels(const std::string& port)"),
+ fn_from_string("void dio_set_voltage_level(const std::string& port, const std::string& level)"),
+ fn_from_string("std::string dio_get_voltage_level(const std::string& port)"),
+ fn_from_string("void dio_set_port_mapping(const std::string& mapping)"),
+ fn_from_string("void dio_set_pin_directions(const std::string& port, uint32_t values)"),
+ fn_from_string("void dio_set_external_power(const std::string& port, bool enable)"),
+ fn_from_string("std::string dio_get_external_power_state(const std::string& port)"),
+ ]),
Interface("dboard_base_rpc", [
fn_from_string("std::vector<std::string> get_sensors(const std::string& trx)"),
fn_from_string("sensor_value_t::sensor_map_t get_sensor(const std::string& trx, const std::string& sensor, size_t chan)"),
diff --git a/host/tests/rfnoc_block_tests/x4xx_zbx_mpm_mock.hpp b/host/tests/rfnoc_block_tests/x4xx_zbx_mpm_mock.hpp
index cd4f71c2f..5fcb14f85 100644
--- a/host/tests/rfnoc_block_tests/x4xx_zbx_mpm_mock.hpp
+++ b/host/tests/rfnoc_block_tests/x4xx_zbx_mpm_mock.hpp
@@ -27,7 +27,7 @@ constexpr double DEFAULT_MCR = 122.88e6;
//! Mock MPM server for X410/ZBX
//
// This is a mock server that mimicks an X410 with a ZBX daughterboard.
-class x4xx_mock_rpc_server : public x400_rpc_iface, public mpmd_rpc_iface, public dboard_base_rpc_iface, public zbx_rpc_iface
+class x4xx_mock_rpc_server : public x400_rpc_iface, public mpmd_rpc_iface, public dboard_base_rpc_iface, public zbx_rpc_iface, public dio_rpc_iface
{
public:
x4xx_mock_rpc_server(const uhd::device_addr_t& device_info)
@@ -315,11 +315,21 @@ public:
// nop
}
+ std::vector<std::string> dio_get_supported_voltage_levels(const std::string&) override
+ {
+ return {"OFF", "1V8", "2V5", "3V3"};
+ }
+
void dio_set_voltage_level(const std::string&, const std::string&) override
{
// nop
}
+ std::string dio_get_voltage_level(const std::string&) override
+ {
+ return "3V3";
+ }
+
void dio_set_port_mapping(const std::string&) override
{
// nop
@@ -330,6 +340,16 @@ public:
// nop
}
+ void dio_set_external_power(const std::string&, bool) override
+ {
+ // nop
+ }
+
+ std::string dio_get_external_power_state(const std::string&) override
+ {
+ return "OFF";
+ }
+
///////////////////////////////////////////////////////////////////////////
// Public attributes for easy inspection
//