aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authormattprost <matt.prost@ni.com>2022-04-04 18:17:04 -0500
committerAaron Rossetto <aaron.rossetto@ni.com>2022-04-07 13:28:02 -0700
commit14a4b969b6757f3d4f24cfb69122ca2fd630e59a (patch)
tree3c3805dcdcebada3de4754c1df65ad4cf80ceb2e /host
parent0cf8a60a4e88d55de04cde1feb85eaadfdcf15d7 (diff)
downloaduhd-14a4b969b6757f3d4f24cfb69122ca2fd630e59a.tar.gz
uhd-14a4b969b6757f3d4f24cfb69122ca2fd630e59a.tar.bz2
uhd-14a4b969b6757f3d4f24cfb69122ca2fd630e59a.zip
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 <matt.prost@ni.com>
Diffstat (limited to 'host')
-rwxr-xr-xhost/lib/ic_reg_maps/common.py24
1 files changed, 24 insertions, 0 deletions
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<typename T> std::set<T> 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")