Adaptation/GUID-DB55C1A0-2901-4661-B6B1-3B61BF6FF4FA.dita
author Graeme Price <GRAEME.PRICE@NOKIA.COM>
Fri, 15 Oct 2010 14:32:18 +0100
changeset 15 307f4279f433
permissions -rw-r--r--
Initial contribution of the Adaptation Documentation.

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE concept
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="GUID-DB55C1A0-2901-4661-B6B1-3B61BF6FF4FA" xml:lang="en"><title>Register Access Client Interface Guide</title><shortdesc>Explains how to use the Register Access client interface
functions. </shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
<p>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. </p>
<section id="GUID-7107B7C2-04E3-4876-892B-20C3F9F12F85"><title>Interface
class</title>             <p>The client interface for the Register
Access platform services is:</p><table id="GUID-A29A52B7-14C5-40F3-A73B-284B0D730965">
<tgroup cols="2"><colspec colname="col1"/><colspec colname="col2"/>
<thead>
<row>
<entry>Class</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><xref href="GUID-66BB033A-3386-3913-9A25-EF3867D42C2C.dita"><apiname>AsspRegister</apiname></xref></entry>
<entry>Provides read, write and modify functions to access hardware
registers of different widths.</entry>
</row>
</tbody>
</tgroup>
</table>         </section>
<section id="GUID-E1D195A0-715F-5961-A67C-A2536D68DAE3"><title>Interface
functions</title> <p>The Register Access client interface provides
the following functions:</p><table id="GUID-12019299-2FEB-4F6B-8217-D4AD085B12BB">
<tgroup cols="3"><colspec colname="col1"/><colspec colname="col2"/>
<colspec colname="col3"/>
<thead>
<row>
<entry>Function</entry>
<entry>Return Type</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><xref href="GUID-66BB033A-3386-3913-9A25-EF3867D42C2C.dita#GUID-66BB033A-3386-3913-9A25-EF3867D42C2C/GUID-A47E7A93-8180-38BA-8FAD-27ADA0E86EF7"><apiname>AsspRegister::Read8(TLinAddr aAddr)</apiname></xref></entry>
<entry>TUint8</entry>
<entry>Return the contents of an 8-bit register.</entry>
</row>
<row>
<entry><xref href="GUID-66BB033A-3386-3913-9A25-EF3867D42C2C.dita#GUID-66BB033A-3386-3913-9A25-EF3867D42C2C/GUID-41AA4058-4528-3AB7-9084-AA6053AF0656"><apiname>AsspRegister::Read16(TLinAddr aAddr)</apiname></xref></entry>
<entry>TUint16</entry>
<entry>Return the contents of a 16-bit register.</entry>
</row>
<row>
<entry><xref href="GUID-66BB033A-3386-3913-9A25-EF3867D42C2C.dita#GUID-66BB033A-3386-3913-9A25-EF3867D42C2C/GUID-E637527E-537A-367D-91C2-A3BB3AA0A587"><apiname>AsspRegister::Read32(TLinAddr aAddr)</apiname></xref></entry>
<entry>TUint32</entry>
<entry>Return the contents of a 32-bit register.</entry>
</row>
<row>
<entry><xref href="GUID-66BB033A-3386-3913-9A25-EF3867D42C2C.dita#GUID-66BB033A-3386-3913-9A25-EF3867D42C2C/GUID-05FADA8D-5B77-39C6-A939-5EB1B209DD53"><apiname>AsspRegister::Read64(TLinAddr aAddr)</apiname></xref></entry>
<entry>TUint64</entry>
<entry>Return the contents of a 64-bit register.</entry>
</row>
<row>
<entry><xref href="GUID-66BB033A-3386-3913-9A25-EF3867D42C2C.dita#GUID-66BB033A-3386-3913-9A25-EF3867D42C2C/GUID-CB85C4D4-3652-311E-808A-048A43F49F3E"><apiname>AsspRegister::Write8(TLinAddr aAddr, TUint8 aValue)</apiname></xref></entry>
<entry>void</entry>
<entry>Store a new value in an 8-bit register.</entry>
</row>
<row>
<entry><xref href="GUID-66BB033A-3386-3913-9A25-EF3867D42C2C.dita#GUID-66BB033A-3386-3913-9A25-EF3867D42C2C/GUID-C20B9119-AAC8-354B-902A-B4349AEFC00E"><apiname>AsspRegister::Write16(TLinAddr aAddr, TUint16 aValue)</apiname></xref></entry>
<entry>void</entry>
<entry>Store a new value in a 16-bit register.</entry>
</row>
<row>
<entry><xref href="GUID-66BB033A-3386-3913-9A25-EF3867D42C2C.dita#GUID-66BB033A-3386-3913-9A25-EF3867D42C2C/GUID-E18C1674-47EA-3B70-9BEE-55302D58F83B"><apiname>AsspRegister::Write32(TLinAddr aAddr, TUint32 aValue)</apiname></xref></entry>
<entry>void</entry>
<entry>Store a new value in a 32-bit register.</entry>
</row>
<row>
<entry><xref href="GUID-66BB033A-3386-3913-9A25-EF3867D42C2C.dita#GUID-66BB033A-3386-3913-9A25-EF3867D42C2C/GUID-99D3233D-8F1C-3A65-BC1F-F10998728EB8"><apiname>AsspRegister::Write64(TLinAddr aAddr, TUint64 aValue)</apiname></xref></entry>
<entry>void</entry>
<entry>Store a new value in a 64-bit register.</entry>
</row>
<row>
<entry><xref href="GUID-66BB033A-3386-3913-9A25-EF3867D42C2C.dita#GUID-66BB033A-3386-3913-9A25-EF3867D42C2C/GUID-3E66E373-E7DB-3F59-B6B1-3577AAD9FBF0"><apiname>AsspRegister::Modify8(TLinAddr aAddr, TUint8 aClearMask,
TUint8 aSetMask)</apiname></xref></entry>
<entry>void</entry>
<entry>Modify the contents of an 8-bit register.</entry>
</row>
<row>
<entry><xref href="GUID-66BB033A-3386-3913-9A25-EF3867D42C2C.dita#GUID-66BB033A-3386-3913-9A25-EF3867D42C2C/GUID-9A6FF0D8-1136-3188-8D85-43EF8919FA7C"><apiname>AsspRegister::Modify16(TLinAddr aAddr, TUint16 aClearMask,
TUint16 aSetMask)</apiname></xref></entry>
<entry>void</entry>
<entry>Modify the contents of a 16-bit register.</entry>
</row>
<row>
<entry><xref href="GUID-66BB033A-3386-3913-9A25-EF3867D42C2C.dita#GUID-66BB033A-3386-3913-9A25-EF3867D42C2C/GUID-035D2133-037A-36C5-B47C-A6FD00FEE3BA"><apiname>AsspRegister::Modify32(TLinAddr aAddr, TUint32 aClearMask,
TUint32 aSetMask)</apiname></xref></entry>
<entry>void</entry>
<entry>Modify the contents of a 32-bit register.</entry>
</row>
<row>
<entry><xref href="GUID-66BB033A-3386-3913-9A25-EF3867D42C2C.dita#GUID-66BB033A-3386-3913-9A25-EF3867D42C2C/GUID-7127519C-305D-3727-898F-860023CE586A"><apiname>AsspRegister::Modify64(TLinAddr aAddr, TUint64 aClearMask,
TUint64 aSetMask)</apiname></xref></entry>
<entry>void</entry>
<entry>Modify the contents of a 64-bit register.</entry>
</row>
</tbody>
</tgroup>
</table> <p>All these functions can be called in any context. </p> <p>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 <codeph>aAddr</codeph> argument of these functions
as a <codeph>TLinAddr</codeph>. </p> <p>The write functions take an
unsigned integer (<codeph>TUint8</codeph>, <codeph>TUint16</codeph>, <codeph>TUint32</codeph> or <codeph>TUint64</codeph>) as the value
of the parameter <codeph>aValue</codeph>.</p> <p>The modify functions
take two unsigned integers (<codeph>TUint8</codeph>, <codeph>TUint16</codeph>, <codeph>TUint32</codeph> or <codeph>TUint64</codeph>) as arguments.
Both the parameters, <codeph>aClearMask</codeph> and <codeph>aSetMask</codeph>, are bitmasks. The <codeph>aClearMask</codeph> argument clears the
bits specified and the <codeph>aSetMask</codeph> sets the bits specified. </p> <b>Addressing a register</b><p>The following code reads the current
value of a hardware register identified by a base address <codeph>iBaseAddr</codeph> plus an offset <codeph>KHoPciStatus</codeph>. </p><codeblock id="GUID-6308D594-B74D-50EE-A3EB-D8739371E46B" xml:space="preserve">TUint status=AsspRegister::Read16(iBaseAddr+KHoPciStatus);</codeblock><b>Modifying a register</b><p>The following code clears the bits
specified by the bitmask <codeph>KHtPciStatus_ParityError</codeph> and sets the bits specified by the bitmask <codeph>NULL</codeph> (that is so say, none in this case). </p><codeblock id="GUID-F000597B-1B52-5C3F-B61E-6B5B88D859C7" xml:space="preserve">AsspRegister::Modify16(baseAddr+KHoPciStatus,KHtPciStatus_ParityError,NULL);</codeblock></section>
</conbody><related-links>
<link href="GUID-3722B946-07CF-4AEA-B228-E50642D6B5BE.dita"><linktext>Register
Access Implementation Guide</linktext></link>
</related-links></concept>