2 \author Travis Goodspeed
3 \brief JTAG handler functions.
17 unsigned long jtagtransn(unsigned long word,
18 unsigned char bitcount,
20 //! Shift the address width.
21 unsigned long jtag_dr_shiftadr(unsigned long in);
22 //! Shift 8 bits of the IR.
23 unsigned char jtag_ir_shift8(unsigned char);
24 //! Shift 16 bits of the DR.
25 unsigned int jtag_dr_shift16(unsigned int);
26 //! Shift 20 bits of the DR, MSP430 specific.
27 unsigned long jtag_dr_shift20(unsigned long in);
28 //! Stop JTAG, release pins
31 //! Setup the JTAG pin directions.
34 //! Ratchet Clock Down and Up
37 void jtag_goto_shift_ir();
39 void jtag_goto_shift_dr();
43 //Pins. Both SPI and JTAG names are acceptable.
60 //This could be more accurate.
61 //Does it ever need to be?
63 #define JTAGDELAY(x) delay(x)
65 #define SETMOSI P5OUT|=MOSI
66 #define CLRMOSI P5OUT&=~MOSI
67 #define SETCLK P5OUT|=SCK
68 #define CLRCLK P5OUT&=~SCK
69 #define READMISO (P5IN&MISO?1:0)
70 #define SETTMS P5OUT|=TMS
71 #define CLRTMS P5OUT&=~TMS
72 #define SETTCK P5OUT|=TCK
73 #define CLRTCK P5OUT&=~TCK
74 #define SETTDI P5OUT|=TDI
75 #define CLRTDI P5OUT&=~TDI
77 #define SETTST P4OUT|=TST
78 #define CLRTST P4OUT&=~TST
79 #define SETRST P2OUT|=RST
80 #define CLRRST P2OUT&=~RST
82 #define SETTCLK SETTDI
83 #define CLRTCLK CLRTDI
86 #define SAVETCLK savedtclk=P5OUT&TCLK;
87 #define RESTORETCLK if(savedtclk) P5OUT|=TCLK; else P5OUT&=~TCLK
89 //Replace every "CLRTCK SETTCK" with this.
90 #define TCKTOCK CLRTCK,SETTCK
93 #define JTAG_IR_SHIFT 0x80
94 #define JTAG_DR_SHIFT 0x81
95 #define JTAG_RESETTAP 0x82
96 #define JTAG_RESETTARGET 0x83
97 #define JTAG_DR_SHIFT20 0x91
106 //#include "jtag430.h"
111 #define Select_IR 0x4
112 #define Update_DR 0x5
113 #define Capture_DR 0x6
114 #define Select_DR 0x7
119 #define RunTest_Idle 0xc
120 #define Update_IR 0xd
121 #define Capture_IR 0xe
122 #define Test_Reset 0xf