All pastes #944332 Raw Edit

Untitled

public text v1 · immutable
·published 2008-03-16 00:54 UTC
rendered paste body
Index: haretconsole/regs_asic3.py
===================================================================
RCS file: /cvs/haret/haretconsole/regs_asic3.py,v
retrieving revision 1.4
diff -u -r1.4 regs_asic3.py
--- haretconsole/regs_asic3.py	16 Mar 2008 00:40:16 -0000	1.4
+++ haretconsole/regs_asic3.py	16 Mar 2008 00:52:47 -0000
@@ -5,6 +5,7 @@
 # This file may be distributed under the terms of the GNU GPL license.
 
 import memalias
+regOneBits = memalias.regOneBits
 
 
 ######################################################################
@@ -12,69 +13,69 @@
 ######################################################################
 
 ASIC3_GPIO_OFFSET = {
-    0x00: "Mask",
-    0x04: "Direction",
-    0x08: "Out",
-    0x0c: "TriggerType",
-    0x10: "EdgeTrigger",
-    0x14: "LevelTrigger",
-    0x18: "SleepMask",
-    0x1c: "SleepOut",
-    0x20: "BattFaultOut",
-    0x24: "IntStatus",
-    0x28: "AltFunction",
-    0x2c: "SleepConf",
-    0x30: "Status",
+    0x00: ("Mask", ()),
+    0x04: ("Direction", ()),
+    0x08: ("Out", ()),
+    0x0c: ("TriggerType", ()),
+    0x10: ("EdgeTrigger", ()),
+    0x14: ("LevelTrigger", ()),
+    0x18: ("SleepMask", ()),
+    0x1c: ("SleepOut", ()),
+    0x20: ("BattFaultOut", ()),
+    0x24: ("IntStatus", ()),
+    0x28: ("AltFunction", ()),
+    0x2c: ("SleepConf", ()),
+    0x30: ("Status", regOneBits("")),
 }
 
 ASIC3_SPI_OFFSET = {
-    0x00: "Control",
-    0x04: "TxData",
-    0x08: "RxData",
-    0x0c: "Int",
-    0x10: "Status",
+    0x00: ("Control", ()),
+    0x04: ("TxData", ()),
+    0x08: ("RxData", ()),
+    0x0c: ("Int", ()),
+    0x10: ("Status", ()),
 }
 
 ASIC3_PWM_OFFSET = {
-    0x00: "TimeBase",
-    0x04: "PeriodTime",
-    0x08: "DutyTime",
+    0x00: ("TimeBase", ()),
+    0x04: ("PeriodTime", ()),
+    0x08: ("DutyTime", ()),
 }
 
 ASIC3_LED_OFFSET = {
-    0x00: "TimeBase",
-    0x04: "PeriodTime",
-    0x08: "DutyTime",
-    0x0c: "AutoStopCount",
+    0x00: ("TimeBase", ()),
+    0x04: ("PeriodTime", ()),
+    0x08: ("DutyTime", ()),
+    0x0c: ("AutoStopCount", ()),
 }
 
 ASIC3_CLOCK_OFFSET = {
-    0x00: "CDEX",
-    0x04: "SEL",
+    0x00: ("CDEX", ()),
+    0x04: ("SEL", ()),
 }
 
 ASIC3_INTR_OFFSET = {
-    0x00: "IntMask",
-    0x04: "PIntStat",
-    0x08: "IntCPS",
-    0x0c: "IntTBS",
+    0x00: ("IntMask", ()),
+    0x04: ("PIntStat", ()),
+    0x08: ("IntCPS", ()),
+    0x0c: ("IntTBS", ()),
 }
 
 ASIC3_OWM_OFFSET = {
-    0x00: "CMD",
-    0x04: "DAT",
-    0x08: "INTR",
-    0x0c: "INTEN",
-    0x10: "CLKDIV",
+    0x00: ("CMD", ()),
+    0x04: ("DAT", ()),
+    0x08: ("INTR", ()),
+    0x0c: ("INTEN", ()),
+    0x10: ("CLKDIV", ()),
 }
 
 ASIC3_SDHWCTRL_OFFSET = {
-    0x00: "SDConf",
+    0x00: ("SDConf", ()),
 }
 
 ASIC3_EXTCF_OFFSET = {
-    0x00: "Select",
-    0x04: "Reset",
+    0x00: ("Select", ()),
+    0x04: ("Reset", ()),
 }
 
 ASIC3_BANK = {
@@ -102,6 +103,8 @@
     out = {}
     for bank, btuple in ASIC3_BANK.items():
         for offset, function in btuple[1].items():
-            name = btuple[0] + "_" + function
-            out[base + ((bank+offset)>>shift)] = name
+            name = btuple[0] + "_" + function[0]
+            bits = [(bit, btuple[0] + bname)
+                    for bit, bname in function[1]]
+            out[base + ((bank+offset)>>shift)] = name, bits
     return out