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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [hal/] [mn10300/] [am33/] [v2_0/] [src/] [variant.S] - Blame information for rev 454

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
##=============================================================================
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 Red Hat, 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 version.
16
##
17
## eCos is distributed in the hope that it will be useful, but WITHOUT ANY
18
## WARRANTY; without even the implied warranty of MERCHANTABILITY or
19
## FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
20
## for more details.
21
##
22
## You should have received a copy of the GNU General Public License along
23
## with eCos; if not, write to the Free Software Foundation, Inc.,
24
## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
25
##
26
## As a special exception, if other files instantiate templates or use macros
27
## or inline functions from this file, or you compile this file and link it
28
## with other works to produce a work based on this file, this file does not
29
## by itself cause the resulting work to be covered by the GNU General Public
30
## License. However the source code for this file must still be made available
31
## in accordance with section (3) of the GNU General Public License.
32
##
33
## This exception does not invalidate any other reasons why a work based on
34
## this file might be covered by the GNU General Public License.
35
##
36
## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
37
## at http://sources.redhat.com/ecos/ecos-license/
38
## -------------------------------------------
39
#####ECOSGPLCOPYRIGHTEND####
40
##=============================================================================
41
#######DESCRIPTIONBEGIN####
42
##
43
## Author(s):   nickg
44
## Contributors:        nickg
45
## Date:        1997-10-16
46
## Purpose:     MN10300 AM33 variant code
47
## Description: This file contains variant specific assembly code for the AM33.
48
##
49
######DESCRIPTIONEND####
50
##
51
##=============================================================================
52
 
53
#include 
54
 
55
#include 
56
 
57
 
58
##-----------------------------------------------------------------------------
59
## NMI trampoline VSRs. All NMI interrupts are routed here initially, where we
60
## decode the NMICR and ISR register contents and vector to the
61
## correct VSR later in the table.
62
 
63
        .text
64
 
65
        .extern hal_lsbit_table
66
 
67
        .globl nmi_vsr_trampoline
68
nmi_vsr_trampoline:
69
        movhu   (NMICR),d0              # D0 = NMI control register
70
        and     0x7,d0                  # LS 3 bits only
71
        mov     3,d1                    # search from bit 3
72
        bsch    d0,d1                   # get ms bit in d1
73
        bcs     2f                      # jump if no bits there
74
        add     9,d1                    # D1 = offset into VSR table
75
        jmp     3f                      # go to rest of code
76
 
77
        .globl nmi_sysef_trampoline
78
nmi_sysef_trampoline:
79
        movhu   (ISR),d0                # D0 = Interrupt Status Register
80
        mov     d0,d1                   # D1 = copy of D0
81
        add     -1,d1                   # D1 = D0-1
82
        not     d1                      # D1 = ~(D0-1) = -D0
83
        and     d1,d0                   # D0 = D0 & -D0 = ls bit only
84
        mov     16,d1                   # D1 = start of search bit
85
        bsch    d0,d1                   # search for 1 bit in d0
86
        bcs     2f                      # jump if failed
87
        add     12,d1                   # d1 = offset in VSR table
88
3:
89
        asl     2,d1                    # D1 = word offset in vsr table
90
        mov     _hal_vsr_table,a0       # A0 = VSR table base
91
        add     d1,a0                   # A0 = address of table entry we want
92
        mov     (a0),a0                 # A0 = VSR to call
93
        jmp     (a0)                    # Call it
94
 
95
2:
96
        # no bits set in ISR or NMICR when we expected them.
97
        # This should never happen, but if it does, use an otherwise
98
        # unused VSR table entry to indicate this.
99
 
100
        mov     27,d1                   # use last VSR table entry.
101
        jmp     3b
102
 
103
 
104
##-----------------------------------------------------------------------------
105
 
106
#define HAL_CHCTR               0xC0000070
107
#define HAL_DCACHE_PURGE_WAY0   0xC8400000
108
#define HAL_CHCTR_DCEN          0x0002
109
#define HAL_CHCTR_DCBUSY        0x0008
110
 
111
        .text
112
 
113
        .globl  _cyg_hal_dcache_store
114
_cyg_hal_dcache_store:
115
        movm    [d2,d3],(sp)
116
 
117
        mov     HAL_CHCTR,a0                    # A0 = control reg
118
        mov     HAL_DCACHE_PURGE_WAY0,a1        # A1 = purge base address
119
 
120
        # Disable DCACHE if it is enabled
121
 
122
        movhu   (a0),d2                         # D2 = old value of control reg
123
 
124
        btst    HAL_CHCTR_DCEN,d2               # check for cache enabled
125
        beq     1f                              # if not, skip disable
126
 
127
        mov     d2,d3                           # make a copy of CHCTR
128
        and     ~HAL_CHCTR_DCEN,d3              # clear DCEN bit
129
        movhu   d3,(a0)                         # store in reg
130
 
131
2:      movhu   (a0),d3                         # get CHCTR
132
        btst    HAL_CHCTR_DCBUSY,d3             # test DCBUSY bit
133
        bne     2b                              # loop while set
134
 
135
1:
136
        # The cache is now disabled
137
 
138
        and     0x000003f0,d0                   # isolate index bits of base addr
139
        add     d0,a1                           # offset a1 to base address
140
 
141
        add     63,d1                           # adjust size to whole multiple of
142
        and     0xFFFFFFC0,d1                   # set size.
143
3:
144
        mov     (0x0000,a1),d0                  # purge way 0
145
        mov     (0x1000,a1),d0                  # purge way 1
146
        mov     (0x2000,a1),d0                  # purge way 2
147
        mov     (0x3000,a1),d0                  # purge way 3
148
 
149
        add     16,a1                           # advance to next set
150
 
151
        sub     64,d1                           # decrement count
152
        bne     3b                              # loop while non zero
153
 
154
        # Restore original cache state from saved CHCTR in D2
155
 
156
        movhu   d2,(a0)
157
 
158
        movm    (sp),[d2,d3]                    # restore work regs
159
 
160
        rets
161
 
162
 
163
##-----------------------------------------------------------------------------
164
## end of variant.S
165
 
166
 
167
 

powered by: WebSVN 2.1.0

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