CVS: jtag/msp430 JTAGfunc.c,1.6,1.7

Chris Liechti <[email protected]>
Newsgroups gmane.comp.hardware.texas-instruments.msp430.gcc.cvs
Message-ID <[email protected]>
Update of /cvsroot/mspgcc/jtag/msp430
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2296/jtag/msp430

Modified Files:
	JTAGfunc.c 
Log Message:
finally ReadMemQuick and WriteMemQuick implementations that do work

Index: JTAGfunc.c
===================================================================
RCS file: /cvsroot/mspgcc/jtag/msp430/JTAGfunc.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -w -d -r1.6 -r1.7
--- JTAGfunc.c	27 Dec 2005 01:12:11 -0000	1.6
+++ JTAGfunc.c	29 Dec 2005 18:44:19 -0000	1.7
@@ -416,21 +416,19 @@
 void WriteMemQuick(WORD StartAddr, WORD Length, const WORD *DataArray) {
     WORD i;
     
-    // Initialize writing:
-    SetPC((WORD)(StartAddr-4));
-    HaltCPU();
+    SetPC(StartAddr - 2);
+    HIL_JTAG_IR(IR_DATA_16BIT);
+    HIL_TCLK(1);                                // F2xxx
+    HIL_JTAG_DR(JMP_$, F_WORD);                 // Load "jmp $" instruction for use while HALT'ed.
+    HIL_TCLK(POS_EDGE);
     
-    ClrTCLK();
     HIL_JTAG_IR(IR_CNTRL_SIG_16BIT);
-    HIL_JTAG_DR(0x2408, F_WORD);                // Set RW to write
+    HIL_JTAG_DR(0x2408, F_WORD);                // Set JTAG_HALT bit
     HIL_JTAG_IR(IR_DATA_QUICK);
     for (i = 0; i < Length; i++) {
-        HIL_JTAG_DR(DataArray[i], F_WORD);      // Shift in the write data
-        SetTCLK();
-        ClrTCLK();                              // Increment PC by 2
+        HIL_JTAG_DR(DataArray[i], F_WORD);           // Write data to memory.
+        HIL_TCLK(POS_EDGE);
     }
-    SetTCLK();
-    
     ReleaseCPU();
 }
 
@@ -475,22 +473,21 @@
 void ReadMemQuick(WORD StartAddr, WORD Length, WORD *DataArray) {
     WORD i;
     
-    // Initialize reading:
-    SetPC(StartAddr-4);         //XXX: is this correct or should it be -2
-    HaltCPU();
+    SetPC(StartAddr - 2);
+    HIL_JTAG_IR(IR_DATA_16BIT);
+    HIL_JTAG_DR(JMP_$, F_WORD);             // Load "jmp $" instruction for use while HALT'ed.
+    HIL_TCLK(NEG_EDGE);
     
-    ClrTCLK();
     HIL_JTAG_IR(IR_CNTRL_SIG_16BIT);
-    HIL_JTAG_DR(0x2409, F_WORD);                    // Set RW to read
+    HIL_JTAG_DR(0x2409, F_WORD);            // Set JTAG_HALT bit
     HIL_JTAG_IR(IR_DATA_QUICK);
-    
     for (i = 0; i < Length; i++) {
-        SetTCLK();
-        ClrTCLK();
-        DataArray[i] = HIL_JTAG_DR(0x0000, F_WORD); // Shift out the data
-                                                    // from the target.
+        HIL_TCLK(NEG_EDGE);
+        DataArray[i] = HIL_JTAG_DR(0, F_WORD);   // Read data from memory.
     }
-    SetTCLK();
+    HIL_TCLK(1);                            // F2xxx
+    HIL_JTAG_IR(IR_CNTRL_SIG_16BIT);
+    HIL_JTAG_DR(0x2401, F_WORD);            // Clear the HALT_JTAG bit (Release CPU)
     
     ReleaseCPU();
 }



-------------------------------------------------------
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.