blob: c4a9dedf2b6cf0a3bd933a0a9717f6874cfc211c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
/*
* This routine does the bulk of the system initialization.
*/
/*
* COPYRIGHT (c) 1989-2007.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.org/license/LICENSE.
*
* SS555 port sponsored by Defence Research and Development Canada - Suffield
* Copyright (C) 2004, Real-Time Systems Inc. (querbach@realtime.bc.ca)
*
* Derived from c/src/lib/libbsp/powerpc/mbx8xx/startup/bspstart.c:
*
* Modifications for MBX860:
* Copyright (c) 1999, National Research Council of Canada
*/
#warning The interrupt disable mask is now stored in SPRG0, please verify that this is compatible to this BSP (see also bootcard.c).
#include <rtems/bspIo.h>
#include <rtems/counter.h>
#include <bsp/bootcard.h>
#include <rtems/powerpc/powerpc.h>
#include <libcpu/cpuIdent.h>
#include <libcpu/spr.h>
#include <bsp/irq.h>
#include <bsp.h>
SPR_RW(SPRG1)
extern unsigned long intrStackPtr;
/*
* Driver configuration parameters
*/
uint32_t bsp_clicks_per_usec;
uint32_t bsp_clock_speed; /* Serial clocks per second */
uint32_t bsp_timer_least_valid;
uint32_t bsp_timer_average_overhead;
void BSP_panic(char *s)
{
printk("%s PANIC %s\n",_RTEMS_version, s);
__asm__ __volatile ("sc");
}
void _BSP_Fatal_error(unsigned int v)
{
printk("%s PANIC ERROR %x\n",_RTEMS_version, v);
__asm__ __volatile ("sc");
}
/*
* bsp_start()
*
* Board-specific initialization code. Called from the generic boot_card()
* function defined in rtems/c/src/lib/libbsp/shared/main.c. That function
* does some of the board independent initialization. It is called from the
* SS555 entry point _start() defined in
* rtems/c/src/lib/libbsp/powerpc/ss555/start/start.S
*
* _start() has set up a stack, has zeroed the .bss section, has set up the
* .data section from contents stored in ROM, has turned off interrupts,
* and placed the processor in the supervisor mode. boot_card() has left
* the processor in that state when bsp_start() was called.
*
* Input parameters: NONE
*
* Output parameters: NONE
*
* Return values: NONE
*/
void bsp_start(void)
{
ppc_cpu_id_t myCpu;
ppc_cpu_revision_t myCpuRevision;
register unsigned char* intrStack;
/*
* Get CPU identification dynamically. Note that the get_ppc_cpu_type()
* function stores the result in global variables so that it can be used
* later.
*/
myCpu = get_ppc_cpu_type();
myCpuRevision = get_ppc_cpu_revision();
/*
* Initialize some SPRG registers related to irq handling
*/
intrStack = (((unsigned char*)&intrStackPtr) - PPC_MINIMUM_STACK_FRAME_SIZE);
_write_SPRG1((unsigned int)intrStack);
/*
* Install our own set of exception vectors
*/
initialize_exceptions();
/*
* initialize the device driver parameters
*/
bsp_clicks_per_usec = BSP_CRYSTAL_HZ / 4 / 1000000;
bsp_clock_speed = BSP_CLOCK_HZ; /* for SCI baud rate generator */
bsp_timer_least_valid = 0;
bsp_timer_average_overhead = 0;
rtems_counter_initialize_converter(BSP_CRYSTAL_HZ / 4);
/*
* Initalize RTEMS IRQ system
*/
BSP_rtems_irq_mng_init(0);
}
|