2 \author Travis Goodspeed
3 \brief JTAG handler functions.
16 unsigned long jtagtransn(unsigned long word,
17 unsigned char bitcount,
19 //! Shift the address width.
20 unsigned long jtag_dr_shiftadr(unsigned long in);
21 //! Shift 8 bits of the IR.
22 unsigned char jtag_ir_shift8(unsigned char);
23 //! Shift 16 bits of the DR.
24 unsigned int jtag_dr_shift16(unsigned int);
25 //! Shift 20 bits of the DR, MSP430 specific.
26 unsigned long jtag_dr_shift20(unsigned long in);
27 //! Stop JTAG, release pins
30 //! Setup the JTAG pin directions.
33 //! Ratchet Clock Down and Up
36 void jtag_goto_shift_ir();
38 void jtag_goto_shift_dr();
42 //Pins. Both SPI and JTAG names are acceptable.
59 //This could be more accurate.
60 //Does it ever need to be?
62 #define JTAGDELAY(x) delay(x)
64 #define SETMOSI P5OUT|=MOSI
65 #define CLRMOSI P5OUT&=~MOSI
66 #define SETCLK P5OUT|=SCK
67 #define CLRCLK P5OUT&=~SCK
68 #define READMISO (P5IN&MISO?1:0)
69 #define SETTMS P5OUT|=TMS
70 #define CLRTMS P5OUT&=~TMS
71 #define SETTCK P5OUT|=TCK
72 #define CLRTCK P5OUT&=~TCK
73 #define SETTDI P5OUT|=TDI
74 #define CLRTDI P5OUT&=~TDI
76 #define SETTST P4OUT|=TST
77 #define CLRTST P4OUT&=~TST
78 #define SETRST P2OUT|=RST
79 #define CLRRST P2OUT&=~RST
81 #define SETTCLK SETTDI
82 #define CLRTCLK CLRTDI
85 #define SAVETCLK savedtclk=P5OUT&TCLK;
86 #define RESTORETCLK if(savedtclk) P5OUT|=TCLK; else P5OUT&=~TCLK
88 //Replace every "CLRTCK SETTCK" with this.
89 #define TCKTOCK CLRTCK,SETTCK
92 #define JTAG_IR_SHIFT 0x80
93 #define JTAG_DR_SHIFT 0x81
94 #define JTAG_RESETTAP 0x82
95 #define JTAG_RESETTARGET 0x83
96 #define JTAG_DR_SHIFT20 0x91
108 #define Select_IR 0x4
109 #define Update_DR 0x5
110 #define Capture_DR 0x6
111 #define Select_DR 0x7
116 #define RunTest_Idle 0xc
117 #define Update_IR 0xd
118 #define Capture_IR 0xe
119 #define Test_Reset 0xf
121 extern app_t const jtag_app;