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

Subversion Repositories openrisc

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

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
##      MPC5xx 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
##
15
## eCos is free software; you can redistribute it and/or modify it under
16
## the terms of the GNU General Public License as published by the Free
17
## Software Foundation; either version 2 or (at your option) any later version.
18
##
19
## eCos is distributed in the hope that it will be useful, but WITHOUT ANY
20
## WARRANTY; without even the implied warranty of MERCHANTABILITY or
21
## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
22
## for more details.
23
##
24
## You should have received a copy of the GNU General Public License along
25
## with eCos; if not, write to the Free Software Foundation, Inc.,
26
## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
27
##
28
## As a special exception, if other files instantiate templates or use macros
29
## or inline functions from this file, or you compile this file and link it
30
## with other works to produce a work based on this file, this file does not
31
## by itself cause the resulting work to be covered by the GNU General Public
32
## License. However the source code for this file must still be made available
33
## in accordance with section (3) of the GNU General Public License.
34
##
35
## This exception does not invalidate any other reasons why a work based on
36
## this file might be covered by the GNU General Public License.
37
##
38
## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
39
## at http://sources.redhat.com/ecos/ecos-license/
40
## -------------------------------------------
41
#####ECOSGPLCOPYRIGHTEND####
42
##=============================================================================
43
#######DESCRIPTIONBEGIN####
44
##
45
## Author(s):   Bob Koninckx
46
## Contributors:Bob Koninckx
47
## Date:        2001-12-15
48
## Purpose:     MPC5xx family definitions.
49
## Description: This file contains various definitions and macros that are
50
##              useful for writing assembly code for the MPC5xx CPU family.
51
## Usage:
52
##              #include 
53
##              ...
54
##
55
##
56
######DESCRIPTIONEND####
57
##
58
##=============================================================================
59
 
60
##------------------------------------------------------------------------------
61
## Handle denormalized numbers etc in hardware, or use a software envelope to
62
## generate 100% IEEE correct results
63
#define FULL_IEEE_FLOATING_POINT_SUPPORT 29
64
 
65
#include 
66
 
67
#include 
68
 
69
##-----------------------------------------------------------------------------
70
## MPC5xx defined vectors
71
 
72
        .macro hal_extra_vectors
73
        # MPC5xx vectors
74
        exception_vector        software_emu
75
        exception_vector        reserved_01100
76
        exception_vector        reserved_01200
77
        exception_vector        instruction_tlb_error
78
        exception_vector        data_tlb_error
79
        exception_vector        reserved_01500
80
        exception_vector        reserved_01600
81
        exception_vector        reserved_01700
82
        exception_vector        reserved_01800
83
        exception_vector        reserved_01900
84
        exception_vector        reserved_01A00
85
        exception_vector        reserved_01B00
86
        exception_vector        data_breakpoint
87
        exception_vector        instruction_breakpoint
88
        exception_vector        peripheral_breakpoint
89
        exception_vector        NMI_port
90
        .endm
91
 
92
##-----------------------------------------------------------------------------
93
## MPC5xx CPU initialization
94
##
95
## Initialize CPU to a post-reset state, ensuring the ground doesn''t
96
## shift under us while we try to set things up.
97
 
98
        .macro hal_cpu_init
99
 
100
        # Set up MSR
101
        lwi     r3,CYG_MSR
102
        sync
103
        mtmsr   r3
104
        sync
105
 
106
#ifndef CYGSEM_HAL_USE_ROM_MONITOR
107
#ifndef CYGSEM_HAL_POWERPC_MPC5XX_OCD_ENABLE
108
#ifdef CYGSEM_HAL_ROM_MONITOR
109
        ## Do not touch the DER register if OCD support is wanted.
110
        ## DER will be set with the OCD debugger in this case.
111
        ## Leave it untouched if co-existence with a ROM monitor
112
        ## is wanted as well.
113
        ## If we want to make a ROM monitor, we have to specify events
114
        ## that assert the FREEZE signal
115
        ## Single steps are implemented using hardware interrupts,
116
        ## breakpoints use program exceptions
117
        lwi     r3, 0x2082000f
118
 
119
#else
120
        ## Disable special MPC5xx "development support" for non
121
        ## debug loads.
122
        lwi     r3, 0x00000000
123
#endif
124
        mtder r3
125
#endif
126
#endif
127
 
128
#ifdef CYGSEM_HAL_POWERPC_IEEE_FLOATING_POINT
129
        mtfsb0 FULL_IEEE_FLOATING_POINT_SUPPORT
130
#else
131
        mtfsb1 FULL_IEEE_FLOATING_POINT_SUPPORT
132
#endif
133
 
134
        # Set up IMMR
135
        lwi     r3, 0x00000000
136
#ifdef CYGHWR_HAL_POWERPC_MPC5XX_IFLASH_ENABLE
137
        lwi     r4, CYGARC_REG_IMM_IMMR_FLEN
138
#else
139
        lwi     r4, 0x00000000
140
#endif
141
        ## We load the internal memory space to address zero
142
        ## Board specific initialization can then relocate this
143
        ## afterwards
144
        or      r3, r3, r4
145
        mtspr   CYGARC_REG_IMMR, r3
146
 
147
        ## Disable bursts. Again, board initialization can enable this
148
        ## afterwards.
149
        li      r0, 0
150
        mtspr   560, r0
151
 
152
        .endm
153
 
154
##-----------------------------------------------------------------------------
155
## MPC5xx exception state handling
156
        .macro  hal_variant_save regs
157
        .endm
158
 
159
        .macro  hal_variant_load regs
160
        .endm
161
 
162
##-----------------------------------------------------------------------------
163
## MPC5xx monitor initialization
164
 
165
#ifndef CYGPKG_HAL_PPC_MON_DEFINED
166
 
167
#if     defined(CYG_HAL_STARTUP_ROM) ||                 \
168
        (       defined(CYG_HAL_STARTUP_RAM) &&         \
169
                !defined(CYGSEM_HAL_USE_ROM_MONITOR))
170
 
171
        .macro  hal_mon_init
172
#ifdef CYGSEM_HAL_POWERPC_COPY_VECTORS
173
        # If we are starting up from ROM and want vectors in RAM
174
        # or we are starting in RAM and NOT using a ROM monitor,
175
        # copy exception handler code to 0.
176
        lwi     r3,rom_vectors          # r3 = rom start
177
        lwi     r4,0                    # r4 = ram start
178
        lwi     r5,rom_vectors_end      # r5 = rom end
179
        cmplw   r3,r5                   # skip if no vectors
180
        beq     2f
181
 
182
        subi    r3,r3,4
183
        subi    r4,r4,4
184
        subi    r5,r5,4
185
1:
186
        lwzu    r0,4(r3)                # get word from ROM
187
        stwu    r0,4(r4)                # store in RAM
188
        cmplw   r3,r5                   # compare
189
        blt     1b                      # loop if not yet done
190
2:
191
#endif
192
 
193
        # Next initialize the VSR table. This happens whether the
194
        # vectors were copied to RAM or not.
195
 
196
        # First fill with exception handlers
197
        lwi     r3,cyg_hal_default_exception_vsr
198
        lwi     r4,hal_vsr_table
199
        subi    r4,r4,4
200
        li      r5,CYGNUM_HAL_VSR_COUNT
201
1:      stwu    r3,4(r4)
202
        subi    r5,r5,1
203
        cmpwi   r5,0
204
        bne     1b
205
 
206
        # Then fill in the special vectors
207
        lwi     r3,cyg_hal_default_interrupt_vsr
208
        lwi     r4,hal_vsr_table
209
        stw     r3,CYGNUM_HAL_VECTOR_INTERRUPT*4(r4)
210
        stw     r3,CYGNUM_HAL_VECTOR_DECREMENTER*4(r4)
211
        .endm
212
 
213
#elif defined(CYG_HAL_STARTUP_RAM) && defined(CYGSEM_HAL_USE_ROM_MONITOR)
214
 
215
        # Initialize the VSR table entries
216
        # We only take control of the interrupt vectors,
217
        # the rest are left to the ROM for now...
218
 
219
        .macro  hal_mon_init
220
        lwi     r3,cyg_hal_default_interrupt_vsr
221
        lwi     r4,hal_vsr_table
222
        stw     r3,CYGNUM_HAL_VECTOR_INTERRUPT*4(r4)
223
        stw     r3,CYGNUM_HAL_VECTOR_DECREMENTER*4(r4)
224
        .endm
225
 
226
 
227
#else
228
 
229
        .macro  hal_mon_init
230
 
231
        .endm
232
 
233
#endif
234
 
235
 
236
#define CYGPKG_HAL_PPC_MON_DEFINED
237
 
238
#endif // CYGPKG_HAL_PPC_MON_DEFINED
239
 
240
 
241
 
242
 
243
##-----------------------------------------------------------------------------
244
## Indicate that the ISR tables are defined in variant.S
245
#define CYG_HAL_PPC_ISR_TABLES_DEFINED
246
 
247
##-----------------------------------------------------------------------------
248
## MPC5xx interrupt handling.
249
 
250
#ifndef CYGPKG_HAL_POWERPC_INTC_DEFINED
251
 
252
## First level decoding of MPC5xx SIU interrupt controller.
253
 
254
        # decode the interrupt
255
        .macro  hal_intc_decode dreg,state
256
        lwz     \dreg,CYGARC_PPCREG_VECTOR(\state) # retrieve vector number,
257
        rlwinm. \dreg,\dreg,22,31,31               # isolate bit 21
258
        beq     0f                                 # done if decrementer (vec 0)
259
        lwi     \dreg,CYGARC_REG_IMM_SIVEC         # if external, get SIU
260
        lbz     \dreg,0(\dreg)                     # vector.
261
        srwi    \dreg,\dreg,2
262
        addi    \dreg,\dreg,1                      # Skip decrementer vector
263
0:      stw     \dreg,CYGARC_PPCREG_VECTOR(\state) # update vector in state frame.
264
        slwi    \dreg,\dreg,2                      # convert to byte offset.
265
        .endm
266
 
267
 
268
#define CYGPKG_HAL_POWERPC_INTC_DEFINED
269
#endif // CYGPKG_HAL_POWERPC_INTC_DEFINED
270
 
271
#------------------------------------------------------------------------------
272
#endif // ifndef CYGONCE_HAL_VARIANT_INC
273
# end of variant.inc

powered by: WebSVN 2.1.0

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