1 | /* |
---|
2 | * Board Support Package for MCF5206eLITE evaluation board |
---|
3 | * BSP definitions |
---|
4 | * |
---|
5 | * Copyright (C) 2000 OKTET Ltd., St.-Petersburg, Russia |
---|
6 | * Author: Victor V. Vengerov <vvv@oktet.ru> |
---|
7 | * |
---|
8 | * The license and distribution terms for this file may be |
---|
9 | * found in the file LICENSE in this distribution or at |
---|
10 | * |
---|
11 | * http://www.rtems.com/license/LICENSE. |
---|
12 | * |
---|
13 | * $Id$ |
---|
14 | */ |
---|
15 | |
---|
16 | #ifndef _BSP_H |
---|
17 | #define _BSP_H |
---|
18 | |
---|
19 | #include "mcf5206/mcf5206e.h" |
---|
20 | |
---|
21 | #ifndef KB |
---|
22 | #define KB (1024) |
---|
23 | #endif |
---|
24 | #ifndef MB |
---|
25 | #define MB (KB*KB) |
---|
26 | #endif |
---|
27 | |
---|
28 | /*** Board resources allocation ***/ |
---|
29 | |
---|
30 | /* |
---|
31 | * To achieve some compatibility with dBUG monitor, we use the same |
---|
32 | * memory resources allocation as it is used in dBUG. |
---|
33 | * |
---|
34 | * If this definitions will be changed, change the linker script also. |
---|
35 | */ |
---|
36 | |
---|
37 | /* Memory mapping */ |
---|
38 | /* CS0: Boot Flash */ |
---|
39 | #define BSP_MEM_ADDR_FLASH (0xFFE00000) |
---|
40 | #define BSP_MEM_SIZE_FLASH (1*MB) |
---|
41 | #define BSP_MEM_MASK_FLASH (MCF5206E_CSMR_MASK_1M) |
---|
42 | |
---|
43 | /* CS2: External SRAM */ |
---|
44 | #define BSP_MEM_ADDR_ESRAM (0x30000000) |
---|
45 | #define BSP_MEM_SIZE_ESRAM (1*MB) |
---|
46 | #define BSP_MEM_MASK_ESRAM (MCF5206E_CSMR_MASK_1M) |
---|
47 | |
---|
48 | /* CS3: General-Purpose I/O register */ |
---|
49 | #define BSP_MEM_ADDR_GPIO (0x40000000) |
---|
50 | #define BSP_MEM_SIZE_GPIO (64*KB) |
---|
51 | #define BSP_MEM_MASK_GPIO (MCF5206E_CSMR_MASK_64K) |
---|
52 | |
---|
53 | /* DRAM0: Dynamic RAM */ |
---|
54 | #define BSP_MEM_ADDR_DRAM (0x00000000) |
---|
55 | #define BSP_MEM_SIZE_DRAM (16*MB) |
---|
56 | #define BSP_MEM_MASK_DRAM (MCF5206E_DCMR_MASK_16M) |
---|
57 | |
---|
58 | /* On-chip SRAM */ |
---|
59 | #define BSP_MEM_ADDR_SRAM (0x20000000) |
---|
60 | #define BSP_MEM_SIZE_SRAM (8*KB) |
---|
61 | |
---|
62 | /* On-chip peripherial registers */ |
---|
63 | #define BSP_MEM_ADDR_IMM (0x10000000) |
---|
64 | #define BSP_MEM_SIZE_IMM (1*KB) |
---|
65 | #define MBAR BSP_MEM_ADDR_IMM |
---|
66 | |
---|
67 | /* Interrupt vector assignment */ |
---|
68 | #define BSP_INTVEC_AVEC1 (25) |
---|
69 | #define BSP_INTLVL_AVEC1 (1) |
---|
70 | #define BSP_INTPRIO_AVEC1 (3) |
---|
71 | |
---|
72 | #define BSP_INTVEC_AVEC2 (26) |
---|
73 | #define BSP_INTLVL_AVEC2 (2) |
---|
74 | #define BSP_INTPRIO_AVEC2 (3) |
---|
75 | |
---|
76 | #define BSP_INTVEC_AVEC3 (27) |
---|
77 | #define BSP_INTLVL_AVEC3 (3) |
---|
78 | #define BSP_INTPRIO_AVEC3 (3) |
---|
79 | |
---|
80 | #define BSP_INTVEC_AVEC4 (28) |
---|
81 | #define BSP_INTLVL_AVEC4 (4) |
---|
82 | #define BSP_INTPRIO_AVEC4 (3) |
---|
83 | |
---|
84 | #define BSP_INTVEC_AVEC5 (29) |
---|
85 | #define BSP_INTLVL_AVEC5 (5) |
---|
86 | #define BSP_INTPRIO_AVEC5 (3) |
---|
87 | |
---|
88 | #define BSP_INTVEC_AVEC6 (30) |
---|
89 | #define BSP_INTLVL_AVEC6 (6) |
---|
90 | #define BSP_INTPRIO_AVEC6 (3) |
---|
91 | |
---|
92 | #define BSP_INTVEC_AVEC7 (31) |
---|
93 | #define BSP_INTLVL_AVEC7 (7) |
---|
94 | #define BSP_INTPRIO_AVEC7 (3) |
---|
95 | |
---|
96 | #define BSP_INTVEC_TIMER1 (BSP_INTVEC_AVEC5) |
---|
97 | #define BSP_INTLVL_TIMER1 (BSP_INTLVL_AVEC5) |
---|
98 | #define BSP_INTPRIO_TIMER1 (2) |
---|
99 | |
---|
100 | #define BSP_INTVEC_TIMER2 (BSP_INTVEC_AVEC6) |
---|
101 | #define BSP_INTLVL_TIMER2 (BSP_INTLVL_AVEC6) |
---|
102 | #define BSP_INTPRIO_TIMER2 (2) |
---|
103 | |
---|
104 | #define BSP_INTVEC_MBUS (BSP_INTVEC_AVEC4) |
---|
105 | #define BSP_INTLVL_MBUS (BSP_INTLVL_AVEC4) |
---|
106 | #define BSP_INTPRIO_MBUS (2) |
---|
107 | |
---|
108 | #define BSP_INTVEC_UART1 (64) |
---|
109 | #define BSP_INTLVL_UART1 (4) |
---|
110 | #define BSP_INTPRIO_UART1 (0) |
---|
111 | |
---|
112 | #define BSP_INTVEC_UART2 (65) |
---|
113 | #define BSP_INTLVL_UART2 (4) |
---|
114 | #define BSP_INTPRIO_UART2 (1) |
---|
115 | |
---|
116 | #define BSP_INTVEC_DMA0 (66) |
---|
117 | #define BSP_INTLVL_DMA0 (3) |
---|
118 | #define BSP_INTPRIO_DMA0 (1) |
---|
119 | |
---|
120 | #define BSP_INTVEC_DMA1 (67) |
---|
121 | #define BSP_INTLVL_DMA1 (3) |
---|
122 | #define BSP_INTPRIO_DMA1 (2) |
---|
123 | |
---|
124 | /* Location of DS1307 Real-Time Clock/NVRAM chip */ |
---|
125 | #define DS1307_I2C_BUS_NUMBER (0) |
---|
126 | |
---|
127 | #ifndef ASM |
---|
128 | |
---|
129 | #ifdef __cplusplus |
---|
130 | extern "C" { |
---|
131 | #endif |
---|
132 | |
---|
133 | #include <bspopts.h> |
---|
134 | #include <rtems.h> |
---|
135 | #include <rtems/console.h> |
---|
136 | #include <rtems/iosupp.h> |
---|
137 | #include <rtems/clockdrv.h> |
---|
138 | |
---|
139 | #include "i2c.h" |
---|
140 | |
---|
141 | /* |
---|
142 | * confdefs.h overrides for this BSP: |
---|
143 | * - termios serial ports (defaults to 1) |
---|
144 | * - Interrupt stack space is not minimum if defined. |
---|
145 | */ |
---|
146 | |
---|
147 | #define CONFIGURE_NUMBER_OF_TERMIOS_PORTS 2 |
---|
148 | |
---|
149 | /* System frequency */ |
---|
150 | #define BSP_SYSTEM_FREQUENCY ((unsigned int)&_SYS_CLOCK_FREQUENCY) |
---|
151 | extern char _SYS_CLOCK_FREQUENCY; /* Don't use this variable directly!!! */ |
---|
152 | |
---|
153 | /* MBUS I2C bus clock default frequency */ |
---|
154 | #define BSP_MBUS_FREQUENCY (16000) |
---|
155 | |
---|
156 | /* Number of I2C buses supported in this board */ |
---|
157 | #define I2C_NUMBER_OF_BUSES (1) |
---|
158 | |
---|
159 | /* I2C bus selection */ |
---|
160 | #define I2C_SELECT_BUS(bus) |
---|
161 | |
---|
162 | /* |
---|
163 | * Simple spin delay in microsecond units for device drivers. |
---|
164 | * This is very dependent on the clock speed of the target. |
---|
165 | */ |
---|
166 | |
---|
167 | #define delay( microseconds ) \ |
---|
168 | { register uint32_t _delay=(microseconds); \ |
---|
169 | register uint32_t _tmp=123; \ |
---|
170 | asm volatile( "0: \ |
---|
171 | nbcd %0 ; \ |
---|
172 | nbcd %0 ; \ |
---|
173 | dbf %1,0b" \ |
---|
174 | : "=d" (_tmp), "=d" (_delay) \ |
---|
175 | : "0" (_tmp), "1" (_delay) ); \ |
---|
176 | } |
---|
177 | |
---|
178 | /* Constants */ |
---|
179 | |
---|
180 | /* Structures */ |
---|
181 | |
---|
182 | /* |
---|
183 | * Device Driver Table Entries |
---|
184 | */ |
---|
185 | |
---|
186 | /* |
---|
187 | * NOTE: Use the standard Console driver entry |
---|
188 | */ |
---|
189 | |
---|
190 | /* |
---|
191 | * NOTE: Use the standard Clock driver entry |
---|
192 | */ |
---|
193 | |
---|
194 | /* |
---|
195 | * Real-Time Clock Driver Table Entry |
---|
196 | * NOTE: put this entry to the device driver table AFTER I2C bus driver! |
---|
197 | */ |
---|
198 | #define RTC_DRIVER_TABLE_ENTRY \ |
---|
199 | { rtc_initialize, NULL, NULL, NULL, NULL, NULL } |
---|
200 | extern rtems_device_driver rtc_initialize( |
---|
201 | rtems_device_major_number major, |
---|
202 | rtems_device_minor_number minor, |
---|
203 | void *arg |
---|
204 | ); |
---|
205 | |
---|
206 | /* miscellaneous stuff assumed to exist */ |
---|
207 | |
---|
208 | extern m68k_isr_entry M68Kvec[]; /* vector table address */ |
---|
209 | |
---|
210 | extern rtems_isr (*rtems_clock_hook)(rtems_vector_number); |
---|
211 | |
---|
212 | /* functions */ |
---|
213 | |
---|
214 | void bsp_cleanup( void ); |
---|
215 | |
---|
216 | m68k_isr_entry set_vector( |
---|
217 | rtems_isr_entry handler, |
---|
218 | rtems_vector_number vector, |
---|
219 | int type |
---|
220 | ); |
---|
221 | |
---|
222 | #ifdef __cplusplus |
---|
223 | } |
---|
224 | #endif |
---|
225 | |
---|
226 | #endif /* ASM */ |
---|
227 | |
---|
228 | #endif |
---|