2 \author Travis Goodspeed and Mark Rages
3 \brief Spy-Bi-Wire Mod of JTAG430 and JTAG430X
5 As SBW is merely a multiplexed method of handling JTAG signals, this
6 module works by replacing preprocessor definitions in the
7 traditional modules to make them SBW compatible. Function pointers
8 would be size efficient, but so it goes.
17 /* To select the 2-wire SBW mode, the SBWTDIO line is held high and
18 the first clock is applied on SBWTCK. After this clock, the
19 normal SBW timings are applied starting with the TMS slot, and
20 the normal JTAG patterns can be applied, typically starting with
21 the Tap Reset and Fuse Check sequence. The SBW mode is exited by
22 holding the TEST/SWBCLK low for more than 100 μs.
29 P5DIR |= SBWTDIO|SBWTCK;
36 // now we're in SBW mode
39 void sbwhandle(u8 app, u8 verb, u8 len){
40 debugstr("Coming soon.");
46 //FIXME these should be prefixed with sbw
47 //to prevent name pollution.
48 int tms=1, tdi=1, tdo=0;
60 P5DIR &= ~SBWTDIO; //input mode
61 P5OUT &= ~SBWTCK; //Drop Metaclock
62 tdo=!!(P5IN & SBWTDIO);
63 P5OUT |= SBWTCK; //output mode
64 P5DIR |= SBWTDIO; //Raise Metaclock
74 SETSBWIO(1);asm("nop");asm("nop");
75 SETSBWIO(0);asm("nop");asm("nop");
76 SETSBWIO(1);asm("nop");asm("nop");
77 SETSBWIO(0);asm("nop");asm("nop");
78 SETSBWIO(1);asm("nop");asm("nop");
84 //tdo=!!(P5IN & SBWTDIO);
93 SETSBWIO(0);asm("nop");asm("nop");
94 SETSBWIO(1);asm("nop");asm("nop");
95 SETSBWIO(0);asm("nop");asm("nop");
96 SETSBWIO(1);asm("nop");asm("nop");
97 SETSBWIO(0);asm("nop");asm("nop");
103 //tdo=!!(P5IN & SBWTDIO);