Supported misnamed platform names for the nhb12 and nhb12b.
[goodfet] / firmware / include / jtagxscale.h
1 /*! 
2   \file jtagxscale.h
3   \author Dave Huseby <huseby at linuxprogrammer.org>
4   \brief Intel XScale JTAG
5 */
6
7 /* NOTE: I heavily cribbed from the ARM7TDMI jtag implementation. Credit where
8  * credit is due. */
9
10 #ifndef JTAGXSCALE_H
11 #define JTAGXSCALE_H
12
13 #include "app.h"
14
15 #define JTAGXSCALE 0x15
16
17 /* 
18  * Utility Macros 
19  */
20
21 /* XTT (LED TCK TOCK) toggles the CLK line while turning on/off the LED */
22 #define XTT             CLRTCK;PLEDOUT^=PLEDPIN;SETTCK;PLEDOUT^=PLEDPIN;
23
24 /* RUN_TEST_IDLE gets us into run-test-idle from anywhere in the TAP FSM */
25 #define RUN_TEST_IDLE   SETTMS;XTT;XTT;XTT;XTT;XTT;XTT;XTT;XTT;CLRTMS;XTT;
26
27 /* SHIFT_IR gets us into the "Shift IR" state from the run-test-idle state */
28 #define SHIFT_IR        SETTMS;XTT;XTT;CLRTMS;XTT;XTT;
29
30 /* SHIFT_DIR gets us into the "Shift DR" state from the run-test-idle state */
31 #define SHIFT_DR        SETTMS;XTT;CLRTMS;XTT;XTT;
32
33
34 /*
35  * XScale 5-bit JTAG Commands
36  */
37
38 /* On the XScale chip, the TDI pin is connected to the MSB of the IR and the 
39  * TDO is connected to the LSB.  That means we have to shift these commands 
40  * in from LSB to MSB order. */
41
42 /* 01000 - High Z
43  * The highz instruction floats all three-stateable output and in/out pins. 
44  * Also, when this instruction is active, the Bypass register is connected 
45  * between TDI and TDO. This register can be accessed via the JTAG Test-Access 
46  * Port throughout the device operation. Access to the Bypass register can also 
47  * be obtained with the bypass instruction. */
48 #define XSCALE_IR_HIGHZ             0x08
49
50 /* 11110 - Get ID Code
51  * The idcode instruction is used in conjunction with the device identification 
52  * register. It connects the identification register between TDI and TDO in the 
53  * Shift_DR state. When selected, idcode parallel-loads the hard-wired 
54  * identification code (32 bits) on TDO into the identification register on the 
55  * rising edge of TCK in the Capture_DR state. Note: The device identification 
56  * register is not altered by data being shifted in on TDI.*/
57 #define XSCALE_IR_IDCODE            0x1E
58
59 /* 11111 - Bypass
60  * The bypass instruction selects the Bypass register between TDI and TDO pins 
61  * while in SHIFT_DR state, effectively bypassing the processor’s test logic. 
62  * 02 is captured in the CAPTURE_DR state. While this instruction is in effect, 
63  * all other test data registers have no effect on the operation of the system. 
64  * Test data registers with both test and system functionality perform their 
65  * system functions when this instruction is selected. */
66 #define XSCALE_IR_BYPASS            0x1F
67
68 /*
69  * GoodFET Commands from the Client
70  */
71
72 /* Get CHIP ID */
73 #define XSCALE_GET_CHIP_ID          0xF1
74
75
76 /*
77  * Public Interface
78  */
79
80 /* this handles shifting arbitrary length bit strings into the instruction
81  * register and clocking out bits while leaving the JTAG state machine in a
82  * known state. it also handle bit swapping. */
83 unsigned long jtag_xscale_shift_n(unsigned long word,
84                                   unsigned char nbits,
85                                   unsigned char flags);
86
87 /* this handles shifting in the IDCODE instruction and shifting the result
88  * out the TDO and return it. */
89 unsigned long jtag_xscale_idcode();
90
91 extern app_t const jtagxscale_app;
92
93 #endif // JTAGXSCALE_H
94