7 extern unsigned int drwidth;
11 #define MSP430X2MODE 2
12 extern unsigned int jtag430mode;
17 unsigned long jtagtransn(unsigned long word,
18 unsigned int bitcount);
19 //! Shift 8 bits of the IR.
20 unsigned char jtag_ir_shift8(unsigned char);
21 //! Shift 16 bits of the DR.
22 unsigned int jtag_dr_shift16(unsigned int);
23 //! Stop JTAG, release pins
30 //! Start JTAG, unique to the '430.
32 //! Reset the TAP state machine, check the fuse.
33 void jtag430_resettap();
35 //! Defined in jtag430asm.S
36 void jtag430_tclk_flashpulses(int);
38 //High-level Macros follow
39 //! Write data to address.
40 void jtag430_writemem(unsigned int adr, unsigned int data);
41 //! Read data from address
42 unsigned int jtag430_readmem(unsigned int adr);
44 void jtag430_haltcpu();
46 void jtag430_releasecpu();
47 //! Set CPU to Instruction Fetch
48 void jtag430_setinstrfetch();
49 //! Set the program counter.
50 void jtag430_setpc(unsigned int adr);
51 //! Write data to address.
52 void jtag430_writeflash(unsigned int adr, unsigned int data);
54 //Pins. Both SPI and JTAG names are acceptable.
71 //This could be more accurate.
72 //Does it ever need to be?
74 #define JTAGDELAY(x) delay(x)
76 #define SETMOSI P5OUT|=MOSI
77 #define CLRMOSI P5OUT&=~MOSI
78 #define SETCLK P5OUT|=SCK
79 #define CLRCLK P5OUT&=~SCK
80 #define READMISO (P5IN&MISO?1:0)
81 #define SETTMS P5OUT|=TMS
82 #define CLRTMS P5OUT&=~TMS
83 #define SETTCK P5OUT|=TCK
84 #define CLRTCK P5OUT&=~TCK
85 #define SETTDI P5OUT|=TDI
86 #define CLRTDI P5OUT&=~TDI
88 #define SETTST P4OUT|=TST
89 #define CLRTST P4OUT&=~TST
90 #define SETRST P2OUT|=RST
91 #define CLRRST P2OUT&=~RST
93 #define SETTCLK SETTDI
94 #define CLRTCLK CLRTDI
97 #define SAVETCLK savedtclk=P5OUT&TCLK;
98 #define RESTORETCLK if(savedtclk) P5OUT|=TCLK; else P5OUT&=~TCLK
101 //16-bit MSP430 JTAG commands, bit-swapped
102 #define IR_CNTRL_SIG_16BIT 0xC8 // 0x13
103 #define IR_CNTRL_SIG_CAPTURE 0x28 // 0x14
104 #define IR_CNTRL_SIG_RELEASE 0xA8 // 0x15
105 // Instructions for the JTAG Fuse
106 #define IR_PREPARE_BLOW 0x44 // 0x22
107 #define IR_EX_BLOW 0x24 // 0x24
108 // Instructions for the JTAG data register
109 #define IR_DATA_16BIT 0x82 // 0x41
110 #define IR_DATA_QUICK 0xC2 // 0x43
111 // Instructions for the JTAG PSA mode
112 #define IR_DATA_PSA 0x22 // 0x44
113 #define IR_SHIFT_OUT_PSA 0x62 // 0x46
114 // Instructions for the JTAG address register
115 #define IR_ADDR_16BIT 0xC1 // 0x83
116 #define IR_ADDR_CAPTURE 0x21 // 0x84
117 #define IR_DATA_TO_ADDR 0xA1 // 0x85
118 // Bypass instruction
119 #define IR_BYPASS 0xFF // 0xFF
122 #define IR_COREIP_ID 0xE8 // 0x17
123 #define IR_DEVICE_ID 0xE1 // 0x87
126 #define MSP430JTAGID 0x89
128 #define MSP430X2JTAGID 0x91