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)
68 #define SETMOSI P5OUT|=MOSI
69 #define CLRMOSI P5OUT&=~MOSI
70 #define SETCLK P5OUT|=SCK
71 #define CLRCLK P5OUT&=~SCK
72 #define READMISO (P5IN&MISO?1:0)
73 #define SETTMS P5OUT|=TMS
74 #define CLRTMS P5OUT&=~TMS
75 #define SETTCK P5OUT|=TCK
76 #define CLRTCK P5OUT&=~TCK
77 #define SETTDI P5OUT|=TDI
78 #define CLRTDI P5OUT&=~TDI
80 #define SETTST P4OUT|=TST
81 #define CLRTST P4OUT&=~TST
82 #define SETRST P2OUT|=RST
83 #define CLRRST P2OUT&=~RST
85 #define SETTCLK SETTDI
86 #define CLRTCLK CLRTDI
89 #define SAVETCLK savedtclk=P5OUT&TCLK;
90 #define RESTORETCLK if(savedtclk) P5OUT|=TCLK; else P5OUT&=~TCLK
92 //Replace every "CLRTCK SETTCK" with this.
93 #define TCKTOCK CLRTCK,SETTCK
96 #define JTAG_IR_SHIFT 0x80
97 #define JTAG_DR_SHIFT 0x81
98 #define JTAG_RESETTAP 0x82
99 #define JTAG_RESETTARGET 0x83
100 #define JTAG_DR_SHIFT20 0x91
112 #define Select_IR 0x4
113 #define Update_DR 0x5
114 #define Capture_DR 0x6
115 #define Select_DR 0x7
120 #define RunTest_Idle 0xc
121 #define Update_IR 0xd
122 #define Capture_IR 0xe
123 #define Test_Reset 0xf
125 extern app_t const jtag_app;