1 //GoodFET JTAG Application
4 //Higher level left to client application.
11 //! Set up the pins for JTAG mode.
21 //! Shift 8 bits in and out.
22 unsigned char jtagtrans8(unsigned char byte){
25 for (bit = 0; bit < 8; bit++) {
26 /* write MOSI on trailing edge of previous clock */
34 SETTMS;//TMS high on last bit to exit.
38 /* read MISO on trailing edge */
54 //! Shift 8 bits in and out.
55 unsigned int jtagtrans16(unsigned int word){
59 for (bit = 0; bit < 16; bit++) {
60 /* write MOSI on trailing edge of previous clock */
68 SETTMS;//TMS high on last bit to exit.
72 /* read MISO on trailing edge */
88 //! Stop JTAG, release pins
95 //! Shift 16 bits of the DR.
96 unsigned int jtag_dr_shift16(unsigned int in){
109 // shift DR, then idle
110 return(jtagtrans16(in));
114 //! Shift 8 bits of the IR.
115 unsigned char jtag_ir_shift8(unsigned char in){
131 // shift IR, then idle.
132 return(jtagtrans8(in));
135 //! Handles a monitor command.
136 void jtaghandle(unsigned char app,
140 //START handled by specific JTAG
150 cmddata[0]=jtag_ir_shift8(cmddata[0]);
154 cmddataword[0]=jtag_dr_shift16(cmddataword[0]);