From 14a4b969b6757f3d4f24cfb69122ca2fd630e59a Mon Sep 17 00:00:00 2001 From: mattprost Date: Mon, 4 Apr 2022 18:17:04 -0500 Subject: ic_reg_maps: Generate save state read functions Auto-generated IC Register Maps (e.g. magnesium_cpld_regs, rhodium_cpld_regs, etc.) now provide getter methods for all attributes. This gives access to the save state information for the device. Signed-off-by: mattprost --- host/lib/ic_reg_maps/common.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'host/lib/ic_reg_maps') diff --git a/host/lib/ic_reg_maps/common.py b/host/lib/ic_reg_maps/common.py index 59a24d298..a689872ff 100755 --- a/host/lib/ic_reg_maps/common.py +++ b/host/lib/ic_reg_maps/common.py @@ -65,6 +65,22 @@ public: % endfor } + % for reg in regs: + % if reg.is_array: + std::vector<${reg.get_type()}> get_state_${reg.get_name()}(void){ + if (_state == NULL) throw uhd::runtime_error("no saved state"); + return _state->${reg.get_name()}; + } + + % else: + ${reg.get_type()} get_state_${reg.get_name()}(void){ + if (_state == NULL) throw uhd::runtime_error("no saved state"); + return _state->${reg.get_name()}; + } + + % endif + % endfor + template std::set get_changed_addrs(void){ if (_state == NULL) throw uhd::runtime_error("no saved state"); //check each register for changes @@ -163,6 +179,14 @@ class ${name}_t: % endif % endfor + % for reg in regs: + def get_state_${reg.get_name()}(self): + if self._state is None: + raise RuntimeError("No saved state") + return self._state.${reg.get_name()} + + %endfor + def get_changed_addrs(self): if self._state is None: raise RuntimeError("No saved state") -- cgit v1.2.3