omap3530/assp/inc/omap3530_assp_priv.h
changeset 0 6663340f3fc9
equal deleted inserted replaced
-1:000000000000 0:6663340f3fc9
       
     1 // Copyright (c) 2004-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 // omap3530/assp/inc/omap3530_assp_priv.h
       
    15 //
       
    16 
       
    17 #ifndef __OMAP3530_PRIV_H__
       
    18 #define __OMAP3530_PRIV_H__
       
    19 
       
    20 #include <e32const.h>
       
    21 #include <arm.h>
       
    22 #include <assp.h>
       
    23 #include <assp/omap3530_assp/omap3530_irqmap.h>
       
    24 #include <assp/omap3530_assp/omap3530_timer.h>
       
    25 #include <assp/omap3530_assp/omap3530_uart.h>
       
    26 
       
    27 /**
       
    28 * IRQ/FIQ dispatchers
       
    29 */
       
    30 static void IrqDispatch();
       
    31 static void FiqDispatch();
       
    32 
       
    33 class TArmCpuId {
       
    34 public:
       
    35 	TInt Implementor;		// Indicates the implementor, ARM:
       
    36 	TInt Variant; 			//Indicates the variant number, or major revision, of the processor:
       
    37 	TInt Architecture; 		//Indicates that the architecture is given in the feature registers:
       
    38 	TInt Primary; 			//part number Indicates the part number, Cortex-A8:
       
    39 	TInt Revision;
       
    40 };
       
    41 
       
    42 class Omap3530Interrupt : public Interrupt
       
    43 	{
       
    44 public:
       
    45 	/**
       
    46 	 * These functions are required to initialise the Interrupt controller,or perform housekeeping
       
    47 	 * functions, or dispatch the incoming IRQ or FIQ interrupts.
       
    48 	 */
       
    49 
       
    50 	/**
       
    51 	 * initialisation
       
    52 	 */
       
    53 	static void Init1();
       
    54 	static void Init3();
       
    55 
       
    56 	/**
       
    57 	 * Housekeeping (disable and clear all hardware interrupt sources)
       
    58 	 */
       
    59 	static void DisableAndClearAll();
       
    60 	IMPORT_C static TInt IsInterruptEnabled(TInt anId);
       
    61 	static void dumpINTCState();	
       
    62 	static void dumpIVTState();
       
    63 	static TInt GetRegisterAndBitOffset(TInt anId,TInt &aReg,TInt &aOffset);
       
    64 	static void Spurious(TAny* anId);
       
    65 
       
    66 	static SInterruptHandler Handlers[KNumOmap3530Ints];
       
    67 
       
    68 	TSpinLock Omap3530INTCLock;
       
    69 	TSpinLock Omap3530IVTLock;
       
    70 private:
       
    71 
       
    72 
       
    73 	};
       
    74 
       
    75 
       
    76 
       
    77 class Omap3530Assp : public Asic
       
    78 	{
       
    79 public:
       
    80 	IMPORT_C Omap3530Assp();
       
    81 
       
    82 public:
       
    83 	IMPORT_C virtual TInt MsTickPeriod();
       
    84 	/**
       
    85 	 * Obtain System Time from the RTC
       
    86 	 * @return System Time in seconds from 00:00 hours of 1/1/2000
       
    87 	 */
       
    88 	virtual TInt SystemTimeInSecondsFrom2000(TInt& aTime)=0;
       
    89 	/**
       
    90 	 * Obtain Adjust the RTC with new System Time (from 00:00 hours of 1/1/2000)
       
    91 	 * @return System wide error code
       
    92 	 */
       
    93 	virtual TInt SetSystemTimeInSecondsFrom2000(TInt aTime)=0;
       
    94 	/**
       
    95 	 * Obtain the time it takes to execute two processor instructions
       
    96 	 * @return Time in nanoseconds it takes two execute 2 instructions at the processor clock speed
       
    97 	 */
       
    98 	IMPORT_C virtual TUint32 NanoWaitCalibration();
       
    99 	
       
   100 	/**
       
   101 	 * initialisation
       
   102 	 */
       
   103 	IMPORT_C virtual void Init1();
       
   104 	IMPORT_C virtual void Init3();
       
   105 	/**
       
   106 	 * Active waiting loop (not to be used after System Tick timer has been set up - Init3()
       
   107 	 * @param aDuration A wait time in milliseconds
       
   108 	 */	
       
   109 	IMPORT_C static void BootWaitMilliSeconds(TInt aDuration);
       
   110 	/**
       
   111 	 * Read and return the Startup reason of the Hardware
       
   112 	 * @return A TMachineStartupType enumerated value
       
   113 	 */	
       
   114 	IMPORT_C virtual TMachineStartupType StartupReason();
       
   115 	/**
       
   116 	 * Read and return the the CPU ID
       
   117 	 * @return An integer containing the CPU ID string read off the hardware
       
   118 	 */	
       
   119 	IMPORT_C static void ArmCpuVersionId(TArmCpuId &id);
       
   120 	/**
       
   121 	 * Get debug port number enumeration
       
   122 	 * @return An integer containing the Omap3530Uart::TUartNumber value, with value ENone if debug port isn't a UART
       
   123 	 */	
       
   124 	IMPORT_C static Omap3530Uart::TUartNumber DebugPortNumber();
       
   125 	/**
       
   126 	 * Read CPU clock period in picoseconds
       
   127 	 * @return An integer containing the CPU clock period in picoseconds
       
   128 	 */	
       
   129 	IMPORT_C static TUint ProcessorPeriodInPs();
       
   130 	/**
       
   131 	 * Read the current time of the RTC
       
   132 	 * @return A value that is the real time as given by a RTC
       
   133 	 */	
       
   134 	//IMPORT_C static TUint RtcData();
       
   135 	/**
       
   136 	 * Set the RTC time 
       
   137 	 * @param aValue The real time to set the RTC
       
   138 	 */	
       
   139 	//IMPORT_C static void SetRtcData(TUint aValue);
       
   140 	/**
       
   141 	 * Obtain the physical start address of Video Buffer
       
   142 	 * @return the physical start address of Video Buffer
       
   143 	 */	
       
   144 					 
       
   145 	IMPORT_C static  TUint64 GetXtalFrequency();
       
   146 
       
   147 private:
       
   148 	/**
       
   149 	 * Assp-specific implementation for Kern::NanoWait function
       
   150 	 */
       
   151 	static void NanoWait(TUint32 aInterval);
       
   152 	TInt StartMsTick();
       
   153 	static void MsTickIsr(TAny* aPtr);
       
   154 	
       
   155 
       
   156 public:
       
   157 	/**
       
   158 	 * for derivation by Variant
       
   159 	 */
       
   160 
       
   161 	/**
       
   162 	 * external interrupt handling
       
   163 	 * used by second-level interrupt controllers at Variant level
       
   164 	 */
       
   165 	virtual TInt InterruptBind(TInt anId, TIsr anIsr, TAny* aPtr)=0;
       
   166 	virtual TInt InterruptUnbind(TInt anId)=0;
       
   167 	virtual TInt InterruptEnable(TInt anId)=0;
       
   168 	virtual TInt InterruptDisable(TInt anId)=0;
       
   169 	virtual TInt InterruptClear(TInt anId)=0;
       
   170 	virtual TInt IsExternalInterrupt(TInt anId)=0;
       
   171 
       
   172 	/**
       
   173 	 * USB client controller - Some example functions for the case that USB cable detection and
       
   174 	 * UDC connect/disconnect functionality are part of the Variant.
       
   175 	 * Pure virtual functions called by the USB PSL, to be implemented by the Variant (derived class).
       
   176 	 * If this functionality is part of the ASSP then these functions can be removed and calls to them
       
   177 	 * in the PSL (./pa_usbc.cpp) replaced by the appropriate internal operations.
       
   178 	 */
       
   179 	virtual TBool UsbClientConnectorDetectable()=0;
       
   180 	virtual TBool UsbClientConnectorInserted()=0;
       
   181 	virtual TInt RegisterUsbClientConnectorCallback(TInt (*aCallback)(TAny*), TAny* aPtr)=0;
       
   182 	virtual void UnregisterUsbClientConnectorCallback()=0;
       
   183 	virtual TBool UsbSoftwareConnectable()=0;
       
   184 	virtual TInt UsbConnect()=0;
       
   185 	virtual TInt UsbDisconnect()=0;
       
   186 
       
   187 	/** Return the frequency in Hz of the SYSCLK source clock */
       
   188 	virtual TUint SysClkFrequency() const = 0;
       
   189 
       
   190 	/** Return the frequency in Hz of the SYSCLK32K source clock */
       
   191 	virtual TUint SysClk32kFrequency() const = 0;
       
   192 
       
   193 	/** Return the frequency in Hz of the ALTCLK source clock */
       
   194 	virtual TUint AltClkFrequency() const = 0;
       
   195 
       
   196 public:
       
   197 	static Omap3530Assp * 											Variant;
       
   198 	TBool															iDebugInitialised;
       
   199 
       
   200 private:
       
   201 	};
       
   202 
       
   203 #endif