williamr@4: // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). williamr@4: // All rights reserved. williamr@4: // This component and the accompanying materials are made available williamr@4: // under the terms of the License "Eclipse Public License v1.0" williamr@4: // which accompanies this distribution, and is available williamr@4: // at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@4: // williamr@4: // Initial Contributors: williamr@4: // Nokia Corporation - initial contribution. williamr@4: // williamr@4: // Contributors: williamr@4: // williamr@4: // Description: williamr@4: // williamr@4: williamr@4: #if 0 // not needed for Symbian^3 williamr@4: williamr@4: #ifndef __ASSPREG_H__ williamr@4: #define __ASSPREG_H__ williamr@4: williamr@4: /** williamr@4: @publishedPartner williamr@4: @prototype williamr@4: williamr@4: A class that exports ASSP register access functionality to williamr@4: device drivers and other kernel-side code. williamr@4: williamr@4: Although Symbian OS defines this class, it does not implement all williamr@4: the functions within it. An implementation for each of the register williamr@4: modification functions defined by this class must be provided by williamr@4: the baseport. williamr@4: */ williamr@4: class AsspRegister williamr@4: { williamr@4: public: williamr@4: williamr@4: /** williamr@4: Return the contents of an 8-bit register. williamr@4: williamr@4: @param aAddr The address of the register to be read. williamr@4: @return The contents of the register. williamr@4: @pre Can be called in any context. williamr@4: */ williamr@4: static inline TUint8 Read8(TLinAddr aAddr) williamr@4: { return *(volatile TUint8*)aAddr; } williamr@4: williamr@4: /** williamr@4: Store a new value in an 8-bit register. This will change williamr@4: the entire contents of the register concerned. williamr@4: williamr@4: @param aAddr The address of the register to be written. williamr@4: @param aValue The new value to be written to the register. williamr@4: @pre Can be called in any context. williamr@4: */ williamr@4: static inline void Write8(TLinAddr aAddr, TUint8 aValue) williamr@4: { *(volatile TUint8*)aAddr = aValue; } williamr@4: williamr@4: /** williamr@4: Modify the contents of an 8-bit register. williamr@4: williamr@4: @param aAddr The address of the register to be modified. williamr@4: @param aClearMask A mask of the bits to be cleared in the register. williamr@4: @param aSetMask A mask of the bits to be set in the register after the clear. williamr@4: @pre Can be called in any context. williamr@4: */ williamr@4: IMPORT_C static void Modify8(TLinAddr aAddr, TUint8 aClearMask, TUint8 aSetMask); williamr@4: williamr@4: /** williamr@4: Return the contents of an 16-bit register. williamr@4: williamr@4: @param aAddr The address of the register to be read. williamr@4: @return The contents of the register. williamr@4: @pre Can be called in any context. williamr@4: */ williamr@4: static inline TUint16 Read16(TLinAddr aAddr) williamr@4: { return *(volatile TUint16*)aAddr; } williamr@4: williamr@4: /** williamr@4: Store a new value in a 16-bit register. This will change williamr@4: the entire contents of the register concerned. williamr@4: williamr@4: @param aAddr The address of the register to be written. williamr@4: @param aValue The new value to be written to the register. williamr@4: @pre Can be called in any context. williamr@4: */ williamr@4: static inline void Write16(TLinAddr aAddr, TUint16 aValue) williamr@4: { *(volatile TUint16*)aAddr = aValue; } williamr@4: williamr@4: /** williamr@4: Modify the contents of a 16-bit register. williamr@4: williamr@4: @param aAddr The address of the register to be modified. williamr@4: @param aClearMask A mask of the bits to be cleared in the register. williamr@4: @param aSetMask A mask of the bits to be set in the register after the clear. williamr@4: @pre Can be called in any context. williamr@4: */ williamr@4: IMPORT_C static void Modify16(TLinAddr aAddr, TUint16 aClearMask, TUint16 aSetMask); williamr@4: williamr@4: /** williamr@4: Return the contents of a 32-bit register. williamr@4: williamr@4: @param aAddr The address of the register to be read. williamr@4: @return The contents of the register. williamr@4: @pre Can be called in any context. williamr@4: */ williamr@4: static inline TUint32 Read32(TLinAddr aAddr) williamr@4: { return *(volatile TUint32*)aAddr; } williamr@4: williamr@4: /** williamr@4: Store a new value in a 32-bit register. This will change williamr@4: the entire contents of the register concerned. williamr@4: williamr@4: @param aAddr The address of the register to be written. williamr@4: @param aValue The new value to be written to the register. williamr@4: @pre Can be called in any context. williamr@4: */ williamr@4: static inline void Write32(TLinAddr aAddr, TUint32 aValue) williamr@4: { *(volatile TUint32*)aAddr = aValue; } williamr@4: williamr@4: /** williamr@4: Modify the contents of a 32-bit register. williamr@4: williamr@4: @param aAddr The address of the register to be modified. williamr@4: @param aClearMask A mask of the bits to be cleared in the register. williamr@4: @param aSetMask A mask of the bits to be set in the register after the clear. williamr@4: @pre Can be called in any context. williamr@4: */ williamr@4: IMPORT_C static void Modify32(TLinAddr aAddr, TUint32 aClearMask, TUint32 aSetMask); williamr@4: williamr@4: /** williamr@4: Return the contents of a 64-bit register. williamr@4: williamr@4: @param aAddr The address of the register to be read. williamr@4: @return The contents of the register. williamr@4: @pre Can be called in any context. williamr@4: */ williamr@4: IMPORT_C static TUint64 Read64(TLinAddr aAddr); williamr@4: williamr@4: /** williamr@4: Store a new value in a 64-bit register. This will change williamr@4: the entire contents of the register concerned. williamr@4: williamr@4: @param aAddr The address of the register to be written. williamr@4: @param aValue The new value to be written to the register. williamr@4: @pre Can be called in any context. williamr@4: */ williamr@4: IMPORT_C static void Write64(TLinAddr aAddr, TUint64 aValue); williamr@4: williamr@4: /** williamr@4: Modify the contents of a 64-bit register. williamr@4: williamr@4: @param aAddr The address of the register to be modified. williamr@4: @param aClearMask A mask of the bits to be cleared in the register. williamr@4: @param aSetMask A mask of the bits to be set in the register after the clear. williamr@4: @pre Can be called in any context. williamr@4: */ williamr@4: IMPORT_C static void Modify64(TLinAddr aAddr, TUint64 aClearMask, TUint64 aSetMask); williamr@4: }; williamr@4: williamr@4: #endif williamr@4: #endif