williamr@2
|
1 |
// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
2 |
// All rights reserved.
|
williamr@2
|
3 |
// This component and the accompanying materials are made available
|
williamr@2
|
4 |
// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
|
williamr@2
|
5 |
// which accompanies this distribution, and is available
|
williamr@2
|
6 |
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
|
williamr@2
|
7 |
//
|
williamr@2
|
8 |
// Initial Contributors:
|
williamr@2
|
9 |
// Nokia Corporation - initial contribution.
|
williamr@2
|
10 |
//
|
williamr@2
|
11 |
// Contributors:
|
williamr@2
|
12 |
//
|
williamr@2
|
13 |
// Description:
|
williamr@2
|
14 |
// template\template_variant\inc\iolines.h
|
williamr@2
|
15 |
// Variant layer header for Template Platform
|
williamr@2
|
16 |
//
|
williamr@2
|
17 |
//
|
williamr@2
|
18 |
|
williamr@2
|
19 |
|
williamr@2
|
20 |
|
williamr@2
|
21 |
#ifndef __V32TEMPLATEV1_H__
|
williamr@2
|
22 |
#define __V32TEMPLATEV1_H__
|
williamr@2
|
23 |
#include <e32cmn.h>
|
williamr@2
|
24 |
#include <kpower.h>
|
williamr@2
|
25 |
|
williamr@2
|
26 |
//----------------------------------------------------------------------------
|
williamr@2
|
27 |
// Variant-specific constants: use #define if constant dependencies are not
|
williamr@2
|
28 |
// declared within this file (this breaks the dependency on other header files)
|
williamr@2
|
29 |
//----------------------------------------------------------------------------
|
williamr@2
|
30 |
|
williamr@2
|
31 |
// Examples of what goes in here include:
|
williamr@2
|
32 |
//
|
williamr@2
|
33 |
// - General-purpose I/O allocation such as
|
williamr@2
|
34 |
// #define KtVariantGpio32KHzClkOut KHtGpioPort1
|
williamr@2
|
35 |
// #define KtVariantGpioRClkOut KHtGpioPort0
|
williamr@2
|
36 |
//
|
williamr@2
|
37 |
// #define KmVariantPinDirectionIn Sleep 0
|
williamr@2
|
38 |
//
|
williamr@2
|
39 |
// - Memory constants (type, geometry, wait states, etc) such as:
|
williamr@2
|
40 |
// #define KwVariantRom0Type TTemplate::ERomTypeBurst4Rom
|
williamr@2
|
41 |
// #define KwVariantRom0Width TTemplate::ERomWidth32
|
williamr@2
|
42 |
// const TUint KwVariantRom0WaitNs = 150;
|
williamr@2
|
43 |
// const TUint KwVariantRom0PageNs = 30;
|
williamr@2
|
44 |
// const TUint KwVariantRom0RecoverNs = 55;
|
williamr@2
|
45 |
//
|
williamr@2
|
46 |
// - Specific Peripherals (Keyboard, LCD, CODECS, Serial Ports) such as
|
williamr@2
|
47 |
// const TUint KwVariantKeyColLshift = 7;
|
williamr@2
|
48 |
// #define KwVariantLcdBpp TTemplate::ELcd8BitsPerPixel
|
williamr@2
|
49 |
// const TUint KwVariantLcdMaxColors = 4096;
|
williamr@2
|
50 |
// const TUint KwVariantCodecMaxVolume = 0;
|
williamr@2
|
51 |
//
|
williamr@2
|
52 |
// - Off-chip hardware control blocks (addresses, register make-up)
|
williamr@2
|
53 |
//
|
williamr@2
|
54 |
// - Interrupts (second-level Interrupt controller base address, register make-up):
|
williamr@2
|
55 |
// (EXAMPLE ONLY:)
|
williamr@2
|
56 |
const TUint32 KHwVariantPhysBase = 0x40000000;
|
williamr@2
|
57 |
const TUint32 KHoVariantRegSpacing = 0x200;
|
williamr@2
|
58 |
|
williamr@2
|
59 |
const TUint32 KHoBaseIntCont = 0x0B*KHoVariantRegSpacing;
|
williamr@2
|
60 |
|
williamr@2
|
61 |
const TUint32 KHoIntContEnable = 0x00; // offsets from KHwVariantPhysBase+KHoBaseIntCont
|
williamr@2
|
62 |
const TUint32 KHoIntContPending = 0x04;
|
williamr@2
|
63 |
// other Variant and external blocks Base adrress offsets to KHwVariantPhysBase
|
williamr@2
|
64 |
|
williamr@2
|
65 |
|
williamr@2
|
66 |
// TO DO: (optional)
|
williamr@2
|
67 |
//
|
williamr@2
|
68 |
// Enumerate here all Variant (2nd level) interrupt sources. It could be a good idea to enumerate them in a way that
|
williamr@2
|
69 |
// facilitates operating on the corresponding interrupt controller registers (e.g using their value as a shift count)
|
williamr@2
|
70 |
//
|
williamr@2
|
71 |
// (EXAMPLE ONLY:)
|
williamr@2
|
72 |
enum TTemplateInterruptId
|
williamr@2
|
73 |
{
|
williamr@2
|
74 |
// the top-level bit is set to distinguish from first level (ASSP) Interrupts
|
williamr@2
|
75 |
EXIntIdA=0x80000000,
|
williamr@2
|
76 |
EXIntIdB=0x80000001,
|
williamr@2
|
77 |
// ...
|
williamr@2
|
78 |
EXIntIdZ=0x80000019,
|
williamr@2
|
79 |
|
williamr@2
|
80 |
ENumXInts=0x1A
|
williamr@2
|
81 |
};
|
williamr@2
|
82 |
|
williamr@2
|
83 |
//
|
williamr@2
|
84 |
// TO DO: (optional)
|
williamr@2
|
85 |
//
|
williamr@2
|
86 |
// Define here some commonly used Variant (2nd level) interrupts
|
williamr@2
|
87 |
//
|
williamr@2
|
88 |
// (EXAMPLE ONLY:)
|
williamr@2
|
89 |
const TInt KIntIdKeyboard=EXIntIdB;
|
williamr@2
|
90 |
|
williamr@2
|
91 |
class Variant
|
williamr@2
|
92 |
{
|
williamr@2
|
93 |
// below is a selection of functions usually implemented at this level. This do not constitute a mandatory
|
williamr@2
|
94 |
// set and it might not be relevant for your hardware...
|
williamr@2
|
95 |
public:
|
williamr@2
|
96 |
/**
|
williamr@2
|
97 |
* initialisation
|
williamr@2
|
98 |
*/
|
williamr@2
|
99 |
static void Init3();
|
williamr@2
|
100 |
/**
|
williamr@2
|
101 |
* Returns the Linear Base address of the Variant Hardware
|
williamr@2
|
102 |
*/
|
williamr@2
|
103 |
IMPORT_C static TUint BaseLinAddress();
|
williamr@2
|
104 |
/**
|
williamr@2
|
105 |
* When invoked, turns off all power supplies
|
williamr@2
|
106 |
*/
|
williamr@2
|
107 |
IMPORT_C static void PowerReset();
|
williamr@2
|
108 |
/**
|
williamr@2
|
109 |
* When invoked, it marks the Serial port used for outputting debug strings as requiring re-initialisation
|
williamr@2
|
110 |
* As in, for example, the serial port was used by a device driver or the system is coming back from Standby
|
williamr@2
|
111 |
*/
|
williamr@2
|
112 |
IMPORT_C static void MarkDebugPortOff();
|
williamr@2
|
113 |
/**
|
williamr@2
|
114 |
* When invoked, initialises the Serial Port hardware for the serial port used to output Debug strings
|
williamr@2
|
115 |
* Called by Template::DebugInit()
|
williamr@2
|
116 |
*/
|
williamr@2
|
117 |
IMPORT_C static void UartInit();
|
williamr@2
|
118 |
/**
|
williamr@2
|
119 |
* When invoked, read the state of on-board switches
|
williamr@2
|
120 |
* @return A bitmask with the state of on-board switches
|
williamr@2
|
121 |
*/
|
williamr@2
|
122 |
IMPORT_C static TUint Switches();
|
williamr@2
|
123 |
// other functions to access hardware not covered by specific device-drivres, which may be called from drivers
|
williamr@2
|
124 |
// or platform-specifc code
|
williamr@2
|
125 |
// ...
|
williamr@2
|
126 |
public:
|
williamr@2
|
127 |
static TUint32 iBaseAddress;
|
williamr@2
|
128 |
// (optional): May need to have a follower variable to store the value of a read only register initialised at boot time
|
williamr@2
|
129 |
// static TUint aFollower;
|
williamr@2
|
130 |
};
|
williamr@2
|
131 |
|
williamr@2
|
132 |
#endif
|