|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. --> |
|
3 <!-- This component and the accompanying materials are made available under the terms of the License |
|
4 "Eclipse Public License v1.0" which accompanies this distribution, |
|
5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". --> |
|
6 <!-- Initial Contributors: |
|
7 Nokia Corporation - initial contribution. |
|
8 Contributors: |
|
9 --> |
|
10 <!DOCTYPE concept |
|
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
|
12 <concept id="GUID-3722B946-07CF-4AEA-B228-E50642D6B5BE" xml:lang="en"><title>Register Access Implementation Guide</title><shortdesc>Describes the implementation of the Register Access platform |
|
13 service.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
14 <p>A ASSP hardware register is a physical interface to an item of |
|
15 hardware which contains values, such as bit fields, for controlling |
|
16 ASSP features.</p> |
|
17 <section id="GUID-514E76B0-009C-48D4-935C-FBE48FDD3631-GENID-1-2-1-10-1-5-1-8-1-1-9-1-4-1-3-2"><title>ASSP</title><p> An ASSP (Application Specific Standard Product) is a class of |
|
18 integrated circuit. Different ASSPs have different architectures and |
|
19 instructions sets. The <xref href="GUID-66BB033A-3386-3913-9A25-EF3867D42C2C.dita"><apiname>AsspRegister</apiname></xref> class provides device driver writers with a simple interface to |
|
20 access ASSP registers. Hardware implementers must provide the specified |
|
21 functionality on a given platform and ASSP by writing the appropriate |
|
22 machine instructions. </p></section> |
|
23 <section id="GUID-DBEB025D-B457-493B-A052-274801C21B1E"><title>Pre-requisites</title><p>Before the implementing a register access implementation, the |
|
24 following must be decided:</p><ul> |
|
25 <li><p>The area in memory to which the registers are mapped. The start |
|
26 of this memory region is known as the base address.</p></li> |
|
27 <li><p>The location of each register in terms of an offset from the |
|
28 base address.</p></li> |
|
29 </ul><p>The above information will be present in a specific header |
|
30 file which is used by any device driver that uses this API. This header |
|
31 file also contains other information required to access the registers, |
|
32 such as:</p><ul> |
|
33 <li><p>constants for bit field offsets</p></li> |
|
34 <li><p>bit field values</p></li> |
|
35 </ul></section> |
|
36 <section id="GUID-CF41655A-5B14-47C4-811A-C9F9352B0688"><title>Implementation</title><p>To provide register access, hardware implementers need to implement |
|
37 the <xref href="GUID-66BB033A-3386-3913-9A25-EF3867D42C2C.dita"><apiname>AsspRegister</apiname></xref> class. </p><p>Generic access to a register is provided in the form of three |
|
38 operations on a hardware register: read, write and modify. All these |
|
39 functions can be called in any context. </p><p>Symbian platform provides |
|
40 the class header and inline implementations of the 8, 16 and 32-bit |
|
41 wide functions. You must implement all the register modify functions |
|
42 and all functions to access 64-bit wide registers. You may also need |
|
43 to replace the inline 8, 16 and 32-bit wide register read and write |
|
44 functions if the ASSP contains write-only registers. </p> <p>You must |
|
45 implement these functions atomically so that there is no possibility |
|
46 of another thread or interrupt service routine accessing the contents |
|
47 of the register before the function returns. Where you cannot implement |
|
48 the function with a single machine instruction you must disable interrupts |
|
49 during the register operation (if you are working with a single core |
|
50 architecture) or wrap a spinlock around the register operation (if |
|
51 you are working with a multicore architecture). </p> <p>There are |
|
52 three cases in which you must enforce atomicity with interrupt disabled |
|
53 or use of spinlocks. </p> <ul> |
|
54 <li id="GUID-3D835089-4626-584F-9FB1-EBD9CBF7A8D0"><p>The modify operations |
|
55 involve reading the register, taking a local copy, changing the local |
|
56 copy and writing it back to the register and cannot be performed with |
|
57 a single machine instruction. </p> </li> |
|
58 <li id="GUID-939FFD27-60EB-5465-95B7-A3654FBB5941"><p>Operations on |
|
59 write-only registers involve maintaining a copy of the current contents |
|
60 of the register within the <xref href="GUID-66BB033A-3386-3913-9A25-EF3867D42C2C.dita"><apiname>AsspRegister</apiname></xref> class. All write and modify operations therefore cannot be performed |
|
61 with a single machine instruction. </p> </li> |
|
62 <li id="GUID-26D38D30-DFF3-5DCD-8163-157A228C50D6"><p>Some architectures |
|
63 contain 64-bit registers. In this case, 64-bit operations involve |
|
64 at least two machine instructions. </p> </li> |
|
65 </ul><p>Baseport implementations of the Register Access platform service |
|
66 come in the form of a ASSP library (or DLL). To avoid the need for |
|
67 each device driver which uses the ASSP register class having to specify |
|
68 a baseport specific library file corresponding to the ASSP library, |
|
69 the name of the baseport specific library file should instead be included |
|
70 in a file used to define other variant specific settings such as the |
|
71 CPU core type, the memory model and the name of the variant. Each |
|
72 baseport will have a file called <filepath>variant.mmh</filepath>, |
|
73 where <codeph>variant</codeph> is the name of the baseport to be used. |
|
74 An example of this being used in a <filepath>variant.mmh</filepath> file is:</p><codeblock xml:space="preserve">#if defined(__USING_BASPORT__) |
|
75 library VariantTarget(basport_name,assp_library) |
|
76 #endif |
|
77 </codeblock><note>baseport_name is the name of the variant and assp_library |
|
78 is the name of the ASSP specific library file.</note><p>In order to |
|
79 specify which baseport assp register set up is to be used in the client |
|
80 projects for this baseport, the following line is included in the |
|
81 MMP file of those projects</p><codeblock xml:space="preserve">#define __USING_BASEPORT___</codeblock></section> |
|
82 </conbody><related-links> |
|
83 <link href="http://developer.symbian.org/main/documentation/reference/s3/pdk/GUID-16AED228-539F-4BF7-A7FD-9A01FF1A9A84.html.dita"> |
|
84 <linktext>SMP - Locking</linktext></link> |
|
85 </related-links></concept> |