epoc32/include/beagle/iolines.h
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 2fe1408b6811
child 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/beagle/iolines.h	Wed Mar 31 12:27:01 2010 +0100
     1.3 @@ -0,0 +1,132 @@
     1.4 +// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// 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
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// template\template_variant\inc\iolines.h
    1.18 +// Variant layer header for Template Platform
    1.19 +// 
    1.20 +//
    1.21 +
    1.22 +
    1.23 +
    1.24 +#ifndef __V32TEMPLATEV1_H__
    1.25 +#define __V32TEMPLATEV1_H__
    1.26 +#include <e32cmn.h>
    1.27 +#include <kpower.h>
    1.28 +
    1.29 +//----------------------------------------------------------------------------
    1.30 +// Variant-specific constants: use #define if constant dependencies are not
    1.31 +// declared within this file (this breaks the dependency on other header files)
    1.32 +//----------------------------------------------------------------------------
    1.33 +
    1.34 +// Examples of what goes in here include:
    1.35 +//
    1.36 +// - General-purpose I/O allocation such as 
    1.37 +//	 #define KtVariantGpio32KHzClkOut		KHtGpioPort1
    1.38 +//	 #define KtVariantGpioRClkOut			KHtGpioPort0
    1.39 +//
    1.40 +//	 #define KmVariantPinDirectionIn Sleep	0
    1.41 +//
    1.42 +// - Memory constants (type, geometry, wait states, etc) such as:
    1.43 +//	 #define KwVariantRom0Type				TTemplate::ERomTypeBurst4Rom
    1.44 +//	 #define KwVariantRom0Width				TTemplate::ERomWidth32
    1.45 +//	 const TUint KwVariantRom0WaitNs		= 150;
    1.46 +//	 const TUint KwVariantRom0PageNs		= 30;
    1.47 +//	 const TUint KwVariantRom0RecoverNs		= 55;
    1.48 +//
    1.49 +// - Specific Peripherals (Keyboard, LCD, CODECS, Serial Ports) such as 
    1.50 +//	 const TUint KwVariantKeyColLshift		= 7;
    1.51 +//	 #define KwVariantLcdBpp				TTemplate::ELcd8BitsPerPixel
    1.52 +//   const TUint KwVariantLcdMaxColors		= 4096;
    1.53 +//   const TUint KwVariantCodecMaxVolume	= 0;
    1.54 +//
    1.55 +// - Off-chip hardware control blocks (addresses, register make-up)
    1.56 +//
    1.57 +// - Interrupts (second-level Interrupt controller base address, register make-up):
    1.58 +//   (EXAMPLE ONLY:)
    1.59 +const TUint32 KHwVariantPhysBase		=	0x40000000;
    1.60 +const TUint32 KHoVariantRegSpacing		=	0x200;
    1.61 +
    1.62 +const TUint32 KHoBaseIntCont			=	0x0B*KHoVariantRegSpacing;
    1.63 +
    1.64 +const TUint32 KHoIntContEnable			=	0x00;		// offsets from KHwVariantPhysBase+KHoBaseIntCont
    1.65 +const TUint32 KHoIntContPending			=	0x04;
    1.66 +// other Variant and external blocks Base adrress offsets to KHwVariantPhysBase
    1.67 +
    1.68 +
    1.69 +// TO DO: (optional)
    1.70 +//
    1.71 +// Enumerate here all Variant (2nd level)  interrupt sources. It could be a good idea to enumerate them in a way that 
    1.72 +// facilitates operating on the corresponding interrupt controller registers (e.g using their value as a shift count)
    1.73 +//
    1.74 +//   (EXAMPLE ONLY:)
    1.75 +enum TTemplateInterruptId
    1.76 +	{
    1.77 +	// the top-level bit is set to distinguish from first level (ASSP) Interrupts
    1.78 +	EXIntIdA=0x80000000,
    1.79 +	EXIntIdB=0x80000001,
    1.80 +	// ...
    1.81 +	EXIntIdZ=0x80000019,
    1.82 +
    1.83 +	ENumXInts=0x1A
    1.84 +	};
    1.85 +
    1.86 +//
    1.87 +// TO DO: (optional)
    1.88 +//
    1.89 +// Define here some commonly used Variant (2nd level) interrupts
    1.90 +//
    1.91 +//   (EXAMPLE ONLY:)
    1.92 +const TInt KIntIdKeyboard=EXIntIdB;
    1.93 +
    1.94 +class Variant
    1.95 +    {
    1.96 +	// below is a selection of functions usually implemented  at this level. This do not constitute a mandatory
    1.97 +	// set and it might not be relevant for your hardware...
    1.98 +public:
    1.99 +	/**
   1.100 +	 * initialisation
   1.101 +	 */
   1.102 +	static void Init3();
   1.103 +	/**
   1.104 +	 * Returns the Linear Base address of the Variant Hardware
   1.105 +	 */
   1.106 +	IMPORT_C static TUint BaseLinAddress();
   1.107 +	/**
   1.108 +	 * When invoked, turns off all power supplies
   1.109 +	 */
   1.110 +	IMPORT_C static void PowerReset();
   1.111 +	/**
   1.112 +	 * When invoked, it marks the Serial port used for outputting debug strings as requiring re-initialisation
   1.113 +	 * As in, for example, the serial port was used by a device driver or the system is coming back from Standby
   1.114 +	 */
   1.115 +	IMPORT_C static void MarkDebugPortOff();
   1.116 +	/**
   1.117 +	 * When invoked, initialises the Serial Port hardware for the serial port used to output Debug strings
   1.118 +	 * Called by Template::DebugInit()
   1.119 +	 */
   1.120 +	IMPORT_C static void UartInit();
   1.121 +	/**
   1.122 +	 * When invoked, read the state of on-board switches
   1.123 +	 * @return A bitmask with the state of on-board switches
   1.124 +	 */
   1.125 +	IMPORT_C static TUint Switches();
   1.126 +	// other functions to access hardware not covered by specific device-drivres, which may be called from drivers
   1.127 +	// or platform-specifc code
   1.128 +	// ...
   1.129 +public:
   1.130 +	static TUint32 iBaseAddress;
   1.131 +	// (optional): May need to have a follower variable to store the value of a read only register initialised at boot time
   1.132 +	// static TUint aFollower;
   1.133 +    };
   1.134 +
   1.135 +#endif