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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [hal/] [h8300/] [h8300h/] [current/] [include/] [variant.inc] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
#ifndef CYGONCE_HAL_VARIANT_INC
2
#define CYGONCE_HAL_VARIANT_INC
3
##=============================================================================
4
##
5
##      variant.inc
6
##
7
##      H8/300H 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 Free Software Foundation, 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
18
## version.
19
##
20
## eCos is distributed in the hope that it will be useful, but WITHOUT
21
## ANY 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
26
## along with eCos; if not, write to the Free Software Foundation, Inc.,
27
## 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
28
##
29
## As a special exception, if other files instantiate templates or use
30
## macros or inline functions from this file, or you compile this file
31
## and link it with other works to produce a work based on this file,
32
## this file does not by itself cause the resulting work to be covered by
33
## the GNU General Public License. However the source code for this file
34
## must still be made available in accordance with section (3) of the GNU
35
## General Public License v2.
36
##
37
## This exception does not invalidate any other reasons why a work based
38
## on this file might be covered by the GNU General Public License.
39
## -------------------------------------------
40
## ####ECOSGPLCOPYRIGHTEND####
41
##=============================================================================
42
#######DESCRIPTIONBEGIN####
43
##
44
## Author(s):   ysato
45
## Contributors:        ysato
46
## Date:        2002-02-28
47
## Purpose:     H8/300H definitions.
48
## Description: This file contains various definitions and macros that are
49
##              useful for writing assembly code for the H8/300H CPU variant.
50
## Usage:
51
##              #include 
52
##              ...
53
##
54
##
55
######DESCRIPTIONEND####
56
##
57
##=============================================================================
58
 
59
#include 
60
 
61
#include 
62
#include 
63
 
64
 
65
#------------------------------------------------------------------------------
66
# Register definitions
67
 
68
#define SYSCR 0xfee012
69
 
70
#------------------------------------------------------------------------------
71
# CPU state save and restore macros
72
 
73
        .macro  hal_cpu_save_all
74
        subs    #4,sp
75
        mov.l   sp,@-sp
76
        mov.l   er6,@-sp                        ; push all registers
77
        mov.l   er5,@-sp
78
        mov.l   er4,@-sp
79
        mov.l   er3,@-sp
80
        mov.l   er2,@-sp
81
        mov.l   er1,@-sp
82
        mov.l   er0,@-sp
83
        mov.w   @(4*9:16,sp),r0
84
        sub.l   er1,er1
85
        mov.b   r0h,r1l
86
        mov.l   er1,@(4*8:16,sp)                ; copy ccr
87
        mov.l   @sp,er0
88
        mov.l   @(4:16,sp),er1
89
        .endm
90
 
91
        .macro  hal_cpu_load_all
92
        mov.w   @(4*8+2,sp),r0
93
        mov.w   @(4*9,sp),r1
94
        mov.b   r0l,r1h
95
        mov.w   r1,@(4*9,sp)                    ; set ccr to exception frame
96
        mov.l   @sp+,er0                        ; pop regs
97
        mov.l   @sp+,er1
98
        mov.l   @sp+,er2
99
        mov.l   @sp+,er3
100
        mov.l   @sp+,er4
101
        mov.l   @sp+,er5
102
        mov.l   @sp+,er6
103
        adds    #4,sp
104
        adds    #4,sp
105
        .endm
106
 
107
        .macro hal_cpu_save_context
108
        hal_cpu_save_all
109
        .endm
110
 
111
        .macro  h8300_var_interrupt_entry
112
        mov.l   @CYG_LABEL_DEFN(_intvector),er0
113
        shll.l  er0
114
        shll.l  er0
115
        mov.l   @(CYG_LABEL_DEFN(hal_vsr_table),er0),er0
116
        .endm
117
 
118
        .macro  h8300_var_call_pending_DSR
119
        mov.l   er5,@-sp                        ; save some work regs
120
        mov.l   er6,@-sp
121
        mov.l   sp,er6                          ; save current SP
122
        mov.l   #__interrupt_stack,sp           ; interrupt stack pointer
123
        stc     ccr,r5l                         ; save PSW
124
        hal_cpu_int_enable                      ; enable interrupts
125
 
126
        ; Call kernel code to invoke DSRs.
127
        jsr     @CYG_LABEL_DEFN(cyg_interrupt_call_pending_DSRs)
128
 
129
        ; On return the old SP in a2 and the old PSW in d2 will
130
        ; have been preserved by the calling conventions.
131
 
132
        hal_cpu_int_merge r5l                   ; Restore previous PSW
133
        mov.l   er6,sp                          ; restore old SP
134
        mov.l   @sp+,er6                        ; Retrieve old work regs
135
        mov.l   @sp+,er5
136
        rts                                     ; and return
137
        .endm
138
 
139
# Location of PC in saved register context (HAL_SavedRegisters)
140
#define SAVED_CONTEXT_PC_OFFSET (4*9)
141
 
142
        # Enable interrupts
143
        .macro hal_cpu_int_enable
144
        andc    #0x3f,ccr
145
        .endm
146
 
147
        # Disable interrupts
148
        .macro hal_cpu_int_disable
149
        orc     #0xc0,ccr
150
        .endm
151
 
152
        # Merge the interrupt enable state of the status register in
153
        # \sr with the current sr.
154
        .macro  hal_cpu_int_merge sr wk=r0l
155
        and.b   #0xc0,\sr
156
        stc     ccr,\wk
157
        and.b   #0x3f,\wk
158
        or      \sr,\wk
159
        ldc     \wk,ccr
160
        .endm
161
 
162
        .macro  hal_cpu_set_int_level
163
        ldc     ccr,r0h
164
        or.b    #0xc0,r0h
165
        and.b   r0l,r0h
166
        mov.b   r0h,ccr
167
        .endm
168
 
169
        .macro  h8300_trap_adjust_pc
170
        mov.l   @(36:16,sp),er0
171
        subs    #2,er0
172
        mov.l   er0,@(36:16,sp)
173
        .endm
174
 
175
##-----------------------------------------------------------------------------
176
# Default interrupt decoding macros.
177
 
178
#ifndef CYGPKG_HAL_H8300_INTC_DEFINED
179
 
180
#define CYG_ISR_TABLE_SIZE       64
181
 
182
        .macro  hal_intc_init
183
        mov.b   @SYSCR,r0l
184
        bclr    #3,r0l
185
        mov.b   r0l,@SYSCR
186
        .endm
187
 
188
#define CYGPKG_HAL_H8300_INTC_DEFINED
189
 
190
#endif
191
 
192
 
193
 
194
#ifndef CYGPKG_HAL_H8300_MON_DEFINED
195
 
196
        .macro  hal_mon_init
197
        .endm
198
 
199
#if !(defined(CYG_HAL_STARTUP_ROM)              || \
200
        defined(CYGPKG_HAL_H8300_H8300H_SIM)    || \
201
        !defined(CYGSEM_HAL_USE_ROM_MONITOR))
202
 
203
#define CYG_HAL_H8300_VSR_TABLE_DEFINED
204
 
205
#endif
206
 
207
 
208
 
209
#define CYGPKG_HAL_H8300_MON_DEFINED
210
 
211
#endif
212
 
213
#------------------------------------------------------------------------------
214
#endif // ifndef CYGONCE_HAL_VARIANT_INC
215
# end of variant.inc

powered by: WebSVN 2.1.0

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