diff -r 578be2adaf3e -r 307f4279f433 Adaptation/GUID-3722B946-07CF-4AEA-B228-E50642D6B5BE.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Adaptation/GUID-3722B946-07CF-4AEA-B228-E50642D6B5BE.dita Fri Oct 15 14:32:18 2010 +0100 @@ -0,0 +1,85 @@ + + + + + +Register Access Implementation GuideDescribes the implementation of the Register Access platform +service. +

A ASSP hardware register is a physical interface to an item of +hardware which contains values, such as bit fields, for controlling +ASSP features.

+
ASSP

An ASSP (Application Specific Standard Product) is a class of +integrated circuit. Different ASSPs have different architectures and +instructions sets. The AsspRegister class provides device driver writers with a simple interface to +access ASSP registers. Hardware implementers must provide the specified +functionality on a given platform and ASSP by writing the appropriate +machine instructions.

+
Pre-requisites

Before the implementing a register access implementation, the +following must be decided:

    +
  • The area in memory to which the registers are mapped. The start +of this memory region is known as the base address.

  • +
  • The location of each register in terms of an offset from the +base address.

  • +

The above information will be present in a specific header +file which is used by any device driver that uses this API. This header +file also contains other information required to access the registers, +such as:

    +
  • constants for bit field offsets

  • +
  • bit field values

  • +
+
Implementation

To provide register access, hardware implementers need to implement +the AsspRegister class.

Generic access to a register is provided in the form of three +operations on a hardware register: read, write and modify. All these +functions can be called in any context.

Symbian platform provides +the class header and inline implementations of the 8, 16 and 32-bit +wide functions. You must implement all the register modify functions +and all functions to access 64-bit wide registers. You may also need +to replace the inline 8, 16 and 32-bit wide register read and write +functions if the ASSP contains write-only registers.

You must +implement these functions atomically so that there is no possibility +of another thread or interrupt service routine accessing the contents +of the register before the function returns. Where you cannot implement +the function with a single machine instruction you must disable interrupts +during the register operation (if you are working with a single core +architecture) or wrap a spinlock around the register operation (if +you are working with a multicore architecture).

There are +three cases in which you must enforce atomicity with interrupt disabled +or use of spinlocks.

    +
  • The modify operations +involve reading the register, taking a local copy, changing the local +copy and writing it back to the register and cannot be performed with +a single machine instruction.

  • +
  • Operations on +write-only registers involve maintaining a copy of the current contents +of the register within the AsspRegister class. All write and modify operations therefore cannot be performed +with a single machine instruction.

  • +
  • Some architectures +contain 64-bit registers. In this case, 64-bit operations involve +at least two machine instructions.

  • +

Baseport implementations of the Register Access platform service +come in the form of a ASSP library (or DLL). To avoid the need for +each device driver which uses the ASSP register class having to specify +a baseport specific library file corresponding to the ASSP library, +the name of the baseport specific library file should instead be included +in a file used to define other variant specific settings such as the +CPU core type, the memory model and the name of the variant. Each +baseport will have a file called variant.mmh, +where variant is the name of the baseport to be used. +An example of this being used in a variant.mmh file is:

#if defined(__USING_BASPORT__) +library VariantTarget(basport_name,assp_library) +#endif +baseport_name is the name of the variant and assp_library +is the name of the ASSP specific library file.

In order to +specify which baseport assp register set up is to be used in the client +projects for this baseport, the following line is included in the +MMP file of those projects

#define __USING_BASEPORT___
+
+ +SMP - Locking +
\ No newline at end of file