|
1 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of the License "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #if 0 // not needed for Symbian^3 |
|
17 |
|
18 #ifndef __ASSPREG_H__ |
|
19 #define __ASSPREG_H__ |
|
20 |
|
21 /** |
|
22 @publishedPartner |
|
23 @prototype |
|
24 |
|
25 A class that exports ASSP register access functionality to |
|
26 device drivers and other kernel-side code. |
|
27 |
|
28 Although Symbian OS defines this class, it does not implement all |
|
29 the functions within it. An implementation for each of the register |
|
30 modification functions defined by this class must be provided by |
|
31 the baseport. |
|
32 */ |
|
33 class AsspRegister |
|
34 { |
|
35 public: |
|
36 |
|
37 /** |
|
38 Return the contents of an 8-bit register. |
|
39 |
|
40 @param aAddr The address of the register to be read. |
|
41 @return The contents of the register. |
|
42 @pre Can be called in any context. |
|
43 */ |
|
44 static inline TUint8 Read8(TLinAddr aAddr) |
|
45 { return *(volatile TUint8*)aAddr; } |
|
46 |
|
47 /** |
|
48 Store a new value in an 8-bit register. This will change |
|
49 the entire contents of the register concerned. |
|
50 |
|
51 @param aAddr The address of the register to be written. |
|
52 @param aValue The new value to be written to the register. |
|
53 @pre Can be called in any context. |
|
54 */ |
|
55 static inline void Write8(TLinAddr aAddr, TUint8 aValue) |
|
56 { *(volatile TUint8*)aAddr = aValue; } |
|
57 |
|
58 /** |
|
59 Modify the contents of an 8-bit register. |
|
60 |
|
61 @param aAddr The address of the register to be modified. |
|
62 @param aClearMask A mask of the bits to be cleared in the register. |
|
63 @param aSetMask A mask of the bits to be set in the register after the clear. |
|
64 @pre Can be called in any context. |
|
65 */ |
|
66 IMPORT_C static void Modify8(TLinAddr aAddr, TUint8 aClearMask, TUint8 aSetMask); |
|
67 |
|
68 /** |
|
69 Return the contents of an 16-bit register. |
|
70 |
|
71 @param aAddr The address of the register to be read. |
|
72 @return The contents of the register. |
|
73 @pre Can be called in any context. |
|
74 */ |
|
75 static inline TUint16 Read16(TLinAddr aAddr) |
|
76 { return *(volatile TUint16*)aAddr; } |
|
77 |
|
78 /** |
|
79 Store a new value in a 16-bit register. This will change |
|
80 the entire contents of the register concerned. |
|
81 |
|
82 @param aAddr The address of the register to be written. |
|
83 @param aValue The new value to be written to the register. |
|
84 @pre Can be called in any context. |
|
85 */ |
|
86 static inline void Write16(TLinAddr aAddr, TUint16 aValue) |
|
87 { *(volatile TUint16*)aAddr = aValue; } |
|
88 |
|
89 /** |
|
90 Modify the contents of a 16-bit register. |
|
91 |
|
92 @param aAddr The address of the register to be modified. |
|
93 @param aClearMask A mask of the bits to be cleared in the register. |
|
94 @param aSetMask A mask of the bits to be set in the register after the clear. |
|
95 @pre Can be called in any context. |
|
96 */ |
|
97 IMPORT_C static void Modify16(TLinAddr aAddr, TUint16 aClearMask, TUint16 aSetMask); |
|
98 |
|
99 /** |
|
100 Return the contents of a 32-bit register. |
|
101 |
|
102 @param aAddr The address of the register to be read. |
|
103 @return The contents of the register. |
|
104 @pre Can be called in any context. |
|
105 */ |
|
106 static inline TUint32 Read32(TLinAddr aAddr) |
|
107 { return *(volatile TUint32*)aAddr; } |
|
108 |
|
109 /** |
|
110 Store a new value in a 32-bit register. This will change |
|
111 the entire contents of the register concerned. |
|
112 |
|
113 @param aAddr The address of the register to be written. |
|
114 @param aValue The new value to be written to the register. |
|
115 @pre Can be called in any context. |
|
116 */ |
|
117 static inline void Write32(TLinAddr aAddr, TUint32 aValue) |
|
118 { *(volatile TUint32*)aAddr = aValue; } |
|
119 |
|
120 /** |
|
121 Modify the contents of a 32-bit register. |
|
122 |
|
123 @param aAddr The address of the register to be modified. |
|
124 @param aClearMask A mask of the bits to be cleared in the register. |
|
125 @param aSetMask A mask of the bits to be set in the register after the clear. |
|
126 @pre Can be called in any context. |
|
127 */ |
|
128 IMPORT_C static void Modify32(TLinAddr aAddr, TUint32 aClearMask, TUint32 aSetMask); |
|
129 |
|
130 /** |
|
131 Return the contents of a 64-bit register. |
|
132 |
|
133 @param aAddr The address of the register to be read. |
|
134 @return The contents of the register. |
|
135 @pre Can be called in any context. |
|
136 */ |
|
137 IMPORT_C static TUint64 Read64(TLinAddr aAddr); |
|
138 |
|
139 /** |
|
140 Store a new value in a 64-bit register. This will change |
|
141 the entire contents of the register concerned. |
|
142 |
|
143 @param aAddr The address of the register to be written. |
|
144 @param aValue The new value to be written to the register. |
|
145 @pre Can be called in any context. |
|
146 */ |
|
147 IMPORT_C static void Write64(TLinAddr aAddr, TUint64 aValue); |
|
148 |
|
149 /** |
|
150 Modify the contents of a 64-bit register. |
|
151 |
|
152 @param aAddr The address of the register to be modified. |
|
153 @param aClearMask A mask of the bits to be cleared in the register. |
|
154 @param aSetMask A mask of the bits to be set in the register after the clear. |
|
155 @pre Can be called in any context. |
|
156 */ |
|
157 IMPORT_C static void Modify64(TLinAddr aAddr, TUint64 aClearMask, TUint64 aSetMask); |
|
158 }; |
|
159 |
|
160 #endif |
|
161 #endif |