diff -r 578be2adaf3e -r 307f4279f433 Adaptation/GUID-DB55C1A0-2901-4661-B6B1-3B61BF6FF4FA.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Adaptation/GUID-DB55C1A0-2901-4661-B6B1-3B61BF6FF4FA.dita Fri Oct 15 14:32:18 2010 +0100 @@ -0,0 +1,129 @@ + + + + + +Register Access Client Interface GuideExplains how to use the Register Access client interface +functions. +

The Register Access client interface is intended for use in writing +device drivers. Writing device drivers involves frequent access to +hardware registers by reading, writing and modifying them.

+
Interface +class

The client interface for the Register +Access platform services is:

+ + + +Class +Description + + + + +AsspRegister +Provides read, write and modify functions to access hardware +registers of different widths. + + + +
+
Interface +functions

The Register Access client interface provides +the following functions:

+ + + + +Function +Return Type +Description + + + + +AsspRegister::Read8(TLinAddr aAddr) +TUint8 +Return the contents of an 8-bit register. + + +AsspRegister::Read16(TLinAddr aAddr) +TUint16 +Return the contents of a 16-bit register. + + +AsspRegister::Read32(TLinAddr aAddr) +TUint32 +Return the contents of a 32-bit register. + + +AsspRegister::Read64(TLinAddr aAddr) +TUint64 +Return the contents of a 64-bit register. + + +AsspRegister::Write8(TLinAddr aAddr, TUint8 aValue) +void +Store a new value in an 8-bit register. + + +AsspRegister::Write16(TLinAddr aAddr, TUint16 aValue) +void +Store a new value in a 16-bit register. + + +AsspRegister::Write32(TLinAddr aAddr, TUint32 aValue) +void +Store a new value in a 32-bit register. + + +AsspRegister::Write64(TLinAddr aAddr, TUint64 aValue) +void +Store a new value in a 64-bit register. + + +AsspRegister::Modify8(TLinAddr aAddr, TUint8 aClearMask, +TUint8 aSetMask) +void +Modify the contents of an 8-bit register. + + +AsspRegister::Modify16(TLinAddr aAddr, TUint16 aClearMask, +TUint16 aSetMask) +void +Modify the contents of a 16-bit register. + + +AsspRegister::Modify32(TLinAddr aAddr, TUint32 aClearMask, +TUint32 aSetMask) +void +Modify the contents of a 32-bit register. + + +AsspRegister::Modify64(TLinAddr aAddr, TUint64 aClearMask, +TUint64 aSetMask) +void +Modify the contents of a 64-bit register. + + + +

All these functions can be called in any context.

The address of a particular register on a particular platform +is typically expressed as a base address and an offset: this is what +you pass to the aAddr argument of these functions +as a TLinAddr.

The write functions take an +unsigned integer (TUint8, TUint16, TUint32 or TUint64) as the value +of the parameter aValue.

The modify functions +take two unsigned integers (TUint8, TUint16, TUint32 or TUint64) as arguments. +Both the parameters, aClearMask and aSetMask, are bitmasks. The aClearMask argument clears the +bits specified and the aSetMask sets the bits specified.

Addressing a register

The following code reads the current +value of a hardware register identified by a base address iBaseAddr plus an offset KHoPciStatus.

TUint status=AsspRegister::Read16(iBaseAddr+KHoPciStatus);Modifying a register

The following code clears the bits +specified by the bitmask KHtPciStatus_ParityError and sets the bits specified by the bitmask NULL (that is so say, none in this case).

AsspRegister::Modify16(baseAddr+KHoPciStatus,KHtPciStatus_ParityError,NULL);
+
+Register +Access Implementation Guide +
\ No newline at end of file