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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [hal/] [powerpc/] [ppc60x/] [v2_0/] [include/] [variant.inc] - Blame information for rev 578

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
#ifndef CYGONCE_HAL_VARIANT_INC
2
#define CYGONCE_HAL_VARIANT_INC
3
##=============================================================================
4
##
5
##      variant.inc
6
##
7
##      PPC60x family assembler header file
8
##
9
##=============================================================================
10
#####ECOSGPLCOPYRIGHTBEGIN####
11
## -------------------------------------------
12
## This file is part of eCos, the Embedded Configurable Operating System.
13
## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
14
## Copyright (C) 2002 Gary Thomas
15
##
16
## eCos is free software; you can redistribute it and/or modify it under
17
## the terms of the GNU General Public License as published by the Free
18
## Software Foundation; either version 2 or (at your option) any later version.
19
##
20
## eCos is distributed in the hope that it will be useful, but WITHOUT ANY
21
## WARRANTY; without even the implied warranty of MERCHANTABILITY or
22
## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
23
## for more details.
24
##
25
## You should have received a copy of the GNU General Public License along
26
## with eCos; if not, write to the Free Software Foundation, Inc.,
27
## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
28
##
29
## As a special exception, if other files instantiate templates or use macros
30
## or inline functions from this file, or you compile this file and link it
31
## with other works to produce a work based on this file, this file does not
32
## by itself cause the resulting work to be covered by the GNU General Public
33
## License. However the source code for this file must still be made available
34
## in accordance with section (3) of the GNU General Public License.
35
##
36
## This exception does not invalidate any other reasons why a work based on
37
## this file might be covered by the GNU General Public License.
38
##
39
## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
40
## at http://sources.redhat.com/ecos/ecos-license/
41
## -------------------------------------------
42
#####ECOSGPLCOPYRIGHTEND####
43
##=============================================================================
44
#######DESCRIPTIONBEGIN####
45
##
46
## Author(s):   jskov
47
## Contributors:jskov, gthomas
48
## Date:        2000-02-04
49
## Purpose:     PPC60x family definitions.
50
## Description: This file contains various definitions and macros that are
51
##              useful for writing assembly code for the PPC60x CPU family.
52
## Usage:
53
##              #include 
54
##              ...
55
##
56
##
57
######DESCRIPTIONEND####
58
##
59
##=============================================================================
60
 
61
#include 
62
 
63
#include 
64
#include 
65
 
66
##-----------------------------------------------------------------------------
67
## PPC60x defined vectors
68
 
69
        .macro hal_extra_vectors
70
        exception_vector        instruction_TLB
71
        exception_vector        data_load_TLB
72
        exception_vector        data_store_TLB
73
        exception_vector        instruction_address_breakpoint
74
        exception_vector        system_management_interrupt
75
        .endm
76
 
77
##-----------------------------------------------------------------------------
78
## PPC60x CPU initialization
79
##
80
## Initialize CPU to a post-reset state, ensuring the ground doesn''t
81
## shift under us while we try to set things up.
82
 
83
        .macro hal_cpu_init
84
        # Set up MSR (disable MMU for now)
85
        lwi     r3,(CYG_MSR & ~(MSR_IR | MSR_DR))
86
        sync
87
        mtmsr   r3
88
        sync
89
        .endm
90
 
91
##-----------------------------------------------------------------------------
92
## PPC60x monitor initialization
93
 
94
#ifndef CYGPKG_HAL_PPC_MON_DEFINED
95
 
96
#if     defined(CYG_HAL_STARTUP_ROM) ||                 \
97
        (       defined(CYG_HAL_STARTUP_RAM) &&         \
98
                !defined(CYGSEM_HAL_USE_ROM_MONITOR))
99
 
100
        .macro  hal_mon_init
101
#ifdef CYGSEM_HAL_POWERPC_COPY_VECTORS
102
        # If we are starting up from ROM and want vectors in RAM
103
        # or we are starting in RAM and NOT using a ROM monitor,
104
        # copy exception handler code to 0.
105
        lwi     r3,rom_vectors          # r3 = rom start
106
        lwi     r4,0                    # r4 = ram start
107
        lwi     r5,rom_vectors_end      # r5 = rom end
108
        cmplw   r3,r5                   # skip if no vectors
109
        beq     2f
110
 
111
        subi    r3,r3,4
112
        subi    r4,r4,4
113
        subi    r5,r5,4
114
1:
115
        lwzu    r0,4(r3)                # get word from ROM
116
        stwu    r0,4(r4)                # store in RAM
117
        cmplw   r3,r5                   # compare
118
        blt     1b                      # loop if not yet done
119
2:
120
#endif
121
 
122
        # Next initialize the VSR table. This happens whether the
123
        # vectors were copied to RAM or not.
124
 
125
        # First fill with exception handlers
126
        lwi     r3,cyg_hal_default_exception_vsr
127
        lwi     r4,hal_vsr_table
128
        subi    r4,r4,4
129
        li      r5,CYGNUM_HAL_VSR_COUNT
130
1:      stwu    r3,4(r4)
131
        subi    r5,r5,1
132
        cmpwi   r5,0
133
        bne     1b
134
 
135
        # Then fill in the special vectors
136
        lwi     r3,cyg_hal_default_interrupt_vsr
137
        lwi     r4,hal_vsr_table
138
        stw     r3,CYGNUM_HAL_VECTOR_INTERRUPT*4(r4)
139
        stw     r3,CYGNUM_HAL_VECTOR_DECREMENTER*4(r4)
140
        .endm
141
 
142
#elif defined(CYG_HAL_STARTUP_RAM) && defined(CYGSEM_HAL_USE_ROM_MONITOR)
143
 
144
        # Initialize the VSR table entries
145
        # We only take control of the interrupt vectors,
146
        # the rest are left to the ROM for now...
147
 
148
        .macro  hal_mon_init
149
        lwi     r3,cyg_hal_default_interrupt_vsr
150
        lwi     r4,hal_vsr_table
151
        stw     r3,CYGNUM_HAL_VECTOR_INTERRUPT*4(r4)
152
        stw     r3,CYGNUM_HAL_VECTOR_DECREMENTER*4(r4)
153
        .endm
154
 
155
 
156
#else
157
 
158
        .macro  hal_mon_init
159
 
160
        .endm
161
 
162
#endif
163
 
164
 
165
#define CYGPKG_HAL_PPC_MON_DEFINED
166
 
167
#endif // CYGPKG_HAL_PPC_MON_DEFINED
168
 
169
##-----------------------------------------------------------------------------
170
## PPC60x exception state handling
171
        .macro  hal_variant_save regs
172
        .endm
173
 
174
        .macro  hal_variant_load regs
175
        .endm
176
 
177
##-----------------------------------------------------------------------------
178
## Indicate that the ISR tables are defined in variant.S
179
 
180
#define CYG_HAL_PPC_ISR_TABLES_DEFINED
181
 
182
#------------------------------------------------------------------------------
183
#endif // ifndef CYGONCE_HAL_VARIANT_INC
184
# end of variant.inc

powered by: WebSVN 2.1.0

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