1
2
3
4
5
6
7
8
9
10#ifndef mcfdebug_h
11#define mcfdebug_h
12
13
14
15#define MCFDEBUG_CSR 0x0
16#define MCFDEBUG_BAAR 0x5
17#define MCFDEBUG_AATR 0x6
18#define MCFDEBUG_TDR 0x7
19#define MCFDEBUG_PBR 0x8
20#define MCFDEBUG_PBMR 0x9
21#define MCFDEBUG_ABHR 0xc
22#define MCFDEBUG_ABLR 0xd
23#define MCFDEBUG_DBR 0xe
24#define MCFDEBUG_DBMR 0xf
25
26
27#define MCFDEBUG_TDR_TRC_DISP 0x00000000
28#define MCFDEBUG_TDR_TRC_HALT 0x40000000
29#define MCFDEBUG_TDR_TRC_INTR 0x80000000
30#define MCFDEBUG_TDR_LXT1 0x00004000
31#define MCFDEBUG_TDR_LXT2 0x00008000
32#define MCFDEBUG_TDR_EBL1 0x00002000
33#define MCFDEBUG_TDR_EBL2 0x20000000
34#define MCFDEBUG_TDR_EDLW1 0x00001000
35#define MCFDEBUG_TDR_EDLW2 0x10000000
36#define MCFDEBUG_TDR_EDWL1 0x00000800
37#define MCFDEBUG_TDR_EDWL2 0x08000000
38#define MCFDEBUG_TDR_EDWU1 0x00000400
39#define MCFDEBUG_TDR_EDWU2 0x04000000
40#define MCFDEBUG_TDR_EDLL1 0x00000200
41#define MCFDEBUG_TDR_EDLL2 0x02000000
42#define MCFDEBUG_TDR_EDLM1 0x00000100
43#define MCFDEBUG_TDR_EDLM2 0x01000000
44#define MCFDEBUG_TDR_EDUM1 0x00000080
45#define MCFDEBUG_TDR_EDUM2 0x00800000
46#define MCFDEBUG_TDR_EDUU1 0x00000040
47#define MCFDEBUG_TDR_EDUU2 0x00400000
48#define MCFDEBUG_TDR_DI1 0x00000020
49#define MCFDEBUG_TDR_DI2 0x00200000
50#define MCFDEBUG_TDR_EAI1 0x00000010
51#define MCFDEBUG_TDR_EAI2 0x00100000
52#define MCFDEBUG_TDR_EAR1 0x00000008
53#define MCFDEBUG_TDR_EAR2 0x00080000
54#define MCFDEBUG_TDR_EAL1 0x00000004
55#define MCFDEBUG_TDR_EAL2 0x00040000
56#define MCFDEBUG_TDR_EPC1 0x00000002
57#define MCFDEBUG_TDR_EPC2 0x00020000
58#define MCFDEBUG_TDR_PCI1 0x00000001
59#define MCFDEBUG_TDR_PCI2 0x00010000
60
61
62#define MCFDEBUG_AAR_RESET 0x00000005
63
64
65
66#define MCFDEBUG_CSR_RESET 0x00100000
67#define MCFDEBUG_CSR_PSTCLK 0x00020000
68#define MCFDEBUG_CSR_IPW 0x00010000
69#define MCFDEBUG_CSR_MAP 0x00008000
70#define MCFDEBUG_CSR_TRC 0x00004000
71#define MCFDEBUG_CSR_EMU 0x00002000
72#define MCFDEBUG_CSR_DDC_READ 0x00000800
73#define MCFDEBUG_CSR_DDC_WRITE 0x00001000
74#define MCFDEBUG_CSR_UHE 0x00000400
75#define MCFDEBUG_CSR_BTB0 0x00000000
76#define MCFDEBUG_CSR_BTB2 0x00000100
77#define MCFDEBUG_CSR_BTB3 0x00000200
78#define MCFDEBUG_CSR_BTB4 0x00000300
79#define MCFDEBUG_CSR_NPL 0x00000040
80#define MCFDEBUG_CSR_SSM 0x00000010
81
82
83#define MCFDEBUG_BAAR_RESET 0x00000005
84
85
86
87
88
89
90
91
92static inline void wdebug(int reg, unsigned long data) {
93 unsigned short dbg_spc[6];
94 unsigned short *dbg;
95
96
97 dbg = (unsigned short *)((((unsigned long)dbg_spc) + 3) & 0xfffffffc);
98
99
100 dbg[0] = 0x2c80 | (reg & 0xf);
101 dbg[1] = (data >> 16) & 0xffff;
102 dbg[2] = data & 0xffff;
103 dbg[3] = 0;
104
105
106#if 0
107
108 asm( "move.l %0, %%a0\n\t"
109 ".word 0xfbd0\n\t"
110 ".word 0x0003\n\t"
111 :: "g" (dbg) : "a0");
112#else
113
114 asm( "wdebug (%0)" :: "a" (dbg));
115#endif
116}
117
118#endif
119