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