fix endianness in device descriptor
[goodfet] / client / GoodFETXSCALE.py
index 6e0aed5..f9b0c33 100644 (file)
@@ -1,11 +1,5 @@
 #!/usr/bin/env python
-# GoodFET Client Library
-# 
-#
-# Good luck with alpha / beta code.
-# Contributions and bug reports welcome.
-#
-# NOTE: this is just a hacked up copy of the GoodFETARM.py file
+# GoodFET XScale JTAG Client
 
 import sys, binascii, struct
 
@@ -23,48 +17,34 @@ NOK   = 0x7E
 OK    = 0x7F
 
 # XSCALE JTAG verbs
-GET_CHIP_ID         = 0xF1
+# verbs start at 0xF0
 
-from GoodFET import GoodFET
+from GoodFETJTAG import GoodFETJTAG
 from intelhex import IntelHex
 
-class GoodFETXSCALE(GoodFET):
+class GoodFETXSCALE(GoodFETJTAG):
 
     """A GoodFET variant for use with XScale processors."""
 
-    XSCALEAPP=0x13;
+    XSCALEAPP=0x15;
     APP=XSCALEAPP;
+
     def setup(self):
         """Move the FET into the JTAG ARM application."""
-        print "Initializing XScale..."
-        self.writecmd(self.APP, SETUP, 0, self.data)
+        sys.stdout.write("Initializing XScale...")
+        self.writecmd(self.APP, SETUP)
+        self._check_return(SETUP)
 
     def start(self):
         """Start debugging."""
-        print "Staring debug..."
-        self.writecmd(self.APP, START, 0, self.data)
+        sys.stdout.write("Staring session...")
+        self.writecmd(self.APP, START)
+        self._check_return(START)
 
     def stop(self):
         """Stop debugging."""
-        print "Stopping debug..."
-        self.writecmd(self.APP, STOP, 0, self.data)
-
-    def get_id(self):
-        """Get the Chip ID."""
-        
-        # send the get chip ID command
-        self.writecmd(self.APP, GET_CHIP_ID, 0, [])
-
-        # get the response
-        ident = struct.unpack("<L", "".join(self.data[0:4]))[0]
-
-        version = ident >> 28
-        part_number = (ident >> 12) & 0x10
-        manufacturer = ident & 0xFFF
-
-        print "XScale ID --\n\tmfg: %x\n\tpart: %x\n\tver: %x\n\t(%x)" % (version, part_number, manufacturer, ident)
+        sys.stdout.write("Stopping session...")
+        self.writecmd(self.APP, STOP)
+        self._check_return(STOP)
 
-        return ident
-