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

Side by Side Diff: arch/arm/include/asm/arch-tegra2/nv_drf_asm.h

Issue 4841001: Tegra2: implement Warmboot code and lp0_vec (Closed) Base URL: http://git.chromium.org/git/u-boot-next.git@chromeos-v2010.09
Patch Set: Created 10 years, 1 month 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 /*
2 * (C) Copyright 2010
3 * NVIDIA Corporation <www.nvidia.com>
4 *
5 * See file CREDITS for list of people who contributed to this
6 * project.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21 * MA 02111-1307 USA
22 */
23
24 #ifndef INCLUDED_NVRM_DRF_ASM_H
25 #define INCLUDED_NVRM_DRF_ASM_H
26
27 /**
28 * @defgroup nvrm_drf RM DRF Macros
29 *
30 * @ingroup nvddk_rm
31 *
32 * The following suite of macros are used from assembly language code for
33 * generating values to write into hardware registers, or for extracting
34 * fields from read registers. These macros are less sophistocated than
35 * C counterparts because the assembler does not understand the C ternary
36 * operator. In particular, depending on the version of the assember, there
37 * may not be common C-style aliases to the native assembler operators. To
38 * accomodate the lowest common denominator, only the native assember operators
39 * (e.g., :SHL:, :AND:, etc.) are used.
40 */
41
42 /**
43 * The default implementation of _MK_ENUM_CONST in the spec-generated headers
44 * appends the C unsigned long suffix operator (UL). This is incompatible with
45 * the assembler. Force _MK_ENUM_CONST to define just a plain constant.
46 */
47 #if defined(_MK_ENUM_CONST)
48 #undef _MK_ENUM_CONST
49 #define _MK_ENUM_CONST(_constant_) (_constant_)
50 #endif
51
52 /*-----------------------------------------------------------------------------
53 * Abstract logical operations because some ARM assemblers don't
54 * understand C operators.
55 *-----------------------------------------------------------------------------
Tom Warren 2010/11/12 00:12:40 Nor should they - write assembler code in assembly
yelin 2010/11/15 23:21:21 Done.
56 */
57
58 #if !defined(_AND_)
59 #if defined(_MSC_VER) /* Microsoft compiler/assember */
60 #define _AND_ :AND:
61 #else
62 #define _AND_ &
63 #endif
64 #endif
65
66 #if !defined(_OR_)
67 #if defined(_MSC_VER) /* Microsoft compiler/assember */
68 #define _OR_ :OR:
69 #else
70 #define _OR_ |
71 #endif
72 #endif
73
74 #if !defined(_SHL_)
75 #if defined(_MSC_VER) /* Microsoft compiler/assember */
76 #define _SHL_ :SHL:
77 #else
78 #define _SHL_ <<
79 #endif
80 #endif
81
82
83 /** NV_DRF_OFFSET - Get a register offset
84
85 @ingroup nvrm_drf
86
87 @param d register domain (hardware block)
88 @param r register name
89 */
90 #define NV_DRF_OFFSET(d,r) (d##_##r##_0)
91
92 /** NV_DRF_SHIFT - Get the shift count of a field
93
94 @ingroup nvrm_drf
95
96 @param d register domain (hardware block)
97 @param r register name
98 @param f register field
99 */
100 #define NV_DRF_SHIFT(d,r,f) (d##_##r##_0_##f##_SHIFT)
101
102 /** NV_DRF_MASK - Get the mask value of a field
103
104 @ingroup nvrm_drf
105
106 @param d register domain (hardware block)
107 @param r register name
108 @param f register field
109 */
110 #define NV_DRF_MASK(d,r,f) ((d##_##r##_0_##f##_DEFAULT_MASK) _SHL_ (d##_##r##_0 _##f##_SHIFT))
111
112 /** NV_DRF_DEF - define a new register value.
113
114 @ingroup nvrm_drf
115
116 @param d register domain (hardware block)
117 @param r register name
118 @param f register field
119 @param c defined value for the field
120 */
121 #define NV_DRF_DEF(d,r,f,c) \
122 ((d##_##r##_0_##f##_##c) _SHL_ (d##_##r##_0_##f##_SHIFT))
123
124 /** NV_DRF_NUM - define a new register value.
125
126 @ingroup nvrm_drf
127
128 @param d register domain (hardware block)
129 @param r register name
130 @param f register field
131 @param n numeric value for the field
132 */
133 #define NV_DRF_NUM(d,r,f,n) \
134 ((((n) _AND_ (d##_##r##_0_##f##_DEFAULT_MASK))) _SHL_ \
135 (d##_##r##_0_##f##_SHIFT))
136
137 /** NV_RESETVAL - get the reset value for a register.
138
139 @ingroup nvrm_drf
140
141 @param d register domain (hardware block)
142 @param r register name
143 */
144 #define NV_RESETVAL(d,r) (d##_##r##_0_RESET_VAL)
145
146 #endif /* INCLUDED_NVRM_DRF_ASM_H */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698