navienginebsp/naviengine_assp/lcdgce/lcdgce.h
changeset 0 5de814552237
equal deleted inserted replaced
-1:000000000000 0:5de814552237
       
     1 /*
       
     2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 * naviengine_assp\lcdgce\lcdgce.h
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 /**
       
    22  @file Definitions for the ne1_tb GCE PDD
       
    23  @internalTechnology
       
    24  @prototype
       
    25 */
       
    26 
       
    27 #ifndef __LCDGCE_H__
       
    28 #define __LCDGCE_H__
       
    29 
       
    30 #include <display.h>
       
    31 
       
    32 
       
    33 const TUint   KVSyncEnable 					= 1<<1;
       
    34 const TUint64 KVSyncDisable 				= ~(TUint64)(KVSyncEnable) ;
       
    35 const TUint   KVSyncClear 					= 1<<1;
       
    36 const TUint   KVSyncStatus 					= 1<<1;
       
    37 const TUint   KVSyncSelectToChannel1		= 1<<8;
       
    38 
       
    39 const TUint   KHex8 						= 0x8;
       
    40 
       
    41 
       
    42 /* The available display modes.
       
    43 	These modes can be changed by software, but the initial mode is specified by
       
    44 	DSW1 DIP switch settings (7 & 8) as described in the table below:
       
    45 
       
    46 DSW1 | 7 8 |
       
    47 -----------------------------------------------------------------------------------------------------
       
    48      | 0 0 | 640 x 480 | D-SUB       | landscape |  VGA on analog 15 pin DSUB connector
       
    49      | 0 1 | 800 x 480 | NEC LCD     | landscape | WVGA
       
    50      | 1 0 | 480 x 640 | Hitachi LCD | portrait  |  VGA (LCD switches: SW4=0111, SW5=0, SW6=0, SW7=0)
       
    51      | 1 1 | 320 x 240 | D-SUB       | landscape | QVGA on analog 15 pin DSUB connector
       
    52 */
       
    53 enum TVideoMode
       
    54 	{
       
    55 	DISPLAY_MODE_ANALOG_VGA   = 0,
       
    56 	DISPLAY_MODE_HITACHI_VGA,
       
    57 	DISPLAY_MODE_ANALOG_QVGA_LANDSCAPE_OLD,
       
    58 	DISPLAY_MODE_HITACHI_QVGA,
       
    59 	DISPLAY_MODE_NEC_WVGA,
       
    60 	DISPLAY_MODE_ANALOG_QVGA_PORTRAIT,
       
    61 	DISPLAY_MODE_ANALOG_QVGA_LANDSCAPE,
       
    62 
       
    63 	DISPLAY_NUM_MODES
       
    64 	};
       
    65 
       
    66 inline TInt ReadDipSwitchDisplayMode()
       
    67 	{
       
    68 	// Check the IDMODE register for DIP switch settings
       
    69 	// to set the requested display mode
       
    70 	// Read bits 12 and 13 from IDMODE register to get the LCD mode
       
    71 	TUint switches = (AsspRegister::Read32(KHwIDMODE) & KHmLcdSwitches) >> KHsLcdSwitches;
       
    72 
       
    73 	TInt mode = 0;
       
    74 	switch (switches)
       
    75 		{
       
    76 		default:
       
    77 		case 0:
       
    78 			mode = DISPLAY_MODE_ANALOG_VGA;
       
    79 			break;
       
    80 		case 1:
       
    81 			mode = DISPLAY_MODE_HITACHI_VGA;
       
    82 			break;
       
    83 		case 2:
       
    84 			mode = DISPLAY_MODE_NEC_WVGA;
       
    85 			break;
       
    86 		case 3:
       
    87 			mode = DISPLAY_MODE_ANALOG_QVGA_LANDSCAPE;
       
    88 			break;
       
    89 			// An alternative case 3 line for QVGA Portrait
       
    90 			//		case 3: iInitialMode = DISPLAY_MODE_ANALOG_QVGA_PORTRAIT;   break;
       
    91 		}
       
    92 	return mode;
       
    93 	}
       
    94 
       
    95 /********************************************************************/
       
    96 /* Class Definition                                                 */
       
    97 /********************************************************************/
       
    98 /**
       
    99  * This class defines a callback mechanism that is used by a resource user to specify its callback. It contains a
       
   100  * function pointer and data pointer. The function pointer specifies the user callback function to be invoked by the
       
   101  * resource while the data pointer specifies the data to be passed to the callback function.
       
   102  */
       
   103 class TLcdUserCallBack
       
   104     {
       
   105 public:
       
   106     // The constructor for the callback mechanism.
       
   107     TLcdUserCallBack(TInt (*aFunction)(TUint aResID, TAny* aPtr), TAny* aPtr)
       
   108 
       
   109         {
       
   110         iCbFn = aFunction;
       
   111         iDataPtr = aPtr;
       
   112         }
       
   113 
       
   114 public:
       
   115     // The callback function pointer.
       
   116     TInt (*iCbFn)(TUint aResID, TAny* aPtr);
       
   117 
       
   118     // Pointer to the data structure to be passed to the callback function.
       
   119     TAny *iDataPtr;
       
   120     };
       
   121 
       
   122 
       
   123 /**
       
   124  PDD Factory class
       
   125  */
       
   126 
       
   127 class DDisplayPddFactory : public DPhysicalDevice
       
   128 	{
       
   129 public:
       
   130 	DDisplayPddFactory();
       
   131 
       
   132 	virtual TInt Install();
       
   133 	virtual void GetCaps(TDes8& aDes) const;
       
   134 	virtual TInt Create(DBase*& aChannel, TInt aUnit, const TDesC8* aInfo, const TVersion& aVer);
       
   135 	virtual TInt Validate(TInt aDeviceType, const TDesC8* anInfo, const TVersion& aVer);
       
   136 	};
       
   137 
       
   138 
       
   139 
       
   140 class DDisplayPddNaviEng : public DDisplayPdd
       
   141 	{
       
   142 
       
   143 	public:
       
   144 	DDisplayPddNaviEng();
       
   145 	~DDisplayPddNaviEng();
       
   146 
       
   147 
       
   148    	//Inherited from DDisplayPdd
       
   149    	TInt  		SetLegacyMode();
       
   150     TInt  		SetGceMode();
       
   151     TInt  		SetRotation(RDisplayChannel::TDisplayRotation aRotation);
       
   152 
       
   153 	TInt  		PostUserBuffer(TBufferNode* aNode);
       
   154 	TInt  		PostCompositionBuffer(TBufferNode* aNode);
       
   155     TInt  		PostLegacyBuffer();
       
   156 
       
   157     TBool 		PostPending();
       
   158 
       
   159     TInt  		CloseMsg();
       
   160     TInt  	 	CreateChannelSetup(TInt aUnit);
       
   161     TDfcQue*	DfcQ(TInt  aUnit);
       
   162 
       
   163 public:
       
   164 	void  VSyncIsr();
       
   165 	static void VSyncDfcFn(TAny* aChannel);
       
   166 
       
   167 
       
   168 
       
   169 private:
       
   170 	TDfcQue* 		iDfcQ;
       
   171 
       
   172     //generic  display info
       
   173 	TVideoInfoV01    	iScreenInfo;
       
   174 
       
   175     //Pointer to a buffer in the Pending state
       
   176     TBufferNode*     	iPendingBuffer;
       
   177 
       
   178      //Pointer to a buffer in the Active state
       
   179     TBufferNode*     	iActiveBuffer;
       
   180 
       
   181     DChunk * 		 	iChunk;
       
   182     TLcdUserCallBack*   iLcdCallback;
       
   183 
       
   184  public:
       
   185 	TDfc 		     	iVSyncDfc;
       
   186 
       
   187 	};
       
   188 
       
   189 
       
   190 //
       
   191 // Add any private functions and data you require
       
   192 //
       
   193 NONSHARABLE_CLASS(DLcdPowerHandler) : public DPowerHandler
       
   194 	{
       
   195 public:
       
   196 	DLcdPowerHandler();
       
   197 
       
   198 	// from DPowerHandler
       
   199 	void PowerDown(TPowerState);
       
   200 	void PowerUp();
       
   201 
       
   202 	void PowerUpDfc();
       
   203 	void PowerDownDfc();
       
   204 
       
   205 	TInt Create();
       
   206 	void DisplayOn();
       
   207 	void DisplayOff();
       
   208 	TInt HalFunction(TInt aFunction, TAny* a1, TAny* a2);
       
   209 
       
   210 	void PowerUpLcd(TBool aSecure);
       
   211 	void PowerDownLcd();
       
   212 
       
   213 	void ScreenInfo(TScreenInfoV01& aInfo);
       
   214 	void WsSwitchOnScreen();
       
   215 	void WsSwitchOffScreen();
       
   216 	void HandleMsg(TMessageBase* aMsg);
       
   217 	void SwitchDisplay(TBool aSecure);
       
   218 
       
   219 	void SetBacklightState(TBool aState);
       
   220 	void BacklightOn();
       
   221 	void BacklightOff();
       
   222 	TInt SetContrast(TInt aContrast);
       
   223 	TInt HalSetContrast(TInt aContrast);
       
   224 	TInt SetBrightness(TInt aBrightness);
       
   225 	TInt HalSetBrightness(TInt aBrightness);
       
   226 	void SwitchToSecureDisplay();
       
   227 	void SwitchFromSecureDisplay();
       
   228 
       
   229 private:
       
   230 	TInt SetPaletteEntry(TInt aEntry, TInt aColor);
       
   231 	TInt GetPaletteEntry(TInt aEntry, TInt* aColor);
       
   232 	TInt NumberOfPaletteEntries();
       
   233 	TInt GetCurrentDisplayModeInfo(TVideoInfoV01& aInfo, TBool aSecure);
       
   234 	TInt GetSpecifiedDisplayModeInfo(TInt aMode, TVideoInfoV01& aInfo);
       
   235 	TInt SetDisplayMode(TInt aMode);
       
   236 	void SplashScreen();
       
   237 	TInt GetDisplayColors(TInt* aColors);
       
   238 
       
   239 public:
       
   240 	TInt InitialiseController();
       
   241 	static void Service(TAny* aPtr);
       
   242 
       
   243     IMPORT_C static    TInt    RegisterCallback(TLcdUserCallBack* aCbPtr);
       
   244     IMPORT_C static    void    DeRegisterCallback(TLcdUserCallBack* aCbPtr);
       
   245 
       
   246 private:
       
   247 	TBool 			iIsPalettized;
       
   248 	TBool 			iDisplayOn;				// to prevent a race condition with WServer trying to power up/down at the same time
       
   249 	DPlatChunkHw* 	iChunk;
       
   250 	DPlatChunkHw* 	iSecureChunk;
       
   251 	TBool 			iWsSwitchOnScreen;
       
   252  	TBool 			iSecureDisplay;
       
   253 
       
   254 	TDfc 			iPowerUpDfc;
       
   255 	TDfc 			iPowerDownDfc;
       
   256 
       
   257 	TVideoInfoV01 	iSecureVideoInfo;
       
   258 	NFastMutex 		iLock;				// protects against being preempted whilst manipulating iVideoInfo/iSecureVideoInfo
       
   259 	TPhysAddr 		ivRamPhys;
       
   260 	TPhysAddr 		iSecurevRamPhys;
       
   261 
       
   262 	TBool 			iBacklightOn;
       
   263 	TInt 			iContrast;
       
   264 	TInt 			iBrightness;
       
   265 	TUint 			iInitialMode;
       
   266 
       
   267 
       
   268 	TLcdUserCallBack * iAppCallBk[2];
       
   269 
       
   270 public:
       
   271 	TMessageQue 	iMsgQ;
       
   272 	TDfcQue* 		iDfcQ;
       
   273 	TVideoInfoV01 	iVideoInfo;
       
   274 	TInt			iSize;
       
   275 	TPhysAddr		iCompositionPhysical;
       
   276 
       
   277     static   DLcdPowerHandler 	* pLcd;
       
   278 
       
   279 	};
       
   280 
       
   281 
       
   282 //#define _GCE_NAVIDISPLAY_DEBUG
       
   283 
       
   284 #ifdef _GCE_NAVIDISPLAY_DEBUG
       
   285 
       
   286 #define  __GCE_DEBUG_PRINT(a) 		Kern::Printf(a)
       
   287 #define  __GCE_DEBUG_PRINT2(a,b) 	Kern::Printf(a,b)
       
   288 
       
   289 #else
       
   290 
       
   291 #define  __GCE_DEBUG_PRINT(a)
       
   292 #define  __GCE_DEBUG_PRINT2(a,b)
       
   293 
       
   294 #endif
       
   295 
       
   296 
       
   297 #endif //__LCDGCE_H__