1 |
786 |
skrzyp |
##=============================================================================
|
2 |
|
|
##
|
3 |
|
|
## var.inc
|
4 |
|
|
##
|
5 |
|
|
## mcfxxxx variant assembler header file
|
6 |
|
|
##
|
7 |
|
|
##=============================================================================
|
8 |
|
|
## ####ECOSGPLCOPYRIGHTBEGIN####
|
9 |
|
|
## -------------------------------------------
|
10 |
|
|
## This file is part of eCos, the Embedded Configurable Operating System.
|
11 |
|
|
## Copyright (C) 2003, 2004, 2006, 2008 Free Software Foundation, 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
|
16 |
|
|
## version.
|
17 |
|
|
##
|
18 |
|
|
## eCos is distributed in the hope that it will be useful, but WITHOUT
|
19 |
|
|
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
20 |
|
|
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
21 |
|
|
## for more details.
|
22 |
|
|
##
|
23 |
|
|
## You should have received a copy of the GNU General Public License
|
24 |
|
|
## along with eCos; if not, write to the Free Software Foundation, Inc.,
|
25 |
|
|
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
26 |
|
|
##
|
27 |
|
|
## As a special exception, if other files instantiate templates or use
|
28 |
|
|
## macros or inline functions from this file, or you compile this file
|
29 |
|
|
## and link it with other works to produce a work based on this file,
|
30 |
|
|
## this file does not by itself cause the resulting work to be covered by
|
31 |
|
|
## the GNU General Public License. However the source code for this file
|
32 |
|
|
## must still be made available in accordance with section (3) of the GNU
|
33 |
|
|
## General Public License v2.
|
34 |
|
|
##
|
35 |
|
|
## This exception does not invalidate any other reasons why a work based
|
36 |
|
|
## on this file might be covered by the GNU General Public License.
|
37 |
|
|
## -------------------------------------------
|
38 |
|
|
## ####ECOSGPLCOPYRIGHTEND####
|
39 |
|
|
##=============================================================================
|
40 |
|
|
#######DESCRIPTIONBEGIN####
|
41 |
|
|
##
|
42 |
|
|
## Author(s): bartv
|
43 |
|
|
## Date: 2003-06-04
|
44 |
|
|
######DESCRIPTIONEND####
|
45 |
|
|
##=============================================================================
|
46 |
|
|
|
47 |
|
|
// ----------------------------------------------------------------------------
|
48 |
|
|
// Generic support for the MAC and eMAC units.
|
49 |
|
|
// Not yet implemented.
|
50 |
|
|
|
51 |
|
|
// ----------------------------------------------------------------------------
|
52 |
|
|
// Now include the cpu-specific header, which can define context macros
|
53 |
|
|
// including the MAC, eMAC, and possibly other state
|
54 |
|
|
#include
|
55 |
|
|
|
56 |
|
|
// ----------------------------------------------------------------------------
|
57 |
|
|
// Thread context support. Usually this is generic for all ColdFires,
|
58 |
|
|
// but it is possible for processor or platform code to override
|
59 |
|
|
// these definitions.
|
60 |
|
|
|
61 |
|
|
// The 68K exception and interrupt VSR's can be used directly since the
|
62 |
|
|
// vector number is part of the hardware state automatically pushed onto
|
63 |
|
|
// the stack. Since there are no trampolines there is no need to adjust
|
64 |
|
|
// the stack before returning.
|
65 |
|
|
#ifndef HAL_CONTEXT_PCSR_RTE_ADJUST
|
66 |
|
|
# define HAL_CONTEXT_PCSR_RTE_ADJUST 0
|
67 |
|
|
#endif
|
68 |
|
|
|
69 |
|
|
#ifndef HAL_CONTEXT_PCSR_SAVE_SR_DEFINED
|
70 |
|
|
.macro hal_context_pcsr_save_sr reg=%sp,off=0,scratch=%d0
|
71 |
|
|
mov.l #0x40000000, \scratch
|
72 |
|
|
mov.w %sr, \scratch
|
73 |
|
|
mov.l \scratch, (hal_context_pcsr_offset+\off)(\reg)
|
74 |
|
|
.endm
|
75 |
|
|
#endif
|
76 |
|
|
|
77 |
|
|
// Get the ISR vector out of the context. This is encoded in one
|
78 |
|
|
// byte in the exception frame. There are two versions depending
|
79 |
|
|
// on the number of ISR vectors. If < 64, i.e. if an interrupt
|
80 |
|
|
// falls in the range 64 <= isrvec < 128, then a simple mask
|
81 |
|
|
// will do the trick. If > 164, i.e. if an interrupt falls in
|
82 |
|
|
// the range 64 <= isrvec < 256, then a subtract is required.
|
83 |
|
|
|
84 |
|
|
#ifndef HAL_CONTEXT_EXTRACT_ISR_DEFINED
|
85 |
|
|
|
86 |
|
|
# if HAL_M68K_VSR_COUNT > 128
|
87 |
|
|
|
88 |
|
|
.macro hal_context_extract_isr_vector_shl2 reg=%sp,off=0,isr
|
89 |
|
|
mov.w (hal_context_pcsr_offset+\off)(\reg),\isr
|
90 |
|
|
andi.l #0x03FC, \isr
|
91 |
|
|
subi.l #0x0100, \isr
|
92 |
|
|
.endm
|
93 |
|
|
|
94 |
|
|
.macro hal_context_extract_isr_vector reg=%sp,off=0,isr
|
95 |
|
|
mov.w (hal_context_pcsr_offset+\off)(\reg),\isr
|
96 |
|
|
andi.l #0x03FC, \isr
|
97 |
|
|
lsr.l #2, \isr
|
98 |
|
|
subi.l #0x040, \isr
|
99 |
|
|
.endm
|
100 |
|
|
|
101 |
|
|
# else
|
102 |
|
|
.macro hal_context_extract_isr_vector_shl2 reg=%sp,off=0,isr
|
103 |
|
|
mov.w (hal_context_pcsr_offset+\off)(\reg),\isr
|
104 |
|
|
andi.l #0x00FC, \isr
|
105 |
|
|
.endm
|
106 |
|
|
|
107 |
|
|
.macro hal_context_extract_isr_vector reg=%sp,off=0,isr
|
108 |
|
|
mov.w (hal_context_pcsr_offset+\off)(\reg),\isr
|
109 |
|
|
andi.l #0x0FC, \isr
|
110 |
|
|
lsr.l #2, \isr
|
111 |
|
|
.endm
|
112 |
|
|
# endif
|
113 |
|
|
#endif
|
114 |
|
|
|
115 |
|
|
#------------------------------------------------------------------------------
|
116 |
|
|
# end of var.inc
|