MSP430F5xx stuff; 1xx support is probably broken right now.
[goodfet] / firmware / include / jtag.h
index 17833d6..a766b06 100644 (file)
@@ -4,15 +4,29 @@
 #include <iomacros.h>
 
 
+extern unsigned int drwidth;
+
+#define MSP430MODE 0
+#define MSP430XMODE 1
+#define MSP430X2MODE 2
+extern unsigned int jtag430mode;
+
 // Generic Commands
 
+//! Shift n bytes.
+unsigned long jtagtransn(unsigned long word,
+                        unsigned int bitcount);
 //! Shift 8 bits of the IR.
 unsigned char jtag_ir_shift8(unsigned char);
 //! Shift 16 bits of the DR.
 unsigned int jtag_dr_shift16(unsigned int);
+//! Shift 20 bits of the DR, MSP430 specific.
+unsigned long jtag_dr_shift20(unsigned long in);
 //! Stop JTAG, release pins
 void jtag_stop();
 
+//! Setup the JTAG pin directions.
+void jtagsetup();
 
 // JTAG430 Commands
 
@@ -21,6 +35,9 @@ void jtag430_start();
 //! Reset the TAP state machine, check the fuse.
 void jtag430_resettap();
 
+//! Defined in jtag430asm.S
+void jtag430_tclk_flashpulses(int);
+
 //High-level Macros follow
 //! Write data to address.
 void jtag430_writemem(unsigned int adr, unsigned int data);
@@ -83,7 +100,8 @@ extern int savedtclk;
 #define SAVETCLK savedtclk=P5OUT&TCLK;
 #define RESTORETCLK if(savedtclk) P5OUT|=TCLK; else P5OUT&=~TCLK
 
-//JTAG commands, bit-swapped
+
+//16-bit MSP430 JTAG commands, bit-swapped
 #define IR_CNTRL_SIG_16BIT         0xC8   // 0x13
 #define IR_CNTRL_SIG_CAPTURE       0x28   // 0x14
 #define IR_CNTRL_SIG_RELEASE       0xA8   // 0x15
@@ -103,3 +121,16 @@ extern int savedtclk;
 // Bypass instruction
 #define IR_BYPASS                  0xFF   // 0xFF
 
+//MSP430X2 unique
+#define IR_COREIP_ID               0xE8   // 0x17 
+#define IR_DEVICE_ID               0xE1   // 0x87
+
+//MSP430 or MSP430X
+#define MSP430JTAGID 0x89
+//MSP430X2 only
+#define MSP430X2JTAGID 0x91
+
+//! Syncs a POR.
+unsigned int jtag430x2_syncpor();
+//! Executes an MSP430X2 POR
+unsigned int jtag430x2_por();