Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(330)

Side by Side Diff: arch/arm/mach-tegra/nv/include/nvrm_arm_cp.h

Issue 3256004: [ARM] tegra: add nvos/nvrm/nvmap drivers (Closed) Base URL: ssh://git@gitrw.chromium.org/kernel.git
Patch Set: remove ap15 headers Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2007-2009 NVIDIA Corporation.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 *
11 * Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation
13 * and/or other materials provided with the distribution.
14 *
15 * Neither the name of the NVIDIA Corporation nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 *
31 */
32
33
34 #ifndef INCLUDED_ARM_CP_H
35 #define INCLUDED_ARM_CP_H
36
37 #include "nvassert.h"
38
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42
43 //==========================================================================
44 // Compiler-specific status and coprocessor register abstraction macros.
45 //==========================================================================
46
47 #if defined(_MSC_VER) && NVOS_IS_WINDOWS_CE // Microsoft compiler on WinCE
48
49 // Define the standard ARM coprocessor register names because the ARM compil er requires
50 // that we use the names and the Microsoft compiler requires that we use the numbers for
51 // its intrinsic functions _MoveToCoprocessor() and _MoveFromCoprocessor().
52 #define p14 14
53 #define p15 15
54 #define c0 0
55 #define c1 1
56 #define c2 2
57 #define c3 3
58 #define c4 4
59 #define c5 5
60 #define c6 6
61 #define c7 7
62 #define c8 8
63 #define c9 9
64 #define c10 10
65 #define c11 11
66 #define c12 12
67 #define c13 13
68 #define c14 14
69 #define c15 15
70
71 /*
72 * @brief Macro to abstract writing of a ARM coprocessor register via the M CR instruction.
73 * @param cp is the coprocessor name (e.g., p15)
74 * @param op1 is a coprocessor-specific operation code (must be a manifest constant).
75 * @param Rd is a variable that will receive the value read from the coproc essor register.
76 * @param CRn is the destination coprocessor register (e.g., c7).
77 * @param CRm is an additional destination coprocessor register (e.g., c2).
78 * @param op2 is a coprocessor-specific operation code (must be a manifest constant).
79 */
80 #define MCR(cp,op1,Rd,CRn,CRm,op2) _MoveToCoprocessor((NvU32)(Rd), cp, op1, CRn, CRm, op2)
81
82 /*
83 * @brief Macro to abstract reading of a ARM coprocessor register via the M RC instruction.
84 * @param cp is the coprocessor name (e.g., p15)
85 * @param op1 is a coprocessor-specific operation code (must be a manifest constant).
86 * @param Rd is a variable that will receive the value read from the coproc essor register.
87 * @param CRn is the destination coprocessor register (e.g., c7).
88 * @param CRm is an additional destination coprocessor register (e.g., c2).
89 * @param op2 is a coprocessor-specific operation code (must be a manifest constant).
90 */
91 #define MRC(cp,op1,Rd,CRn,CRm,op2) *((NvU32*)(&(Rd))) = _MoveFromCoprocesso r(cp, op1, CRn, CRm, op2)
92
93 #elif defined(__ARMCC_VERSION) // ARM compiler
94
95 /*
96 * @brief Macro to abstract writing of a ARM coprocessor register via the M CR instruction.
97 * @param cp is the coprocessor name (e.g., p15)
98 * @param op1 is a coprocessor-specific operation code (must be a manifest constant).
99 * @param Rd is a variable that will be written to the coprocessor register .
100 * @param CRn is the destination coprocessor register (e.g., c7)
101 * @param CRm is an additional destination coprocessor register (e.g., c2).
102 * @param op2 is a coprocessor-specific operation code (must be a manifest constant).
103 */
104 #define MCR(cp,op1,Rd,CRn,CRm,op2) __asm { MCR cp, op1, Rd, CRn, CRm, op2 }
105
106 /*
107 * @brief Macro to abstract reading of a ARM coprocessor register via the M RC instruction.
108 * @param cp is the coprocessor name (e.g., p15)
109 * @param op1 is a coprocessor-specific operation code (must be a manifest constant).
110 * @param Rd is a variable that will receive the value read from the coproc essor register.
111 * @param CRn is the destination coprocessor register (e.g., c7).
112 * @param CRm is an additional destination coprocessor register (e.g., c2).
113 * @param op2 is a coprocessor-specific operation code (must be a manifest constant).
114 */
115 #define MRC(cp,op1,Rd,CRn,CRm,op2) __asm { MRC cp, op1, Rd, CRn, CRm, op2 }
116
117 #elif NVOS_IS_LINUX || __GNUC__ // linux compilers
118
119 #if defined(__arm__) // ARM GNU compiler
120
121 // Define the standard ARM coprocessor register names because the ARM compil er requires
122 // that we use the names and the GNU compiler requires that we use the numbe rs.
123 #define p14 14
124 #define p15 15
125 #define c0 0
126 #define c1 1
127 #define c2 2
128 #define c3 3
129 #define c4 4
130 #define c5 5
131 #define c6 6
132 #define c7 7
133 #define c8 8
134 #define c9 9
135 #define c10 10
136 #define c11 11
137 #define c12 12
138 #define c13 13
139 #define c14 14
140 #define c15 15
141
142 /*
143 * @brief Macro to abstract writing of a ARM coprocessor register via the M CR instruction.
144 * @param cp is the coprocessor name (e.g., p15)
145 * @param op1 is a coprocessor-specific operation code (must be a manifest constant).
146 * @param Rd is a variable that will receive the value read from the coproc essor register.
147 * @param CRn is the destination coprocessor register (e.g., c7).
148 * @param CRm is an additional destination coprocessor register (e.g., c2).
149 * @param op2 is a coprocessor-specific operation code (must be a manifest constant).
150 */
151 #define MCR(cp,op1,Rd,CRn,CRm,op2) asm(" MCR " #cp",%1,%2,"#CRn","#CRm ",%5 " \
152 : : "i" (cp), "i" (op1), "r" (Rd), "i" (CRn), "i" (CRm), "i" (op2))
153
154 /*
155 * @brief Macro to abstract reading of a ARM coprocessor register via the M RC instruction.
156 * @param cp is the coprocessor name (e.g., p15)
157 * @param op1 is a coprocessor-specific operation code (must be a manifest constant).
158 * @param Rd is a variable that will receive the value read from the coproc essor register.
159 * @param CRn is the destination coprocessor register (e.g., c7).
160 * @param CRm is an additional destination coprocessor register (e.g., c2).
161 * @param op2 is a coprocessor-specific operation code (must be a manifest constant).
162 */
163 #define MRC(cp,op1,Rd,CRn,CRm,op2) asm( " MRC " #cp",%2,%0," #CRn","#CRm",% 5" \
164 : "=r" (Rd) : "i" (cp), "i" (op1), "i" (CRn), "i" (CRm), "i" (op2))
165
166 #else
167
168 /* x86 processor. No such instructions. Callers should not call these macros
169 * when running on x86. If they do, it will compile but will not work. */
170 #define MCR(cp,op1,Rd,CRn,CRm,op2) do { Rd = Rd; NV_ASSERT(0); } while (0)
171 #define MRC(cp,op1,Rd,CRn,CRm,op2) do { Rd = 0; /*NV_ASSERT(0);*/ } while ( 0)
172
173 #endif
174 #else
175
176 // !!!FIXME!!! TEST FOR ALL KNOWN COMPILERS -- FOR NOW JUST DIE AT RUN-TIME
177 // #error "Unknown compiler"
178 #define MCR(cp,op1,Rd,CRn,CRm,op2) do { Rd = Rd; NV_ASSERT(0); } while (0)
179 #define MRC(cp,op1,Rd,CRn,CRm,op2) do { Rd = 0; /*NV_ASSERT(0);*/ } while ( 0)
180
181 #endif
182
183
184 #ifdef __cplusplus
185 }
186 #endif
187
188 #endif // INCLUDED_ARM_CP_H
189
OLDNEW
« no previous file with comments | « arch/arm/mach-tegra/nv/include/nvrm_analog.h ('k') | arch/arm/mach-tegra/nv/include/nvrm_avp_shrd_interrupt.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698