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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [CORTEX_AT91SAM3U256_IAR/] [AT91Lib/] [peripherals/] [cp15/] [cp15_asm_iar.s] - Blame information for rev 580

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 580 jeremybenn
/* ----------------------------------------------------------------------------
2
 *         ATMEL Microcontroller Software Support
3
 * ----------------------------------------------------------------------------
4
 * Copyright (c) 2008, Atmel Corporation
5
 *
6
 * All rights reserved.
7
 *
8
 * Redistribution and use in source and binary forms, with or without
9
 * modification, are permitted provided that the following conditions are met:
10
 *
11
 * - Redistributions of source code must retain the above copyright notice,
12
 * this list of conditions and the disclaimer below.
13
 *
14
 * Atmel's name may not be used to endorse or promote products derived from
15
 * this software without specific prior written permission.
16
 *
17
 * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
18
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
20
 * DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
21
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
23
 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
26
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 * ----------------------------------------------------------------------------
28
 */
29
 
30
        MODULE  ?cp15
31
 
32
        ;; Forward declaration of sections.
33
        SECTION IRQ_STACK:DATA:NOROOT(2)
34
        SECTION CSTACK:DATA:NOROOT(3)
35
 
36
//------------------------------------------------------------------------------
37
//         Headers
38
//------------------------------------------------------------------------------
39
 
40
#define __ASSEMBLY__
41
#include "board.h"
42
 
43
#ifdef CP15_PRESENT
44
 
45
//------------------------------------------------------------------------------
46
/// Functions to access CP15 coprocessor register
47
//------------------------------------------------------------------------------
48
 
49
        PUBLIC  _readControlRegister
50
        PUBLIC  _writeControlRegister
51
        PUBLIC  _waitForInterrupt
52
        PUBLIC  _writeTTB
53
        PUBLIC  _writeDomain
54
        PUBLIC  _writeITLBLockdown
55
        PUBLIC  _prefetchICacheLine
56
 
57
//------------------------------------------------------------------------------
58
/// Control Register c1
59
/// Register c1 is the Control Register for the ARM926EJ-S processor.
60
/// This register specifies the configuration used to enable and disable the
61
/// caches and MMU. It is recommended that you access this register using a
62
/// read-modify-write sequence.
63
//------------------------------------------------------------------------------
64
// CP15 Read Control Register
65
_readControlRegister:
66
        mov     r0, #0
67
        mrc     p15, 0, r0, c1, c0, 0
68
        bx      lr
69
 
70
// CP15 Write Control Register
71
_writeControlRegister:
72
        mcr     p15, 0, r0, c1, c0, 0
73
        bx      lr
74
 
75
//------------------------------------------------------------------------------
76
/// CP15 Wait For Interrupt operation
77
/// The purpose of the Wait For Interrupt operation is to put the processor in
78
/// to a low power state.
79
/// This puts the processor into a low-power state and stops it executing more
80
/// instructions until an interrupt, or debug request occurs, regardless of
81
/// whether the interrupts are disabled by the masks in the CPSR.
82
/// When an interrupt does occur, the MCR instruction completes and the IRQ or
83
/// FIQ handler is entered as normal. The return link in r14_irq or r14_fiq
84
/// contains the address of the MCR instruction plus 8, so that the normal
85
/// instruction used for interrupt return (SUBS PC,R14,#4) returns to the
86
/// instruction following the MCR.
87
/// Wait For Interrupt : MCR p15, 0, <Rd>, c7, c0, 4
88
//------------------------------------------------------------------------------
89
_waitForInterrupt:
90
        mov     r0, #0
91
        mcr     p15, 0, r0, c7, c0, 4
92
        bx      lr
93
 
94
//------------------------------------------------------------------------------
95
/// CP15 Translation Table Base Register c2
96
/// Register c2 is the Translation Table Base Register (TTBR), for the base
97
/// address of the first-level translation table.
98
/// Reading from c2 returns the pointer to the currently active first-level
99
/// translation table in bits [31:14] and an Unpredictable value in bits [13:0].
100
/// Writing to register c2 updates the pointer to the first-level translation
101
/// table from the value in bits [31:14] of the written value. Bits [13:0]
102
/// Should Be Zero.
103
/// You can use the following instructions to access the TTBR:
104
/// Read TTBR  : MRC p15, 0, <Rd>, c2, c0, 0
105
/// Write TTBR : MCR p15, 0, <Rd>, c2, c0, 0
106
//------------------------------------------------------------------------------
107
_writeTTB:
108
        MCR     p15, 0, r0, c2, c0, 0
109
        bx      lr
110
 
111
//------------------------------------------------------------------------------
112
/// Domain Access Control Register c3
113
/// Read domain access permissions  : MRC p15, 0, <Rd>, c3, c0, 0
114
/// Write domain access permissions : MCR p15, 0, <Rd>, c3, c0, 0
115
//------------------------------------------------------------------------------
116
_writeDomain:
117
        MCR     p15, 0, r0, c3, c0, 0
118
        bx      lr
119
 
120
//------------------------------------------------------------------------------
121
/// TLB Lockdown Register c10
122
/// The TLB Lockdown Register controls where hardware page table walks place the
123
/// TLB entry, in the set associative region or the lockdown region of the TLB,
124
/// and if in the lockdown region, which entry is written. The lockdown region
125
/// of the TLB contains eight entries. See TLB structure for a description of
126
/// the structure of the TLB.
127
/// Read data TLB lockdown victim  : MRC p15,0,<Rd>,c10,c0,0
128
/// Write data TLB lockdown victim : MCR p15,0,<Rd>,c10,c0,0
129
//------------------------------------------------------------------------------
130
_writeITLBLockdown:
131
        MCR     p15, 0, r0, c10, c0, 0
132
        bx      lr
133
 
134
//------------------------------------------------------------------------------
135
/// Prefetch ICache line
136
/// Performs an ICache lookup of the specified modified virtual address.
137
/// If the cache misses, and the region is cacheable, a linefill is performed.
138
/// Prefetch ICache line (MVA): MCR p15, 0, <Rd>, c7, c13, 1
139
//------------------------------------------------------------------------------
140
_prefetchICacheLine:
141
        MCR     p15, 0, r0, c7, c13, 1
142
        bx      lr
143
#endif
144
    END
145
 

powered by: WebSVN 2.1.0

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