source: rtems/c/src/lib/libbsp/powerpc/gen5200/include/bsp.h @ 82bd8d9d

4.104.114.95
Last change on this file since 82bd8d9d was 82bd8d9d, checked in by Thomas Doerfler <Thomas.Doerfler@…>, on 09/03/08 at 15:39:03

Converted to use shared

exception and interrupt code.

  • Property mode set to 100644
File size: 7.2 KB
Line 
1/*===============================================================*\
2| Project: RTEMS generic MPC5200 BSP                              |
3+-----------------------------------------------------------------+
4| Partially based on the code references which are named below.   |
5| Adaptions, modifications, enhancements and any recent parts of  |
6| the code are:                                                   |
7|                    Copyright (c) 2005                           |
8|                    Embedded Brains GmbH                         |
9|                    Obere Lagerstr. 30                           |
10|                    D-82178 Puchheim                             |
11|                    Germany                                      |
12|                    rtems@embedded-brains.de                     |
13+-----------------------------------------------------------------+
14| The license and distribution terms for this file may be         |
15| found in the file LICENSE in this distribution or at            |
16|                                                                 |
17| http://www.rtems.com/license/LICENSE.                           |
18|                                                                 |
19+-----------------------------------------------------------------+
20| this file contains board specific definitions                   |
21\*===============================================================*/
22
23#ifndef __GEN5200_BSP_h
24#define __GEN5200_BSP_h
25
26#include <libcpu/powerpc-utility.h>
27
28/*
29 * Some symbols defined in the linker command file.
30 */
31
32LINKER_SYMBOL(bsp_ram_start);
33LINKER_SYMBOL(bsp_ram_end);
34LINKER_SYMBOL(bsp_ram_size);
35
36LINKER_SYMBOL(bsp_rom_start);
37LINKER_SYMBOL(bsp_rom_end);
38LINKER_SYMBOL(bsp_rom_size);
39
40LINKER_SYMBOL(bsp_dpram_start);
41LINKER_SYMBOL(bsp_dpram_end);
42LINKER_SYMBOL(bsp_dpram_size);
43
44LINKER_SYMBOL(bsp_section_text_start);
45LINKER_SYMBOL(bsp_section_text_end);
46LINKER_SYMBOL(bsp_section_text_size);
47
48LINKER_SYMBOL(bsp_section_data_start);
49LINKER_SYMBOL(bsp_section_data_end);
50LINKER_SYMBOL(bsp_section_data_size);
51
52LINKER_SYMBOL(bsp_section_bss_start);
53LINKER_SYMBOL(bsp_section_bss_end);
54LINKER_SYMBOL(bsp_section_bss_size);
55
56LINKER_SYMBOL(bsp_interrupt_stack_start);
57LINKER_SYMBOL(bsp_interrupt_stack_end);
58LINKER_SYMBOL(bsp_interrupt_stack_size);
59
60LINKER_SYMBOL(bsp_work_area_start);
61
62LINKER_SYMBOL(MBAR);
63
64/*
65 * distinguish board characteristics
66 */
67/*
68 * for PM520 mdule on a ZE30 carrier
69 */
70#if defined(PM520_ZE30)
71#define PM520
72#define GPIOPCR_INITMASK 0x337F3F77
73#define GPIOPCR_INITVAL  0x01552114
74/* we have PSC1/4/5/6 */
75/* #define GEN5200_UART_AVAIL_MASK 0x39 */
76#define GEN5200_UART_AVAIL_MASK 0x39
77#endif
78/*
79 * for PM520 mdule on a CR825 carrier
80 */
81#if defined(PM520_CR825)
82#define PM520
83#define GPIOPCR_INITMASK 0x330F0F77
84#define GPIOPCR_INITVAL  0x01050444
85/* we have PSC1/2/3*/
86#define GEN5200_UART_AVAIL_MASK 0x07
87#endif
88
89#if defined(BRS5L)
90/*
91 * IMD Custom Board BRS5L
92 */
93#define GPIOPCR_INITMASK 0xb30F0F77
94#define GPIOPCR_INITVAL  0x91050444
95/* we have PSC1/2/3 */
96#define GEN5200_UART_AVAIL_MASK 0x07
97
98/* we need the low level initialization in start.S*/
99#define NEED_LOW_LEVEL_INIT
100
101#define HAS_NVRAM_93CXX
102#elif defined (PM520)
103
104#define HAS_UBOOT
105
106#elif defined (icecube)
107/*
108 *  Codename: IceCube
109 *  Compatible Boards:
110 *     Freescape MPC5200LITE
111 *     Embedded Planet EP5200
112 */
113
114#define HAS_UBOOT
115
116/* These are copied from PM520 but seem to work so OK */
117#define GPIOPCR_INITMASK 0x330F0F77
118#define GPIOPCR_INITVAL  0x01050444
119
120/* we only have PSC1 */
121#define GEN5200_UART_AVAIL_MASK 0x01
122
123/* We want to prompt for a reset and then reset the board */
124#define BSP_PRESS_KEY_FOR_RESET 1
125#define BSP_RESET_BOARD_AT_EXIT 1
126
127#else
128#error "board type not defined"
129#endif
130
131#ifndef ASM
132
133#ifdef __cplusplus
134extern "C" {
135#endif
136
137#include "bspopts.h"
138
139#include <rtems.h>
140#include <rtems/console.h>
141#include <rtems/clockdrv.h>
142#include <i2cdrv.h>
143#include <bsp/irq.h>
144#include <bsp/vectors.h>
145
146#if defined(HAS_UBOOT)
147/* This is the define U-Boot uses to configure which entries in the structure are valid */
148#define CONFIG_MPC5xxx
149#include <u-boot.h>
150
151extern bd_t *uboot_bdinfo_ptr;
152extern bd_t uboot_bdinfo_copy;
153#endif
154
155/*
156 * Network driver configuration
157 */
158struct rtems_bsdnet_ifconfig;
159extern int rtems_mpc5200_fec_driver_attach_detach (struct rtems_bsdnet_ifconfig *config, int attaching);
160#define RTEMS_BSP_NETWORK_DRIVER_NAME   "eth1"
161#define RTEMS_BSP_NETWORK_DRIVER_ATTACH rtems_mpc5200_fec_driver_attach_detach
162
163/* miscellaneous stuff assumed to exist */
164
165/*
166 * We need to decide how much memory will be non-cacheable. This
167 * will mainly be memory that will be used in DMA (network and serial
168 * buffers).
169 */
170/*
171#define NOCACHE_MEM_SIZE 512*1024
172*/
173
174/*
175 *  Stuff for Time Test 27
176 */
177#define MUST_WAIT_FOR_INTERRUPT 0
178
179/*
180 *  Device Driver Table Entries
181 */
182
183/*
184 * NOTE: Use the standard Console driver entry
185 */
186
187/*
188 * NOTE: Use the standard Clock driver entry
189 */
190
191#ifdef HAS_NVRAM_93CXX
192#define NVRAM_DRIVER_TABLE_ENTRY \
193  { nvram_driver_initialize, nvram_driver_open, nvram_driver_close, \
194    nvram_driver_read, nvram_driver_write, NULL }
195#endif
196
197#define RTC_DRIVER_TABLE_ENTRY \
198    { rtc_initialize, NULL, NULL, NULL, NULL, NULL }
199extern rtems_device_driver rtc_initialize(
200    rtems_device_major_number major,
201    rtems_device_minor_number minor,
202    void *arg
203);
204
205/*
206 * indicate, that BSP has IDE driver
207 */
208#define RTEMS_BSP_HAS_IDE_DRIVER
209
210/*
211 * How many libio files we want
212 */
213#define BSP_LIBIO_MAX_FDS       20
214
215/* functions */
216
217void bsp_cleanup(void);
218
219/* console modes (only termios) */
220#ifdef  PRINTK_MINOR
221#undef  PRINTK_MINOR
222#endif
223#define PRINTK_MINOR PSC1_MINOR
224
225#define SINGLE_CHAR_MODE
226/* #define UARTS_USE_TERMIOS_INT   1 */
227/* #define SHOW_MORE_INIT_SETTINGS 1 */
228
229/* ata modes */
230/* #undef ATA_USE_INT */
231#define ATA_USE_INT
232
233/* clock settings */
234#if defined(HAS_UBOOT)
235#define IPB_CLOCK (uboot_bdinfo_ptr->bi_ipbfreq)
236#define XLB_CLOCK (uboot_bdinfo_ptr->bi_busfreq)
237#define G2_CLOCK  (uboot_bdinfo_ptr->bi_intfreq)
238#else
239#define IPB_CLOCK 33000000   /* 33 MHz */
240#define XLB_CLOCK 66000000   /* 66 MHz */
241#define G2_CLOCK  231000000  /* 231 MHz */
242#endif
243
244#if defined(HAS_UBOOT)
245#define GEN5200_CONSOLE_BAUD (uboot_bdinfo_ptr->bi_baudrate)
246#else
247#define GEN5200_CONSOLE_BAUD 9600
248#endif
249
250/*
251 *  Convert decrement value to tenths of microsecnds (used by
252 *  shared timer driver).
253 *
254 *    + CPU has a XLB_CLOCK bus,
255 *    + There are 4 bus cycles per click
256 *    + We return value in 1/10 microsecond units.
257 *   Modified following equation to integer equation to remove
258 *   floating point math.
259 *   (int) ((float)(_value) / ((XLB_CLOCK/1000000 * 0.1) / 4.0))
260 */
261
262#define BSP_Convert_decrementer( _value ) \
263  (int) (((_value) * 4000) / (XLB_CLOCK/10000))
264
265/* slicetimer settings */
266#define USE_SLICETIMER_0     TRUE
267#define USE_SLICETIMER_1     FALSE
268
269Thread _Thread_Idle_body(uint32_t ignored);
270#define BSP_IDLE_TASK_BODY _Thread_Idle_body
271
272/* BSP specific IRQ Benchmarking support */
273void BSP_IRQ_Benchmarking_Reset(void);
274void BSP_IRQ_Benchmarking_Report(void);
275
276#if defined(HAS_UBOOT)
277  /* Routine to obtain U-Boot environment variables */
278  const char *bsp_uboot_getenv(
279    const char *name
280  );
281#endif
282
283void cpu_init(void);
284
285#ifdef __cplusplus
286}
287#endif
288
289#endif /* ASM */
290
291#endif /* GEN5200 */
Note: See TracBrowser for help on using the repository browser.