1 |
1633 |
jcastillo |
#ifndef _m68302_h_
|
2 |
|
|
#define _m68302_h_
|
3 |
|
|
|
4 |
|
|
|
5 |
|
|
#ifndef REG8 /* 8-bit reg */
|
6 |
|
|
#define REG8(addr) *((volatile unsigned char * ) (addr))
|
7 |
|
|
#endif
|
8 |
|
|
#ifndef REG16 /* 16-bit reg */
|
9 |
|
|
#define REG16(addr) *((volatile unsigned short * ) (addr))
|
10 |
|
|
#endif
|
11 |
|
|
#ifndef REG32 /* 32-bit reg */
|
12 |
|
|
#define REG32(addr) *((volatile unsigned long * ) (addr))
|
13 |
|
|
#endif
|
14 |
|
|
|
15 |
|
|
#ifndef AREG8 /* 8-bit reg */
|
16 |
|
|
#define AREG8(addr) ((volatile unsigned char * ) (addr))
|
17 |
|
|
#endif
|
18 |
|
|
#ifndef AREG16 /* 16-bit reg */
|
19 |
|
|
#define AREG16(addr) ((volatile unsigned short * ) (addr))
|
20 |
|
|
#endif
|
21 |
|
|
#ifndef AREG32 /* 32-bit reg */
|
22 |
|
|
#define AREG32(addr) ((volatile unsigned short * ) (addr))
|
23 |
|
|
#endif
|
24 |
|
|
|
25 |
|
|
/* These values must be the same as in begin.s */
|
26 |
|
|
#define BAR 0xF00000
|
27 |
|
|
//#define BAR 0xFFF000
|
28 |
|
|
|
29 |
|
|
#define GIMR BAR+0x812 /* Global Interrupt Mode Reg's Memory Address */
|
30 |
|
|
#define IMR BAR+0x816 /* Interrupt Mask Reg'S Memory Address */
|
31 |
|
|
#define ISR BAR+0x818
|
32 |
|
|
#define TMR1 BAR+0x840 /* Timer Mode Register 1 */
|
33 |
|
|
#define TRR1 BAR+0x842 /* Timer Reference Register 1 */
|
34 |
|
|
#define TCR1 BAR+0x844 /* Timer Capture Register 1 */
|
35 |
|
|
#define TCN1 BAR+0x846 /* Timer Counter 1 */
|
36 |
|
|
#define TER1 BAR+0x849 /* Timer Event Register 1 */
|
37 |
|
|
#define TMR2 BAR+0x850 /* Timer Mode Register 2 */
|
38 |
|
|
#define TRR2 BAR+0x852 /* Timer Reference Register 2 */
|
39 |
|
|
#define TCR2 BAR+0x854 /* Timer Capture Register 2 */
|
40 |
|
|
#define TCN2 BAR+0x856 /* Timer Counter 2 */
|
41 |
|
|
#define TER2 BAR+0x859 /* Timer Event Register 2 */
|
42 |
|
|
#define WRR BAR+0x84A /* Watchdog Reference Register */
|
43 |
|
|
#define WCN BAR+0x84C /* Watchdog Counter */
|
44 |
|
|
|
45 |
|
|
#define ISR_TMR1 (1 << 9) /* TIMER1 bit in the ISR and IMR */
|
46 |
|
|
#define ISR_TMR2 (1 << 6) /* TIMER3 bit in the ISR and IMR */
|
47 |
|
|
#define ISR_PB10 (1 << 14) /* PB10 bit in the ISR and IMR */
|
48 |
|
|
#define ISR_PB11 (1 << 15) /* PB11 bit in the ISR and IMR */
|
49 |
|
|
#define ISR_SCC1 (1 << 13) /* SCC1 bit in the ISR and IMR */
|
50 |
|
|
#define ISR_SCC2 (1 << 10) /* SCC2 bit in the ISR and IMR */
|
51 |
|
|
#define ISR_SCC3 (1 << 8) /* SCC3 bit in the ISR and IMR */
|
52 |
|
|
|
53 |
|
|
struct _68302_TMR
|
54 |
|
|
{
|
55 |
|
|
unsigned short PS:8;
|
56 |
|
|
unsigned short CE:2;
|
57 |
|
|
unsigned short OM:1;
|
58 |
|
|
unsigned short ORI:1;
|
59 |
|
|
unsigned short FRR:1;
|
60 |
|
|
unsigned short ICLK:2;
|
61 |
|
|
unsigned short RST:1;
|
62 |
|
|
};
|
63 |
|
|
|
64 |
|
|
struct _68302_TIMER
|
65 |
|
|
{
|
66 |
|
|
struct _68302_TMR TMR;
|
67 |
|
|
unsigned short TRR;
|
68 |
|
|
unsigned short TCR;
|
69 |
|
|
unsigned short TCN;
|
70 |
|
|
unsigned char RES;
|
71 |
|
|
unsigned char TER;
|
72 |
|
|
};
|
73 |
|
|
|
74 |
|
|
|
75 |
|
|
// port A
|
76 |
|
|
#define PACNT REG16(BAR+0x81E)
|
77 |
|
|
#define PADDR REG16(BAR+0x820)
|
78 |
|
|
#define PADAT REG16(BAR+0x822)
|
79 |
|
|
#define A_PADAT AREG16(BAR+0x822)
|
80 |
|
|
|
81 |
|
|
/* port B */
|
82 |
|
|
#define PBCNT REG16(BAR+0x824)
|
83 |
|
|
#define PBDDR REG16(BAR+0x826)
|
84 |
|
|
#define PBDAT REG16(BAR+0x828)
|
85 |
|
|
#define A_PBDAT AREG16(BAR+0x828)
|
86 |
|
|
|
87 |
|
|
|
88 |
|
|
// Common SCC
|
89 |
|
|
#define SIMODE REG16(BAR+0x8B4)
|
90 |
|
|
#define SIMASK REG16(BAR+0x8B2)
|
91 |
|
|
#define SPMODE REG16(BAR+0x8B0)
|
92 |
|
|
#define SMC2Rx REG16(BAR+0x66A)
|
93 |
|
|
#define SMC1Rx REG16(BAR+0x666)
|
94 |
|
|
#define SMC2Tx REG16(BAR+0x66C)
|
95 |
|
|
#define SCC_BD_SIZE 4 // Each BD has 4 ushorts
|
96 |
|
|
|
97 |
|
|
struct _68302_scc{
|
98 |
|
|
unsigned short res1;
|
99 |
|
|
unsigned short scon; // configuration
|
100 |
|
|
unsigned short scm; // mode
|
101 |
|
|
unsigned short dsr; // data sync
|
102 |
|
|
unsigned char scce; // event
|
103 |
|
|
unsigned char res2;
|
104 |
|
|
unsigned char sccm; // mask
|
105 |
|
|
unsigned char res3;
|
106 |
|
|
unsigned char sccs; // status
|
107 |
|
|
unsigned char res4;
|
108 |
|
|
unsigned short res5;
|
109 |
|
|
};
|
110 |
|
|
|
111 |
|
|
#define SCC1_BASE REG16(BAR+0x880)
|
112 |
|
|
#define SCC2_BASE REG16(BAR+0x890)
|
113 |
|
|
#define SCC3_BASE REG16(BAR+0x8A0)
|
114 |
|
|
|
115 |
|
|
|
116 |
|
|
#define SCM_MODE0 (1 << 0)
|
117 |
|
|
#define SCM_MODE1 (1 << 1)
|
118 |
|
|
#define SCM_ENT (1 << 2)
|
119 |
|
|
#define SCM_ENR (1 << 3)
|
120 |
|
|
#define SCM_DIAG0 (1 << 4)
|
121 |
|
|
#define SCM_DIAG1 (1 << 5)
|
122 |
|
|
|
123 |
|
|
#define SCCME_CTS (1 << 7)
|
124 |
|
|
#define SCCME_CD (1 << 6)
|
125 |
|
|
#define SCCME_IDL (1 << 5)
|
126 |
|
|
#define SCCME_BRK (1 << 4) // receive break
|
127 |
|
|
#define SCCME_CCR (1 << 3) // control char received
|
128 |
|
|
#define SCCME_BSY (1 << 2) // receive overrun
|
129 |
|
|
#define SCCME_TX (1 << 1) // buffer transmitted
|
130 |
|
|
#define SCCME_RX (1 << 0) // buffer received
|
131 |
|
|
|
132 |
|
|
#define SCCS_CTS (1 << 0)
|
133 |
|
|
#define SCCS_CD (1 << 1)
|
134 |
|
|
|
135 |
|
|
/* SCC1 */
|
136 |
|
|
|
137 |
|
|
#define SCON1 REG16(BAR+0x882)
|
138 |
|
|
#define SCM1 REG16(BAR+0x884)
|
139 |
|
|
#define SCCE1 REG8(BAR+0x888)
|
140 |
|
|
#define SCCM1 REG8(BAR+0x88A)
|
141 |
|
|
#define SCCS1 REG8(BAR+0x88C)
|
142 |
|
|
|
143 |
|
|
#define SCC1_BD_BASE REG16(BAR+0x400)
|
144 |
|
|
|
145 |
|
|
#define SCC1_TXBD0_1W REG16(BAR+0x440)
|
146 |
|
|
#define SCC1_TXBD0_2W REG16(BAR+0x442)
|
147 |
|
|
#define SCC1_TXBD0_1L REG32(BAR+0x444)
|
148 |
|
|
#define SCC1_RXBD0_1W REG16(BAR+0x400)
|
149 |
|
|
#define SCC1_RXBD0_2W REG16(BAR+0x402)
|
150 |
|
|
#define SCC1_RXBD0_1L REG32(BAR+0x404)
|
151 |
|
|
#define SCC1_MAX_IDL REG16(BAR+0x49C)
|
152 |
|
|
#define SCC1_BRKCR REG16(BAR+0x4A0)
|
153 |
|
|
#define SCC1_PAREC REG16(BAR+0x4A2)
|
154 |
|
|
#define SCC1_FRMEC REG16(BAR+0x4A4)
|
155 |
|
|
#define SCC1_NOSEC REG16(BAR+0x4A6)
|
156 |
|
|
#define SCC1_BRKEC REG16(BAR+0x4A8)
|
157 |
|
|
#define SCC1_MRBLR REG16(BAR+0x482)
|
158 |
|
|
#define SCC1_RFCR REG16(BAR+0x480)
|
159 |
|
|
#define SCC1_CARACT REG16(BAR+0x4B0)
|
160 |
|
|
#define SCC1_UADDR1 REG16(BAR+0x4aa)
|
161 |
|
|
#define SCC1_UADDR2 REG16(BAR+0x4ac)
|
162 |
|
|
|
163 |
|
|
/* SCC2 */
|
164 |
|
|
|
165 |
|
|
#define SCON2 REG16(BAR+0x892)
|
166 |
|
|
#define SCM2 REG16(BAR+0x894)
|
167 |
|
|
#define SCCE2 REG8(BAR+0x898)
|
168 |
|
|
#define SCCM2 REG8(BAR+0x89A)
|
169 |
|
|
#define SCCS2 REG8(BAR+0x89C)
|
170 |
|
|
|
171 |
|
|
#define SCC2_BD_BASE REG16(BAR+0x500)
|
172 |
|
|
|
173 |
|
|
#define SCC2_TXBD0_1W REG16(BAR+0x540)
|
174 |
|
|
#define SCC2_TXBD0_2W REG16(BAR+0x542)
|
175 |
|
|
#define SCC2_TXBD0_1L REG32(BAR+0x544)
|
176 |
|
|
#define SCC2_RXBD0_1W REG16(BAR+0x500)
|
177 |
|
|
#define SCC2_RXBD0_2W REG16(BAR+0x502)
|
178 |
|
|
#define SCC2_RXBD0_1L REG32(BAR+0x504)
|
179 |
|
|
#define SCC2_MAX_IDL REG16(BAR+0x59C)
|
180 |
|
|
#define SCC2_BRKCR REG16(BAR+0x5A0)
|
181 |
|
|
#define SCC2_PAREC REG16(BAR+0x5A2)
|
182 |
|
|
#define SCC2_FRMEC REG16(BAR+0x5A4)
|
183 |
|
|
#define SCC2_NOSEC REG16(BAR+0x5A6)
|
184 |
|
|
#define SCC2_BRKEC REG16(BAR+0x5A8)
|
185 |
|
|
#define SCC2_MRBLR REG16(BAR+0x582)
|
186 |
|
|
#define SCC2_RFCR REG16(BAR+0x580)
|
187 |
|
|
#define SCC2_CARACT REG16(BAR+0x5B0)
|
188 |
|
|
#define SCC2_UADDR1 REG16(BAR+0x5aa)
|
189 |
|
|
#define SCC2_UADDR2 REG16(BAR+0x5ac)
|
190 |
|
|
|
191 |
|
|
/* SCC3 */
|
192 |
|
|
|
193 |
|
|
#define SCON3 REG16(BAR+0x8A2)
|
194 |
|
|
#define SCM3 REG16(BAR+0x8A4)
|
195 |
|
|
#define SCCE3 REG8(BAR+0x8A8)
|
196 |
|
|
#define SCCM3 REG8(BAR+0x8AA)
|
197 |
|
|
#define SCCS3 REG8(BAR+0x8AC)
|
198 |
|
|
|
199 |
|
|
#define SCC3_BD_BASE REG16(BAR+0x600)
|
200 |
|
|
|
201 |
|
|
#define SCC3_TXBD0_1W REG16(BAR+0x640)
|
202 |
|
|
#define SCC3_TXBD0_2W REG16(BAR+0x642)
|
203 |
|
|
#define SCC3_TXBD0_1L REG32(BAR+0x644)
|
204 |
|
|
#define SCC3_RXBD0_1W REG16(BAR+0x600)
|
205 |
|
|
#define SCC3_RXBD0_2W REG16(BAR+0x602)
|
206 |
|
|
#define SCC3_RXBD0_1L REG32(BAR+0x604)
|
207 |
|
|
#define SCC3_MAX_IDL REG16(BAR+0x69C)
|
208 |
|
|
#define SCC3_BRKCR REG16(BAR+0x6A0)
|
209 |
|
|
#define SCC3_PAREC REG16(BAR+0x6A2)
|
210 |
|
|
#define SCC3_FRMEC REG16(BAR+0x6A4)
|
211 |
|
|
#define SCC3_NOSEC REG16(BAR+0x6A6)
|
212 |
|
|
#define SCC3_BRKEC REG16(BAR+0x6A8)
|
213 |
|
|
#define SCC3_MRBLR REG16(BAR+0x682)
|
214 |
|
|
#define SCC3_RFCR REG16(BAR+0x680)
|
215 |
|
|
#define SCC3_CARACT REG16(BAR+0x6B0)
|
216 |
|
|
#define SCC3_UADDR1 REG16(BAR+0x6aa)
|
217 |
|
|
#define SCC3_UADDR2 REG16(BAR+0x6ac)
|
218 |
|
|
|
219 |
|
|
#endif
|