]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - packages/hal/fr30/arch/v2_0/include/arch.inc
Initial revision
[karo-tx-redboot.git] / packages / hal / fr30 / arch / v2_0 / include / arch.inc
1 #ifndef CYGONCE_HAL_ARCH_INC
2 #define CYGONCE_HAL_ARCH_INC
3 ##=============================================================================
4 ##
5 ##      arch.inc
6 ##
7 ##      fr30 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) 2007 eCosCentric Ltd.
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):    larsi
47 ## Contributors: larsi
48 ## Date:        2006-06-20
49 ## Purpose:     Architecture definitions.
50 ## Description: This file contains various definitions and macros that are
51 ##              useful for writing assembly code for the fr30 CPU family.
52 ## Usage:
53 ##              #include <cyg/hal/arch.inc>
54 ##              ...
55 ##              
56 ##
57 ######DESCRIPTIONEND####
58 ##
59 ##=============================================================================
60
61 #include <cyg/hal/fr30.inc>
62
63 #include <cyg/hal/variant.inc>
64
65 ##-----------------------------------------------------------------------------
66 ## define some .equ's to access c-code #define's from assembler code
67 .equ    CYGNUM_ASM_CALL_IF_TABLE_SIZE,   CYGNUM_CALL_IF_TABLE_SIZE
68
69 ##-----------------------------------------------------------------------------
70 ## CPU specific macros. These provide a common assembler interface to
71 ## operations that may have CPU specific implementations on different
72 ## variants of the architecture
73
74 #ifndef CYGPKG_HAL_FR30_CPU_INIT_DEFINED
75     # Initialize CPU
76     .macro  hal_cpu_init
77     .endm
78 #endif /* !CYGPKG_HAL_FR30_CPU_INIT_DEFINED */
79
80 .macro  hal_cpu_int_enable
81     orccr   #0x10
82 .endm
83
84 .macro  hal_cpu_int_disable
85     andccr  #0xef
86 .endm
87
88
89 # Merge the interrupt enable state of the status register in
90 # \sr with the current sr.
91
92 .macro  hal_cpu_int_merge sr
93     FIXME hal_cpu_int_merge not implemented yet
94 .endm
95
96 ##-----------------------------------------------------------------------------
97 # Default FR30 interrupt controller macros. Every FR30 has an integrated
98 # interrupt controller, which we use here. This should be enough if there is
99 # no special external interrupt controller (which I did not see yet).
100
101 #ifndef CYGPKG_HAL_FR30_INTC_DEFINED
102
103 #ifndef CYGPKG_HAL_FR30_INTC_INIT_DEFINED
104 # initialize all interrupts to disabled. This is done automatically during
105 # CPU reset and the macro is not used during ECOS startup. It is not
106 # supplied here but would be setting all ICRs to 31 (to disable the particular
107 # interrupt and maybe setting ILM in PS to 0.
108     .macro   hal_intc_init
109     .endm
110 #endif
111
112
113 # Normally interrupts are decoded by hardware and can not be software decoded,
114 # so this is empty here.
115
116     .macro  hal_intc_decode vnum
117     .endm
118
119 # Also translation interrupt number <--> vector number is done automatically
120 # in hardware, so the macros are not supplied here.
121
122 #endif
123
124 #------------------------------------------------------------------------------
125 # These defines are for the ISR and VSR tables which are defined in assembler
126 # code. (currently in variant.S / vectors.S) and have to be the same like in
127 # hal_intr.h
128
129 #define CYGNUM_HAL_VECTOR_INTRFIRST               15
130 #define CYGNUM_HAL_VECTOR_INTRLAST                63
131 #define CYGNUM_HAL_VECTOR_NUMINTRS                (CYGNUM_HAL_VECTOR_INTRLAST-CYGNUM_HAL_VECTOR_INTRFIRST+1)
132
133 // Common interrupt vectors
134 #ifndef CYGNUM_HAL_ISR_MIN
135 #define CYGNUM_HAL_ISR_MIN                       CYGNUM_HAL_VECTOR_INTRFIRST
136 #define CYGNUM_HAL_ISR_MAX                       CYGNUM_HAL_VECTOR_INTRLAST
137 #define CYGNUM_HAL_ISR_COUNT                     (CYGNUM_HAL_VECTOR_NUMINTRS)
138 #endif
139
140 // The default size of the VSR table is 256 entries.
141 #ifndef CYGNUM_HAL_VSR_MIN
142 #define CYGNUM_HAL_VSR_MIN                        0
143 #define CYGNUM_HAL_VSR_MAX                        255
144 #define CYGNUM_HAL_VSR_COUNT                      256
145 #endif
146
147 #------------------------------------------------------------------------------
148 # Register save and restore macros. These expect a pointer to a CPU save state
149 # area in the register \ptr. The GPR indicated by \reg will be saved into its
150 # slot in that structure.
151
152 # TODO do this macros if needed, look at MIPS arch.inc for inspiration
153
154
155 #------------------------------------------------------------------------------
156 # Stack switching macros
157
158
159
160 #------------------------------------------------------------------------------
161 # MEMC macros.
162
163
164 #------------------------------------------------------------------------------
165 # Cache macros.
166
167 #ifndef CYGPKG_HAL_FR30_CACHE_DEFINED
168
169     .macro  hal_cache_init
170
171     .endm
172
173 #endif
174
175 #------------------------------------------------------------------------------
176 # Diagnostics macros.
177
178 #------------------------------------------------------------------------------
179 # Timer initialization.
180
181 #ifndef CYGPKG_HAL_FR30_TIMER_DEFINED
182
183     .macro  hal_timer_init
184     .endm
185
186 #endif
187
188 #------------------------------------------------------------------------------
189 # Difference of the flash memory from the linkers LMA (loadmemoryaddress) after
190 # the new mapping in (mapping is done in hal_fr30_ram_startup_trampoline).
191
192 #ifndef CYGPKG_HAL_FR30_LMA_OFFSET
193
194 #define CYGPKG_HAL_FR30_LMA_OFFSET  0x0
195
196 #endif
197
198
199 #endif // ifndef CYGONCE_HAL_ARCH_INC
200 # end of arch.inc