navienginebsp/naviengine_assp/naviengine_lcd.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\naviengine_lcd.h
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #ifndef __NAVIENGINE_LCD_H__
       
    22 #define __NAVIENGINE_LCD_H__
       
    23 #include <e32const.h>
       
    24 #include <platform.h>
       
    25 #include <e32hal.h>
       
    26 #include <assp.h>
       
    27 #include <kernel/kern_priv.h>
       
    28 
       
    29 
       
    30 
       
    31 // Macro to calculate the screen buffer size
       
    32 // aBpp is the number of bits-per-pixel, aPpl is the number of pixels per line and aLpp number of lines per panel
       
    33 #define FRAME_BUFFER_SIZE(aBpp,aPpl,aLpp)	(aBpp*aPpl*aLpp)/8	
       
    34 																
       
    35 
       
    36 //----------------------------------------------------------------------------
       
    37 //Display Controller registers
       
    38 //----------------------------------------------------------------------------
       
    39 
       
    40 // ------------------------------
       
    41 // Interface control registers
       
    42 // ------------------------------
       
    43 
       
    44 const TUint KHoDisplayInterfaceControl 			= 0x00;			//!!!
       
    45 const TUint KHwDisplayInterfaceControl 			= KHwDisplayBase + KHoDisplayInterfaceControl;
       
    46 	//DE		- positive logic
       
    47 	//EVSYNC	- negative logic
       
    48 	//VSYNC		- negative logic
       
    49 	//EHSYNC	- negative logic
       
    50 	//HSYNC		- negative logic
       
    51 	//Dot clock normal polarity
       
    52 	//Switch on VSync, HSync, CSync, DEN
       
    53 	const TUint KInterfaceControlValue 			= 0x04;
       
    54 const TUint KHoDisplayInterruptStatus			= 0x08;
       
    55 const TUint KHwDisplayInterruptStatus			= KHwDisplayBase + KHoDisplayInterruptStatus;
       
    56 const TUint KHoDisplayInterruptClear 			= 0x10;
       
    57 const TUint KHwDisplayInterruptClear 			= KHwDisplayBase + KHoDisplayInterruptClear;
       
    58 const TUint KHoDisplayInterruptEnable 			= 0x18;
       
    59 const TUint KHwDisplayInterruptEnable 			= KHwDisplayBase + KHoDisplayInterruptEnable;
       
    60 const TUint KHoDisplayInterruptLineSettings 	= 0x20; 	//???
       
    61 const TUint KHwDisplayInterruptLineSettings		= KHwDisplayBase + KHoDisplayInterruptLineSettings; 	//???
       
    62 	// ic_al_h???
       
    63 const TUint KHoDisplayInterruptEnableSelection	= 0x28;
       
    64 const TUint KHwDisplayInterruptEnableSelection	= KHwDisplayBase + KHoDisplayInterruptEnableSelection;
       
    65 
       
    66 
       
    67 // ------------------------------
       
    68 // Display control registers
       
    69 // ------------------------------
       
    70 
       
    71 const TUint KHoDisplayResolutionAndCycle 		= 0x30;		//!!!
       
    72 const TUint KHwDisplayResolutionAndCycle 		= KHwDisplayBase + KHoDisplayResolutionAndCycle;
       
    73 	//ds_hr[10:0] - Sets the horizontal (width) resolution. The valid range is 320 (QVGA) to 1280 (WXGA).
       
    74 	//ds_vr[25:16] - Sets the vertical (height) resolution. The valid range is 240 (QVGA) to 800 (WXGA).
       
    75 	//ds_th[42:32] - Sets HSYNC in dot clock units. ds_hr + 3 to 7FEh (7FFh is prohibited).
       
    76 	//ds_tv[57:48] - Sets VSYNC in line units. ds_vr + 3 to 3FEh (3FFh is prohibited).
       
    77 
       
    78 	#define DISPLAY_RESOLUTION_AND_CYCLE(height, width, linesInFrame, pixelsInLine)	(((height<<16) + width) | ((TUint64) ((linesInFrame<<16) + (pixelsInLine)) <<32))
       
    79 
       
    80 
       
    81 const TUint KHoDisplayPulseWidth 				= 0x38;		//!!!
       
    82 const TUint KHwDisplayPulseWidth 				= KHwDisplayBase + KHoDisplayPulseWidth;
       
    83 	//ds_thp[10:0] - Sets the HSYNC pulse width in dot clock units. Set these bits so that the total blank period is 3 clocks or more.
       
    84 	//ds_tvp[25:16] - Sets the VSYNC pulse width in line units. Set these bits so that the total blank period is 3H or more.
       
    85 	//ds_thb[42:32] - Sets the HSYNC back porch width in dot clock units.
       
    86 	//ds_tvb[57:48] - Sets the VSYNC back porch width in line units.
       
    87 
       
    88 	//settings for LCD QVGA mode
       
    89 	//	const TUint KPulseWidthLow 				= (3<<16)+25;  // SW4-2 OFF 
       
    90 	//	const TUint KPulseWidthHigh				= (3<<16)+38;  // SW4-2 OFF
       
    91 	const TUint KPulseWidthLow 					= (2<<16)+25;  // SW4-2 ON -on some VGA monitors it doesn't show the whole area
       
    92 	const TUint KPulseWidthHigh 				= (2<<16)+14;  // SW4-2 ON   
       
    93 	const TUint64 KPulseWidth 					= KPulseWidthLow | ((TUint64)KPulseWidthHigh <<32);
       
    94 
       
    95 	//settings for Hitachi LCD VGA mode
       
    96 	const TUint KPulseWidthLowVgaLCD 			= (2<<16)+30;
       
    97 	const TUint KPulseWidthHighVgaLCD 			= 0x00020030;
       
    98 	const TUint64 KPulseWidthVgaLCD 			= KPulseWidthLowVgaLCD | ((TUint64)KPulseWidthHighVgaLCD <<32);	
       
    99 
       
   100 	//settings for NEC LCD WVGA mode
       
   101 	const TUint KPulseWidthLowWvga 				= (2<<16)+30;	// RMH - xxx - magic numbers!!!
       
   102 	const TUint KPulseWidthHighWvga 			= 0x000A0000;	// RMH - xxx - magic numbers!!! 0a seems to be a vertical offset, with 02 being too small and 21 being too large; the last two digits, now 00, were 30 seem to be the horizintal offset...
       
   103 	const TUint64 KPulseWidthWvga 				= KPulseWidthLowWvga | ((TUint64)KPulseWidthHighWvga <<32);	
       
   104 
       
   105 	//settings for VGA mode on monitor (if LCD panel is not present)
       
   106 	const TUint KPulseWidthLowVga 				= (2<<16)+96;
       
   107 	const TUint KPulseWidthHighVga 				= 0x00210030;
       
   108 	const TUint64 KPulseWidthVga 				= KPulseWidthLowVga | ((TUint64)KPulseWidthHighVga <<32);
       
   109 
       
   110 const TUint KHoDisplayDisplaySettings 			= 0x40;	//!!!
       
   111 const TUint KHwDisplaySettings 					= KHwDisplayBase + KHoDisplayDisplaySettings;
       
   112 		//ds_oc[0] - Sets on/off of display output to LCD panel;  0 - Off (Black output if sync signal is output); 1 - On
       
   113 		//gamma correction and dithering
       
   114 	const TUint KDisplaySettingsValue 			= 0x1;
       
   115 
       
   116 
       
   117 const TUint KHoDisplayDithering 				= 0x48;
       
   118 const TUint KHwDisplayDithering 				= KHwDisplayBase + KHoDisplayDithering;
       
   119 const TUint KHoDisplayBrightness 				= 0x50;		//!!!
       
   120 const TUint KHwDisplayBrightness 				= KHwDisplayBase + KHoDisplayBrightness;
       
   121 
       
   122 	//ds_bc[7:0] Sets the brightness coefficient for RGB data. The range is -128 to 127 (8 bits). To turn off brightness control, set to 0.
       
   123 	const TUint KDisplayBrightnessVal 			= 0x00;		//!!!
       
   124 
       
   125 // ------------------------------
       
   126 // Memory Frame control registers
       
   127 // ------------------------------
       
   128 
       
   129 const TUint KHoDisplayEndianConversion 			= 0x58;		//!!!
       
   130 const TUint KHwDisplayEndianConversion 			= KHwDisplayBase + KHoDisplayEndianConversion;
       
   131 
       
   132 	//mf_es0[1::0] - endian conversion of data in VRAM - should be 00b ???
       
   133 	//mf_lbs[25:24] = 0 -limits of layers and dimensions
       
   134 	const TUint KEndianConversionValue 			= 0x00;		//!!!
       
   135 
       
   136 
       
   137 //mf_pf0[3:0] Sets the pixel format of each memory frame stored in VRAM. 0h: ARGB0565
       
   138 const TUint KHoDisplayPixelFormat 				= 0x60;			//!!!
       
   139 const TUint KHwDisplayPixelFormat 				= KHwDisplayBase + KHoDisplayPixelFormat;
       
   140 
       
   141 const TUint KPixelFormatValue16bpp 				= 0x0;	// ARGB0565
       
   142 const TUint KPixelFormatValue32bpp 				= 0x4;	// ARGB8888
       
   143 const TUint KPixelFormatValue					= KPixelFormatValue32bpp; // Retain keyword and default to bpp32
       
   144 
       
   145 
       
   146 //mf_sa0[31:0]  - Sets the start address of the memory frame stored in VRAM, in byte units.
       
   147 //mf_sa1[63:32] - Sets the start address of the memory frame stored in VRAM, in byte units.
       
   148 const TUint KHoDisplayMemoryFrameAddress 		= 0x0070;			//!!!
       
   149 const TUint KHwDisplayMemoryFrameAddress 		= KHwDisplayBase + KHoDisplayMemoryFrameAddress;
       
   150 
       
   151 
       
   152 // physical address in VRAM
       
   153 const TUint KHoDisplayColorPalletAddress 		= 0x90;
       
   154 const TUint KHwDisplayColorPalletAddress		= KHwDisplayBase + KHoDisplayColorPalletAddress;
       
   155 
       
   156 	
       
   157 const TUint KHoDisplayColorPalletDirection 		= 0xA0;
       
   158 const TUint KHwDisplayColorPalletDirection		= KHwDisplayBase + KHoDisplayColorPalletDirection;
       
   159 
       
   160 const TUint KHoDisplayMemoryFrameSizeH 			= 0xA8;	//!!!
       
   161 const TUint KHwDisplayMemoryFrameSizeH 			= KHwDisplayBase + KHoDisplayMemoryFrameSizeH;
       
   162 
       
   163 	// mf_ws_h0[11:0] - horisontal(width) size in byte units. The valid setting range is 1 to 4,096 at 0 to 4,095.
       
   164 
       
   165 	// Usually the width value - 1, eg for 640 pixels wide, use 639
       
   166 
       
   167 const TUint KHoDisplayMemoryFrameSizeV 			= 0xB8;	//!!!
       
   168 const TUint KHwDisplayMemoryFrameSizeV 			= KHwDisplayBase + KHoDisplayMemoryFrameSizeV;
       
   169 
       
   170 	// mf_ws_v0[11:0] - vertical(height) size in line units
       
   171 
       
   172 	// Usually the height value - 1, eg for 480 pixels high, use 479
       
   173 
       
   174 const TUint KHoDisplayMemoryFrameStartPointX	= 0xc8;	//!!!
       
   175 const TUint KHwDisplayMemoryFrameStartPointX	= KHwDisplayBase + KHoDisplayMemoryFrameStartPointX;
       
   176 //mf_sp_x0[11:0] -	Sets the horizontal-direction start point coordinates of the
       
   177 //					frame memory stored in VRAM, in pixel units
       
   178 
       
   179 const TUint KHoDisplayMemoryFrameStartPointY	= 0xd8;	//!!!
       
   180 const TUint KHwDisplayMemoryFrameStartPointY	= KHwDisplayBase + KHoDisplayMemoryFrameStartPointY;
       
   181 //mf_sp_y0[11:0] -	Sets the vertical-direction start point coordinates of the
       
   182 //					frame memory stored in VRAM, in line units.
       
   183 
       
   184 const TUint KHoDisplayMemoryFrameStartFractionV		= 0xe8;
       
   185 const TUint KHwDisplayMemoryFrameStartFractionV		= KHwDisplayBase + KHoDisplayMemoryFrameStartFractionV;
       
   186 
       
   187 const TUint KHoDisplayMemoryFrameDisplayFrameSizeH 	= 0xf0;	//!!!
       
   188 const TUint KHwDisplayMemoryFrameDisplayFrameSizeH	= KHwDisplayBase + KHoDisplayMemoryFrameDisplayFrameSizeH;
       
   189 
       
   190 	//mf_ds_h0[11:0] - Sets display frame horizontal-direction size in the memory
       
   191 	//					frame, in pixel units. The valid setting range is 1 to 1,280 at 0 to 1,279.
       
   192 
       
   193 	// Usually the width value - 1, eg for 640 pixels wide, use 639
       
   194 
       
   195 
       
   196 const TUint KHoDisplayMemoryFrameDisplayFrameSizeV	= 0x100;	//!!!
       
   197 const TUint KHwDisplayMemoryFrameDisplayFrameSizeV	= KHwDisplayBase + KHoDisplayMemoryFrameDisplayFrameSizeV;
       
   198 
       
   199 	//mf_ds_v0[11:0] - Sets display frame vertical-direction size in the memory
       
   200 	//					frame, in line units. The valid setting range is 1 to 800 at 0 to 799.
       
   201 
       
   202 	// Usually the height value - 1, eg for 480 pixels high, use 479
       
   203 	
       
   204 		
       
   205 
       
   206 const TUint KHoDisplayBorderColourRGB	= 0x110;	//!!!
       
   207 const TUint KHwDisplayBorderColourRGB	= KHwDisplayBase + KHoDisplayBorderColourRGB;	//!!!
       
   208 
       
   209 	//!!!
       
   210 	//mf_bc0[23:0]	- Sets the border color value. Correspondence of mf_bcX[23:0] is as shown in Figure 2-6-22.
       
   211 	//mf_bc_s0[28] - Sets the border color format for the corresponding layer.
       
   212 	//						0: Format set by mf_pf0 (memory frame pixel format)
       
   213 	//						1: ARGB0888
       
   214 
       
   215 
       
   216 // ------------------------------
       
   217 // Display frame control registers	
       
   218 // ------------------------------
       
   219 
       
   220 // NOTE: KH*DisplayDisplay is done on purpose because KH*Display is the prefix and the next Display is part of the register name!
       
   221 
       
   222 const TUint KHoDisplayDisplayFrameControl			= 0x130;	//!!!
       
   223 const TUint KHwDisplayDisplayFrameControl			= KHwDisplayBase + KHoDisplayDisplayFrameControl;
       
   224 	//df_dc0[3:0] - Sets whether a layer is to be displayed according to a priority.7 - is off
       
   225 	//df_vs0[8] - Selects the contents of VRAM or register to be displayed.
       
   226 	//				0: VRAM
       
   227 	//				1: Register (Value of constant color (df_cc_r, df_cc_g, and df_cc_b) registers is displayed.)
       
   228 	//df_lc0[12] - Sets layer on/off. (Stops access to VRAM.) Display can be turned off by df_dc0, but
       
   229 	// 				access to VRAM is not stopped. To accurately turn off display, use this register
       
   230 
       
   231 	// Values to set layers 0-3 frame control on and fix their priority.
       
   232 	const TUint64 KDisplayFrameControlValue 		= (1<<12);
       
   233 	const TUint64 KDisplayFrame1ControlValue 		= (1<<28) | (0x1<<16);
       
   234 	const TUint64 KDisplayFrame2ControlValue 		= ((TInt64)1<<44) | ((TInt64)0x2<<32) ;
       
   235 	const TUint64 KDisplayFrame3ControlValue 		= ((TInt64)1<<60) | ((TInt64)0x3<<48) ;  
       
   236 
       
   237 
       
   238 const TUint KHoDisplayDisplayFrameStartPointX 		= 0x140;	//!!!
       
   239 const TUint KHwDisplayDisplayFrameStartPointX 		= KHwDisplayBase + KHoDisplayDisplayFrameStartPointX;
       
   240 	//df_sp_x0[11:0] - Sets the horizontal-direction start point coordinates to be
       
   241 	//					displayed, in pixel units. The valid setting range is -2,048 to 2,047.
       
   242 
       
   243 const TUint KHoDisplayDisplayFrameStartPointY		= 0x150;	//!!!
       
   244 const TUint KHwDisplayDisplayFrameStartPointY		= KHwDisplayBase + KHoDisplayDisplayFrameStartPointY;
       
   245 	//df_sp_y0[11:0] - Sets the vertical-direction start point coordinates to be
       
   246 	//					displayed, in line units. The valid setting range is -2,048 to 2,047.
       
   247 
       
   248 const TUint KHoDisplayDisplayFrameSizeH 			= 0x160;	//!!!
       
   249 const TUint KHwDisplayDisplayFrameSizeH 			= KHwDisplayBase + KHoDisplayDisplayFrameSizeH;
       
   250 	//df_ds_h0[10:0] - Sets the horizontal size to be displayed in pixel units.
       
   251 	//					The valid setting range is 1 to 1,280 at 0 to 1,279
       
   252 
       
   253 const TUint KHoDisplayDisplayFrameSizeV 			= 0x170;	//!!!
       
   254 const TUint KHwDisplayDisplayFrameSizeV 			= KHwDisplayBase + KHoDisplayDisplayFrameSizeV;
       
   255 	//df_ds_v0[10:0] - Sets the vertical size to be displayed in line units. The valid setting range is 1-800 at 0-799.
       
   256 	//					Caution Ignored depending on the setting of mf_ms_v (memory frame, magnification select, V0, V2,V4)
       
   257 
       
   258 const TUint KHoDisplayDisplayFrameExpansionRateH 	= 0x180;
       
   259 const TUint KHwDisplayDisplayFrameExpansionRateH 	= KHwDisplayBase + KHoDisplayDisplayFrameExpansionRateH;
       
   260 	// df_rc_h0[12:0] - set to 0
       
   261 
       
   262 const TUint KHoDisplayDisplayFrameExpansionRateV 	= 0x190;
       
   263 const TUint KHwDisplayDisplayFrameExpansionRateV 	= KHwDisplayBase + KHoDisplayDisplayFrameExpansionRateV;
       
   264 	// df_rc_v0[12:0] - set to 0
       
   265 
       
   266 const TUint KHoDisplayDisplayFramePixelTransmittance			= 0x1a0;
       
   267 const TUint KHwDisplayDisplayPixelTransmittance					= KHwDisplayBase + KHoDisplayDisplayFramePixelTransmittance;
       
   268 const TUint KHoDisplayDisplayFrameTranCtrlLayerTransmittance	= 0x1b0;
       
   269 const TUint KHwDisplayDisplayTranCtrlLayerTransmittance			= KHwDisplayBase + KHoDisplayDisplayFrameTranCtrlLayerTransmittance;
       
   270 	//Display frames 0 to 6 transmission control layer transmittance
       
   271 
       
   272 const TUint KHoDisplayDisplayFrameColourKeyControl		= 0x1c0;
       
   273 const TUint KHwDisplayDisplayColourKeyControl			= KHwDisplayBase + KHoDisplayDisplayFrameColourKeyControl;
       
   274 	// Display frames color key control and color key R, G, B format instruction
       
   275 
       
   276 const TUint KHoDisplayDisplayFrameColourKey				= 0x1c8;
       
   277 const TUint KHwDisplayDisplayColourKey					= KHwDisplayBase + KHoDisplayDisplayFrameColourKey;
       
   278 
       
   279 const TUint KHoDisplayDisplayFrameColourKeyControlRange = 0x1e8;
       
   280 const TUint KHwDisplayDisplayColourKeyControlRange		= KHwDisplayBase + KHoDisplayDisplayFrameColourKeyControlRange;
       
   281 	// Display frame color key control R, G, B permissible range
       
   282 
       
   283 const TUint KHoDisplayDisplayFrameConstantColour		= 0x1f8;	//!!!
       
   284 const TUint KHwDisplayDisplayFrameConstantColour		= KHwDisplayBase + KHoDisplayDisplayFrameConstantColour;
       
   285 	//Sets the constant colours rgb 
       
   286 
       
   287 const TUint KHoDisplayDisplayFrameBackgroundColour		= 0x218;	//!!!
       
   288 const TUint KHwDisplayDisplayFrameBackgroundColour		= KHwDisplayBase + KHoDisplayDisplayFrameBackgroundColour;
       
   289 	// df_bc_r[23:16], df_bc_g[15:8] & df_bc_b[7:0]
       
   290 
       
   291 
       
   292 // 220 CDE
       
   293 
       
   294 // ------------------------------
       
   295 // (5) H/W cursor control register
       
   296 // ------------------------------
       
   297 
       
   298 //	...
       
   299 
       
   300 // ------------------------------
       
   301 // (6) V blank update control register
       
   302 // ------------------------------
       
   303 
       
   304 
       
   305 // If the display supports Contrast and/or Brightness control then supply the following defines:
       
   306 // This is only example code... you may need to modify it for your hardware
       
   307 const TInt KConfigInitialDisplayContrast	= 128;
       
   308 const TInt KConfigLcdMinDisplayContrast		= 1;
       
   309 const TInt KConfigLcdMaxDisplayContrast		= 255;
       
   310 const TInt KConfigInitialDisplayBrightness	= 128;
       
   311 const TInt KConfigLcdMinDisplayBrightness	= 1;
       
   312 const TInt KConfigLcdMaxDisplayBrightness	= 255;
       
   313 
       
   314 #endif //__NAVIENGINE_LCD_H__