2 \author Travis Goodspeed <travis at radiantmachines.com>
12 //! Set up the pins for JTAG mode.
24 //! Shift 8 bits in and out.
25 unsigned char jtagtrans8(unsigned char byte){
28 for (bit = 0; bit < 8; bit++) {
29 /* write MOSI on trailing edge of previous clock */
37 SETTMS;//TMS high on last bit to exit.
40 /* read MISO on trailing edge */
54 //! Shift n bits in and out.
55 unsigned long jtagtransn(unsigned long word,
56 unsigned int bitcount){
59 unsigned long high=0x8000;
68 for (bit = 0; bit < bitcount; bit++) {
69 /* write MOSI on trailing edge of previous clock */
77 SETTMS;//TMS high on last bit to exit.
80 /* read MISO on trailing edge */
85 word = ((word << 16) | (word >> 4)) & 0x000FFFFF;
100 //! Stop JTAG, release pins
106 unsigned int drwidth=20;
107 //! Shift all bits of the DR.
108 unsigned long jtag_dr_shift20(unsigned long in){
118 // shift DR, then idle
119 return(jtagtransn(in,20));
123 //! Shift 16 bits of the DR.
124 unsigned int jtag_dr_shift16(unsigned int in){
134 // shift DR, then idle
135 return(jtagtransn(in,16));
139 //! Shift 8 bits of the IR.
140 unsigned char jtag_ir_shift8(unsigned char in){
152 // shift IR, then idle.
153 return(jtagtrans8(in));
156 //! Handles a monitor command.
157 void jtaghandle(unsigned char app,
161 //START handled by specific JTAG
171 cmddata[0]=jtag_ir_shift8(cmddata[0]);
175 cmddataword[0]=jtag_dr_shift16(cmddataword[0]);