2 \author Travis Goodspeed
3 \brief JTAG handler functions.
14 extern unsigned char jtagid;
20 unsigned long jtagtransn(unsigned long word,
21 unsigned char bitcount,
23 //! Shift the address width.
24 unsigned long jtag_dr_shiftadr(unsigned long in);
25 //! Shift 8 bits of the IR.
26 unsigned char jtag_ir_shift8(unsigned char);
27 //! Shift 16 bits of the DR.
28 unsigned int jtag_dr_shift16(unsigned int);
29 //! Shift 20 bits of the DR, MSP430 specific.
30 unsigned long jtag_dr_shift20(unsigned long in);
31 //! Stop JTAG, release pins
34 //! Setup the JTAG pin directions.
37 //! Ratchet Clock Down and Up
40 void jtag_goto_shift_ir();
42 void jtag_goto_shift_dr();
46 //Pins. Both SPI and JTAG names are acceptable.
63 //This could be more accurate.
64 //Does it ever need to be?
66 #define JTAGDELAY(x) delay(x)
69 #define SETMOSI SPIOUT|=MOSI
70 #define CLRMOSI SPIOUT&=~MOSI
71 #define SETCLK SPIOUT|=SCK
72 #define CLRCLK SPIOUT&=~SCK
73 #define READMISO (SPIIN&MISO?1:0)
74 #define SETTMS SPIOUT|=TMS
75 #define CLRTMS SPIOUT&=~TMS
76 #define SETTCK SPIOUT|=TCK
77 #define CLRTCK SPIOUT&=~TCK
78 #define SETTDI SPIOUT|=TDI
79 #define CLRTDI SPIOUT&=~TDI
81 #define SETTST P4OUT|=TST
82 #define CLRTST P4OUT&=~TST
83 #define SETRST P2OUT|=RST
84 #define CLRRST P2OUT&=~RST
86 #define SETTCLK SETTDI
87 #define CLRTCLK CLRTDI
90 #define SAVETCLK savedtclk=SPIOUT&TCLK;
91 #define RESTORETCLK if(savedtclk) SPIOUT|=TCLK; else SPIOUT&=~TCLK
93 //Replace every "CLRTCK SETTCK" with this.
94 #define TCKTOCK CLRTCK,SETTCK
97 #define JTAG_IR_SHIFT 0x80
98 #define JTAG_DR_SHIFT 0x81
99 #define JTAG_RESETTAP 0x82
100 #define JTAG_RESETTARGET 0x83
101 #define JTAG_DR_SHIFT20 0x91
113 #define Select_IR 0x4
114 #define Update_DR 0x5
115 #define Capture_DR 0x6
116 #define Select_DR 0x7
121 #define RunTest_Idle 0xc
122 #define Update_IR 0xd
123 #define Capture_IR 0xe
124 #define Test_Reset 0xf
126 extern app_t const jtag_app;