omap3530/beagle_drivers/lcd/lcd.cpp
author arunabha
Tue, 20 Apr 2010 17:06:04 +0100
changeset 32 161f6b2f6990
parent 21 524118fd998f
child 78 0d34a4aa948d
child 87 cf5d4fe2473f
permissions -rwxr-xr-x
Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
     1
// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
     2
// All rights reserved.
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
     3
// This component and the accompanying materials are made available
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
     4
// under the terms of the License "Eclipse Public License v1.0"
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
     5
// which accompanies this distribution, and is available
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
     7
//
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
     8
// Initial Contributors:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
     9
// Nokia Corporation - initial contribution.
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    10
//
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    11
// Contributors:
32
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
    12
// iwanj@users.sourceforge.net added NGA support based on Syborg display PDD
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
    13
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    14
// Description:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    15
// omap3530/beagle_drivers/lcd/lcd.cpp
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    16
// Implementation of an LCD driver. 
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    17
// This file is part of the Beagle Base port
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    18
// N.B. This sample code assumes that the display supports setting the backlight on or off, 
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    19
// as well as adjusting the contrast and the brightness.
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    20
//
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    21
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    22
#include <videodriver.h>
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    23
#include <platform.h>
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    24
#include <nkern.h>
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    25
#include <kernel.h>
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    26
#include <kern_priv.h>
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    27
#include <kpower.h>
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    28
#include <assp/omap3530_assp/omap3530_assp_priv.h>
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    29
#include <assp/omap3530_assp/omap3530_hardware_base.h>
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    30
#include <assp/omap3530_assp/omap3530_prcm.h>
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    31
32
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
    32
//#undef __KTRACE_OPT
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
    33
//#define __KTRACE_OPT(c,p)	p
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
    34
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    35
#define DSS_SYSCONFIG				0x48050010
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    36
#define DISPC_SYSSTATUS				0x48050414
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    37
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    38
#define DISPC_SYSCONFIG				0x48050410
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    39
#define DISPC_CONFIG				0x48050444
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    40
#define DISPC_DEFAULT_COLOR0		0x4805044c
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    41
#define DISPC_TRANS_COLOR0			0x48050454
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    42
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    43
#define DISPC_TIMING_H				0x48050464
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    44
#define DISPC_TIMING_V				0x48050468
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    45
#define DISPC_POL_FREQ				0x4805046c
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    46
#define DISPC_DIVISOR				0x48050470
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    47
#define DISPC_SIZE_LCD				0x4805047c
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    48
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    49
#define DISPC_GFX_BA1				0x48050480
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    50
#define DISPC_GFX_BA2				0x48050484
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    51
#define DISPC_GFX_POSITION			0x48050488
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    52
#define DISPC_GFX_SIZE				0x4805048c
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    53
#define DISPC_GFX_ATTRIBUTES		0x480504a0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    54
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    55
#define DISPC_GFX_FIFO_THRESHOLD	0x480504a4
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    56
#define DISPC_GFX_FIFO_SIZE_STATUS	0x480504a8
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    57
#define DISPC_GFX_ROW_INC			0x480504ac
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    58
#define DISPC_GFX_PIXEL_INC			0x480504b0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    59
#define DISPC_GFX_WINDOW_SKIP		0x480504b4
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    60
#define DISPC_GFX_TABLE_BA			0x480504b8
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    61
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    62
#define DISPC_CONTROL				0x48050440
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    63
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    64
#define GET_REGISTER(Reg)		*( (TUint *) Omap3530HwBase::TVirtual<Reg>::Value )
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    65
#define SET_REGISTER(Reg,Val)	*( (TUint *) Omap3530HwBase::TVirtual<Reg>::Value ) = Val
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    66
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    67
#define _MODE_1280x1024_
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    68
//#define _MODE_1024x768_
32
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
    69
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    70
#ifdef _MODE_800x600_
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    71
// ModeLine       "800x600@60" 40.0 800 840 968 1056 600 601 605 628 +hsync +vsync
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    72
// Decoded by: http://www.tkk.fi/Misc/Electronics/faq/vga2rgb/calc.html
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    73
#	define PIXEL_CLK	40000
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    74
#	define H_DISP		800
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    75
#	define H_FPORCH	40
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    76
#	define H_SYNC		128
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    77
#	define H_BPORCH	88
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    78
#	define H_SYNC_POL	1
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    79
#	define V_DISP		600
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    80
#	define V_FPORCH	1
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    81
#	define V_SYNC		4
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    82
#	define V_BPORCH	23
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    83
#	define V_SYNC_POL	1
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    84
#	define INTERLACE_ENABLE	0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    85
#endif
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    86
#ifdef _MODE_1024x768_
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    87
// ModeLine       "1024x768@60" 65.0 1024 1048 1184 1344 768 771 777 806 -hsync -vsync
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    88
// Decoded by: http://www.tkk.fi/Misc/Electronics/faq/vga2rgb/calc.html
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    89
#	define PIXEL_CLK	65000
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    90
#	define H_DISP		1024
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    91
#	define H_FPORCH	24
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    92
#	define H_SYNC		136
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    93
#	define H_BPORCH	160
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    94
#	define H_SYNC_POL	0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    95
#	define V_DISP		768
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    96
#	define V_FPORCH	3
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    97
#	define V_SYNC		6
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    98
#	define V_BPORCH	29
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    99
#	define V_SYNC_POL	0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   100
#	define INTERLACE_ENABLE	0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   101
#endif
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   102
#ifdef _MODE_1280x1024_
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   103
// ModeLine "1280x1024@60" 108.0 1280 1328 1440 1688 1024 1025 1028 1066 +hsync +vsync
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   104
// Decoded by: http://www.tkk.fi/Misc/Electronics/faq/vga2rgb/calc.html
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   105
#	define PIXEL_CLK	108000
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   106
#	define H_DISP		1280
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   107
#	define H_FPORCH	48
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   108
#	define H_SYNC		112
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   109
#	define H_BPORCH	248
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   110
#	define H_SYNC_POL	1
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   111
#	define V_DISP		1024
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   112
#	define V_FPORCH	1
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   113
#	define V_SYNC		3
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   114
#	define V_BPORCH	38
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   115
#	define V_SYNC_POL	1
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   116
#	define INTERLACE_ENABLE	0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   117
#endif
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   118
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   119
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   120
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   121
// TO DO: (mandatory)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   122
// If the display supports Contrast and/or Brightness control then supply the following defines:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   123
// This is only example code... you may need to modify it for your hardware
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   124
const TInt KConfigInitialDisplayContrast	= 128;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   125
const TInt KConfigLcdMinDisplayContrast		= 1;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   126
const TInt KConfigLcdMaxDisplayContrast		= 255;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   127
const TInt KConfigInitialDisplayBrightness	= 128;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   128
const TInt KConfigLcdMinDisplayBrightness	= 1;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   129
const TInt KConfigLcdMaxDisplayBrightness	= 255;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   130
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   131
// TO DO: (mandatory)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   132
// define a macro to calculate the screen buffer size
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   133
// This is only example code... you may need to modify it for your hardware
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   134
// aBpp is the number of bits-per-pixel, aPpl is the number of pixels per line and 
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   135
// aLpp number of lines per panel
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   136
#define FRAME_BUFFER_SIZE(aBpp,aPpl,aLpp)	(aBpp*aPpl*aLpp)/8	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   137
																
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   138
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   139
// TO DO: (mandatory)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   140
// define the physical screen dimensions
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   141
// This is only example code... you need to modify it for your hardware
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   142
const TUint	KConfigLcdWidth					= 360;//640;		// 640 pixels per line
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   143
const TUint	KConfigLcdHeight				= 640;//480;		// 480 lines per panel
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   144
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   145
// TO DO: (mandatory)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   146
// define the characteristics of the LCD display
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   147
// This is only example code... you need to modify it for your hardware
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   148
const TBool	KConfigLcdIsMono				= EFalse;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   149
const TBool	KConfigLcdPixelOrderLandscape	= ETrue;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   150
const TBool	KConfigLcdPixelOrderRGB			= ETrue;
32
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   151
const TInt	KConfigLcdMaxDisplayColors		= 16777216;//65536;	//24bit: 16777216;
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   152
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   153
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   154
// TO DO: (mandatory)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   155
// define the display dimensions in TWIPs
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   156
// A TWIP is a 20th of a point.  A point is a 72nd of an inch
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   157
// Therefore a TWIP is a 1440th of an inch
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   158
// This is only example code... you need to modify it for your hardware
21
524118fd998f Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents: 0
diff changeset
   159
const TInt	KConfigLcdWidthInTwips			= 2670;		// = 6.69 inches	//15*1440;
524118fd998f Fixes for the Keyboard mapping , serial Mouse and the LCD drivers
arunabha
parents: 0
diff changeset
   160
const TInt	KConfigLcdHeightInTwips			= 3550;		//5616;		// = 5.11 inches	//12*1440;
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   161
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   162
// TO DO: (mandatory)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   163
// define the available display modes
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   164
// This is only example code... you need to modify it for your hardware
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   165
const TInt  KConfigLcdNumberOfDisplayModes	= 1;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   166
const TInt  KConfigLcdInitialDisplayMode	= 0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   167
struct SLcdConfig
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   168
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   169
	TInt iMode;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   170
	TInt iOffsetToFirstVideoBuffer;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   171
	TInt iLenghtOfVideoBufferInBytes;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   172
	TInt iOffsetBetweenLines;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   173
	TBool iIsPalettized;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   174
	TInt iBitsPerPixel;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   175
	};
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   176
static const SLcdConfig Lcd_Mode_Config[KConfigLcdNumberOfDisplayModes]=
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   177
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   178
		{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   179
		0,								// iMode
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   180
		0,								// iOffsetToFirstVideoBuffer
32
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   181
		FRAME_BUFFER_SIZE(32/*16*/, KConfigLcdWidth, KConfigLcdHeight),	// iLenghtOfVideoBufferInBytes
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   182
		KConfigLcdWidth*4,//2,				// iOffsetBetweenLines
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   183
		EFalse,							// iIsPalettized
32
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   184
		32,//16								// iBitsPerPixel
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   185
		}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   186
	};	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   187
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   188
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   189
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   190
_LIT(KLitLcd,"LCD");
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   191
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   192
//
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   193
// TO DO: (optional)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   194
//
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   195
// Add any private functions and data you require
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   196
//
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   197
NONSHARABLE_CLASS(DLcdPowerHandler) : public DPowerHandler
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   198
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   199
public: 
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   200
	DLcdPowerHandler();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   201
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   202
	// from DPowerHandler
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   203
	void PowerDown(TPowerState);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   204
	void PowerUp();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   205
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   206
	void PowerUpDfc();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   207
	void PowerDownDfc();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   208
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   209
	TInt Create();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   210
	void DisplayOn();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   211
	void DisplayOff();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   212
	TInt HalFunction(TInt aFunction, TAny* a1, TAny* a2);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   213
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   214
	void PowerUpLcd(TBool aSecure);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   215
	void PowerDownLcd();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   216
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   217
	void ScreenInfo(TScreenInfoV01& aInfo);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   218
	void WsSwitchOnScreen();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   219
	void WsSwitchOffScreen();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   220
	void HandleMsg();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   221
	void SwitchDisplay(TBool aSecure);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   222
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   223
	void SetBacklightState(TBool aState);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   224
	void BacklightOn();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   225
	void BacklightOff();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   226
	TInt SetContrast(TInt aContrast);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   227
	TInt SetBrightness(TInt aBrightness);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   228
32
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   229
#ifdef ENABLE_GCE_MODE
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   230
	void ChangeFrameBufferAddress(TUint32 aFbAddr);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   231
#endif
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   232
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   233
private:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   234
	TInt SetPaletteEntry(TInt aEntry, TInt aColor);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   235
	TInt GetPaletteEntry(TInt aEntry, TInt* aColor);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   236
	TInt NumberOfPaletteEntries();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   237
	TInt GetCurrentDisplayModeInfo(TVideoInfoV01& aInfo, TBool aSecure);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   238
	TInt GetSpecifiedDisplayModeInfo(TInt aMode, TVideoInfoV01& aInfo);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   239
	TInt SetDisplayMode(TInt aMode);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   240
	void SplashScreen();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   241
	TInt GetDisplayColors(TInt* aColors);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   242
32
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   243
#ifdef ENABLE_GCE_MODE
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   244
public:
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   245
	static DLcdPowerHandler* pLcd;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   246
	TInt iSize;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   247
	TPhysAddr iCompositionPhysical;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   248
	TVideoInfoV01 iVideoInfo;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   249
	TDfcQue* iDfcQ;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   250
	TPhysAddr ivRamPhys;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   251
#endif
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   252
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   253
private:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   254
	TBool iIsPalettized;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   255
	TBool iDisplayOn;				// to prevent a race condition with WServer trying to power up/down at the same time
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   256
	DPlatChunkHw* iChunk;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   257
	DPlatChunkHw* iSecureChunk;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   258
	TBool iWsSwitchOnScreen;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   259
 	TBool iSecureDisplay;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   260
	TMessageQue iMsgQ;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   261
	TDfc iPowerUpDfc;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   262
	TDfc iPowerDownDfc;	
32
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   263
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   264
#ifndef ENABLE_GCE_MODE
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   265
	TDfcQue* iDfcQ;
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   266
	TVideoInfoV01 iVideoInfo;
32
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   267
	TPhysAddr ivRamPhys;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   268
#endif
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   269
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   270
	TVideoInfoV01 iSecureVideoInfo;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   271
	NFastMutex iLock;				// protects against being preempted whilst manipulating iVideoInfo/iSecureVideoInfo
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   272
	TPhysAddr iSecurevRamPhys;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   273
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   274
	TBool iBacklightOn;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   275
	TInt iContrast;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   276
	TInt iBrightness;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   277
	};
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   278
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   279
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   280
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   281
HAL handler function
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   282
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   283
@param	aPtr a pointer to an instance of DLcdPowerHandler
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   284
@param	aFunction the function number
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   285
@param	a1 an arbitrary parameter
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   286
@param	a2 an arbitrary parameter
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   287
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   288
LOCAL_C TInt halFunction(TAny* aPtr, TInt aFunction, TAny* a1, TAny* a2)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   289
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   290
	DLcdPowerHandler* pH=(DLcdPowerHandler*)aPtr;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   291
	return pH->HalFunction(aFunction,a1,a2);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   292
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   293
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   294
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   295
DFC for receiving messages from the power handler
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   296
@param	aPtr a pointer to an instance of DLcdPowerHandler
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   297
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   298
void rxMsg(TAny* aPtr)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   299
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   300
	DLcdPowerHandler& h=*(DLcdPowerHandler*)aPtr;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   301
	h.HandleMsg();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   302
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   303
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   304
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   305
DFC for powering up the device
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   306
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   307
@param aPtr	aPtr a pointer to an instance of DLcdPowerHandler
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   308
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   309
void power_up_dfc(TAny* aPtr)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   310
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   311
	((DLcdPowerHandler*)aPtr)->PowerUpDfc();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   312
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   313
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   314
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   315
DFC for powering down the device
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   316
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   317
@param aPtr	aPtr a pointer to an instance of DLcdPowerHandler
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   318
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   319
void power_down_dfc(TAny* aPtr)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   320
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   321
	((DLcdPowerHandler*)aPtr)->PowerDownDfc();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   322
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   323
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   324
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   325
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   326
Default constructor
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   327
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   328
DLcdPowerHandler::DLcdPowerHandler() :
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   329
		DPowerHandler(KLitLcd),
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   330
		iMsgQ(rxMsg,this,NULL,1),
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   331
		iPowerUpDfc(&power_up_dfc,this,6),
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   332
		iPowerDownDfc(&power_down_dfc,this,7),
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   333
		iBacklightOn(EFalse),
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   334
		iContrast(KConfigInitialDisplayContrast),
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   335
		iBrightness(KConfigInitialDisplayBrightness)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   336
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   337
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   338
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   339
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   340
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   341
Second-phase constructor 
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   342
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   343
Called by factory function at ordinal 0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   344
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   345
TInt DLcdPowerHandler::Create()
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   346
	{
32
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   347
#ifdef ENABLE_GCE_MODE
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   348
	pLcd = this;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   349
#endif
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   350
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   351
	iDfcQ=Kern::DfcQue0();	// use low priority DFC queue for this driver 
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   352
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   353
	// map the video RAM
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   354
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   355
	//TPhysAddr videoRamPhys;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   356
	TInt vSize = Lcd_Mode_Config[KConfigLcdInitialDisplayMode].iLenghtOfVideoBufferInBytes; //KConfigLcdWidth*KConfigLcdHeight*3; //VideoRamSize();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   357
	TInt r = Epoc::AllocPhysicalRam( 2*vSize, ivRamPhys );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   358
	if ( r!=KErrNone )
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   359
		{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   360
		Kern::Fault( "AllocVRam", r );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   361
		}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   362
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   363
	//TInt vSize = ((Omap3530BoardAssp*)Arch::TheAsic())->VideoRamSize();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   364
	//ivRamPhys = TOmap3530Assp::VideoRamPhys();				// EXAMPLE ONLY: assume TOmap3530Assp interface class
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   365
	r = DPlatChunkHw::New(iChunk,ivRamPhys,vSize,EMapAttrUserRw|EMapAttrBufferedC);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   366
	if (r != KErrNone)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   367
		return r;	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   368
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   369
	//create "secure" screen immediately after normal one
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   370
	iSecurevRamPhys =  ivRamPhys + vSize;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   371
	TInt r2 = DPlatChunkHw::New(iSecureChunk,iSecurevRamPhys,vSize,EMapAttrUserRw|EMapAttrBufferedC);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   372
	if (r2 != KErrNone)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   373
		return r2;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   374
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   375
	TUint* pV=(TUint*)iChunk->LinearAddress();	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   376
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   377
	__KTRACE_OPT(KEXTENSION,Kern::Printf("DLcdPowerHandler::Create: VideoRamSize=%x, VideoRamPhys=%08x, VideoRamLin=%08x",vSize,ivRamPhys,pV));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   378
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   379
	// TO DO: (mandatory)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   380
	// initialise the palette for the initial display mode
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   381
	// NOTE: the palette could either be a buffer allocated in system RAM (usually contiguous to Video buffer)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   382
	//		 or could be offered as part of the hardware block that implemenst the lcd control
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   383
	//
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   384
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   385
	TUint* pV2=(TUint*)iSecureChunk->LinearAddress();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   386
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   387
	__KTRACE_OPT(KEXTENSION,Kern::Printf("DLcdPowerHandler::Create: Secure display VideoRamSize=%x, VideoRamPhys=%08x, VideoRamLin=%08x",vSize,iSecurevRamPhys,pV2));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   388
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   389
	// TO DO: (mandatory)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   390
	// initialise the secure screen's palette for the initial display mode
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   391
	//
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   392
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   393
	// setup the video info structure, this'll be used to remember the video settings
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   394
	iVideoInfo.iDisplayMode = KConfigLcdInitialDisplayMode;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   395
	iVideoInfo.iOffsetToFirstPixel = Lcd_Mode_Config[KConfigLcdInitialDisplayMode].iOffsetToFirstVideoBuffer;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   396
	iVideoInfo.iIsPalettized = Lcd_Mode_Config[KConfigLcdInitialDisplayMode].iIsPalettized;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   397
	iVideoInfo.iOffsetBetweenLines = Lcd_Mode_Config[KConfigLcdInitialDisplayMode].iOffsetBetweenLines;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   398
	iVideoInfo.iBitsPerPixel = Lcd_Mode_Config[KConfigLcdInitialDisplayMode].iBitsPerPixel;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   399
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   400
	iVideoInfo.iSizeInPixels.iWidth = KConfigLcdWidth;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   401
	iVideoInfo.iSizeInPixels.iHeight = KConfigLcdHeight;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   402
	iVideoInfo.iSizeInTwips.iWidth = KConfigLcdWidthInTwips;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   403
	iVideoInfo.iSizeInTwips.iHeight = KConfigLcdHeightInTwips;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   404
	iVideoInfo.iIsMono = KConfigLcdIsMono;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   405
	iVideoInfo.iVideoAddress=(TInt)pV;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   406
	iVideoInfo.iIsPixelOrderLandscape = KConfigLcdPixelOrderLandscape;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   407
	iVideoInfo.iIsPixelOrderRGB = KConfigLcdPixelOrderRGB;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   408
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   409
	iSecureVideoInfo = iVideoInfo;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   410
	iSecureVideoInfo.iVideoAddress = (TInt)pV2;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   411
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   412
	iDisplayOn = EFalse;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   413
	iSecureDisplay = EFalse;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   414
32
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   415
#ifdef ENABLE_GCE_MODE
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   416
	// Alloc Physical RAM for the Composition Buffers used by the GCE
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   417
	iSize = Lcd_Mode_Config[KConfigLcdInitialDisplayMode].iLenghtOfVideoBufferInBytes;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   418
	__KTRACE_OPT(KEXTENSION, Kern::Printf("DLcdPowerHandler.iSize  = %d", iSize));
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   419
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   420
	// double and round the page size
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   421
	TUint round = 2*Kern::RoundToPageSize(iSize);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   422
	r = Epoc::AllocPhysicalRam(round , iCompositionPhysical);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   423
	if(r != KErrNone)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   424
		{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   425
		__KTRACE_OPT(KEXTENSION, Kern::Printf("Failed to allocate physical RAM for composition buffer %d", r));
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   426
		return r;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   427
		}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   428
#endif
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   429
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   430
	// install the HAL function
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   431
	r=Kern::AddHalEntry(EHalGroupDisplay, halFunction, this);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   432
	if (r!=KErrNone)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   433
		return r;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   434
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   435
	iPowerUpDfc.SetDfcQ(iDfcQ);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   436
	iPowerDownDfc.SetDfcQ(iDfcQ);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   437
	iMsgQ.SetDfcQ(iDfcQ);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   438
	iMsgQ.Receive();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   439
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   440
	// install the power handler
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   441
	// power up the screen
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   442
	Add();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   443
	DisplayOn();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   444
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   445
	SplashScreen();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   446
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   447
	return KErrNone;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   448
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   449
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   450
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   451
Turn the display on
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   452
May be called as a result of a power transition or from the HAL
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   453
If called from HAL, then the display may be already be on (iDisplayOn == ETrue)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   454
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   455
void DLcdPowerHandler::DisplayOn()
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   456
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   457
	__KTRACE_OPT(KBOOT, Kern::Printf("DisplayOn %d", iDisplayOn));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   458
	if (!iDisplayOn)				// may have been powered up already
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   459
		{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   460
		iDisplayOn = ETrue;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   461
		PowerUpLcd(iSecureDisplay);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   462
		SetContrast(iContrast);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   463
		SetBrightness(iBrightness);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   464
		}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   465
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   466
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   467
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   468
Turn the display off
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   469
May be called as a result of a power transition or from the HAL
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   470
If called from Power Manager, then the display may be already be off (iDisplayOn == EFalse)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   471
if the platform is in silent running mode
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   472
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   473
void DLcdPowerHandler::DisplayOff()
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   474
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   475
	__KTRACE_OPT(KBOOT, Kern::Printf("DisplayOff %d", iDisplayOn));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   476
	if (iDisplayOn)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   477
		{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   478
		iDisplayOn = EFalse;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   479
		PowerDownLcd();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   480
		}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   481
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   482
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   483
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   484
Switch between secure and non-secure displays
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   485
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   486
@param aSecure ETrue if switching to secure display
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   487
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   488
void DLcdPowerHandler::SwitchDisplay(TBool aSecure)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   489
 	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   490
 	if (aSecure)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   491
 		{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   492
 		if (!iSecureDisplay)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   493
 			{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   494
 			//switch to secure display
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   495
 			DisplayOff();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   496
 			iSecureDisplay = ETrue;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   497
 			DisplayOn();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   498
 			}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   499
 		}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   500
 	else
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   501
 		{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   502
 		if (iSecureDisplay)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   503
 			{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   504
 			//switch from secure display
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   505
 			DisplayOff();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   506
 			iSecureDisplay = EFalse;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   507
 			DisplayOn();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   508
 			}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   509
 		}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   510
 	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   511
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   512
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   513
DFC to power up the display
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   514
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   515
void DLcdPowerHandler::PowerUpDfc()
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   516
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   517
	__KTRACE_OPT(KPOWER, Kern::Printf("PowerUpDfc"));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   518
	DisplayOn();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   519
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   520
	PowerUpDone();				// must be called from a different thread than PowerUp()
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   521
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   522
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   523
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   524
DFC to power down the display
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   525
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   526
void DLcdPowerHandler::PowerDownDfc()
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   527
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   528
	__KTRACE_OPT(KPOWER, Kern::Printf("PowerDownDfc"));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   529
	DisplayOff();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   530
	PowerDownDone();			// must be called from a different thread than PowerUp()
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   531
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   532
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   533
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   534
Schedule the power-down DFC
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   535
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   536
void DLcdPowerHandler::PowerDown(TPowerState)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   537
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   538
	iPowerDownDfc.Enque();		// schedules DFC to execute on this driver's thread
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   539
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   540
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   541
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   542
Schedule the power-up DFC
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   543
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   544
void DLcdPowerHandler::PowerUp()
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   545
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   546
	iPowerUpDfc.Enque();		// schedules DFC to execute on this driver's thread
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   547
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   548
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   549
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   550
Power up the display
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   551
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   552
@param aSecure ETrue if powering up the secure display
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   553
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   554
void DLcdPowerHandler::PowerUpLcd(TBool aSecure)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   555
    {
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   556
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   557
	TUint32 l = 0x0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   558
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   559
	// Set up the Display Subsystem to control a DVI monitor
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   560
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   561
    // The following four lines need to be replaced by a call to the GPIO driver which should call the PowerClock driver
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   562
//	PowerClock::GpioActive(0, PowerClock::E1s, PowerClock::ECpu10, PowerClock::EBus10);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   563
//	PowerClock::GpioAccess(0, PowerClock::EAuto);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   564
	Prcm::SetClockState( Prcm::EClkGpio1_F, Prcm::EClkOn );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   565
	Prcm::SetClockState( Prcm::EClkGpio1_I, Prcm::EClkAuto );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   566
	*( (TUint *) Omap3530HwBase::TVirtual<0x48310034>::Value ) = 0xfefffedf;		//GPIO1 output enable	p3336
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   567
	*( (TUint *) Omap3530HwBase::TVirtual<0x48310094>::Value ) = 0x01000120;		//GPIO1 set data out	p3336
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   568
//	const TUint KCM_CLKSEL_DSS = Omap3530HwBase::TVirtual<0x48004E40>::Value;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   569
//	Prcm::Set(KCM_CLKSEL_DSS, 0xffffffffu, 0x00001006);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   570
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   571
	Prcm::SetDivider( Prcm::EClkDss1_F, 2 );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   572
	Prcm::SetDivider( Prcm::EClkTv_F, 1 );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   573
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   574
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   575
	SET_REGISTER( DSS_SYSCONFIG, 0x00000010 );			// Display Subsystem reset
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   576
	while ( !( GET_REGISTER( DISPC_SYSSTATUS ) & 1 ) );	// Spin until reset complete
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   577
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   578
	TInt8 MIDLEMODE		= 0x2;	// Smart Standby. MStandby is asserted based on the internal activity of the module.
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   579
	TInt8 CLOCKACTIVITY = 0x0;	// interface and functional clocks can be switched off.
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   580
	TInt8 SIDLEMODE		= 0x2;	// Smart idle. Idle request is acknowledged based on the internal activity of the module
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   581
	TInt8 ENWAKEUP		= 0x1;	// Wakeup is enabled.
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   582
	TInt8 SOFTRESET		= 0x0;	// Normal mode
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   583
	TInt8 AUTOIDLE		= 0x1;	// Automatic L3 and L4 interface clock gating strategy is applied based on interface activity
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   584
	l = MIDLEMODE<<12 | CLOCKACTIVITY<<8 | SIDLEMODE<<3 | ENWAKEUP<<2 | SOFTRESET<<1 | AUTOIDLE;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   585
	SET_REGISTER( DISPC_SYSCONFIG, l );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   586
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   587
	TInt8 LOADMOAD = 0x2; 		//Frame data only loaded every frame
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   588
	l = LOADMOAD<<1;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   589
	SET_REGISTER( DISPC_CONFIG, l );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   590
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   591
	SET_REGISTER( DISPC_DEFAULT_COLOR0, 0xFFFFFFFF );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   592
	SET_REGISTER( DISPC_TRANS_COLOR0, 0x00000000 );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   593
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   594
	TUint8 hbp = H_BPORCH - 1;	// Horizontal Back Porch
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   595
	TUint8 hfp = H_FPORCH - 1;	// Horizontal front porch
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   596
	TUint8 hsw = H_SYNC - 1;	// Horizontal synchronization pulse width
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   597
	if ( hsw > 63 )
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   598
		{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   599
		hsw = 63;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   600
		Kern::Printf("[LCD] H_SYNC too big");
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   601
		}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   602
	l = hbp<<20 | hfp<<8 | hsw;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   603
	SET_REGISTER( DISPC_TIMING_H, l );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   604
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   605
	TUint8 vbp = V_BPORCH;		// Vertical back porch
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   606
	TUint8 vfp = V_FPORCH;		// Vertical front porch
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   607
	TUint8 vsw = V_SYNC;		// Vertical synchronization pulse width
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   608
	__ASSERT_ALWAYS( vbp<=255, Kern::Fault("LCD", 1) );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   609
	__ASSERT_ALWAYS( vfp<=255, Kern::Fault("LCD", 1) );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   610
	__ASSERT_ALWAYS( vsw>=1 && vsw<=255, Kern::Fault("LCD", 1) );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   611
	l = vbp<<20 | vfp<<8 | vsw;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   612
	SET_REGISTER( DISPC_TIMING_V, l );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   613
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   614
	TUint8 onoff= 0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   615
	TUint8 rf	= 0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   616
	TUint8 ieo 	= 0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   617
	TUint8 ipc	= 1;			// Invert Pixel Clock
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   618
	TUint8 ihs	= H_SYNC_POL ? 0 : 1;	// Invert HSYNC (0: Positive Sync polarity, 1: Negative Sync polarity)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   619
	TUint8 ivs	= V_SYNC_POL ? 0 : 1;	// Invert VSYNC (0: Positive Sync polarity, 1: Negative Sync polarity)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   620
	TUint8 acbi	= 0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   621
	TUint16 acb	= 0x28;			// AC-bias pin frequency
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   622
	l = onoff<<17 | rf<<16 | ieo<<15 | ipc<<14 | ihs<<13 | ivs<<12 | acbi<<8 | acb;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   623
	SET_REGISTER( DISPC_POL_FREQ, l );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   624
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   625
	TUint8 lcd = 1;				// Display Controller Logic Clock Divisor
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   626
	TUint8 pcd = ( 432000 + (PIXEL_CLK - 1) ) / PIXEL_CLK; // Pixel Clock Divisor - add (PIXEL_CLK - 1) to avoid rounding error
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   627
	__ASSERT_ALWAYS( lcd>=1 && lcd<=255, Kern::Fault("LCD", 1) );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   628
	__ASSERT_ALWAYS( pcd>=2 && pcd<=255, Kern::Fault("LCD", 1) );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   629
	l = lcd<<16 | pcd;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   630
	SET_REGISTER( DISPC_DIVISOR, l );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   631
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   632
	TUint16 ppl = H_DISP - 1;	// Pixels per line
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   633
	TUint16 llp = V_DISP - 1;	// Lines per panel
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   634
	__ASSERT_ALWAYS( ppl>=1 && ppl<=2048, Kern::Fault("LCD", 1) );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   635
	__ASSERT_ALWAYS( llp>=1 && llp<=2048, Kern::Fault("LCD", 1) );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   636
	l = llp<<16 | ppl;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   637
	SET_REGISTER( DISPC_SIZE_LCD, l );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   638
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   639
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   640
	// Setup a graphics region (GFX)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   641
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   642
	// Set GFX frame buffer
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   643
	SET_REGISTER( DISPC_GFX_BA1, ivRamPhys );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   644
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   645
	// Center the GFX
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   646
	TInt16 gfxposy	= ( V_DISP - KConfigLcdHeight ) / 2;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   647
	TInt16 gfxposx	= ( H_DISP - KConfigLcdWidth ) / 2;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   648
	l = ( gfxposy << 16 ) | gfxposx;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   649
	SET_REGISTER( DISPC_GFX_POSITION, l );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   650
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   651
	// Set the GFX dimensions
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   652
	TInt16 gfxsizey = KConfigLcdHeight - 1;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   653
	TInt16 gfxsizex = KConfigLcdWidth - 1;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   654
	l = gfxsizey<<16 | gfxsizex;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   655
	SET_REGISTER( DISPC_GFX_SIZE, l );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   656
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   657
	TInt8 GFXSELFREFRESH		= 0x0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   658
	TInt8 GFXARBITRATION		= 0x0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   659
	TInt8 GFXROTATION			= 0x0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   660
	TInt8 GFXFIFOPRELOAD		= 0x0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   661
	TInt8 GFXENDIANNESS			= 0x0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   662
	TInt8 GFXNIBBLEMODE			= 0x0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   663
	TInt8 GFXCHANNELOUT			= 0x0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   664
	TInt8 GFXBURSTSIZE			= 0x2;	// 16x32bit bursts
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   665
	TInt8 GFXREPLICATIONENABLE	= 0x0;	// Disable Graphics replication logic
32
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   666
	TInt8 GFXFORMAT				= 0x8;//0x6;	// RGB16=0x6, RGB24-unpacked=0x8, RGB24-packed=0x9
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   667
	TInt8 GFXENABLE				= 0x1;	// Graphics enabled
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   668
	l = GFXSELFREFRESH<<15 | GFXARBITRATION<<14 | GFXROTATION<<12 | GFXFIFOPRELOAD<<11 | GFXENDIANNESS<<10 | GFXNIBBLEMODE<<9 | GFXCHANNELOUT<8 | GFXBURSTSIZE<<6 | GFXREPLICATIONENABLE<<5 | GFXFORMAT<<1 | GFXENABLE;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   669
	SET_REGISTER( DISPC_GFX_ATTRIBUTES, l );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   670
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   671
	TInt16 GFXFIFOHIGHTHRESHOLD	= 0x3fc;	// Graphics FIFO High Threshold
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   672
	TInt16 GFXFIFOLOWTHRESHOLD	= 0x3BC;	// Graphics FIFO Low Threshold
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   673
	l = GFXFIFOHIGHTHRESHOLD<<16 | GFXFIFOLOWTHRESHOLD;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   674
	SET_REGISTER(DISPC_GFX_FIFO_THRESHOLD, l);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   675
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   676
	TInt16 GFXFIFOSIZE = 0x400;	// Number of bytes defining the FIFO value
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   677
	l = GFXFIFOSIZE;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   678
	SET_REGISTER(DISPC_GFX_FIFO_SIZE_STATUS, l);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   679
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   680
	TInt32 GFXROWINC	= 0x1;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   681
	l = GFXROWINC;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   682
	SET_REGISTER(DISPC_GFX_ROW_INC, l);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   683
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   684
	TInt16	GFXPIXELINC	= 0x1;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   685
	l = GFXPIXELINC;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   686
	SET_REGISTER(DISPC_GFX_PIXEL_INC, l);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   687
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   688
	TInt32 GFXWINDOWSKIP = 0x0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   689
	l = GFXWINDOWSKIP;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   690
	SET_REGISTER(DISPC_GFX_WINDOW_SKIP, l);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   691
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   692
	// TO DO: Sort out the Gamma table + pallets
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   693
	TInt32 GFXTABLEBA	= 0x807ff000;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   694
	l = GFXTABLEBA;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   695
	SET_REGISTER(DISPC_GFX_TABLE_BA, l);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   696
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   697
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   698
	// Propigate all the shadowed registers 
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   699
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   700
	TInt8 SPATIALTEMPORALDITHERINGFRAMES	= 0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   701
	TInt8 LCDENABLEPOL			= 0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   702
	TInt8 LCDENABLESIGNAL		= 0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   703
	TInt8 PCKFREEENABLE			= 0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   704
	TInt8 TDMUNUSEDBITS			= 0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   705
	TInt8 TDMCYCLEFORMAT		= 0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   706
	TInt8 TDMPARALLELMODE		= 0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   707
	TInt8 TDMENABLE				= 0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   708
	TInt8 HT					= 0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   709
	TInt8 GPOUT1				= 1;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   710
	TInt8 GPOUT0				= 1;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   711
	TInt8 GPIN1					= 0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   712
	TInt8 GPIN0					= 0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   713
	TInt8 OVERLAYOPTIMIZATION	= 0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   714
	TInt8 RFBIMODE				= 0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   715
	TInt8 SECURE				= 0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   716
	TInt8 TFTDATALINES			= 0x3;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   717
	TInt8 STDITHERENABLE		= 0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   718
	TInt8 GODIGITAL				= 1;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   719
	TInt8 GOLCD					= 1;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   720
	TInt8 M8B					= 0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   721
	TInt8 STNTFT				= 1;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   722
	TInt8 MONOCOLOR				= 0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   723
	TInt8 DIGITALENABLE			= 1;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   724
	TInt8 LCDENABLE				= 1;	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   725
	l = SPATIALTEMPORALDITHERINGFRAMES<<30 | LCDENABLEPOL<<29 | LCDENABLESIGNAL<<28 | PCKFREEENABLE<<27 | 
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   726
		TDMUNUSEDBITS<<25 | TDMCYCLEFORMAT<<23 | TDMPARALLELMODE<<21 | TDMENABLE<<20 | HT<<17 | GPOUT1<<16 | 
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   727
			GPOUT0<<15 | GPIN1<<14 | GPIN0<<13 | OVERLAYOPTIMIZATION<<12 | 	RFBIMODE<<11 | SECURE<<10 |
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   728
				TFTDATALINES<<8 | STDITHERENABLE<<7 | GODIGITAL<<6 | GOLCD<<5 | M8B<<4 | STNTFT<<3 |
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   729
					MONOCOLOR<<2 | DIGITALENABLE<<1 | LCDENABLE;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   730
	NKern::Sleep(1);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   731
	SET_REGISTER(DISPC_CONTROL, l);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   732
	NKern::Sleep(1);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   733
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   734
    }
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   735
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   736
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   737
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   738
Power down the display and the backlight
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   739
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   740
void DLcdPowerHandler::PowerDownLcd()
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   741
    {
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   742
	SetBacklightState(EFalse);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   743
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   744
	// TO DO: (mandatory)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   745
	// Power down the display & disable LCD DMA.
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   746
	// May need to wait until the current frame has been output
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   747
	//
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   748
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   749
	SET_REGISTER(DISPC_CONTROL, 0);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   750
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   751
    }
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   752
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   753
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   754
Set the Lcd contrast
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   755
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   756
@param aValue the contrast setting
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   757
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   758
TInt DLcdPowerHandler::SetContrast(TInt aValue)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   759
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   760
	__KTRACE_OPT(KEXTENSION,Kern::Printf("SetContrast(%d)", aValue));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   761
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   762
	if (aValue >= KConfigLcdMinDisplayContrast && aValue <= KConfigLcdMaxDisplayContrast)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   763
		{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   764
		iContrast=aValue;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   765
		
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   766
		// TO DO: (mandatory)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   767
		// set the contrast
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   768
		//
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   769
		return KErrNone;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   770
		}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   771
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   772
	return KErrArgument;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   773
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   774
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   775
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   776
Set the Lcd brightness
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   777
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   778
@param aValue the brightness setting
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   779
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   780
TInt DLcdPowerHandler::SetBrightness(TInt aValue)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   781
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   782
	__KTRACE_OPT(KEXTENSION,Kern::Printf("SetBrightness(%d)", aValue));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   783
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   784
	if (aValue >= KConfigLcdMinDisplayBrightness && aValue <= KConfigLcdMaxDisplayBrightness)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   785
		{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   786
		iBrightness=aValue;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   787
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   788
		// TO DO: (mandatory)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   789
		// set the brightness
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   790
		//
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   791
		return KErrNone;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   792
		}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   793
	return KErrArgument;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   794
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   795
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   796
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   797
Turn the backlight on
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   798
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   799
void DLcdPowerHandler::BacklightOn()
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   800
    {
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   801
	// TO DO: (mandatory)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   802
	// turn the backlight on
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   803
	//
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   804
    }
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   805
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   806
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   807
Turn the backlight off
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   808
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   809
void DLcdPowerHandler::BacklightOff()
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   810
    {
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   811
	// TO DO: (mandatory)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   812
	// turn the backlight off
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   813
	//
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   814
    }
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   815
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   816
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   817
Set the state of the backlight
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   818
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   819
@param aState ETrue if setting the backlight on
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   820
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   821
void DLcdPowerHandler::SetBacklightState(TBool aState)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   822
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   823
	iBacklightOn=aState;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   824
	if (iBacklightOn)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   825
		BacklightOn();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   826
	else
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   827
		BacklightOff();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   828
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   829
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   830
void DLcdPowerHandler::ScreenInfo(TScreenInfoV01& anInfo)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   831
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   832
	__KTRACE_OPT(KEXTENSION,Kern::Printf("DLcdPowerHandler::ScreenInfo"));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   833
	anInfo.iWindowHandleValid=EFalse;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   834
	anInfo.iWindowHandle=NULL;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   835
	anInfo.iScreenAddressValid=ETrue;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   836
	anInfo.iScreenAddress=(TAny *)(iChunk->LinearAddress());
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   837
	anInfo.iScreenSize.iWidth=KConfigLcdWidth;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   838
	anInfo.iScreenSize.iHeight=KConfigLcdHeight;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   839
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   840
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   841
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   842
Handle a message from the power handler
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   843
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   844
void DLcdPowerHandler::HandleMsg(void)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   845
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   846
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   847
	TMessageBase* msg = iMsgQ.iMessage;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   848
	if (msg == NULL)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   849
		return;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   850
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   851
	if (msg->iValue)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   852
		DisplayOn();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   853
	else
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   854
		DisplayOff();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   855
	msg->Complete(KErrNone,ETrue);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   856
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   857
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   858
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   859
Send a message to the power-handler message queue to turn the display on
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   860
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   861
void DLcdPowerHandler::WsSwitchOnScreen()
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   862
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   863
	TThreadMessage& m=Kern::Message();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   864
	m.iValue = ETrue;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   865
	m.SendReceive(&iMsgQ);		// send a message and block Client thread until keyboard has been powered up
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   866
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   867
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   868
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   869
Send a message to the power-handler message queue to turn the display off
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   870
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   871
void DLcdPowerHandler::WsSwitchOffScreen()
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   872
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   873
	TThreadMessage& m=Kern::Message();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   874
	m.iValue = EFalse;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   875
	m.SendReceive(&iMsgQ);		// send a message and block Client thread until keyboard has been powered down
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   876
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   877
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   878
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   879
Return information about the current display mode
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   880
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   881
@param	aInfo a structure supplied by the caller to be filled by this function.
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   882
@param	aSecure ETrue if requesting information about the secure display
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   883
@return	KErrNone if successful
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   884
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   885
TInt DLcdPowerHandler::GetCurrentDisplayModeInfo(TVideoInfoV01& aInfo, TBool aSecure)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   886
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   887
	__KTRACE_OPT(KEXTENSION,Kern::Printf("GetCurrentDisplayModeInfo"));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   888
	NKern::FMWait(&iLock);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   889
	if (aSecure)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   890
 		aInfo = iSecureVideoInfo;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   891
 	else
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   892
 		aInfo = iVideoInfo;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   893
	NKern::FMSignal(&iLock);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   894
	return KErrNone;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   895
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   896
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   897
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   898
Return information about the specified display mode
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   899
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   900
@param	aMode the display mode to query
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   901
@param	aInfo a structure supplied by the caller to be filled by this function.
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   902
@return	KErrNone if successful
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   903
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   904
TInt DLcdPowerHandler::GetSpecifiedDisplayModeInfo(TInt aMode, TVideoInfoV01& aInfo)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   905
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   906
	__KTRACE_OPT(KEXTENSION,Kern::Printf("GetSpecifiedDisplayModeInfo mode is %d",aMode));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   907
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   908
	if (aMode < 0 || aMode >= KConfigLcdNumberOfDisplayModes)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   909
		return KErrArgument;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   910
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   911
	NKern::FMWait(&iLock);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   912
	aInfo = iVideoInfo;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   913
	NKern::FMSignal(&iLock);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   914
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   915
	if (aMode != aInfo.iDisplayMode)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   916
		{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   917
		aInfo.iOffsetToFirstPixel=Lcd_Mode_Config[aMode].iOffsetToFirstVideoBuffer;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   918
		aInfo.iIsPalettized = Lcd_Mode_Config[aMode].iIsPalettized;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   919
		aInfo.iOffsetBetweenLines=Lcd_Mode_Config[aMode].iOffsetBetweenLines;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   920
		aInfo.iBitsPerPixel = Lcd_Mode_Config[aMode].iBitsPerPixel;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   921
		}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   922
	return KErrNone;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   923
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   924
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   925
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   926
Set the display mode
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   927
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   928
@param	aMode the display mode to set
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   929
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   930
TInt DLcdPowerHandler::SetDisplayMode(TInt aMode)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   931
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   932
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   933
	__KTRACE_OPT(KEXTENSION,Kern::Printf("SetDisplayMode = %d", aMode));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   934
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   935
	if (aMode < 0 || aMode >= KConfigLcdNumberOfDisplayModes)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   936
		return KErrArgument;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   937
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   938
	NKern::FMWait(&iLock);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   939
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   940
	// store the current mode
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   941
	iVideoInfo.iDisplayMode = aMode;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   942
	iVideoInfo.iOffsetToFirstPixel = Lcd_Mode_Config[aMode].iOffsetToFirstVideoBuffer;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   943
	iVideoInfo.iIsPalettized = Lcd_Mode_Config[aMode].iIsPalettized;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   944
	iVideoInfo.iOffsetBetweenLines = Lcd_Mode_Config[aMode].iOffsetBetweenLines;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   945
	iVideoInfo.iBitsPerPixel = Lcd_Mode_Config[aMode].iBitsPerPixel;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   946
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   947
	// store the current mode for secure screen
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   948
	iSecureVideoInfo.iDisplayMode = aMode;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   949
	iSecureVideoInfo.iOffsetToFirstPixel = Lcd_Mode_Config[aMode].iOffsetToFirstVideoBuffer;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   950
	iSecureVideoInfo.iIsPalettized = Lcd_Mode_Config[aMode].iIsPalettized;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   951
	iSecureVideoInfo.iOffsetBetweenLines = Lcd_Mode_Config[aMode].iOffsetBetweenLines;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   952
	iSecureVideoInfo.iBitsPerPixel = Lcd_Mode_Config[aMode].iBitsPerPixel;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   953
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   954
	// TO DO: (mandatory)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   955
	// set bits per pixel on hardware
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   956
	// May need to reconfigure DMA if video buffer size and location have changed
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   957
	//
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   958
	NKern::FMSignal(&iLock);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   959
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   960
	__KTRACE_OPT(KEXTENSION,Kern::Printf("SetDisplayMode mode = %d, otfp = %d, palettized = %d, bpp = %d, obl = %d",
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   961
		aMode, iVideoInfo.iOffsetToFirstPixel, iVideoInfo.iIsPalettized, iVideoInfo.iBitsPerPixel, iVideoInfo.iOffsetBetweenLines));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   962
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   963
	return KErrNone;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   964
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   965
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   966
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   967
Fill the video memory with an initial pattern or image
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   968
This will be displayed on boot-up
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   969
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   970
void DLcdPowerHandler::SplashScreen()
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   971
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   972
	// TO DO: (optional)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   973
	// replace the example code below to display a different spash screen
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   974
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   975
	__KTRACE_OPT(KEXTENSION,Kern::Printf("Splash SCreen +"));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   976
	TUint* pV=(TUint*)(iVideoInfo.iVideoAddress + iVideoInfo.iOffsetToFirstPixel);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   977
	__KTRACE_OPT(KEXTENSION,Kern::Printf("Splash SCreen FB @ %x",pV));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   978
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   979
	//Fill the framebuffer with bars
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   980
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   981
	for (TInt y = 0; y<KConfigLcdHeight; ++y)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   982
		{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   983
		for(TInt x = 0; x<KConfigLcdHeight; ++x)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   984
			{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   985
			TUint8 r = 0x00;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   986
			TUint8 g = 0x00;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   987
			TUint8 b = 0x00;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   988
			TUint16 rgb = ((r&0xf8) << 8) | ((g&0xfc) << 3) | ((b&0xf8) >> 3);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   989
			
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   990
			TUint16* px = reinterpret_cast<TUint16*>(pV) + y*KConfigLcdWidth + x;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   991
			*px = rgb;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   992
			}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   993
		}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   994
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   995
	__KTRACE_OPT(KEXTENSION,Kern::Printf("Splash SCreen -"));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   996
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   997
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   998
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   999
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1000
Get the size of the pallete
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1001
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1002
@return	the number of pallete entries
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1003
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1004
TInt DLcdPowerHandler::NumberOfPaletteEntries()		//only call when holding mutex
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1005
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1006
	// TO DO: (mandatory)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1007
	// Calculate the number of Palette entries - this is normally 
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1008
	// calculated from the bits per-pixel.
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1009
	// This is only example code... you may need to modify it for your hardware
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1010
	//
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1011
	TInt num = iVideoInfo.iIsPalettized ? 1<<iVideoInfo.iBitsPerPixel : 0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1012
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1013
	__KTRACE_OPT(KEXTENSION,Kern::Printf("NumberOfPaletteEntries = %d", num));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1014
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1015
	return num;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1016
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1017
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1018
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1019
/** 
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1020
Retrieve the palette entry at a particular offset
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1021
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1022
@param	aEntry the palette index
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1023
@param	aColor a caller-supplied pointer to a location where the returned RGB color is to be stored
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1024
@return	KErrNone if successful
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1025
		KErrNotSupported if the current vide mode does not support a palette
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1026
		KErrArgument if aEntry is out of range
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1027
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1028
TInt DLcdPowerHandler::GetPaletteEntry(TInt aEntry, TInt* aColor)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1029
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1030
	NKern::FMWait(&iLock);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1031
	if (!iVideoInfo.iIsPalettized)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1032
		{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1033
		NKern::FMSignal(&iLock);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1034
		return KErrNotSupported;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1035
		}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1036
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1037
	if ((aEntry < 0) || (aEntry >= NumberOfPaletteEntries()))
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1038
		{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1039
		NKern::FMSignal(&iLock);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1040
		return KErrArgument;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1041
		}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1042
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1043
	// TO DO: (mandatory)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1044
	// read the RGB value of the palette entry into aColor
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1045
	// NOTE: the palette could either be a buffer allocated in system RAM (usually contiguous to Video buffer)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1046
	//		 or could be offered as part of the hardware block that implemenst the lcd control
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1047
	//
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1048
	NKern::FMSignal(&iLock);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1049
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1050
	__KTRACE_OPT(KEXTENSION,Kern::Printf("GetPaletteEntry %d color 0x%x", aEntry, aColor));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1051
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1052
	return KErrNone;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1053
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1054
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1055
/** 
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1056
Set the palette entry at a particular offset
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1057
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1058
@param	aEntry the palette index
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1059
@param	aColor the RGB color to store
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1060
@return	KErrNone if successful
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1061
		KErrNotSupported if the current vide mode does not support a palette
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1062
		KErrArgument if aEntry is out of range
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1063
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1064
TInt DLcdPowerHandler::SetPaletteEntry(TInt aEntry, TInt aColor)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1065
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1066
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1067
	NKern::FMWait(&iLock);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1068
	if (!iVideoInfo.iIsPalettized)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1069
		{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1070
		NKern::FMSignal(&iLock);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1071
		return KErrNotSupported;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1072
		}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1073
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1074
	if ((aEntry < 0) || (aEntry >= NumberOfPaletteEntries()))	//check entry in range
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1075
		{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1076
		NKern::FMSignal(&iLock);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1077
		return KErrArgument;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1078
		}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1079
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1080
	// TO DO: (mandatory)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1081
	// update the palette entry for the secure and non-secure screen
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1082
	// NOTE: the palette could either be a buffer allocated in system RAM (usually contiguous to Video buffer)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1083
	//		 or could be offered as part of the hardware block that implemenst the lcd control
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1084
	//
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1085
	__KTRACE_OPT(KEXTENSION,Kern::Printf("SetPaletteEntry %d to 0x%x", aEntry, aColor ));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1086
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1087
	return KErrNone;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1088
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1089
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1090
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1091
a HAL entry handling function for HAL group attribute EHalGroupDisplay
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1092
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1093
@param	a1 an arbitrary argument
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1094
@param	a2 an arbitrary argument
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1095
@return	KErrNone if successful
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1096
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1097
TInt DLcdPowerHandler::HalFunction(TInt aFunction, TAny* a1, TAny* a2)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1098
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1099
	TInt r=KErrNone;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1100
	switch(aFunction)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1101
		{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1102
		case EDisplayHalScreenInfo:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1103
			{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1104
			TPckgBuf<TScreenInfoV01> vPckg;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1105
			ScreenInfo(vPckg());
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1106
			Kern::InfoCopy(*(TDes8*)a1,vPckg);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1107
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1108
			}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1109
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1110
		case EDisplayHalWsRegisterSwitchOnScreenHandling:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1111
			iWsSwitchOnScreen=(TBool)a1;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1112
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1113
		
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1114
		case EDisplayHalWsSwitchOnScreen:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1115
			WsSwitchOnScreen();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1116
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1117
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1118
		case EDisplayHalMaxDisplayContrast:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1119
			{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1120
			TInt mc=KConfigLcdMaxDisplayContrast;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1121
			kumemput32(a1,&mc,sizeof(mc));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1122
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1123
			}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1124
		case EDisplayHalSetDisplayContrast:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1125
			__KTRACE_OPT(KEXTENSION,Kern::Printf("EDisplayHalSetDisplayContrast"));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1126
			if(!Kern::CurrentThreadHasCapability(ECapabilityWriteDeviceData,__PLATSEC_DIAGNOSTIC_STRING("Checked by Hal function EDisplayHalSetDisplayContrast")))
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1127
				return KErrPermissionDenied;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1128
			r=SetContrast(TInt(a1));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1129
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1130
		
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1131
		case EDisplayHalDisplayContrast:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1132
			kumemput32(a1,&iContrast,sizeof(iContrast));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1133
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1134
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1135
		case EDisplayHalMaxDisplayBrightness:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1136
			{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1137
			TInt mc=KConfigLcdMaxDisplayBrightness;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1138
			kumemput32(a1,&mc,sizeof(mc));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1139
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1140
			}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1141
		
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1142
		case EDisplayHalSetDisplayBrightness:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1143
			__KTRACE_OPT(KEXTENSION,Kern::Printf("EDisplayHalSetDisplayBrightness"));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1144
			if(!Kern::CurrentThreadHasCapability(ECapabilityWriteDeviceData,__PLATSEC_DIAGNOSTIC_STRING("Checked by Hal function EDisplayHalSetDisplayBrightness")))
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1145
				return KErrPermissionDenied;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1146
			r=SetBrightness(TInt(a1));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1147
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1148
		
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1149
		case EDisplayHalDisplayBrightness:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1150
			kumemput32(a1,&iBrightness,sizeof(iBrightness));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1151
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1152
		
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1153
		case EDisplayHalSetBacklightOn:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1154
			if(!Kern::CurrentThreadHasCapability(ECapabilityWriteDeviceData,__PLATSEC_DIAGNOSTIC_STRING("Checked by Hal function EDisplayHalSetBacklightOn")))
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1155
				return KErrPermissionDenied;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1156
			if (Kern::MachinePowerStatus()<ELow)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1157
				r=KErrBadPower;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1158
			else
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1159
				SetBacklightState(TBool(a1));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1160
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1161
		
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1162
		case EDisplayHalBacklightOn:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1163
			kumemput32(a1,&iBacklightOn,sizeof(TInt));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1164
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1165
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1166
		case EDisplayHalModeCount:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1167
			{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1168
			TInt ndm = KConfigLcdNumberOfDisplayModes;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1169
			kumemput32(a1, &ndm, sizeof(ndm));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1170
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1171
			}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1172
		
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1173
		case EDisplayHalSetMode:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1174
			if(!Kern::CurrentThreadHasCapability(ECapabilityMultimediaDD,__PLATSEC_DIAGNOSTIC_STRING("Checked by Hal function EDisplayHalSetMode")))
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1175
				return KErrPermissionDenied;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1176
			r = SetDisplayMode((TInt)a1);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1177
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1178
		
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1179
		case EDisplayHalMode:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1180
			kumemput32(a1, &iVideoInfo.iDisplayMode, sizeof(iVideoInfo.iDisplayMode));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1181
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1182
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1183
		case EDisplayHalSetPaletteEntry:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1184
			if(!Kern::CurrentThreadHasCapability(ECapabilityMultimediaDD,__PLATSEC_DIAGNOSTIC_STRING("Checked by Hal function EDisplayHalSetPaletteEntry")))
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1185
				return KErrPermissionDenied;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1186
			r = SetPaletteEntry((TInt)a1, (TInt)a2);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1187
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1188
		
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1189
		case EDisplayHalPaletteEntry:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1190
			{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1191
			TInt entry;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1192
			kumemget32(&entry, a1, sizeof(TInt));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1193
			TInt x;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1194
			r = GetPaletteEntry(entry, &x);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1195
			if (r == KErrNone)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1196
				kumemput32(a2, &x, sizeof(x));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1197
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1198
			}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1199
		
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1200
		case EDisplayHalSetState:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1201
			{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1202
			if(!Kern::CurrentThreadHasCapability(ECapabilityPowerMgmt,__PLATSEC_DIAGNOSTIC_STRING("Checked by Hal function EDisplayHalSetState")))
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1203
				return KErrPermissionDenied;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1204
			if ((TBool)a1)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1205
				{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1206
				WsSwitchOnScreen();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1207
				}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1208
			else
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1209
				{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1210
				WsSwitchOffScreen();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1211
				}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1212
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1213
			}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1214
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1215
		case EDisplayHalState:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1216
			kumemput32(a1, &iDisplayOn, sizeof(TBool));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1217
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1218
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1219
		case EDisplayHalColors:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1220
			{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1221
			TInt mdc = KConfigLcdMaxDisplayColors;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1222
			kumemput32(a1, &mdc, sizeof(mdc));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1223
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1224
			}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1225
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1226
		case EDisplayHalCurrentModeInfo:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1227
			{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1228
			TPckgBuf<TVideoInfoV01> vPckg;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1229
			r = GetCurrentDisplayModeInfo(vPckg(), (TBool)a2);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1230
			if (KErrNone == r)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1231
				Kern::InfoCopy(*(TDes8*)a1,vPckg);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1232
			}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1233
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1234
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1235
		case EDisplayHalSpecifiedModeInfo:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1236
			{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1237
			TPckgBuf<TVideoInfoV01> vPckg;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1238
			TInt mode;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1239
			kumemget32(&mode, a1, sizeof(mode));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1240
			r = GetSpecifiedDisplayModeInfo(mode, vPckg());
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1241
			if (KErrNone == r)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1242
				Kern::InfoCopy(*(TDes8*)a2,vPckg);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1243
			}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1244
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1245
			
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1246
		case EDisplayHalSecure:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1247
			kumemput32(a1, &iSecureDisplay, sizeof(TBool));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1248
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1249
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1250
		case EDisplayHalSetSecure:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1251
			{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1252
			if(!Kern::CurrentThreadHasCapability(ECapabilityMultimediaDD,__PLATSEC_DIAGNOSTIC_STRING("Checked by Hal function EDisplayHalSetSecure")))
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1253
				return KErrPermissionDenied;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1254
			SwitchDisplay((TBool)a1);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1255
			}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1256
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1257
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1258
		default:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1259
			r=KErrNotSupported;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1260
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1261
		}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1262
	return r;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1263
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1264
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1265
32
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1266
#ifdef ENABLE_GCE_MODE
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1267
DLcdPowerHandler* DLcdPowerHandler::pLcd = NULL;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1268
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1269
void DLcdPowerHandler::ChangeFrameBufferAddress(TUint32 aFbAddr)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1270
	{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1271
	//TODO: this is guess work
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1272
	//find out the correct sequence to change LCD DMA address
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1273
	//
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1274
	const TInt8 DISPC_GODIGITAL_BITSHIFT = 6;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1275
	const TInt8 DISPC_GOLCD_BITSHIFT = 5;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1276
	const TUint32 goFlags = (1 << DISPC_GODIGITAL_BITSHIFT) | (1 << DISPC_GOLCD_BITSHIFT);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1277
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1278
	const TUint32 ctl = GET_REGISTER(DISPC_CONTROL);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1279
	SET_REGISTER(DISPC_GFX_BA1, aFbAddr);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1280
	SET_REGISTER(DISPC_CONTROL, ctl | goFlags);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1281
	}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1282
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1283
#include <display.h>
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1284
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1285
class DDisplayPddBeagle : public DDisplayPdd
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1286
	{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1287
public:
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1288
	DDisplayPddBeagle();
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1289
	~DDisplayPddBeagle();
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1290
    virtual TInt  SetLegacyMode();
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1291
    virtual TInt  SetGceMode();
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1292
    virtual TInt  SetRotation(RDisplayChannel::TDisplayRotation aRotation);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1293
	virtual TInt  PostUserBuffer(TBufferNode* aNode);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1294
	virtual TInt  PostCompositionBuffer(TBufferNode* aNode);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1295
    virtual TInt  PostLegacyBuffer();
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1296
    virtual TInt  CloseMsg();
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1297
    virtual TInt  CreateChannelSetup(TInt aUnit);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1298
   	virtual TBool  PostPending();
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1299
    virtual TDfcQue* DfcQ(TInt  aUnit);    
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1300
            
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1301
public:
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1302
	static void VSyncDfcFn(TAny* aChannel);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1303
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1304
private:
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1305
	TDfcQue* 			iDfcQ;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1306
	TVideoInfoV01    	iScreenInfo;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1307
    TBufferNode*     	iPendingBuffer;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1308
    TBufferNode*     	iActiveBuffer;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1309
    DChunk* 		 	iChunk;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1310
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1311
public:
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1312
	TDfc 		     	iVSyncDfc;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1313
	};
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1314
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1315
class DDisplayPddFactory : public DPhysicalDevice
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1316
	{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1317
public:
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1318
	DDisplayPddFactory();
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1319
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1320
	virtual TInt Install();
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1321
	virtual void GetCaps(TDes8& aDes) const;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1322
	virtual TInt Create(DBase*& aChannel, TInt aUnit, const TDesC8* aInfo, const TVersion& aVer);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1323
	virtual TInt Validate(TInt aDeviceType, const TDesC8* anInfo, const TVersion& aVer);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1324
	};
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1325
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1326
const TInt KVSyncDfcPriority = 7 ;   //priority of DFC within the queue (0 to 7, where 7 is highest)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1327
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1328
DDisplayPddBeagle::DDisplayPddBeagle():
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1329
	iPendingBuffer(NULL),
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1330
	iActiveBuffer(NULL),
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1331
	iChunk(NULL),
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1332
	iVSyncDfc(&VSyncDfcFn, this, KVSyncDfcPriority)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1333
	{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1334
	__KTRACE_OPT(KEXTENSION, Kern::Printf("DDisplayPddBeagle::DDisplayPddBeagle"));
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1335
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1336
	iPostFlag = EFalse;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1337
	}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1338
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1339
DDisplayPddBeagle::~DDisplayPddBeagle()
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1340
	{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1341
	__KTRACE_OPT(KEXTENSION, Kern::Printf("DDisplayPddBeagle::~DDisplayPddBeagle()"));
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1342
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1343
	//The DFC Queue is owned by DLcdPowerHandler so we shouldn't call Destroy() at this point.
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1344
	if (iDfcQ)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1345
		{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1346
		iDfcQ=NULL;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1347
		}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1348
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1349
	DChunk* chunk = (DChunk*) __e32_atomic_swp_ord_ptr(&iChunk, 0);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1350
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1351
	if(chunk)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1352
		{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1353
		Kern::ChunkClose(chunk);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1354
		}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1355
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1356
	}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1357
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1358
TInt DDisplayPddBeagle::SetLegacyMode()
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1359
	{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1360
	__KTRACE_OPT(KEXTENSION, Kern::Printf("DDisplayPddBeagle::SetLegacyMode()"));
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1361
    return KErrNone;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1362
	}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1363
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1364
TInt DDisplayPddBeagle::SetGceMode()
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1365
	{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1366
	__KTRACE_OPT(KEXTENSION, Kern::Printf("DDisplayPddBeagle::SetGceMode()"));
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1367
    PostCompositionBuffer(&iLdd->iCompositionBuffer[0]);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1368
    return KErrNone;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1369
	}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1370
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1371
TInt DDisplayPddBeagle::SetRotation(RDisplayChannel::TDisplayRotation aDegOfRot)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1372
	{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1373
	__KTRACE_OPT(KEXTENSION, Kern::Printf("DDisplayPddBeagle::SetRotation()"));
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1374
	return KErrNone;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1375
	}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1376
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1377
TInt DDisplayPddBeagle::PostUserBuffer(TBufferNode* aNode)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1378
	{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1379
	__KTRACE_OPT(KEXTENSION, Kern::Printf("DDisplayPddBeagle::PostUserBuffer :  aNode->iAddress = %08x\n", aNode->iAddress));
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1380
	if(iPendingBuffer)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1381
		{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1382
		iPendingBuffer->iState = EBufferFree;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1383
		if (!(iPendingBuffer->iType == EBufferTypeUser) )
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1384
			{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1385
			iPendingBuffer->iFree  = ETrue;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1386
			}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1387
		}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1388
	aNode->iState   = EBufferPending;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1389
	iPendingBuffer	= aNode;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1390
	iPostFlag		= ETrue;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1391
	
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1392
  	// Activate the posted buffer
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1393
	TUint32 physicalAddress = Epoc::LinearToPhysical( aNode->iAddress );
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1394
	DLcdPowerHandler::pLcd->ChangeFrameBufferAddress(physicalAddress);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1395
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1396
	/* Queue a DFC to complete the request*/
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1397
	iVSyncDfc.Enque();
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1398
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1399
	return KErrNone;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1400
	}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1401
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1402
TInt DDisplayPddBeagle::PostCompositionBuffer(TBufferNode* aNode)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1403
	{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1404
	__KTRACE_OPT(KEXTENSION, Kern::Printf("DDisplayPddBeagle::PostCompositionBuffer :  aNode->iAddress = %08x\n", aNode->iAddress));
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1405
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1406
	if(iPendingBuffer)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1407
		{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1408
		iPendingBuffer->iState = EBufferFree;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1409
		if (iPendingBuffer->iType == EBufferTypeUser)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1410
			{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1411
			RequestComplete(RDisplayChannel::EReqPostUserBuffer, KErrCancel);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1412
			}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1413
		else
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1414
			{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1415
			iPendingBuffer->iFree  = ETrue;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1416
			}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1417
		}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1418
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1419
	aNode->iState	= EBufferPending;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1420
	aNode->iFree	= EFalse;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1421
	iPendingBuffer	= aNode;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1422
	iPostFlag		= ETrue;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1423
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1424
  	// Activate the posted buffer
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1425
	TUint32 physicalAddress = Epoc::LinearToPhysical( aNode->iAddress );
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1426
	DLcdPowerHandler::pLcd->ChangeFrameBufferAddress(physicalAddress);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1427
	
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1428
	/* Queue a DFC to complete the request*/
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1429
	iVSyncDfc.Enque();
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1430
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1431
	return KErrNone;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1432
	}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1433
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1434
TInt DDisplayPddBeagle::PostLegacyBuffer()
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1435
	{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1436
	__KTRACE_OPT(KEXTENSION, Kern::Printf("DDisplayPddBeagle::PostLegacyBuffer()"));
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1437
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1438
	if(iPendingBuffer)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1439
		{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1440
		iPendingBuffer->iState = EBufferFree;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1441
		if (iPendingBuffer->iType == EBufferTypeUser)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1442
			{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1443
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1444
			RequestComplete(RDisplayChannel::EReqPostUserBuffer, KErrCancel);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1445
			}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1446
		else
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1447
			{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1448
			iPendingBuffer->iFree  = ETrue;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1449
			}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1450
		}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1451
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1452
	iLdd->iLegacyBuffer[0].iState		= EBufferPending;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1453
	iLdd->iLegacyBuffer[0].iFree		= EFalse;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1454
	iPendingBuffer						= &iLdd->iLegacyBuffer[0];
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1455
	iPostFlag		= ETrue;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1456
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1457
  	// Activate the posted buffer
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1458
	DLcdPowerHandler::pLcd->ChangeFrameBufferAddress(DLcdPowerHandler::pLcd->ivRamPhys);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1459
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1460
	/* Queue a DFC to complete the request*/
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1461
	iVSyncDfc.Enque();
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1462
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1463
	return KErrNone;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1464
	}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1465
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1466
TInt DDisplayPddBeagle::CloseMsg()
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1467
	{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1468
	__KTRACE_OPT(KEXTENSION, Kern::Printf("DDisplayPddBeagle::CloseMsg()"));
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1469
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1470
	iPendingBuffer  = NULL;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1471
	iActiveBuffer	= NULL;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1472
	iVSyncDfc.Cancel();
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1473
    return KErrNone;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1474
	}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1475
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1476
TInt DDisplayPddBeagle::CreateChannelSetup(TInt aUnit)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1477
	{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1478
	__KTRACE_OPT(KEXTENSION, Kern::Printf("DDisplayPddBeagle::CreateChannelSetup()"));
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1479
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1480
	iScreenInfo = DLcdPowerHandler::pLcd->iVideoInfo;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1481
	iLdd->iUnit = aUnit;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1482
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1483
	iLdd->iDisplayInfo.iAvailableRotations			= RDisplayChannel::ERotationNormal;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1484
	iLdd->iDisplayInfo.iNormal.iOffsetBetweenLines	= iScreenInfo.iOffsetBetweenLines;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1485
	iLdd->iDisplayInfo.iNormal.iHeight				= iScreenInfo.iSizeInPixels.iHeight;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1486
	iLdd->iDisplayInfo.iNormal.iWidth				= iScreenInfo.iSizeInPixels.iWidth;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1487
	iLdd->iDisplayInfo.iNumCompositionBuffers		= KDisplayCBMax;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1488
	iLdd->iDisplayInfo.iBitsPerPixel				= iScreenInfo.iBitsPerPixel;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1489
    iLdd->iDisplayInfo.iRefreshRateHz = 60;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1490
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1491
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1492
	switch (iScreenInfo.iBitsPerPixel)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1493
		{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1494
		case 16:
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1495
			iLdd->iDisplayInfo.iPixelFormat = EUidPixelFormatRGB_565;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1496
			break;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1497
		case 24:
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1498
			iLdd->iDisplayInfo.iPixelFormat = EUidPixelFormatRGB_888;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1499
			break;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1500
		case 32:
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1501
			iLdd->iDisplayInfo.iPixelFormat = EUidPixelFormatARGB_8888;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1502
			break;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1503
		default:
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1504
			iLdd->iDisplayInfo.iPixelFormat = EUidPixelFormatUnknown;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1505
			break;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1506
		}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1507
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1508
	iLdd->iCurrentRotation = RDisplayChannel::ERotationNormal;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1509
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1510
	// Open shared chunk to the composition framebuffer
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1511
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1512
	DChunk* chunk = 0;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1513
	TLinAddr chunkKernelAddr  = 0;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1514
	TUint32 chunkMapAttr = 0;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1515
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1516
	// round to twice the page size
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1517
	TUint round  =  2*Kern::RoundToPageSize(DLcdPowerHandler::pLcd->iSize);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1518
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1519
	__KTRACE_OPT(KEXTENSION, Kern::Printf("DDisplayPddBeagle::CreateChannelSetup DLcdPowerHandler::pLcd->iSize  = %d\n", DLcdPowerHandler::pLcd->iSize));
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1520
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1521
	TChunkCreateInfo info;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1522
	info.iType					 = TChunkCreateInfo::ESharedKernelMultiple;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1523
	info.iMaxSize				 = round;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1524
	info.iMapAttr				 = EMapAttrFullyBlocking;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1525
	info.iOwnsMemory			 = EFalse;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1526
	info.iDestroyedDfc			 = 0;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1527
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1528
	TInt r = Kern::ChunkCreate(info, chunk, chunkKernelAddr, chunkMapAttr);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1529
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1530
	__KTRACE_OPT(KEXTENSION, Kern::Printf("CreateChannelSetup:ChunkCreate called for composition chunk. Set iChunkKernelAddr  = %08x\n", chunkKernelAddr));
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1531
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1532
	if( r == KErrNone)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1533
		{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1534
		// map our chunk
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1535
		r = Kern::ChunkCommitPhysical(chunk, 0,round , DLcdPowerHandler::pLcd->iCompositionPhysical);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1536
		__KTRACE_OPT(KEXTENSION, Kern::Printf("Mapping chunk %d", r));
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1537
		if(r != KErrNone)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1538
			{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1539
			Kern::ChunkClose(chunk);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1540
			}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1541
		}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1542
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1543
	if ( r!= KErrNone)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1544
		{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1545
		return r;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1546
		}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1547
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1548
	iChunk	= chunk;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1549
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1550
	// init CB 0
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1551
	iLdd->iCompositionBuffer[0].iType			= EBufferTypeComposition;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1552
	iLdd->iCompositionBuffer[0].iBufferId		= 0;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1553
	iLdd->iCompositionBuffer[0].iFree			= ETrue;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1554
	iLdd->iCompositionBuffer[0].iState			= EBufferFree;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1555
	iLdd->iCompositionBuffer[0].iAddress		= chunkKernelAddr;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1556
	iLdd->iCompositionBuffer[0].iPhysicalAddress = Epoc::LinearToPhysical(chunkKernelAddr);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1557
	iLdd->iCompositionBuffer[0].iChunk			= chunk;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1558
	iLdd->iCompositionBuffer[0].iHandle			= 0;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1559
	iLdd->iCompositionBuffer[0].iOffset			= 0;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1560
	iLdd->iCompositionBuffer[0].iSize			= DLcdPowerHandler::pLcd->iSize;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1561
	iLdd->iCompositionBuffer[0].iPendingRequest = 0;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1562
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1563
	// init CB 1
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1564
	iLdd->iCompositionBuffer[1].iType			= EBufferTypeComposition;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1565
	iLdd->iCompositionBuffer[1].iBufferId		= 1;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1566
	iLdd->iCompositionBuffer[1].iFree			= ETrue;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1567
	iLdd->iCompositionBuffer[1].iState			= EBufferFree;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1568
	iLdd->iCompositionBuffer[1].iAddress		= chunkKernelAddr + DLcdPowerHandler::pLcd->iSize;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1569
	iLdd->iCompositionBuffer[1].iPhysicalAddress = Epoc::LinearToPhysical(chunkKernelAddr + DLcdPowerHandler::pLcd->iSize);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1570
	iLdd->iCompositionBuffer[1].iChunk			= chunk;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1571
	iLdd->iCompositionBuffer[1].iHandle			= 0;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1572
	iLdd->iCompositionBuffer[1].iOffset			= DLcdPowerHandler::pLcd->iSize;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1573
	iLdd->iCompositionBuffer[1].iSize			= DLcdPowerHandler::pLcd->iSize;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1574
	iLdd->iCompositionBuffer[1].iPendingRequest = 0;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1575
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1576
	iLdd->iCompositionBuffIdx					= 0;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1577
	//Use the same DFC queue created by the DLcdPowerHandler so all hardware accesses are executed under the same DFC thread.
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1578
	iDfcQ= DLcdPowerHandler::pLcd->iDfcQ;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1579
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1580
	// Set the Post DFC.
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1581
	iVSyncDfc.SetDfcQ(iDfcQ);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1582
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1583
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1584
	return KErrNone;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1585
	}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1586
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1587
TBool DDisplayPddBeagle::PostPending()
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1588
	{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1589
	return (iPendingBuffer != NULL);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1590
	}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1591
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1592
TDfcQue * DDisplayPddBeagle::DfcQ(TInt aUnit)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1593
	{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1594
	return iDfcQ;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1595
	}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1596
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1597
void DDisplayPddBeagle::VSyncDfcFn(TAny* aChannel)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1598
	{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1599
	DDisplayPddBeagle * channel =(DDisplayPddBeagle*)aChannel;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1600
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1601
	if (channel->iPostFlag)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1602
		{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1603
		 channel->iPostFlag = EFalse;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1604
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1605
		if (channel->iActiveBuffer)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1606
			{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1607
			//When a User buffer is registered its iFree member becomes EFalse and Deregister sets it
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1608
			//back to ETrue. Composition and Legacy buffers are not free when they are in the pending or
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1609
			//active state.
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1610
			if (channel->iActiveBuffer->iType == EBufferTypeUser)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1611
				{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1612
				channel->RequestComplete(RDisplayChannel::EReqPostUserBuffer, KErrNone);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1613
				}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1614
			else
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1615
				{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1616
				channel->iActiveBuffer->iFree	= ETrue;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1617
				}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1618
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1619
			channel->iActiveBuffer->iState		= EBufferFree;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1620
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1621
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1622
			//If no buffer was available during a call to GetCompositionBuffer the active buffer has
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1623
			//been returned as the next available one, so we must set the buffer to the proper state before we
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1624
			//send the notification.
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1625
			TInt pendingIndex = channel->iLdd->iPendingIndex[RDisplayChannel::EReqGetCompositionBuffer];
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1626
			if(channel->iLdd->iPendingReq[RDisplayChannel::EReqGetCompositionBuffer][pendingIndex].iTClientReq)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1627
				{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1628
				if(channel->iLdd->iPendingReq[RDisplayChannel::EReqGetCompositionBuffer][pendingIndex].iTClientReq->IsReady())
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1629
					{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1630
					channel->iActiveBuffer->iState = EBufferCompose;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1631
				    channel->RequestComplete(RDisplayChannel::EReqGetCompositionBuffer,KErrNone);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1632
				    }
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1633
			    }
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1634
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1635
			channel->iActiveBuffer				= NULL;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1636
			}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1637
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1638
		if (channel->iPendingBuffer)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1639
			{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1640
			__KTRACE_OPT(KEXTENSION, Kern::Printf("DDisplayPddBeagle::VSyncDfcFn moving pending buffer at address %08x to the active state\n", channel->iPendingBuffer->iAddress));
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1641
			channel->iActiveBuffer			= channel->iPendingBuffer;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1642
			channel->iActiveBuffer->iState	= EBufferActive;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1643
			channel->iPendingBuffer			= NULL;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1644
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1645
			channel->RequestComplete(RDisplayChannel::EReqWaitForPost,  KErrNone);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1646
			}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1647
		}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1648
	}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1649
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1650
DDisplayPddFactory::DDisplayPddFactory()
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1651
	{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1652
	__KTRACE_OPT(KEXTENSION, Kern::Printf("DDisplayPddFactory::DDisplayPddFactory()"));
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1653
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1654
	iVersion		= TVersion(KDisplayChMajorVersionNumber,
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1655
                      KDisplayChMinorVersionNumber,
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1656
                      KDisplayChBuildVersionNumber);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1657
	}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1658
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1659
TInt DDisplayPddFactory::Create(DBase*& aChannel, TInt aUnit, const TDesC8* aInfo, const TVersion& aVer)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1660
	{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1661
	__KTRACE_OPT(KEXTENSION, Kern::Printf("DDisplayPddFactory::Create()"));
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1662
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1663
	DDisplayPddBeagle *device= new DDisplayPddBeagle() ;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1664
	aChannel=device;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1665
	if (!device)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1666
		{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1667
		return KErrNoMemory;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1668
		}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1669
	return KErrNone;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1670
	}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1671
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1672
TInt DDisplayPddFactory::Install()
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1673
	{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1674
	__KTRACE_OPT(KEXTENSION, Kern::Printf("DDisplayPddFactory::Install()"));
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1675
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1676
	TBuf<32> name(RDisplayChannel::Name());
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1677
	_LIT(KPddExtension,".pdd");
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1678
	name.Append(KPddExtension);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1679
	return SetName(&name);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1680
	}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1681
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1682
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1683
void DDisplayPddFactory::GetCaps(TDes8& /*aDes*/) const
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1684
	{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1685
	//Not supported
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1686
	}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1687
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1688
TInt DDisplayPddFactory::Validate(TInt aUnit, const TDesC8* /*anInfo*/, const TVersion& aVer)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1689
	{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1690
	__KTRACE_OPT(KEXTENSION, Kern::Printf("DDisplayPddFactory::Validate()"));
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1691
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1692
	if (!Kern::QueryVersionSupported(iVersion,aVer))
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1693
		{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1694
		return KErrNotSupported;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1695
		}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1696
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1697
	if (aUnit != 0)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1698
		{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1699
		return KErrNotSupported;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1700
		}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1701
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1702
	return KErrNone;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1703
	}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1704
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1705
#endif //ENABLE_GCE_MODE
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1706
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1707
DECLARE_STANDARD_EXTENSION()
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1708
	{
32
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1709
	__KTRACE_OPT(KEXTENSION, Kern::Printf("Creating DLcdPowerHandler"));
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1710
32
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1711
	TInt r = KErrNoMemory;
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1712
	DLcdPowerHandler* pH=new DLcdPowerHandler;
32
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1713
	if (!pH)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1714
		{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1715
		__KTRACE_OPT(KEXTENSION, Kern::Printf("Failed to create DLcdPowerHandler %d", r));
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1716
		return r;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1717
		}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1718
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1719
	r = pH->Create();
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1720
	if (r != KErrNone)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1721
		{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1722
		__KTRACE_OPT(KEXTENSION, Kern::Printf("Failed to create DLcdPowerHandler %d", r));
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1723
		return r;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1724
		}
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1725
32
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1726
#ifdef ENABLE_GCE_MODE
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1727
	__KTRACE_OPT(KEXTENSION, Kern::Printf("Creating DDisplayPddFactory"));
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1728
	r = KErrNoMemory;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1729
	DDisplayPddFactory * device = new DDisplayPddFactory;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1730
	if (!device)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1731
		{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1732
		__KTRACE_OPT(KEXTENSION, Kern::Printf("Failed to create DLcdPowerHandler %d", r));
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1733
		return r;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1734
		}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1735
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1736
	__KTRACE_OPT(KEXTENSION, Kern::Printf("Installing DDisplayPddFactory"));
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1737
	r = Kern::InstallPhysicalDevice(device);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1738
	if (r != KErrNone)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1739
		{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1740
		__KTRACE_OPT(KEXTENSION, Kern::Printf("Failed to install DDisplayPddFactory %d", r));
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1741
		}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1742
#endif
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1743
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1744
	return r;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1745
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1746