CVS: python/msp430 jtag.py,1.15,1.16
Chris Liechti <[email protected]>
| Newsgroups | gmane.comp.hardware.texas-instruments.msp430.gcc.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/mspgcc/python/msp430
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18329/python/msp430
Modified Files:
jtag.py
Log Message:
api change -> new "open" then "connect" (this change was required to have the correct order with ramsize autodetect or manual set)
Index: jtag.py
===================================================================
RCS file: /cvsroot/mspgcc/python/msp430/jtag.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -w -d -r1.15 -r1.16
--- jtag.py 27 Dec 2005 14:58:28 -0000 1.15
+++ jtag.py 27 Dec 2005 16:22:10 -0000 1.16
@@ -82,10 +82,18 @@
MSP430_Open.restype = ctypes.c_int
except AttributeError:
if DEBUG:
- sys.stderr.write('MSP430_Open not found in library, using dummy.\n')
- #TI's USB-FET lib does not have this function
+ sys.stderr.write('MSP430_Open not found in library, using MSP430_Identify instead.\n')
+ MSP430_Identify = MSP430mspgcc.MSP430_Identify
+ MSP430_Identify.argtypes = [ctypes.POINTER(ctypes.char), ctypes.c_long, ctypes.c_long]
+ MSP430_Identify.restype = ctypes.c_int
+ #TI's USB-FET lib does not have this function, they have an MSP430_Identify instead
def MSP430_Open():
- return STATUS_OK
+ buffer = ctypes.char*56
+ status = MSP430_Identify(ctypes.byref(buffer), 56, 0)
+ if DEBUG:
+ sys.stderr.write('MSP430_Identify: Device type: %r\n' % buffer[4:36])
+ return status
+
MSP430_Close = MSP430mspgcc.MSP430_Close
MSP430_Close.argtypes = [ctypes.c_long]
MSP430_Close.restype = ctypes.c_int
@@ -141,10 +149,8 @@
class ParJTAG:
"""implementation of the _parjtag module in python with the help of ctypes"""
- def connect(self, port = None):
- """Enable JTAG and connect to target. This stops it.
- This function must be called before using any other JTAG function,
- or the other functions will yield unpredictable data."""
+ def open(self, port = None):
+ """Initilize library"""
version = ctypes.c_long()
if port is None:
if sys.platform == 'win32':
@@ -156,8 +162,12 @@
if status != STATUS_OK:
raise IOError("Could not initialize the library (port: %s)" % port)
if DEBUG:
- sys.stderr.write('MSP430mspgcc.dll version: %d\n' % (version.value,))
+ sys.stderr.write('MSP430mspgcc.dll/so version: %d\n' % (version.value,))
+ def connect(self,):
+ """Enable JTAG and connect to target. This stops it.
+ This function must be called before using any other JTAG function,
+ or the other functions will yield unpredictable data."""
MSP430_VCC(3)
status = MSP430_Open()
@@ -305,12 +315,16 @@
# ---------- direct use API ---------------
- def connect(self, lpt=None):
- """Connect to devcice at specified port, default = LPT1."""
+ def open(self, lpt=None):
+ """Initialize and open port"""
if lpt is None:
- _parjtag.connect()
+ _parjtag.open()
else:
- _parjtag.connect(lpt)
+ _parjtag.open(lpt)
+
+ def connect(self):
+ """Connect to devcice"""
+ _parjtag.connect()
def close(self):
"""Release device from JTAG"""
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click