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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // omap3530/assp/inc/omap3530_assp_priv.h
17 #ifndef __OMAP3530_PRIV_H__
18 #define __OMAP3530_PRIV_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>
30 static void IrqDispatch();
31 static void FiqDispatch();
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:
42 class Omap3530Interrupt : public Interrupt
46 * These functions are required to initialise the Interrupt controller,or perform housekeeping
47 * functions, or dispatch the incoming IRQ or FIQ interrupts.
57 * Housekeeping (disable and clear all hardware interrupt sources)
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);
66 static SInterruptHandler Handlers[KNumOmap3530Ints];
68 TSpinLock Omap3530INTCLock;
69 TSpinLock Omap3530IVTLock;
77 class Omap3530Assp : public Asic
80 IMPORT_C Omap3530Assp();
83 IMPORT_C virtual TInt MsTickPeriod();
85 * Obtain System Time from the RTC
86 * @return System Time in seconds from 00:00 hours of 1/1/2000
88 virtual TInt SystemTimeInSecondsFrom2000(TInt& aTime)=0;
90 * Obtain Adjust the RTC with new System Time (from 00:00 hours of 1/1/2000)
91 * @return System wide error code
93 virtual TInt SetSystemTimeInSecondsFrom2000(TInt aTime)=0;
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
98 IMPORT_C virtual TUint32 NanoWaitCalibration();
103 IMPORT_C virtual void Init1();
104 IMPORT_C virtual void Init3();
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
109 IMPORT_C static void BootWaitMilliSeconds(TInt aDuration);
111 * Read and return the Startup reason of the Hardware
112 * @return A TMachineStartupType enumerated value
114 IMPORT_C virtual TMachineStartupType StartupReason();
116 * Read and return the the CPU ID
117 * @return An integer containing the CPU ID string read off the hardware
119 IMPORT_C static void ArmCpuVersionId(TArmCpuId &id);
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
124 IMPORT_C static Omap3530Uart::TUartNumber DebugPortNumber();
126 * Read CPU clock period in picoseconds
127 * @return An integer containing the CPU clock period in picoseconds
129 IMPORT_C static TUint ProcessorPeriodInPs();
131 * Read the current time of the RTC
132 * @return A value that is the real time as given by a RTC
134 //IMPORT_C static TUint RtcData();
137 * @param aValue The real time to set the RTC
139 //IMPORT_C static void SetRtcData(TUint aValue);
141 * Obtain the physical start address of Video Buffer
142 * @return the physical start address of Video Buffer
145 IMPORT_C static TUint64 GetXtalFrequency();
149 * Assp-specific implementation for Kern::NanoWait function
151 static void NanoWait(TUint32 aInterval);
153 static void MsTickIsr(TAny* aPtr);
158 * for derivation by Variant
162 * external interrupt handling
163 * used by second-level interrupt controllers at Variant level
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;
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.
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;
187 /** Return the frequency in Hz of the SYSCLK source clock */
188 virtual TUint SysClkFrequency() const = 0;
190 /** Return the frequency in Hz of the SYSCLK32K source clock */
191 virtual TUint SysClk32kFrequency() const = 0;
193 /** Return the frequency in Hz of the ALTCLK source clock */
194 virtual TUint AltClkFrequency() const = 0;
197 static Omap3530Assp * Variant;
198 TBool iDebugInitialised;