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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [hal/] [mn10300/] [am33/] [current/] [src/] [variant.S] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
##=============================================================================
2
##
3
##      variant.S
4
##
5
##      MN10300 AM33 variant code
6
##
7
##=============================================================================
8
## ####ECOSGPLCOPYRIGHTBEGIN####
9
## -------------------------------------------
10
## This file is part of eCos, the Embedded Configurable Operating System.
11
## Copyright (C) 1998, 1999, 2000, 2001, 2002 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):   nickg
43
## Contributors:        nickg
44
## Date:        1997-10-16
45
## Purpose:     MN10300 AM33 variant code
46
## Description: This file contains variant specific assembly code for the AM33.
47
##
48
######DESCRIPTIONEND####
49
##
50
##=============================================================================
51
 
52
#include 
53
 
54
#include 
55
 
56
 
57
##-----------------------------------------------------------------------------
58
## NMI trampoline VSRs. All NMI interrupts are routed here initially, where we
59
## decode the NMICR and ISR register contents and vector to the
60
## correct VSR later in the table.
61
 
62
        .text
63
 
64
        .extern hal_lsbit_table
65
 
66
        .globl nmi_vsr_trampoline
67
nmi_vsr_trampoline:
68
        movhu   (NMICR),d0              # D0 = NMI control register
69
        and     0x7,d0                  # LS 3 bits only
70
        mov     3,d1                    # search from bit 3
71
        bsch    d0,d1                   # get ms bit in d1
72
        bcs     2f                      # jump if no bits there
73
        add     9,d1                    # D1 = offset into VSR table
74
        jmp     3f                      # go to rest of code
75
 
76
        .globl nmi_sysef_trampoline
77
nmi_sysef_trampoline:
78
        movhu   (ISR),d0                # D0 = Interrupt Status Register
79
        mov     d0,d1                   # D1 = copy of D0
80
        add     -1,d1                   # D1 = D0-1
81
        not     d1                      # D1 = ~(D0-1) = -D0
82
        and     d1,d0                   # D0 = D0 & -D0 = ls bit only
83
        mov     16,d1                   # D1 = start of search bit
84
        bsch    d0,d1                   # search for 1 bit in d0
85
        bcs     2f                      # jump if failed
86
        add     12,d1                   # d1 = offset in VSR table
87
3:
88
        asl     2,d1                    # D1 = word offset in vsr table
89
        mov     _hal_vsr_table,a0       # A0 = VSR table base
90
        add     d1,a0                   # A0 = address of table entry we want
91
        mov     (a0),a0                 # A0 = VSR to call
92
        jmp     (a0)                    # Call it
93
 
94
2:
95
        # no bits set in ISR or NMICR when we expected them.
96
        # This should never happen, but if it does, use an otherwise
97
        # unused VSR table entry to indicate this.
98
 
99
        mov     27,d1                   # use last VSR table entry.
100
        jmp     3b
101
 
102
 
103
##-----------------------------------------------------------------------------
104
 
105
#define HAL_CHCTR               0xC0000070
106
#define HAL_DCACHE_PURGE_WAY0   0xC8400000
107
#define HAL_CHCTR_DCEN          0x0002
108
#define HAL_CHCTR_DCBUSY        0x0008
109
 
110
        .text
111
 
112
        .globl  _cyg_hal_dcache_store
113
_cyg_hal_dcache_store:
114
        movm    [d2,d3],(sp)
115
 
116
        mov     HAL_CHCTR,a0                    # A0 = control reg
117
        mov     HAL_DCACHE_PURGE_WAY0,a1        # A1 = purge base address
118
 
119
        # Disable DCACHE if it is enabled
120
 
121
        movhu   (a0),d2                         # D2 = old value of control reg
122
 
123
        btst    HAL_CHCTR_DCEN,d2               # check for cache enabled
124
        beq     1f                              # if not, skip disable
125
 
126
        mov     d2,d3                           # make a copy of CHCTR
127
        and     ~HAL_CHCTR_DCEN,d3              # clear DCEN bit
128
        movhu   d3,(a0)                         # store in reg
129
 
130
2:      movhu   (a0),d3                         # get CHCTR
131
        btst    HAL_CHCTR_DCBUSY,d3             # test DCBUSY bit
132
        bne     2b                              # loop while set
133
 
134
1:
135
        # The cache is now disabled
136
 
137
        and     0x000003f0,d0                   # isolate index bits of base addr
138
        add     d0,a1                           # offset a1 to base address
139
 
140
        add     63,d1                           # adjust size to whole multiple of
141
        and     0xFFFFFFC0,d1                   # set size.
142
3:
143
        mov     (0x0000,a1),d0                  # purge way 0
144
        mov     (0x1000,a1),d0                  # purge way 1
145
        mov     (0x2000,a1),d0                  # purge way 2
146
        mov     (0x3000,a1),d0                  # purge way 3
147
 
148
        add     16,a1                           # advance to next set
149
 
150
        sub     64,d1                           # decrement count
151
        bne     3b                              # loop while non zero
152
 
153
        # Restore original cache state from saved CHCTR in D2
154
 
155
        movhu   d2,(a0)
156
 
157
        movm    (sp),[d2,d3]                    # restore work regs
158
 
159
        rets
160
 
161
 
162
##-----------------------------------------------------------------------------
163
## end of variant.S
164
 
165
 
166
 

powered by: WebSVN 2.1.0

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