1 |
786 |
skrzyp |
#ifndef CYGONCE_HAL_PLATFORM_INC
|
2 |
|
|
#define CYGONCE_HAL_PLATFORM_INC
|
3 |
|
|
##=============================================================================
|
4 |
|
|
##
|
5 |
|
|
## platform.inc
|
6 |
|
|
##
|
7 |
|
|
## Platform specific 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, 2003 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): gthomas
|
45 |
|
|
## Contributors:
|
46 |
|
|
## Date: 2002-07-31
|
47 |
|
|
## Purpose: Platform specific assembly code
|
48 |
|
|
## Description: This file contains various definitions and macros that are
|
49 |
|
|
## useful for writing assembly code for the platform.
|
50 |
|
|
## Usage: included from
|
51 |
|
|
##
|
52 |
|
|
##
|
53 |
|
|
######DESCRIPTIONEND####
|
54 |
|
|
##
|
55 |
|
|
##=============================================================================
|
56 |
|
|
##-----------------------------------------------------------------------------
|
57 |
|
|
## MPC82xx interrupt handling.
|
58 |
|
|
|
59 |
|
|
#ifndef CYGPKG_HAL_POWERPC_INTC_DEFINED
|
60 |
|
|
|
61 |
|
|
# decode the interrupt
|
62 |
|
|
.macro hal_intc_decode dreg,state
|
63 |
|
|
lwz \dreg,CYGARC_PPCREG_VECTOR(\state) # retrieve vector number,
|
64 |
|
|
rlwinm. \dreg,\dreg,22,31,31 # isolate bit 21
|
65 |
|
|
beq 0f # done if decrementer (vec 0)
|
66 |
|
|
lwi \dreg,_CSB281_EPIC_IACK # if external, get vector
|
67 |
|
|
li r0,0
|
68 |
|
|
lwbrx \dreg,r0,\dreg # EPIC is little endian!
|
69 |
|
|
cmpi 0,\dreg,0xFF # spurious interrupt?
|
70 |
|
|
beq restore_state
|
71 |
|
|
lwi r3,_CSB281_EPIC_EOI # clear interrupt?
|
72 |
|
|
stw r0,0(r3)
|
73 |
|
|
0: stw \dreg,CYGARC_PPCREG_VECTOR(\state) # update vector in state frame.
|
74 |
|
|
slwi \dreg,\dreg,2 # convert to byte offset.
|
75 |
|
|
.endm
|
76 |
|
|
|
77 |
|
|
#define CYGPKG_HAL_POWERPC_INTC_DEFINED
|
78 |
|
|
#endif // CYGPKG_HAL_POWERPC_INTC_DEFINED
|
79 |
|
|
|
80 |
|
|
#------------------------------------------------------------------------------
|
81 |
|
|
#endif // ifndef CYGONCE_HAL_PLATFORM_INC
|
82 |
|
|
# end of platform.inc
|