OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [hal/] [sparclite/] [arch/] [v2_0/] [src/] [hal_boot.c] - Blame information for rev 174

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
//==========================================================================
2
//
3
//      hal_boot.c
4
//
5
//      SPARClite Architecture specific interrupt dispatch tables
6
//
7
//==========================================================================
8
//####ECOSGPLCOPYRIGHTBEGIN####
9
// -------------------------------------------
10
// This file is part of eCos, the Embedded Configurable Operating System.
11
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
12
//
13
// eCos is free software; you can redistribute it and/or modify it under
14
// the terms of the GNU General Public License as published by the Free
15
// Software Foundation; either version 2 or (at your option) any later version.
16
//
17
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
18
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
19
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
20
// for more details.
21
//
22
// You should have received a copy of the GNU General Public License along
23
// with eCos; if not, write to the Free Software Foundation, Inc.,
24
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
25
//
26
// As a special exception, if other files instantiate templates or use macros
27
// or inline functions from this file, or you compile this file and link it
28
// with other works to produce a work based on this file, this file does not
29
// by itself cause the resulting work to be covered by the GNU General Public
30
// License. However the source code for this file must still be made available
31
// in accordance with section (3) of the GNU General Public License.
32
//
33
// This exception does not invalidate any other reasons why a work based on
34
// this file might be covered by the GNU General Public License.
35
//
36
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
37
// at http://sources.redhat.com/ecos/ecos-license/
38
// -------------------------------------------
39
//####ECOSGPLCOPYRIGHTEND####
40
//==========================================================================
41
//#####DESCRIPTIONBEGIN####
42
//
43
// Author(s):    hmt
44
// Contributors: hmt
45
// Date:         1998-12-10
46
// Purpose:      Interrupt handler tables for SPARClite.
47
//              
48
//####DESCRIPTIONEND####
49
//
50
//==========================================================================
51
 
52
#include <pkgconf/hal.h>
53
#include <cyg/infra/cyg_type.h>
54
 
55
/*------------------------------------------------------------------------*/
56
/* calling this is our raison d'etre: */
57
extern void cyg_start( void );
58
 
59
/*------------------------------------------------------------------------*/
60
/* data copy and bss zero functions                                       */
61
 
62
typedef void (CYG_ROM_ADDRESS)(void);
63
 
64
#ifdef CYG_HAL_STARTUP_ROM      
65
void hal_copy_data(void)
66
{
67
    extern char __ram_data_start;
68
    extern char __ram_data_end;
69
    extern CYG_ROM_ADDRESS __rom_data_start;
70
    long *p = (long *)&__ram_data_start;
71
    long *q = (long *)&__rom_data_start;
72
 
73
    while( p <= (long *)&__ram_data_end )
74
        *p++ = *q++;
75
}
76
#endif
77
 
78
void hal_zero_bss(void)
79
{
80
    extern CYG_ROM_ADDRESS __bss_start;
81
    extern CYG_ROM_ADDRESS __bss_end;
82
 
83
    register long long zero = 0;
84
    register long long *end = (long long *)&__bss_end;
85
    register long long *p = (long long *)&__bss_start;
86
 
87
    while( p <= end )
88
        *p++ = zero;
89
}
90
 
91
#ifdef CYGSEM_HAL_STOP_CONSTRUCTORS_ON_FLAG
92
cyg_bool cyg_hal_stop_constructors;
93
#endif
94
 
95
void
96
cyg_hal_invoke_constructors (void)
97
{
98
    typedef void (*pfunc) (void);
99
    extern pfunc __CTOR_LIST__[];
100
    extern pfunc __CTOR_END__[];
101
 
102
#ifdef CYGSEM_HAL_STOP_CONSTRUCTORS_ON_FLAG
103
    static pfunc *p = &__CTOR_END__[-1];
104
 
105
    cyg_hal_stop_constructors = 0;
106
    for (; p >= __CTOR_LIST__; p--) {
107
        (*p) ();
108
        if (cyg_hal_stop_constructors) {
109
            p--;
110
            break;
111
        }
112
    }
113
#else
114
    pfunc *p;
115
 
116
    for (p = &__CTOR_END__[-1]; p >= __CTOR_LIST__; p--)
117
        (*p) ();
118
#endif
119
}
120
 
121
// Override any __gccmain the compiler might generate. We don't want
122
// constructors to be called twice.
123
void  __gccmain(void) {}
124
 
125
/*------------------------------------------------------------------------*/
126
/*   CYG_HAL_START - pre-main-entrypoint                                  */
127
 
128
#ifdef CYGPKG_HAL_SPARCLITE_SLEB
129
#define SLEB_LED (*(volatile char *)(0x02000003))
130
#define LED( _x_ ) SLEB_LED = (char)(0xff & ~(_x_))
131
#else
132
#define LED( _x_ ) CYG_EMPTY_STATEMENT
133
#endif
134
 
135
extern void hal_board_prestart( void );
136
extern void hal_board_poststart( void );
137
 
138
// This is called with traps enabled, but interrupts masked out:
139
// Be sure to enable them in hal_board_poststart() at the latest.
140
 
141
void cyg_hal_start( void )
142
{
143
    /* Board specific prestart that's best done in C */
144
    hal_board_prestart();
145
 
146
    LED( 0xd0 );
147
 
148
#ifdef CYG_HAL_STARTUP_ROM
149
    /* Copy data from ROM to RAM */
150
    hal_copy_data();
151
#endif
152
 
153
    LED( 0xd4 );
154
 
155
    /* Zero BSS */
156
    hal_zero_bss();
157
 
158
    LED( 0xd8 );
159
 
160
    /* Call constructors */
161
    cyg_hal_invoke_constructors();
162
 
163
    LED( 0xdc );
164
 
165
    /* Board specific late startup that's best done in C */
166
    hal_board_poststart();
167
 
168
    LED( 0xf8 );
169
 
170
    /* Call cyg_start */
171
    cyg_start(); /* does not return */
172
}
173
 
174
// EOF hal_boot.c

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.