bsptemplate/asspandvariant/template_assp/template_assp_priv.h
changeset 0 a41df078684a
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // template\template_assp\template_assp_priv.h
       
    15 // Template ASSP architecture private header file
       
    16 // 
       
    17 // WARNING: This file contains some APIs which are internal and are subject
       
    18 //          to change without notice. Such APIs should therefore not be used
       
    19 //          outside the Kernel and Hardware Services package.
       
    20 //
       
    21 
       
    22 #ifndef __KA_TEMPLATE_H__
       
    23 #define __KA_TEMPLATE_H__
       
    24 #include <e32const.h>
       
    25 #include <arm.h>
       
    26 #include <assp.h>
       
    27 #include <template_assp.h>
       
    28 
       
    29 // Example only
       
    30 const TInt KNumTemplateInts=EAsspIntIdZ+1;
       
    31 
       
    32 class TemplateInterrupt : public Interrupt
       
    33 	{
       
    34 public:
       
    35 	/**
       
    36 	 * These functions are required to initialise the Interrupt controller,or perform housekeeping
       
    37 	 * functions, or dispatch the incoming IRQ or FIQ interrupts.
       
    38 	 */
       
    39 
       
    40 	/**
       
    41 	 * initialisation
       
    42 	 */
       
    43 	static void Init1();
       
    44 	static void Init3();
       
    45 	/**
       
    46 	 * IRQ/FIQ dispatchers
       
    47 	 */
       
    48 	static void IrqDispatch();
       
    49 	static void FiqDispatch();
       
    50 	/**
       
    51 	 * Housekeeping (disable and clear all hardware interrupt sources)
       
    52 	 */
       
    53 	static void DisableAndClearAll();
       
    54 	/**
       
    55 	 * Empty interrupt handler
       
    56 	 */
       
    57 	static void Spurious(TAny* anId);
       
    58 public:
       
    59 	static SInterruptHandler Handlers[KNumTemplateInts];
       
    60 	};
       
    61 
       
    62 class TemplateAssp : public Asic
       
    63 	{
       
    64 public:
       
    65 	IMPORT_C TemplateAssp();
       
    66 
       
    67 public:
       
    68 	/**
       
    69 	 * These are the mandatory Asic class functions which are implemented here rather than in the Variant.
       
    70 	 * It makes sense having an ASSP class when there is functionality at Variant/Core level which is common
       
    71 	 * to a group of devices and is provided by an IP block(s) which is likely to be used in future generations
       
    72 	 * of the same family of devices.
       
    73 	 * In general the common functionality includes first-level Interrupt controllers, Power and Reset controllers,
       
    74 	 * and timing functions
       
    75 	 */
       
    76 
       
    77 	/**
       
    78 	 * initialisation
       
    79 	 */
       
    80 	IMPORT_C virtual void Init1();
       
    81 	IMPORT_C virtual void Init3();
       
    82 	/**
       
    83 	 * Read and return the Startup reason of the Super Page (set up by Bootstrap)
       
    84 	 * @return A TMachineStartupType enumerated value
       
    85 	 * @see TMachineStartupType
       
    86 	 */
       
    87 	IMPORT_C virtual TMachineStartupType StartupReason();
       
    88 
       
    89 	/**
       
    90 	 * timing functions
       
    91 	 */
       
    92 
       
    93 	/**
       
    94 	 * Obtain the period of System Tick timer in microseconds
       
    95 	 * @return Period of System Tick timer in microseconds
       
    96 	 */
       
    97 	IMPORT_C virtual TInt MsTickPeriod();
       
    98 	/**
       
    99 	 * Obtain System Time from the RTC
       
   100 	 * @return System Time in seconds from 00:00 hours of 1/1/2000
       
   101 	 */
       
   102 	IMPORT_C virtual TInt SystemTimeInSecondsFrom2000(TInt& aTime);
       
   103 	/**
       
   104 	 * Obtain Adjust the RTC with new System Time (from 00:00 hours of 1/1/2000)
       
   105 	 * @return System wide error code
       
   106 	 */
       
   107 	IMPORT_C virtual TInt SetSystemTimeInSecondsFrom2000(TInt aTime);
       
   108 	/**
       
   109 	 * Obtain the time it takes to execute two processor instructions
       
   110 	 * @return Time in nanoseconds it takes two execute 2 instructions at the processor clock speed
       
   111 	 */
       
   112 	IMPORT_C virtual TUint32 NanoWaitCalibration();
       
   113 
       
   114 public:
       
   115 	/**
       
   116 	 * for derivation by Variant
       
   117 	 */
       
   118 
       
   119 	/**
       
   120 	 * external interrupt handling
       
   121 	 * used by second-level interrupt controllers at Variant level
       
   122 	 */
       
   123 	virtual TInt InterruptBind(TInt anId, TIsr anIsr, TAny* aPtr)=0;
       
   124 	virtual TInt InterruptUnbind(TInt anId)=0;
       
   125 	virtual TInt InterruptEnable(TInt anId)=0;
       
   126 	virtual TInt InterruptDisable(TInt anId)=0;
       
   127 	virtual TInt InterruptClear(TInt anId)=0;
       
   128 
       
   129 	/**
       
   130 	 * USB client controller - Some example functions for the case that USB cable detection and
       
   131 	 * UDC connect/disconnect functionality are part of the Variant.
       
   132 	 * Pure virtual functions called by the USB PSL, to be implemented by the Variant (derived class).
       
   133 	 * If this functionality is part of the ASSP then these functions can be removed and calls to them
       
   134 	 * in the PSL (./pa_usbc.cpp) replaced by the appropriate internal operations.
       
   135 	 */
       
   136 	virtual TBool UsbClientConnectorDetectable()=0;
       
   137 	virtual TBool UsbClientConnectorInserted()=0;
       
   138 	virtual TInt RegisterUsbClientConnectorCallback(TInt (*aCallback)(TAny*), TAny* aPtr)=0;
       
   139 	virtual void UnregisterUsbClientConnectorCallback()=0;
       
   140 	virtual TBool UsbSoftwareConnectable()=0;
       
   141 	virtual TInt UsbConnect()=0;
       
   142 	virtual TInt UsbDisconnect()=0;
       
   143 
       
   144 	/**
       
   145 	 * miscellaneous
       
   146 	 */
       
   147 	virtual TInt VideoRamSize()=0;
       
   148 
       
   149 public:
       
   150 	static TemplateAssp* Variant;
       
   151 	static TPhysAddr VideoRamPhys;
       
   152 	NTimerQ* iTimerQ;
       
   153 	};
       
   154 
       
   155 #endif