1 //GoodFET JTAG Application
4 //Higher level left to client application.
13 //! Set up the pins for JTAG mode.
23 //! Shift 8 bits in and out.
24 unsigned char jtagtrans8(unsigned char byte){
27 for (bit = 0; bit < 8; bit++) {
28 /* write MOSI on trailing edge of previous clock */
36 SETTMS;//TMS high on last bit to exit.
40 /* read MISO on trailing edge */
56 //! Shift 8 bits in and out.
57 unsigned int jtagtrans16(unsigned int word){
61 for (bit = 0; bit < 16; bit++) {
62 /* write MOSI on trailing edge of previous clock */
70 SETTMS;//TMS high on last bit to exit.
74 /* read MISO on trailing edge */
90 //! Stop JTAG, release pins
97 //! Shift 16 bits of the DR.
98 unsigned int jtag_dr_shift16(unsigned int in){
111 // shift DR, then idle
112 return(jtagtrans16(in));
116 //! Shift 8 bits of the IR.
117 unsigned char jtag_ir_shift8(unsigned char in){
133 // shift IR, then idle.
134 return(jtagtrans8(in));
137 //! Handles a monitor command.
138 void jtaghandle(unsigned char app,
142 //START handled by specific JTAG
152 cmddata[0]=jtag_ir_shift8(cmddata[0]);
156 cmddataword[0]=jtag_dr_shift16(cmddataword[0]);