r4650 - in developers/werner/ahrt/host/tmc: demo lib

werner at docs.openmoko.org werner at docs.openmoko.org
Tue Sep 16 16:40:58 CEST 2008


Author: werner
Date: 2008-09-16 16:40:57 +0200 (Tue, 16 Sep 2008)
New Revision: 4650

Modified:
   developers/werner/ahrt/host/tmc/demo/dxplore.py
   developers/werner/ahrt/host/tmc/lib/decode.py
   developers/werner/ahrt/host/tmc/lib/dxplore.py
   developers/werner/ahrt/host/tmc/lib/wave.py
Log:
Highlights:
- yet more decoding fixes
- measurement of distance from user-defined origin, toggled with [Space]

Details:
- lib/decode.py (decode_address): range check for known FBR indices allowed too
  large values
- lib/decode.py (decode_arg): do not cut off the byte/block count in CMD53
  reads
- lib/decode.py (decode_arg): merged common processing of CMD52 and CMD53
- lib/wave.py (digital.debounce): do not delete the beginning of the waveform
  if the acquisition begins inside a glitch
- lib/dxplore.py (measurement.__init__): follow "s" with a space to keep format
  from changing when changing units
- lib/dxplore.py (measurement.hide): prefix is also shown when hidden
- lib/dxplore.py: added prefixes to all measurements
- lib/dxplore.py: added measurement relative to a user-defined origin, toggled
  with [Space]



Modified: developers/werner/ahrt/host/tmc/demo/dxplore.py
===================================================================
--- developers/werner/ahrt/host/tmc/demo/dxplore.py	2008-09-16 03:02:47 UTC (rev 4649)
+++ developers/werner/ahrt/host/tmc/demo/dxplore.py	2008-09-16 14:40:57 UTC (rev 4650)
@@ -29,6 +29,7 @@
 dig = []
 for wv in w[1:]:
     dig.append(wv.digitize(0.5))
+#    dig[-1].debounce(100e-9)
 
 min = dig[0].sample_step()
 for d in dig[1:]:

Modified: developers/werner/ahrt/host/tmc/lib/decode.py
===================================================================
--- developers/werner/ahrt/host/tmc/lib/decode.py	2008-09-16 03:02:47 UTC (rev 4649)
+++ developers/werner/ahrt/host/tmc/lib/decode.py	2008-09-16 14:40:57 UTC (rev 4650)
@@ -82,7 +82,7 @@
 	    "BSZ", "BSZ", "PWR", "HSp")[addr]
 
     # FBR
-    if addr >= 0x100 and addr < 0x800 and (addr & 0xff) < 0x112:
+    if addr >= 0x100 and addr < 0x800 and (addr & 0xff) < 0x12:
 	return ("F%d" % (addr >> 8))+(
 	    "FIC", "EFC", "Pwr", "RFU",
 	    "RFU", "RFU", "RFU", "RFU",
@@ -94,34 +94,26 @@
 
 
 def decode_arg(cmd, arg):
-    if cmd == 52:
+    if cmd == 52 or cmd == 53:
 	write = (arg >> 31) & 1
 	s = ("R", "W")[write]
 	s += str((arg >> 28) & 7)
-	s += (" ", "W")[(arg >> 27) & 1]
 	addr = (arg >> 9) & 0x1ffff
 	name = decode_address(addr)
 	if name is None:
-	    s += "0x%X" % addr
+	    addr = "0x%X" % addr
 	else:
-	    s += name+("(0x%X)" % addr)
+	    addr = name+("(0x%X)" % addr)
+    if cmd == 52:
+	s += (" ", "W")[(arg >> 27) & 1]
+	s += addr
 	if not write:
-	    return s
-	return s+",0x%X" % (arg & 0xff)
+	    s += ",0x%X" % (arg & 0xff)
+	return s
     if cmd == 53:
-	write = (arg >> 31) & 1
-	s = ("R", "W")[write]
-	s += str((arg >> 28) & 7)
 	s += ("b", "B")[(arg >> 27) & 1]
 	s += ("=", "+")[(arg >> 26) & 1]
-	addr = (arg >> 9) & 0x1ffff
-	name = decode_address(addr)
-	if name is None:
-	    s += "0x%X" % addr
-	else:
-	    s += name+("(0x%X)" % addr)
-	if not write:
-	    return s
+	s += addr
 	return s+"*%d" % (arg & 0x1ff)
     return None
 

Modified: developers/werner/ahrt/host/tmc/lib/dxplore.py
===================================================================
--- developers/werner/ahrt/host/tmc/lib/dxplore.py	2008-09-16 03:02:47 UTC (rev 4649)
+++ developers/werner/ahrt/host/tmc/lib/dxplore.py	2008-09-16 14:40:57 UTC (rev 4650)
@@ -145,7 +145,7 @@
     def __init__(self, master, t0, dt, prefix = ""):
         self.fn = (
 	  ( self.show_samples, "Sa" ),
-	  ( self.show_time, "s" ),
+	  ( self.show_time, "s " ),
 	  ( self.show_frequency, "Hz" ))
 
 	self.t0 = t0
@@ -153,7 +153,7 @@
 	self.prefix = prefix
 	self.last_prefix = None
 	self.var = StringVar()
-	self.button = Button(master, textvariable = self.var, width = 12,
+	self.button = Button(master, textvariable = self.var, width = 14,
 	  relief = FLAT, borderwidth = 0, font = self.font,
           fg = self.color, bg = self.background_color,
 	  activeforeground = self.color,
@@ -255,7 +255,7 @@
 	    self.last_prefix = self.prefix
 
     def hide(self):
-	self.var.set(" "*9+self.fn[self.index][1])
+	self.var.set(self.prefix+" "*9+self.fn[self.index][1])
 	self.last = None
 
     def remove(self):
@@ -282,6 +282,8 @@
 	self.main.wz.coords(self.zoom_tag, x, 0, x, self.main.zres)
 	self.main.wz.tag_raise(self.zoom_tag)
 	self.main.meas_pos.show(self.pos)
+	if self.main.user_pos is not None:
+	    self.main.meas_user.show(self.pos-self.main.user_pos)
 
     def x_to_pos(self, x):
 	s = self.main.pos0+int(round((x-self.main.x0)/self.main.mag))
@@ -320,6 +322,7 @@
 	self.wd = self.meas_window(master, t0, sample_step)
 	self.setup_events(master)
 	self.decode_from = None
+	self.user_pos = None
 	self.ch = []
 	self.cur = cursor(self)
 	for ch in range(0, channels):
@@ -354,8 +357,9 @@
 	  bg = self.background_color)
 	w.pack(expand = 1, fill = "x")
 
-	self.meas_start = measurement(w, 0, sample_step)
-	self.meas_pos = measurement(w, t0, sample_step)
+	self.meas_start = measurement(w, 0, sample_step, "SEL ")
+	self.meas_pos = measurement(w, t0, sample_step, "CUR ")
+	self.meas_user = measurement(w, 0, sample_step, "USR ")
 	self.meas_width = measurement(w, 0, sample_step)
 
     def tick_window(self, master):
@@ -387,6 +391,7 @@
 	master.bind("-", self.zoom_out)
 	master.bind(".", self.center)
 	master.bind("c", self.center)
+	master.bind("<space>", self.user_coord)
 
     def decoder_menu(self, master, ch, n):
 	mb = Menubutton(master, direction = RIGHT, text = decoders[0][0],
@@ -482,6 +487,14 @@
 	    self.cur.pos = self.samples-1
 	self.center(event)
 
+    def user_coord(self, event):
+	if self.user_pos is None:
+	    self.user_pos = self.cur.pos
+	    self.meas_user.show(0)
+	else:
+	    self.user_pos = None
+	    self.meas_user.hide()
+
     def reset(self):
 	end = (self.samples-self.pos0)*self.mag
 	# Entire waveform is on screen

Modified: developers/werner/ahrt/host/tmc/lib/wave.py
===================================================================
--- developers/werner/ahrt/host/tmc/lib/wave.py	2008-09-16 03:02:47 UTC (rev 4649)
+++ developers/werner/ahrt/host/tmc/lib/wave.py	2008-09-16 14:40:57 UTC (rev 4650)
@@ -496,8 +496,14 @@
 	    if self.data[i]+t <= self.data[i+1]:
 		i += 1
 	    else:
-		del self.data[i]
-		del self.data[i]
+		# If we begin in a glitch, we just remove the second entry,
+		# so that the start of the waveform is preserved.
+		if i == 0:
+		    del self.data[1]
+		    self.initial = not self.initial
+		else:
+		    del self.data[i]
+		    del self.data[i]
 
     def __len__(self):
 	return len(self.data)*2




More information about the commitlog mailing list