aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/ic_reg_maps/gen_ad5623_regs.py
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-06-16 00:35:55 +0000
committerJosh Blum <josh@joshknows.com>2010-06-16 00:35:55 +0000
commit2a2434d95e2eb10c629f33e7e67a6456bc4f6648 (patch)
tree4aa5acc9dbbbafbfcd4537d8f67a854da4781203 /host/lib/ic_reg_maps/gen_ad5623_regs.py
parentb4b80f1f6e59fa02d508af860f1a572c9224b975 (diff)
parentca6417739de4e5344325e96887dcdbf8311e265b (diff)
downloaduhd-2a2434d95e2eb10c629f33e7e67a6456bc4f6648.tar.gz
uhd-2a2434d95e2eb10c629f33e7e67a6456bc4f6648.tar.bz2
uhd-2a2434d95e2eb10c629f33e7e67a6456bc4f6648.zip
Merge branch 'sched' of ettus.sourcerepo.com:ettus/uhdpriv into usrp_e
Diffstat (limited to 'host/lib/ic_reg_maps/gen_ad5623_regs.py')
-rwxr-xr-xhost/lib/ic_reg_maps/gen_ad5623_regs.py48
1 files changed, 48 insertions, 0 deletions
diff --git a/host/lib/ic_reg_maps/gen_ad5623_regs.py b/host/lib/ic_reg_maps/gen_ad5623_regs.py
new file mode 100755
index 000000000..e653921ba
--- /dev/null
+++ b/host/lib/ic_reg_maps/gen_ad5623_regs.py
@@ -0,0 +1,48 @@
+#!/usr/bin/env python
+#
+# Copyright 2010 Ettus Research LLC
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+########################################################################
+# Template for raw text data describing registers
+# name addr[bit range inclusive] default optional enums
+########################################################################
+REGS_TMPL="""\
+data 0[4:15] 0
+addr 0[16:18] 0 DAC_A=0, DAC_B=1, ALL=7
+cmd 0[19:21] 0 wr_input_n, up_dac_n, wr_input_n_up_all, wr_up_dac_chan_n, power_down, reset, load_ldac
+"""
+
+########################################################################
+# Template for methods in the body of the struct
+########################################################################
+BODY_TMPL="""\
+boost::uint32_t get_reg(void){
+ boost::uint32_t reg = 0;
+ #for $reg in filter(lambda r: r.get_addr() == 0, $regs)
+ reg |= (boost::uint32_t($reg.get_name()) & $reg.get_mask()) << $reg.get_shift();
+ #end for
+ return reg;
+}
+"""
+
+if __name__ == '__main__':
+ import common; common.generate(
+ name='ad5623_regs',
+ regs_tmpl=REGS_TMPL,
+ body_tmpl=BODY_TMPL,
+ file=__file__,
+ )