omap3530/beagle_drivers/lcd/lcd.cpp
author will.long
Tue, 21 Sep 2010 13:48:52 +0800
changeset 78 0d34a4aa948d
parent 32 161f6b2f6990
permissions -rwxr-xr-x
change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
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.
78
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
    20
////
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
    21
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    22
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    23
#include <videodriver.h>
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    24
#include <platform.h>
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    25
#include <nkern.h>
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    26
#include <kernel.h>
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    27
#include <kern_priv.h>
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    28
#include <kpower.h>
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    29
#include <assp/omap3530_assp/omap3530_assp_priv.h>
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    30
#include <assp/omap3530_assp/omap3530_hardware_base.h>
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    31
#include <assp/omap3530_assp/omap3530_prcm.h>
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    32
32
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
    33
//#undef __KTRACE_OPT
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
    34
//#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
    35
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    36
#define DSS_SYSCONFIG				0x48050010
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    37
#define DISPC_SYSSTATUS				0x48050414
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    38
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    39
#define DISPC_SYSCONFIG				0x48050410
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    40
#define DISPC_CONFIG				0x48050444
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    41
#define DISPC_DEFAULT_COLOR0		0x4805044c
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    42
#define DISPC_TRANS_COLOR0			0x48050454
78
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
    43
#define DISPC_LINE_STATUS			0x4805045C
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    44
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    45
#define DISPC_TIMING_H				0x48050464
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    46
#define DISPC_TIMING_V				0x48050468
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    47
#define DISPC_POL_FREQ				0x4805046c
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    48
#define DISPC_DIVISOR				0x48050470
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    49
#define DISPC_SIZE_LCD				0x4805047c
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    50
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    51
#define DISPC_GFX_BA1				0x48050480
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    52
#define DISPC_GFX_BA2				0x48050484
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    53
#define DISPC_GFX_POSITION			0x48050488
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    54
#define DISPC_GFX_SIZE				0x4805048c
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    55
#define DISPC_GFX_ATTRIBUTES		0x480504a0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    56
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    57
#define DISPC_GFX_FIFO_THRESHOLD	0x480504a4
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    58
#define DISPC_GFX_FIFO_SIZE_STATUS	0x480504a8
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    59
#define DISPC_GFX_ROW_INC			0x480504ac
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    60
#define DISPC_GFX_PIXEL_INC			0x480504b0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    61
#define DISPC_GFX_WINDOW_SKIP		0x480504b4
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    62
#define DISPC_GFX_TABLE_BA			0x480504b8
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    63
78
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
    64
#define VENC_F_CONTROL				0x48050C08
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    65
#define DISPC_CONTROL				0x48050440
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 GET_REGISTER(Reg)		*( (TUint *) Omap3530HwBase::TVirtual<Reg>::Value )
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    68
#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
    69
78
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
    70
#define GPIO3_OE					0x49052034
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
    71
#define GPIO3_CLEARDATAOUT			0x49052090
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
    72
#define GPIO3_SETDATAOUT			0x49052094
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
    73
#define CONTROL_PADCONF_DSS_DATA18	0x48002100
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
    74
#define CONTROL_PADCONF_DSS_DATA20	0x48002104
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
    75
#define CONTROL_PADCONF_DSS_DATA22	0x48002108
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
    76
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
    77
//const TUint32 SPICLK=0x01000000,SPISDAO=0x02000000,SPISDAI=0x04000000,SPICS0=0x08000000,SPIRESET=0x10000000;
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
    78
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
    79
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
    80
#define GPIO5_OE					0x49056034
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
    81
#define GPIO5_CLEARDATAOUT			0x49056090
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
    82
#define GPIO5_SETDATAOUT			0x49056094
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
    83
#define GPIO5_DATADRAIN				0x49056038
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
    84
#define CONTROL_PADCONF_MMC2_CLK	0x48002158
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
    85
#define CONTROL_PADCONF_MMC2_DAT0	0x4800215C
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
    86
#define CONTROL_PADCONF_MMC2_DAT2	0x48002160
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
    87
#define CONTROL_PADCONF_MMC2_DAT4	0x48002164
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
    88
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
    89
#define KEXTENSION KALWAYS 
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
    90
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
    91
//const TUint32 SPICLK=0x00000004,SPISDAO=0x00000008,SPISDAI=0x00000010,SPICS0=0x00000040/*GPIO134*/,SPIRESET=0x00000080;
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
    92
const TUint32 SPICS0=0x00000040/*GPIO134*/,SPICLK=0x01000000,SPISDAO=0x02000000,
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
    93
			SPISDAI=0x04000000,SPIRESET=0x20000000;
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
    94
/**
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    95
#define _MODE_1280x1024_
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    96
//#define _MODE_1024x768_
32
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
    97
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    98
#ifdef _MODE_800x600_
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
    99
// 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
   100
// 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
   101
#	define PIXEL_CLK	40000
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   102
#	define H_DISP		800
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   103
#	define H_FPORCH	40
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   104
#	define H_SYNC		128
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   105
#	define H_BPORCH	88
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   106
#	define H_SYNC_POL	1
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   107
#	define V_DISP		600
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   108
#	define V_FPORCH	1
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   109
#	define V_SYNC		4
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   110
#	define V_BPORCH	23
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   111
#	define V_SYNC_POL	1
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   112
#	define INTERLACE_ENABLE	0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   113
#endif
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   114
#ifdef _MODE_1024x768_
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   115
// 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
   116
// 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
   117
#	define PIXEL_CLK	65000
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   118
#	define H_DISP		1024
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   119
#	define H_FPORCH	24
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   120
#	define H_SYNC		136
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   121
#	define H_BPORCH	160
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   122
#	define H_SYNC_POL	0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   123
#	define V_DISP		768
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   124
#	define V_FPORCH	3
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   125
#	define V_SYNC		6
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   126
#	define V_BPORCH	29
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   127
#	define V_SYNC_POL	0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   128
#	define INTERLACE_ENABLE	0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   129
#endif
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   130
#ifdef _MODE_1280x1024_
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   131
// 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
   132
// 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
   133
#	define PIXEL_CLK	108000
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   134
#	define H_DISP		1280
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   135
#	define H_FPORCH	48
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   136
#	define H_SYNC		112
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   137
#	define H_BPORCH	248
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   138
#	define H_SYNC_POL	1
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   139
#	define V_DISP		1024
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   140
#	define V_FPORCH	1
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   141
#	define V_SYNC		3
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   142
#	define V_BPORCH	38
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   143
#	define V_SYNC_POL	1
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   144
#	define INTERLACE_ENABLE	0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   145
#endif
78
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   146
*/
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   147
#	define PIXEL_CLK	25000	//this value is just the RGB's clk
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   148
#	define H_DISP		480
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   149
#	define H_FPORCH	20
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   150
#	define H_SYNC		20
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   151
#	define H_BPORCH	20
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   152
#	define H_SYNC_POL	1
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   153
#	define V_DISP		800
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   154
#	define V_FPORCH	500
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   155
#	define V_SYNC		250
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   156
#	define V_BPORCH	500
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   157
#	define V_SYNC_POL	1
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   158
#	define INTERLACE_ENABLE	0
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   159
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   160
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   161
// TO DO: (mandatory)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   162
// 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
   163
// 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
   164
const TInt KConfigInitialDisplayContrast	= 128;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   165
const TInt KConfigLcdMinDisplayContrast		= 1;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   166
const TInt KConfigLcdMaxDisplayContrast		= 255;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   167
const TInt KConfigInitialDisplayBrightness	= 128;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   168
const TInt KConfigLcdMinDisplayBrightness	= 1;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   169
const TInt KConfigLcdMaxDisplayBrightness	= 255;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   170
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   171
// TO DO: (mandatory)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   172
// define a macro to calculate the screen buffer size
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   173
// 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
   174
// 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
   175
// aLpp number of lines per panel
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   176
#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
   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
// TO DO: (mandatory)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   180
// define the physical screen dimensions
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   181
// This is only example code... you need to modify it for your hardware
78
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   182
//const TUint	KConfigLcdWidth					= 480;//360;//640;		// 640 pixels per line
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   183
//const TUint	KConfigLcdHeight				= 800;//640;//480;		// 480 lines per panel
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   184
const TUint	KConfigLcdWidth					= 360;//360;//640;		// 640 pixels per line
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   185
const TUint	KConfigLcdHeight				= 640;//640;//480;		// 480 lines per panel
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   186
// TO DO: (mandatory)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   187
// define the characteristics of the LCD display
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   188
// 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
   189
const TBool	KConfigLcdIsMono				= EFalse;
78
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   190
const TBool	KConfigLcdPixelOrderLandscape	= EFalse;//ETrue;
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   191
const TBool	KConfigLcdPixelOrderRGB			= ETrue;
78
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   192
//const TInt	KConfigLcdMaxDisplayColors		= 262144;//16777216;//65536;	//24bit: 16777216;
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   193
const TInt	KConfigLcdMaxDisplayColors		= 16777216;//262144;//16777216;//65536;	//24bit: 16777216;
0
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
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   196
// TO DO: (mandatory)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   197
// define the display dimensions in TWIPs
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   198
// 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
   199
// Therefore a TWIP is a 1440th of an inch
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   200
// This is only example code... you need to modify it for your hardware
78
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   201
const TInt	KConfigLcdWidthInTwips			= 2670;//2670;		// = 6.69 inches	//15*1440;
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   202
const TInt	KConfigLcdHeightInTwips			= 3550;//3550;		//5616;		// = 5.11 inches	//12*1440;
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   203
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   204
// TO DO: (mandatory)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   205
// define the available display modes
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   206
// 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
   207
const TInt  KConfigLcdNumberOfDisplayModes	= 1;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   208
const TInt  KConfigLcdInitialDisplayMode	= 0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   209
struct SLcdConfig
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   210
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   211
	TInt iMode;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   212
	TInt iOffsetToFirstVideoBuffer;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   213
	TInt iLenghtOfVideoBufferInBytes;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   214
	TInt iOffsetBetweenLines;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   215
	TBool iIsPalettized;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   216
	TInt iBitsPerPixel;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   217
	};
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   218
static const SLcdConfig Lcd_Mode_Config[KConfigLcdNumberOfDisplayModes]=
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   219
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   220
		{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   221
		0,								// iMode
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   222
		0,								// iOffsetToFirstVideoBuffer
78
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   223
//		FRAME_BUFFER_SIZE(16/*32*//*16*/, KConfigLcdWidth, KConfigLcdHeight),	// iLenghtOfVideoBufferInBytes
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   224
//		KConfigLcdWidth*2/*4*/,//2,				// iOffsetBetweenLines
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   225
//		EFalse,							// iIsPalettized
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   226
//		16/*32,*///16								// iBitsPerPixel
32
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   227
		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
   228
		KConfigLcdWidth*4,//2,				// iOffsetBetweenLines
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   229
		EFalse,							// iIsPalettized
32
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   230
		32,//16								// iBitsPerPixel
78
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   231
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   232
		}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   233
	};	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   234
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   235
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   236
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   237
_LIT(KLitLcd,"LCD");
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   238
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   239
//
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   240
// TO DO: (optional)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   241
//
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   242
// Add any private functions and data you require
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   243
//
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   244
NONSHARABLE_CLASS(DLcdPowerHandler) : public DPowerHandler
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   245
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   246
public: 
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   247
	DLcdPowerHandler();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   248
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   249
	// from DPowerHandler
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   250
	void PowerDown(TPowerState);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   251
	void PowerUp();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   252
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   253
	void PowerUpDfc();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   254
	void PowerDownDfc();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   255
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   256
	TInt Create();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   257
	void DisplayOn();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   258
	void DisplayOff();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   259
	TInt HalFunction(TInt aFunction, TAny* a1, TAny* a2);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   260
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   261
	void PowerUpLcd(TBool aSecure);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   262
	void PowerDownLcd();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   263
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   264
	void ScreenInfo(TScreenInfoV01& aInfo);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   265
	void WsSwitchOnScreen();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   266
	void WsSwitchOffScreen();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   267
	void HandleMsg();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   268
	void SwitchDisplay(TBool aSecure);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   269
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   270
	void SetBacklightState(TBool aState);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   271
	void BacklightOn();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   272
	void BacklightOff();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   273
	TInt SetContrast(TInt aContrast);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   274
	TInt SetBrightness(TInt aBrightness);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   275
32
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   276
#ifdef ENABLE_GCE_MODE
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   277
	void ChangeFrameBufferAddress(TUint32 aFbAddr);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   278
#endif
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   279
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   280
private:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   281
	TInt SetPaletteEntry(TInt aEntry, TInt aColor);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   282
	TInt GetPaletteEntry(TInt aEntry, TInt* aColor);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   283
	TInt NumberOfPaletteEntries();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   284
	TInt GetCurrentDisplayModeInfo(TVideoInfoV01& aInfo, TBool aSecure);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   285
	TInt GetSpecifiedDisplayModeInfo(TInt aMode, TVideoInfoV01& aInfo);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   286
	TInt SetDisplayMode(TInt aMode);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   287
	void SplashScreen();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   288
	TInt GetDisplayColors(TInt* aColors);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   289
32
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   290
#ifdef ENABLE_GCE_MODE
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   291
public:
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   292
	static DLcdPowerHandler* pLcd;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   293
	TInt iSize;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   294
	TPhysAddr iCompositionPhysical;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   295
	TVideoInfoV01 iVideoInfo;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   296
	TDfcQue* iDfcQ;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   297
	TPhysAddr ivRamPhys;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   298
#endif
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   299
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   300
private:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   301
	TBool iIsPalettized;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   302
	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
   303
	DPlatChunkHw* iChunk;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   304
	DPlatChunkHw* iSecureChunk;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   305
	TBool iWsSwitchOnScreen;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   306
 	TBool iSecureDisplay;
78
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   307
//	TDfcQue* iDfcQ;
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   308
	TMessageQue iMsgQ;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   309
	TDfc iPowerUpDfc;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   310
	TDfc iPowerDownDfc;	
32
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   311
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   312
#ifndef ENABLE_GCE_MODE
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   313
	TDfcQue* iDfcQ;
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   314
	TVideoInfoV01 iVideoInfo;
32
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   315
	TPhysAddr ivRamPhys;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   316
#endif
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   317
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   318
	TVideoInfoV01 iSecureVideoInfo;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   319
	NFastMutex iLock;				// protects against being preempted whilst manipulating iVideoInfo/iSecureVideoInfo
78
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   320
//	TPhysAddr ivRamPhys;
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   321
	TPhysAddr iSecurevRamPhys;
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
	TBool iBacklightOn;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   324
	TInt iContrast;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   325
	TInt iBrightness;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   326
	};
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
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   329
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   330
HAL handler function
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   331
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   332
@param	aPtr a pointer to an instance of DLcdPowerHandler
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   333
@param	aFunction the function number
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   334
@param	a1 an arbitrary parameter
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   335
@param	a2 an arbitrary parameter
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
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
   338
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   339
	DLcdPowerHandler* pH=(DLcdPowerHandler*)aPtr;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   340
	return pH->HalFunction(aFunction,a1,a2);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   341
	}
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
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   344
DFC for receiving messages from the power handler
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   345
@param	aPtr a pointer to an instance of DLcdPowerHandler
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   346
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   347
void rxMsg(TAny* aPtr)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   348
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   349
	DLcdPowerHandler& h=*(DLcdPowerHandler*)aPtr;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   350
	h.HandleMsg();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   351
	}
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
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   354
DFC for powering up the device
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   355
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   356
@param aPtr	aPtr a pointer to an instance of DLcdPowerHandler
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   357
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   358
void power_up_dfc(TAny* aPtr)
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
	((DLcdPowerHandler*)aPtr)->PowerUpDfc();
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
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   364
DFC for powering down the device
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   365
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   366
@param aPtr	aPtr a pointer to an instance of DLcdPowerHandler
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   367
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   368
void power_down_dfc(TAny* aPtr)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   369
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   370
	((DLcdPowerHandler*)aPtr)->PowerDownDfc();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   371
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   372
78
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   373
void Wait_(void)	//Wait_() nearly =1ms
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   374
{
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   375
	Kern::NanoWait(7000000);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   376
//	Kern::NanoWait(10000000);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   377
//	Kern::NanoWait(10000000);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   378
//	Kern::NanoWait(10000000);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   379
	
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   380
}
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   381
void Wait_1(void)
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   382
{
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   383
	Kern::NanoWait(700000);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   384
}
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   385
void Wait(int ms)
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   386
{
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   387
	for(int i=0;i<ms;i++)
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   388
		Wait_();
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   389
}
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   390
void Wait2(int ms)
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   391
{
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   392
	for(int i=0;i<ms;i++)
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   393
		Wait_();
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   394
}
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   395
void Wait3(int ms)
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   396
{
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   397
	for(int i=0;i<ms;i++)
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   398
		Wait_1();
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   399
}
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   400
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   401
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   402
/**
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   403
set the mux mode to GPIO, used to simulate GPIO function
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   404
SCL--GPIO88,--output
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   405
SDO--GPIO89,--output
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   406
SDI--GPIO90--input
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   407
CSa--GPIO91--output
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   408
CSb--GPIO92--output
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   409
RESET--GPIO93--output
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   410
CS0--GPIO134--output, LCD's chip select
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   411
*/
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   412
void SET_GPIOTOSPI(void)
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   413
{
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   414
	TUint32 l=0x00;
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   415
	TInt8	n=0x01,n1=0x04;
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   416
	TInt8	muxmode=0x04;//set mode4(GPIO)
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   417
//	l=GET_REGISTER(CONTROL_PADCONF_MMC2_CLK)&0xFFF8FFF8|muxmode|muxmode<<16;	//set as GPIO130.131
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   418
//	SET_REGISTER(CONTROL_PADCONF_MMC2_CLK,l);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   419
	l=GET_REGISTER(CONTROL_PADCONF_MMC2_DAT0)&0xFFFFFFF8|muxmode;	//set as GPIO132
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   420
	SET_REGISTER(CONTROL_PADCONF_MMC2_DAT0,l);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   421
	l=GET_REGISTER(CONTROL_PADCONF_MMC2_DAT2)&0xFFFFFFF8|muxmode;	//set as GPIO134.135
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   422
	SET_REGISTER(CONTROL_PADCONF_MMC2_DAT2,l);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   423
	
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   424
	l=GET_REGISTER(GPIO5_OE)&0xFFFFFF23|n<<4|n<<5;//set GPIO130.131.134.135 as output, 132 as input
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   425
	SET_REGISTER(GPIO5_OE,l);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   426
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   427
	l=GET_REGISTER(CONTROL_PADCONF_DSS_DATA18)&0xFFF8FFF8|muxmode|muxmode<<16;	//set as GPIO88,89
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   428
	SET_REGISTER(CONTROL_PADCONF_DSS_DATA18,l);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   429
	l=GET_REGISTER(CONTROL_PADCONF_DSS_DATA20)&0xFFF8FFF8|muxmode|muxmode<<16;	//set as GPIO90,91
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   430
	SET_REGISTER(CONTROL_PADCONF_DSS_DATA20,l);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   431
	l=GET_REGISTER(CONTROL_PADCONF_DSS_DATA22)&0xFFFFFFF8|muxmode|muxmode<<16;	//set as GPIO92,93
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   432
	SET_REGISTER(CONTROL_PADCONF_DSS_DATA22,l);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   433
	
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   434
	l=GET_REGISTER(GPIO3_OE)&0xC0FFFFFF|n1<<24;//SPI's input and output
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   435
	SET_REGISTER(GPIO3_OE,l);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   436
	
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   437
/////////set the init state
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   438
	SET_REGISTER(GPIO5_SETDATAOUT,SPICS0);//
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   439
	SET_REGISTER(GPIO3_CLEARDATAOUT,SPISDAO);//
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   440
	SET_REGISTER(GPIO3_CLEARDATAOUT,SPICLK);// 
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   441
	Wait3(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   442
}
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   443
void SCLRISING(void)	//create a rising edge
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   444
{
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   445
	SET_REGISTER(GPIO3_SETDATAOUT,SPICLK);		
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   446
	Wait3(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   447
	SET_REGISTER(GPIO3_CLEARDATAOUT,SPICLK);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   448
	//Wait(10);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   449
	
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   450
}
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   451
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   452
/**
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   453
Write_Reg_NT35582() is the function used to initialize LCD with the SPI, it follows the instruction 
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   454
from NT35582 spec page.21
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   455
*/
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   456
void Write_Reg_NT35582(TUint8 highcmd, TUint8 lowcmd, TUint8 lowpara)
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   457
{
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   458
	int i=0;
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   459
	//Write 1st command
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   460
	SET_REGISTER(GPIO5_CLEARDATAOUT,SPICS0);	//set cs0 low
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   461
	//Wait(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   462
	SET_REGISTER(GPIO3_CLEARDATAOUT,SPISDAO);	//set R/W=0
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   463
	Wait3(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   464
	SCLRISING();
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   465
	SET_REGISTER(GPIO3_CLEARDATAOUT,SPISDAO);	//set D/CX=0
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   466
	Wait3(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   467
	SCLRISING();
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   468
	SET_REGISTER(GPIO3_SETDATAOUT,SPISDAO);	//set H/L=1
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   469
	Wait3(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   470
	SCLRISING();
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   471
	for(i=0;i<5;i++)
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   472
		{
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   473
		SET_REGISTER(GPIO3_CLEARDATAOUT,SPISDAO);	//set data=0
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   474
		Wait3(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   475
		SCLRISING();
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   476
		}
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   477
	for(i=7;i>=0;i--)
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   478
		{
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   479
		if(highcmd>>i&1)
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   480
			{
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   481
			SET_REGISTER(GPIO3_SETDATAOUT,SPISDAO);	//set bit=1
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   482
			Wait3(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   483
			SCLRISING();
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   484
			}
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   485
		else
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   486
			{
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   487
			SET_REGISTER(GPIO3_CLEARDATAOUT,SPISDAO);	//set bit=1
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   488
			Wait3(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   489
			SCLRISING();
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   490
			}
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   491
		}
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   492
	SET_REGISTER(GPIO5_SETDATAOUT,SPICS0);	//set cs0 high
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   493
	Wait3(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   494
	//Write 2nd command
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   495
	SET_REGISTER(GPIO5_CLEARDATAOUT,SPICS0);	//set cs0 low
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   496
	//Wait(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   497
	SET_REGISTER(GPIO3_CLEARDATAOUT,SPISDAO);	//set R/W=0
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   498
	Wait3(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   499
	SCLRISING();
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   500
	SET_REGISTER(GPIO3_CLEARDATAOUT,SPISDAO);	//set D/CX=0
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   501
	Wait3(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   502
	SCLRISING();
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   503
	SET_REGISTER(GPIO3_CLEARDATAOUT,SPISDAO);	//set H/L=0
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   504
	Wait3(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   505
	SCLRISING();
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   506
	for(i=0;i<5;i++)
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   507
		{
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   508
		SET_REGISTER(GPIO3_CLEARDATAOUT,SPISDAO);	//set data=0
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   509
		Wait3(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   510
		SCLRISING();
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   511
		}
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   512
	for(i=7;i>=0;i--)
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   513
		{
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   514
		if(lowcmd>>i&1)
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   515
			{
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   516
			SET_REGISTER(GPIO3_SETDATAOUT,SPISDAO);	//set bit=1
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   517
			Wait3(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   518
			SCLRISING();
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   519
			}
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   520
		else
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   521
			{
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   522
			SET_REGISTER(GPIO3_CLEARDATAOUT,SPISDAO);	//set bit=1
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   523
			Wait3(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   524
			SCLRISING();
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   525
			}
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   526
		}
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   527
	
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   528
	SET_REGISTER(GPIO5_SETDATAOUT,SPICS0);	//set cs0 high
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   529
	Wait3(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   530
	//Write parameter
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   531
	SET_REGISTER(GPIO5_CLEARDATAOUT,SPICS0);	//set cs0 low
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   532
	//Wait(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   533
	SET_REGISTER(GPIO3_CLEARDATAOUT,SPISDAO);	//set R/W=0
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   534
	Wait3(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   535
	SCLRISING();
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   536
	SET_REGISTER(GPIO3_SETDATAOUT,SPISDAO);	//set D/CX=1
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   537
	Wait3(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   538
	SCLRISING();
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   539
	SET_REGISTER(GPIO3_CLEARDATAOUT,SPISDAO);	//set H/L=0
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   540
	Wait3(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   541
	SCLRISING();
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   542
	for(i=0;i<5;i++)
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   543
		{
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   544
		SET_REGISTER(GPIO3_CLEARDATAOUT,SPISDAO);	//set data=0
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   545
		Wait3(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   546
		SCLRISING();
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   547
		}
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   548
	for(i=7;i>=0;i--)
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   549
		{
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   550
		if(lowpara>>i&1)
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   551
			{
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   552
			SET_REGISTER(GPIO3_SETDATAOUT,SPISDAO);	//set bit=1
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   553
			Wait3(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   554
			SCLRISING();
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   555
			}
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   556
		else
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   557
			{
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   558
			SET_REGISTER(GPIO3_CLEARDATAOUT,SPISDAO);	//set bit=1
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   559
			Wait3(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   560
			SCLRISING();
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   561
			}
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   562
		}
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   563
	SET_REGISTER(GPIO5_SETDATAOUT,SPICS0);	//set cs0 high
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   564
	Wait3(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   565
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   566
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   567
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   568
	
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   569
}
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   570
void Read_Reg_NT35582(TUint8 highcmd, TUint8 lowcmd)
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   571
{
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   572
	int i=0;
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   573
	TUint8 lowpara=0;
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   574
	//Write 1st command
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   575
	SET_REGISTER(GPIO5_CLEARDATAOUT,SPICS0);	//set cs0 low
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   576
	Wait(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   577
	SET_REGISTER(GPIO3_CLEARDATAOUT,SPISDAO);	//set R/W=0
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   578
	Wait(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   579
	SCLRISING();
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   580
	SET_REGISTER(GPIO3_CLEARDATAOUT,SPISDAO);	//set D/CX=0
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   581
	Wait(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   582
	SCLRISING();
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   583
	SET_REGISTER(GPIO3_SETDATAOUT,SPISDAO);	//set H/L=1
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   584
	Wait(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   585
	SCLRISING();
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   586
	for(i=0;i<5;i++)
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   587
		{
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   588
		SET_REGISTER(GPIO3_CLEARDATAOUT,SPISDAO);	//set data=0
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   589
		Wait(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   590
		SCLRISING();
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   591
		}
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   592
	for(i=7;i>=0;i--)
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   593
		{
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   594
		if(highcmd>>i&1)
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   595
			{
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   596
			SET_REGISTER(GPIO3_SETDATAOUT,SPISDAO);	//set bit=1
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   597
			Wait(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   598
			SCLRISING();
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   599
			}
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   600
		else
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   601
			{
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   602
			SET_REGISTER(GPIO3_CLEARDATAOUT,SPISDAO);	//set bit=1
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   603
			Wait(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   604
			SCLRISING();
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   605
			}
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   606
		}
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   607
	SET_REGISTER(GPIO5_SETDATAOUT,SPICS0);	//set cs0 high
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   608
	Wait(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   609
	//Write 2nd command
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   610
	SET_REGISTER(GPIO5_CLEARDATAOUT,SPICS0);	//set cs0 low
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   611
	Wait(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   612
	SET_REGISTER(GPIO3_CLEARDATAOUT,SPISDAO);	//set R/W=0
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   613
	Wait(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   614
	SCLRISING();
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   615
	SET_REGISTER(GPIO3_CLEARDATAOUT,SPISDAO);	//set D/CX=0
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   616
	Wait(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   617
	SCLRISING();
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   618
	SET_REGISTER(GPIO3_CLEARDATAOUT,SPISDAO);	//set H/L=0
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   619
	Wait(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   620
	SCLRISING();
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   621
	for(i=0;i<5;i++)
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   622
		{
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   623
		SET_REGISTER(GPIO3_CLEARDATAOUT,SPISDAO);	//set data=0
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   624
		Wait(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   625
		SCLRISING();
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   626
		}
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   627
	for(i=7;i>=0;i--)
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   628
		{
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   629
		if(lowcmd>>i&1)
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   630
			{
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   631
			SET_REGISTER(GPIO3_SETDATAOUT,SPISDAO);	//set bit=1
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   632
			Wait(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   633
			SCLRISING();
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   634
			}
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   635
		else
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   636
			{
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   637
			SET_REGISTER(GPIO3_CLEARDATAOUT,SPISDAO);	//set bit=1
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   638
			Wait(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   639
			SCLRISING();
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   640
			}
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   641
		}
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   642
	
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   643
	SET_REGISTER(GPIO5_SETDATAOUT,SPICS0);	//set cs0 high
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   644
	Wait(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   645
	//Read  parameter
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   646
	SET_REGISTER(GPIO5_CLEARDATAOUT,SPICS0);	//set cs0 low
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   647
	Wait(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   648
	SET_REGISTER(GPIO3_SETDATAOUT,SPISDAO);	//set R/W=1
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   649
	Wait(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   650
	SCLRISING();
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   651
	SET_REGISTER(GPIO3_SETDATAOUT,SPISDAO);	//set D/CX=1
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   652
	Wait(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   653
	SCLRISING();
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   654
	SET_REGISTER(GPIO3_CLEARDATAOUT,SPISDAO);	//set H/L=0
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   655
	Wait(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   656
	SCLRISING();
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   657
	for(i=0;i<5;i++)
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   658
		{
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   659
		SET_REGISTER(GPIO3_CLEARDATAOUT,SPISDAO);	//set data=0
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   660
		Wait(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   661
		SCLRISING();
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   662
		}
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   663
	for(i=7;i>=0;i--)
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   664
		{
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   665
		SCLRISING();
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   666
		if(GET_REGISTER(GPIO5_DATADRAIN)&SPISDAI)
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   667
			lowpara|=1<<i;
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   668
		else
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   669
			lowpara|=0<<i;
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   670
		}
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   671
	SET_REGISTER(GPIO5_SETDATAOUT,SPICS0);	//set cs0 high
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   672
	Wait(1);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   673
	Kern::Printf("Get para from Reg %x %x is %x",highcmd,lowcmd,lowpara);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   674
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   675
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   676
	
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   677
}
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   678
void BYDLCD_INIT(void)
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   679
{
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   680
	Kern::Printf("Start LCD driver IC NT35582 Init");
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   681
	SET_GPIOTOSPI();
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   682
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   683
	SET_REGISTER(GPIO3_SETDATAOUT,SPIRESET);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   684
	Wait(100);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   685
	SET_REGISTER(GPIO3_CLEARDATAOUT,SPIRESET);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   686
	Wait(100);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   687
	SET_REGISTER(GPIO3_SETDATAOUT,SPIRESET);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   688
	Wait(100);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   689
	
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   690
	for(int i=0;i<1;i++)
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   691
		{
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   692
		Kern::Printf("init");
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   693
	Write_Reg_NT35582(0x01,0x00,0x00);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   694
	//Wait(100);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   695
	
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   696
	Write_Reg_NT35582(0xC0,0x00,0x86);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   697
	Write_Reg_NT35582(0xC0,0x01,0x00);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   698
	Write_Reg_NT35582(0xC0,0x02,0x86);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   699
	Write_Reg_NT35582(0xC0,0x03,0x00);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   700
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   701
	Write_Reg_NT35582(0xC1,0x00,0x60);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   702
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   703
	Write_Reg_NT35582(0xC2,0x00,0x21);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   704
	Write_Reg_NT35582(0xC2,0x02,0x70);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   705
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   706
	Write_Reg_NT35582(0xB6,0x00,0x10);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   707
	Write_Reg_NT35582(0xB6,0x02,0x30);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   708
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   709
	Write_Reg_NT35582(0xC7,0x00,0x8F);// here change the VCOM voltage
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   710
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   711
	Write_Reg_NT35582(0x36,0x00,0x41);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   712
	Write_Reg_NT35582(0x3A,0x00,0x66);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   713
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   714
	Write_Reg_NT35582(0xE0,0x00,0x0E);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   715
	Write_Reg_NT35582(0xE0,0x01,0x14);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   716
	Write_Reg_NT35582(0xE0,0x02,0x29);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   717
	Write_Reg_NT35582(0xE0,0x03,0x3A);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   718
	Write_Reg_NT35582(0xE0,0x04,0x1D);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   719
	Write_Reg_NT35582(0xE0,0x05,0x30);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   720
	Write_Reg_NT35582(0xE0,0x06,0x61);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   721
	Write_Reg_NT35582(0xE0,0x07,0x3D);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   722
	Write_Reg_NT35582(0xE0,0x08,0x22);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   723
	Write_Reg_NT35582(0xE0,0x09,0x2A);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   724
	Write_Reg_NT35582(0xE0,0x0A,0x87);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   725
	Write_Reg_NT35582(0xE0,0x0B,0x16);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   726
	Write_Reg_NT35582(0xE0,0x0C,0x3B);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   727
	Write_Reg_NT35582(0xE0,0x0D,0x4C);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   728
	Write_Reg_NT35582(0xE0,0x0E,0x78);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   729
	Write_Reg_NT35582(0xE0,0x0F,0x96);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   730
	Write_Reg_NT35582(0xE0,0x10,0x4A);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   731
	Write_Reg_NT35582(0xE0,0x11,0x4D);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   732
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   733
	Write_Reg_NT35582(0xE1,0x00,0x0E);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   734
	Write_Reg_NT35582(0xE1,0x01,0x14);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   735
	Write_Reg_NT35582(0xE1,0x02,0x29);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   736
	Write_Reg_NT35582(0xE1,0x03,0x3A);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   737
	Write_Reg_NT35582(0xE1,0x04,0x1D);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   738
	Write_Reg_NT35582(0xE1,0x05,0x30);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   739
	Write_Reg_NT35582(0xE1,0x06,0x61);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   740
	Write_Reg_NT35582(0xE1,0x07,0x3F);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   741
	Write_Reg_NT35582(0xE1,0x08,0x20);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   742
	Write_Reg_NT35582(0xE1,0x09,0x26);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   743
	Write_Reg_NT35582(0xE1,0x0A,0x83);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   744
	Write_Reg_NT35582(0xE1,0x0B,0x16);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   745
	Write_Reg_NT35582(0xE1,0x0C,0x3B);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   746
	Write_Reg_NT35582(0xE1,0x0D,0x4C);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   747
	Write_Reg_NT35582(0xE1,0x0E,0x78);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   748
	Write_Reg_NT35582(0xE1,0x0F,0x96);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   749
	Write_Reg_NT35582(0xE1,0x10,0x4A);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   750
	Write_Reg_NT35582(0xE1,0x11,0x4D);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   751
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   752
	Write_Reg_NT35582(0xE2,0x00,0x0E);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   753
	Write_Reg_NT35582(0xE2,0x01,0x14);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   754
	Write_Reg_NT35582(0xE2,0x02,0x29);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   755
	Write_Reg_NT35582(0xE2,0x03,0x3A);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   756
	Write_Reg_NT35582(0xE2,0x04,0x1D);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   757
	Write_Reg_NT35582(0xE2,0x05,0x30);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   758
	Write_Reg_NT35582(0xE2,0x06,0x61);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   759
	Write_Reg_NT35582(0xE2,0x07,0x3D);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   760
	Write_Reg_NT35582(0xE2,0x08,0x22);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   761
	Write_Reg_NT35582(0xE2,0x09,0x2A);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   762
	Write_Reg_NT35582(0xE2,0x0A,0x87);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   763
	Write_Reg_NT35582(0xE2,0x0B,0x16);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   764
	Write_Reg_NT35582(0xE2,0x0C,0x3B);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   765
	Write_Reg_NT35582(0xE2,0x0D,0x4C);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   766
	Write_Reg_NT35582(0xE2,0x0E,0x78);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   767
	Write_Reg_NT35582(0xE2,0x0F,0x96);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   768
	Write_Reg_NT35582(0xE2,0x10,0x4A);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   769
	Write_Reg_NT35582(0xE2,0x11,0x4D);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   770
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   771
	Write_Reg_NT35582(0xE3,0x00,0x0E);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   772
	Write_Reg_NT35582(0xE3,0x01,0x14);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   773
	Write_Reg_NT35582(0xE3,0x02,0x29);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   774
	Write_Reg_NT35582(0xE3,0x03,0x3A);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   775
	Write_Reg_NT35582(0xE3,0x04,0x1D);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   776
	Write_Reg_NT35582(0xE3,0x05,0x30);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   777
	Write_Reg_NT35582(0xE3,0x06,0x61);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   778
	Write_Reg_NT35582(0xE3,0x07,0x3F);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   779
	Write_Reg_NT35582(0xE3,0x08,0x20);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   780
	Write_Reg_NT35582(0xE3,0x09,0x26);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   781
	Write_Reg_NT35582(0xE3,0x0A,0x83);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   782
	Write_Reg_NT35582(0xE3,0x0B,0x16);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   783
	Write_Reg_NT35582(0xE3,0x0C,0x3B);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   784
	Write_Reg_NT35582(0xE3,0x0D,0x4C);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   785
	Write_Reg_NT35582(0xE3,0x0E,0x78);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   786
	Write_Reg_NT35582(0xE3,0x0F,0x96);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   787
	Write_Reg_NT35582(0xE3,0x10,0x4A);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   788
	Write_Reg_NT35582(0xE3,0x11,0x4D);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   789
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   790
	Write_Reg_NT35582(0xE4,0x00,0x0E);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   791
	Write_Reg_NT35582(0xE4,0x01,0x14);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   792
	Write_Reg_NT35582(0xE4,0x02,0x29);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   793
	Write_Reg_NT35582(0xE4,0x03,0x3A);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   794
	Write_Reg_NT35582(0xE4,0x04,0x1D);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   795
	Write_Reg_NT35582(0xE4,0x05,0x30);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   796
	Write_Reg_NT35582(0xE4,0x06,0x61);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   797
	Write_Reg_NT35582(0xE4,0x07,0x3D);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   798
	Write_Reg_NT35582(0xE4,0x08,0x22);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   799
	Write_Reg_NT35582(0xE4,0x09,0x2A);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   800
	Write_Reg_NT35582(0xE4,0x0A,0x87);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   801
	Write_Reg_NT35582(0xE4,0x0B,0x16);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   802
	Write_Reg_NT35582(0xE4,0x0C,0x3B);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   803
	Write_Reg_NT35582(0xE4,0x0D,0x4C);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   804
	Write_Reg_NT35582(0xE4,0x0E,0x78);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   805
	Write_Reg_NT35582(0xE4,0x0F,0x96);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   806
	Write_Reg_NT35582(0xE4,0x10,0x4A);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   807
	Write_Reg_NT35582(0xE4,0x11,0x4D);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   808
	
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   809
	Write_Reg_NT35582(0xE5,0x00,0x0E);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   810
	Write_Reg_NT35582(0xE5,0x01,0x14);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   811
	Write_Reg_NT35582(0xE5,0x02,0x29);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   812
	Write_Reg_NT35582(0xE5,0x03,0x3A);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   813
	Write_Reg_NT35582(0xE5,0x04,0x1D);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   814
	Write_Reg_NT35582(0xE5,0x05,0x30);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   815
	Write_Reg_NT35582(0xE5,0x06,0x61);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   816
	Write_Reg_NT35582(0xE5,0x07,0x3F);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   817
	Write_Reg_NT35582(0xE5,0x08,0x20);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   818
	Write_Reg_NT35582(0xE5,0x09,0x26);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   819
	Write_Reg_NT35582(0xE5,0x0A,0x83);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   820
	Write_Reg_NT35582(0xE5,0x0B,0x16);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   821
	Write_Reg_NT35582(0xE5,0x0C,0x3B);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   822
	Write_Reg_NT35582(0xE5,0x0D,0x4C);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   823
	Write_Reg_NT35582(0xE5,0x0E,0x78);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   824
	Write_Reg_NT35582(0xE5,0x0F,0x96);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   825
	Write_Reg_NT35582(0xE5,0x10,0x4A);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   826
	Write_Reg_NT35582(0xE5,0x11,0x4D);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   827
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   828
	
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   829
	Write_Reg_NT35582(0x11,0x00,0x00);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   830
	Wait(150);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   831
	Write_Reg_NT35582(0x29,0x00,0x00);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   832
	Wait(100);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   833
		}
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   834
	//Kern::Printf("SW RESET");
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   835
	//Write_Reg_NT35582a(0x01,0x00,0x00);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   836
	//Wait(2000);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   837
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   838
	//Kern::Printf("SLP Out");
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   839
	//Write_Reg_NT35582a(0x11,0x00,0x00);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   840
	//Wait(2000);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   841
	//Kern::Printf("DISPON");
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   842
	//Write_Reg_NT35582a(0x29,0x00,0x00);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   843
	//Wait(2000);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   844
	
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   845
	Kern::Printf("END driver IC NT35582 Init");
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   846
	//Wait(2000);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   847
}
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   848
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   849
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   850
Default constructor
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   851
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   852
DLcdPowerHandler::DLcdPowerHandler() :
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   853
		DPowerHandler(KLitLcd),
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   854
		iMsgQ(rxMsg,this,NULL,1),
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   855
		iPowerUpDfc(&power_up_dfc,this,6),
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   856
		iPowerDownDfc(&power_down_dfc,this,7),
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   857
		iBacklightOn(EFalse),
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   858
		iContrast(KConfigInitialDisplayContrast),
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   859
		iBrightness(KConfigInitialDisplayBrightness)
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
	}
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
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   864
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   865
Second-phase constructor 
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
Called by factory function at ordinal 0
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
TInt DLcdPowerHandler::Create()
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   870
	{
78
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   871
	BYDLCD_INIT();
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   872
	Wait2(1000);
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
   873
32
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   874
#ifdef ENABLE_GCE_MODE
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   875
	pLcd = this;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   876
#endif
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   877
	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
   878
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   879
	// map the video RAM
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
	//TPhysAddr videoRamPhys;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   882
	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
   883
	TInt r = Epoc::AllocPhysicalRam( 2*vSize, ivRamPhys );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   884
	if ( r!=KErrNone )
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   885
		{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   886
		Kern::Fault( "AllocVRam", r );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   887
		}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   888
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   889
	//TInt vSize = ((Omap3530BoardAssp*)Arch::TheAsic())->VideoRamSize();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   890
	//ivRamPhys = TOmap3530Assp::VideoRamPhys();				// EXAMPLE ONLY: assume TOmap3530Assp interface class
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   891
	r = DPlatChunkHw::New(iChunk,ivRamPhys,vSize,EMapAttrUserRw|EMapAttrBufferedC);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   892
	if (r != KErrNone)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   893
		return r;	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   894
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   895
	//create "secure" screen immediately after normal one
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   896
	iSecurevRamPhys =  ivRamPhys + vSize;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   897
	TInt r2 = DPlatChunkHw::New(iSecureChunk,iSecurevRamPhys,vSize,EMapAttrUserRw|EMapAttrBufferedC);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   898
	if (r2 != KErrNone)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   899
		return r2;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   900
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   901
	TUint* pV=(TUint*)iChunk->LinearAddress();	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   902
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   903
	__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
   904
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   905
	// TO DO: (mandatory)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   906
	// initialise the palette for the initial display mode
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   907
	// 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
   908
	//		 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
   909
	//
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
	TUint* pV2=(TUint*)iSecureChunk->LinearAddress();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   912
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   913
	__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
   914
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   915
	// TO DO: (mandatory)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   916
	// 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
   917
	//
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   918
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   919
	// 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
   920
	iVideoInfo.iDisplayMode = KConfigLcdInitialDisplayMode;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   921
	iVideoInfo.iOffsetToFirstPixel = Lcd_Mode_Config[KConfigLcdInitialDisplayMode].iOffsetToFirstVideoBuffer;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   922
	iVideoInfo.iIsPalettized = Lcd_Mode_Config[KConfigLcdInitialDisplayMode].iIsPalettized;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   923
	iVideoInfo.iOffsetBetweenLines = Lcd_Mode_Config[KConfigLcdInitialDisplayMode].iOffsetBetweenLines;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   924
	iVideoInfo.iBitsPerPixel = Lcd_Mode_Config[KConfigLcdInitialDisplayMode].iBitsPerPixel;
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
	iVideoInfo.iSizeInPixels.iWidth = KConfigLcdWidth;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   927
	iVideoInfo.iSizeInPixels.iHeight = KConfigLcdHeight;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   928
	iVideoInfo.iSizeInTwips.iWidth = KConfigLcdWidthInTwips;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   929
	iVideoInfo.iSizeInTwips.iHeight = KConfigLcdHeightInTwips;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   930
	iVideoInfo.iIsMono = KConfigLcdIsMono;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   931
	iVideoInfo.iVideoAddress=(TInt)pV;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   932
	iVideoInfo.iIsPixelOrderLandscape = KConfigLcdPixelOrderLandscape;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   933
	iVideoInfo.iIsPixelOrderRGB = KConfigLcdPixelOrderRGB;
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
	iSecureVideoInfo = iVideoInfo;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   936
	iSecureVideoInfo.iVideoAddress = (TInt)pV2;
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
	iDisplayOn = EFalse;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   939
	iSecureDisplay = EFalse;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   940
32
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   941
#ifdef ENABLE_GCE_MODE
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   942
	// 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
   943
	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
   944
	__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
   945
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   946
	// 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
   947
	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
   948
	r = Epoc::AllocPhysicalRam(round , iCompositionPhysical);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   949
	if(r != KErrNone)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   950
		{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   951
		__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
   952
		return r;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   953
		}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   954
#endif
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
   955
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   956
	// install the HAL function
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   957
	r=Kern::AddHalEntry(EHalGroupDisplay, halFunction, this);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   958
	if (r!=KErrNone)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   959
		return r;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   960
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   961
	iPowerUpDfc.SetDfcQ(iDfcQ);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   962
	iPowerDownDfc.SetDfcQ(iDfcQ);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   963
	iMsgQ.SetDfcQ(iDfcQ);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   964
	iMsgQ.Receive();
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
	// install the power handler
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   967
	// power up the screen
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   968
	Add();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   969
	DisplayOn();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   970
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   971
	SplashScreen();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   972
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   973
	return KErrNone;
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
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   976
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   977
Turn the display on
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   978
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
   979
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
   980
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   981
void DLcdPowerHandler::DisplayOn()
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
	__KTRACE_OPT(KBOOT, Kern::Printf("DisplayOn %d", iDisplayOn));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   984
	if (!iDisplayOn)				// may have been powered up already
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   985
		{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   986
		iDisplayOn = ETrue;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   987
		PowerUpLcd(iSecureDisplay);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   988
		SetContrast(iContrast);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   989
		SetBrightness(iBrightness);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   990
		}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   991
	}
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
Turn the display off
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
   995
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
   996
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
   997
if the platform is in silent running mode
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
void DLcdPowerHandler::DisplayOff()
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1000
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1001
	__KTRACE_OPT(KBOOT, Kern::Printf("DisplayOff %d", iDisplayOn));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1002
	if (iDisplayOn)
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
		iDisplayOn = EFalse;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1005
		PowerDownLcd();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1006
		}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1007
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1008
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1009
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1010
Switch between secure and non-secure displays
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1011
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1012
@param aSecure ETrue if switching to secure display
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1013
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1014
void DLcdPowerHandler::SwitchDisplay(TBool aSecure)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1015
 	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1016
 	if (aSecure)
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
 		if (!iSecureDisplay)
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
 			//switch to secure display
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1021
 			DisplayOff();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1022
 			iSecureDisplay = ETrue;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1023
 			DisplayOn();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1024
 			}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1025
 		}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1026
 	else
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
 		if (iSecureDisplay)
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
 			//switch from secure display
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1031
 			DisplayOff();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1032
 			iSecureDisplay = EFalse;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1033
 			DisplayOn();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1034
 			}
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
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
DFC to power up the display
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1040
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1041
void DLcdPowerHandler::PowerUpDfc()
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
	__KTRACE_OPT(KPOWER, Kern::Printf("PowerUpDfc"));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1044
	DisplayOn();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1045
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1046
	PowerUpDone();				// must be called from a different thread than PowerUp()
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
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
DFC to power down the display
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
void DLcdPowerHandler::PowerDownDfc()
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
	__KTRACE_OPT(KPOWER, Kern::Printf("PowerDownDfc"));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1055
	DisplayOff();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1056
	PowerDownDone();			// must be called from a different thread than PowerUp()
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
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1059
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1060
Schedule the power-down DFC
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1061
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1062
void DLcdPowerHandler::PowerDown(TPowerState)
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
	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
  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
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1068
Schedule the power-up DFC
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
void DLcdPowerHandler::PowerUp()
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1071
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1072
	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
  1073
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1074
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
Power up the display
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1077
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1078
@param aSecure ETrue if powering up the secure display
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
void DLcdPowerHandler::PowerUpLcd(TBool aSecure)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1081
    {
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1082
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1083
	TUint32 l = 0x0;
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
	// Set up the Display Subsystem to control a DVI monitor
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
    // 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
  1088
//	PowerClock::GpioActive(0, PowerClock::E1s, PowerClock::ECpu10, PowerClock::EBus10);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1089
//	PowerClock::GpioAccess(0, PowerClock::EAuto);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1090
	Prcm::SetClockState( Prcm::EClkGpio1_F, Prcm::EClkOn );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1091
	Prcm::SetClockState( Prcm::EClkGpio1_I, Prcm::EClkAuto );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1092
	*( (TUint *) Omap3530HwBase::TVirtual<0x48310034>::Value ) = 0xfefffedf;		//GPIO1 output enable	p3336
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1093
	*( (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
  1094
//	const TUint KCM_CLKSEL_DSS = Omap3530HwBase::TVirtual<0x48004E40>::Value;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1095
//	Prcm::Set(KCM_CLKSEL_DSS, 0xffffffffu, 0x00001006);
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
	Prcm::SetDivider( Prcm::EClkDss1_F, 2 );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1098
	Prcm::SetDivider( Prcm::EClkTv_F, 1 );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1099
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1100
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1101
	SET_REGISTER( DSS_SYSCONFIG, 0x00000010 );			// Display Subsystem reset
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1102
	while ( !( GET_REGISTER( DISPC_SYSSTATUS ) & 1 ) );	// Spin until reset complete
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
	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
  1105
	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
  1106
	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
  1107
	TInt8 ENWAKEUP		= 0x1;	// Wakeup is enabled.
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1108
	TInt8 SOFTRESET		= 0x0;	// Normal mode
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1109
	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
  1110
	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
  1111
	SET_REGISTER( DISPC_SYSCONFIG, l );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1112
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1113
	TInt8 LOADMOAD = 0x2; 		//Frame data only loaded every frame
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1114
	l = LOADMOAD<<1;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1115
	SET_REGISTER( DISPC_CONFIG, l );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1116
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1117
	SET_REGISTER( DISPC_DEFAULT_COLOR0, 0xFFFFFFFF );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1118
	SET_REGISTER( DISPC_TRANS_COLOR0, 0x00000000 );
78
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
  1119
	TUint16 LINENUMBER=799;
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
  1120
	l=LINENUMBER;
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
  1121
	SET_REGISTER(DISPC_LINE_STATUS, l);
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1122
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1123
	TUint8 hbp = H_BPORCH - 1;	// Horizontal Back Porch
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1124
	TUint8 hfp = H_FPORCH - 1;	// Horizontal front porch
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1125
	TUint8 hsw = H_SYNC - 1;	// Horizontal synchronization pulse width
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1126
	if ( hsw > 63 )
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1127
		{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1128
		hsw = 63;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1129
		Kern::Printf("[LCD] H_SYNC too big");
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
	l = hbp<<20 | hfp<<8 | hsw;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1132
	SET_REGISTER( DISPC_TIMING_H, l );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1133
	
78
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
  1134
	TUint16 vbp = V_BPORCH;		// Vertical back porch
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
  1135
	TUint16 vfp = V_FPORCH;		// Vertical front porch
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1136
	TUint8 vsw = V_SYNC;		// Vertical synchronization pulse width
78
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
  1137
//	__ASSERT_ALWAYS( vbp<=255, Kern::Fault("LCD", 1) );
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
  1138
//	__ASSERT_ALWAYS( vfp<=255, Kern::Fault("LCD", 1) );
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1139
	__ASSERT_ALWAYS( vsw>=1 && vsw<=255, Kern::Fault("LCD", 1) );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1140
	l = vbp<<20 | vfp<<8 | vsw;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1141
	SET_REGISTER( DISPC_TIMING_V, l );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1142
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1143
	TUint8 onoff= 0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1144
	TUint8 rf	= 0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1145
	TUint8 ieo 	= 0;
78
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
  1146
	TUint8 ipc	= 0;			// Invert Pixel Clock
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
  1147
	TUint8 ihs	= H_SYNC_POL ;//? 0 : 1;	// Invert HSYNC (0: Positive Sync polarity, 1: Negative Sync polarity)
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
  1148
	TUint8 ivs	= V_SYNC_POL ;//? 0 : 1;	// Invert VSYNC (0: Positive Sync polarity, 1: Negative Sync polarity)
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1149
	TUint8 acbi	= 0;
78
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
  1150
	TUint8 acb	= 0x28;			// AC-bias pin frequency
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1151
	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
  1152
	SET_REGISTER( DISPC_POL_FREQ, l );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1153
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1154
	TUint8 lcd = 1;				// Display Controller Logic Clock Divisor
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1155
	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
  1156
	__ASSERT_ALWAYS( lcd>=1 && lcd<=255, Kern::Fault("LCD", 1) );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1157
	__ASSERT_ALWAYS( pcd>=2 && pcd<=255, Kern::Fault("LCD", 1) );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1158
	l = lcd<<16 | pcd;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1159
	SET_REGISTER( DISPC_DIVISOR, l );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1160
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1161
	TUint16 ppl = H_DISP - 1;	// Pixels per line
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1162
	TUint16 llp = V_DISP - 1;	// Lines per panel
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1163
	__ASSERT_ALWAYS( ppl>=1 && ppl<=2048, Kern::Fault("LCD", 1) );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1164
	__ASSERT_ALWAYS( llp>=1 && llp<=2048, Kern::Fault("LCD", 1) );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1165
	l = llp<<16 | ppl;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1166
	SET_REGISTER( DISPC_SIZE_LCD, l );
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
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1169
	// Setup a graphics region (GFX)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1170
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1171
	// Set GFX frame buffer
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1172
	SET_REGISTER( DISPC_GFX_BA1, ivRamPhys );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1173
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1174
	// Center the GFX
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1175
	TInt16 gfxposy	= ( V_DISP - KConfigLcdHeight ) / 2;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1176
	TInt16 gfxposx	= ( H_DISP - KConfigLcdWidth ) / 2;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1177
	l = ( gfxposy << 16 ) | gfxposx;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1178
	SET_REGISTER( DISPC_GFX_POSITION, l );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1179
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1180
	// Set the GFX dimensions
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1181
	TInt16 gfxsizey = KConfigLcdHeight - 1;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1182
	TInt16 gfxsizex = KConfigLcdWidth - 1;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1183
	l = gfxsizey<<16 | gfxsizex;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1184
	SET_REGISTER( DISPC_GFX_SIZE, l );
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1185
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1186
	TInt8 GFXSELFREFRESH		= 0x0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1187
	TInt8 GFXARBITRATION		= 0x0;
78
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
  1188
	TInt8 GFXROTATION			= 0x2;
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1189
	TInt8 GFXFIFOPRELOAD		= 0x0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1190
	TInt8 GFXENDIANNESS			= 0x0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1191
	TInt8 GFXNIBBLEMODE			= 0x0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1192
	TInt8 GFXCHANNELOUT			= 0x0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1193
	TInt8 GFXBURSTSIZE			= 0x2;	// 16x32bit bursts
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1194
	TInt8 GFXREPLICATIONENABLE	= 0x0;	// Disable Graphics replication logic
78
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
  1195
	TInt8 GFXFORMAT				= 0x8;//0x6;//0x6;	// RGB16=0x6, RGB24-unpacked=0x8, RGB24-packed=0x9
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1196
	TInt8 GFXENABLE				= 0x1;	// Graphics enabled
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1197
	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
  1198
	SET_REGISTER( DISPC_GFX_ATTRIBUTES, l );
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
	TInt16 GFXFIFOHIGHTHRESHOLD	= 0x3fc;	// Graphics FIFO High Threshold
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1201
	TInt16 GFXFIFOLOWTHRESHOLD	= 0x3BC;	// Graphics FIFO Low Threshold
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1202
	l = GFXFIFOHIGHTHRESHOLD<<16 | GFXFIFOLOWTHRESHOLD;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1203
	SET_REGISTER(DISPC_GFX_FIFO_THRESHOLD, l);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1204
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1205
	TInt16 GFXFIFOSIZE = 0x400;	// Number of bytes defining the FIFO value
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1206
	l = GFXFIFOSIZE;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1207
	SET_REGISTER(DISPC_GFX_FIFO_SIZE_STATUS, l);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1208
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1209
	TInt32 GFXROWINC	= 0x1;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1210
	l = GFXROWINC;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1211
	SET_REGISTER(DISPC_GFX_ROW_INC, l);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1212
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1213
	TInt16	GFXPIXELINC	= 0x1;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1214
	l = GFXPIXELINC;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1215
	SET_REGISTER(DISPC_GFX_PIXEL_INC, l);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1216
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1217
	TInt32 GFXWINDOWSKIP = 0x0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1218
	l = GFXWINDOWSKIP;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1219
	SET_REGISTER(DISPC_GFX_WINDOW_SKIP, l);
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
	// TO DO: Sort out the Gamma table + pallets
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1222
	TInt32 GFXTABLEBA	= 0x807ff000;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1223
	l = GFXTABLEBA;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1224
	SET_REGISTER(DISPC_GFX_TABLE_BA, l);
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
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1227
	// Propigate all the shadowed registers 
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1228
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1229
	TInt8 SPATIALTEMPORALDITHERINGFRAMES	= 0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1230
	TInt8 LCDENABLEPOL			= 0;
78
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
  1231
	TInt8 LCDENABLESIGNAL		= 1;
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1232
	TInt8 PCKFREEENABLE			= 0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1233
	TInt8 TDMUNUSEDBITS			= 0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1234
	TInt8 TDMCYCLEFORMAT		= 0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1235
	TInt8 TDMPARALLELMODE		= 0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1236
	TInt8 TDMENABLE				= 0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1237
	TInt8 HT					= 0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1238
	TInt8 GPOUT1				= 1;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1239
	TInt8 GPOUT0				= 1;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1240
	TInt8 GPIN1					= 0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1241
	TInt8 GPIN0					= 0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1242
	TInt8 OVERLAYOPTIMIZATION	= 0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1243
	TInt8 RFBIMODE				= 0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1244
	TInt8 SECURE				= 0;
78
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
  1245
	TInt8 TFTDATALINES			= 0x2;//0x3;//0x2;
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1246
	TInt8 STDITHERENABLE		= 0;
78
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
  1247
	TInt8 GODIGITAL				= 0;
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1248
	TInt8 GOLCD					= 1;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1249
	TInt8 M8B					= 0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1250
	TInt8 STNTFT				= 1;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1251
	TInt8 MONOCOLOR				= 0;
78
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
  1252
	TInt8 DIGITALENABLE			= 0;
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1253
	TInt8 LCDENABLE				= 1;	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1254
	l = SPATIALTEMPORALDITHERINGFRAMES<<30 | LCDENABLEPOL<<29 | LCDENABLESIGNAL<<28 | PCKFREEENABLE<<27 | 
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1255
		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
  1256
			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
  1257
				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
  1258
					MONOCOLOR<<2 | DIGITALENABLE<<1 | LCDENABLE;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1259
	NKern::Sleep(1);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1260
	SET_REGISTER(DISPC_CONTROL, l);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1261
	NKern::Sleep(1);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1262
	
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
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1266
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1267
Power down the display and the backlight
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1268
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1269
void DLcdPowerHandler::PowerDownLcd()
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1270
    {
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1271
	SetBacklightState(EFalse);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1272
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1273
	// TO DO: (mandatory)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1274
	// Power down the display & disable LCD DMA.
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1275
	// 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
  1276
	//
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1277
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1278
	SET_REGISTER(DISPC_CONTROL, 0);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1279
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1280
    }
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1281
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1282
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1283
Set the Lcd contrast
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1284
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1285
@param aValue the contrast setting
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1286
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1287
TInt DLcdPowerHandler::SetContrast(TInt aValue)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1288
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1289
	__KTRACE_OPT(KEXTENSION,Kern::Printf("SetContrast(%d)", aValue));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1290
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1291
	if (aValue >= KConfigLcdMinDisplayContrast && aValue <= KConfigLcdMaxDisplayContrast)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1292
		{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1293
		iContrast=aValue;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1294
		
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1295
		// TO DO: (mandatory)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1296
		// set the contrast
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1297
		//
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1298
		return KErrNone;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1299
		}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1300
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1301
	return KErrArgument;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1302
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1303
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1304
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1305
Set the Lcd brightness
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1306
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1307
@param aValue the brightness setting
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1308
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1309
TInt DLcdPowerHandler::SetBrightness(TInt aValue)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1310
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1311
	__KTRACE_OPT(KEXTENSION,Kern::Printf("SetBrightness(%d)", aValue));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1312
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1313
	if (aValue >= KConfigLcdMinDisplayBrightness && aValue <= KConfigLcdMaxDisplayBrightness)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1314
		{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1315
		iBrightness=aValue;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1316
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1317
		// TO DO: (mandatory)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1318
		// set the brightness
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1319
		//
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1320
		return KErrNone;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1321
		}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1322
	return KErrArgument;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1323
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1324
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1325
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1326
Turn the backlight on
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1327
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1328
void DLcdPowerHandler::BacklightOn()
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1329
    {
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1330
	// TO DO: (mandatory)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1331
	// turn the backlight on
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1332
	//
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1333
    }
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1334
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1335
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1336
Turn the backlight off
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1337
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1338
void DLcdPowerHandler::BacklightOff()
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1339
    {
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1340
	// TO DO: (mandatory)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1341
	// turn the backlight off
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1342
	//
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1343
    }
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1344
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1345
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1346
Set the state of the backlight
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1347
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1348
@param aState ETrue if setting the backlight on
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1349
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1350
void DLcdPowerHandler::SetBacklightState(TBool aState)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1351
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1352
	iBacklightOn=aState;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1353
	if (iBacklightOn)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1354
		BacklightOn();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1355
	else
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1356
		BacklightOff();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1357
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1358
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1359
void DLcdPowerHandler::ScreenInfo(TScreenInfoV01& anInfo)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1360
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1361
	__KTRACE_OPT(KEXTENSION,Kern::Printf("DLcdPowerHandler::ScreenInfo"));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1362
	anInfo.iWindowHandleValid=EFalse;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1363
	anInfo.iWindowHandle=NULL;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1364
	anInfo.iScreenAddressValid=ETrue;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1365
	anInfo.iScreenAddress=(TAny *)(iChunk->LinearAddress());
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1366
	anInfo.iScreenSize.iWidth=KConfigLcdWidth;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1367
	anInfo.iScreenSize.iHeight=KConfigLcdHeight;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1368
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1369
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1370
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1371
Handle a message from the power handler
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1372
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1373
void DLcdPowerHandler::HandleMsg(void)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1374
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1375
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1376
	TMessageBase* msg = iMsgQ.iMessage;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1377
	if (msg == NULL)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1378
		return;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1379
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1380
	if (msg->iValue)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1381
		DisplayOn();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1382
	else
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1383
		DisplayOff();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1384
	msg->Complete(KErrNone,ETrue);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1385
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1386
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1387
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1388
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
  1389
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1390
void DLcdPowerHandler::WsSwitchOnScreen()
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1391
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1392
	TThreadMessage& m=Kern::Message();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1393
	m.iValue = ETrue;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1394
	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
  1395
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1396
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1397
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1398
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
  1399
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1400
void DLcdPowerHandler::WsSwitchOffScreen()
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1401
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1402
	TThreadMessage& m=Kern::Message();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1403
	m.iValue = EFalse;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1404
	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
  1405
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1406
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1407
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1408
Return information about the current display mode
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1409
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1410
@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
  1411
@param	aSecure ETrue if requesting information about the secure display
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1412
@return	KErrNone if successful
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1413
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1414
TInt DLcdPowerHandler::GetCurrentDisplayModeInfo(TVideoInfoV01& aInfo, TBool aSecure)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1415
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1416
	__KTRACE_OPT(KEXTENSION,Kern::Printf("GetCurrentDisplayModeInfo"));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1417
	NKern::FMWait(&iLock);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1418
	if (aSecure)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1419
 		aInfo = iSecureVideoInfo;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1420
 	else
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1421
 		aInfo = iVideoInfo;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1422
	NKern::FMSignal(&iLock);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1423
	return KErrNone;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1424
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1425
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1426
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1427
Return information about the specified display mode
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1428
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1429
@param	aMode the display mode to query
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1430
@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
  1431
@return	KErrNone if successful
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1432
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1433
TInt DLcdPowerHandler::GetSpecifiedDisplayModeInfo(TInt aMode, TVideoInfoV01& aInfo)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1434
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1435
	__KTRACE_OPT(KEXTENSION,Kern::Printf("GetSpecifiedDisplayModeInfo mode is %d",aMode));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1436
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1437
	if (aMode < 0 || aMode >= KConfigLcdNumberOfDisplayModes)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1438
		return KErrArgument;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1439
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1440
	NKern::FMWait(&iLock);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1441
	aInfo = iVideoInfo;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1442
	NKern::FMSignal(&iLock);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1443
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1444
	if (aMode != aInfo.iDisplayMode)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1445
		{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1446
		aInfo.iOffsetToFirstPixel=Lcd_Mode_Config[aMode].iOffsetToFirstVideoBuffer;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1447
		aInfo.iIsPalettized = Lcd_Mode_Config[aMode].iIsPalettized;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1448
		aInfo.iOffsetBetweenLines=Lcd_Mode_Config[aMode].iOffsetBetweenLines;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1449
		aInfo.iBitsPerPixel = Lcd_Mode_Config[aMode].iBitsPerPixel;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1450
		}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1451
	return KErrNone;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1452
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1453
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1454
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1455
Set the display mode
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1456
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1457
@param	aMode the display mode to set
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1458
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1459
TInt DLcdPowerHandler::SetDisplayMode(TInt aMode)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1460
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1461
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1462
	__KTRACE_OPT(KEXTENSION,Kern::Printf("SetDisplayMode = %d", aMode));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1463
78
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
  1464
	Kern::Printf("SetDisplayMode = %d", aMode);
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1465
	if (aMode < 0 || aMode >= KConfigLcdNumberOfDisplayModes)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1466
		return KErrArgument;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1467
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1468
	NKern::FMWait(&iLock);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1469
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1470
	// store the current mode
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1471
	iVideoInfo.iDisplayMode = aMode;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1472
	iVideoInfo.iOffsetToFirstPixel = Lcd_Mode_Config[aMode].iOffsetToFirstVideoBuffer;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1473
	iVideoInfo.iIsPalettized = Lcd_Mode_Config[aMode].iIsPalettized;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1474
	iVideoInfo.iOffsetBetweenLines = Lcd_Mode_Config[aMode].iOffsetBetweenLines;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1475
	iVideoInfo.iBitsPerPixel = Lcd_Mode_Config[aMode].iBitsPerPixel;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1476
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1477
	// store the current mode for secure screen
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1478
	iSecureVideoInfo.iDisplayMode = aMode;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1479
	iSecureVideoInfo.iOffsetToFirstPixel = Lcd_Mode_Config[aMode].iOffsetToFirstVideoBuffer;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1480
	iSecureVideoInfo.iIsPalettized = Lcd_Mode_Config[aMode].iIsPalettized;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1481
	iSecureVideoInfo.iOffsetBetweenLines = Lcd_Mode_Config[aMode].iOffsetBetweenLines;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1482
	iSecureVideoInfo.iBitsPerPixel = Lcd_Mode_Config[aMode].iBitsPerPixel;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1483
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1484
	// TO DO: (mandatory)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1485
	// set bits per pixel on hardware
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1486
	// 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
  1487
	//
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1488
	NKern::FMSignal(&iLock);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1489
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1490
	__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
  1491
		aMode, iVideoInfo.iOffsetToFirstPixel, iVideoInfo.iIsPalettized, iVideoInfo.iBitsPerPixel, iVideoInfo.iOffsetBetweenLines));
78
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
  1492
	Kern::Printf("SetDisplayMode mode = %d, otfp = %d, palettized = %d, bpp = %d, obl = %d",
0d34a4aa948d change display device from monitor to a LCD, SPI driver not ready yet, use GPIO to realize the LCD's initialization for this version
will.long
parents: 32
diff changeset
  1493
		aMode, iVideoInfo.iOffsetToFirstPixel, iVideoInfo.iIsPalettized, iVideoInfo.iBitsPerPixel, iVideoInfo.iOffsetBetweenLines);
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1494
	return KErrNone;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1495
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1496
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1497
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1498
Fill the video memory with an initial pattern or image
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1499
This will be displayed on boot-up
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1500
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1501
void DLcdPowerHandler::SplashScreen()
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1502
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1503
	// TO DO: (optional)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1504
	// 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
  1505
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1506
	__KTRACE_OPT(KEXTENSION,Kern::Printf("Splash SCreen +"));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1507
	TUint* pV=(TUint*)(iVideoInfo.iVideoAddress + iVideoInfo.iOffsetToFirstPixel);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1508
	__KTRACE_OPT(KEXTENSION,Kern::Printf("Splash SCreen FB @ %x",pV));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1509
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1510
	//Fill the framebuffer with bars
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1511
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1512
	for (TInt y = 0; y<KConfigLcdHeight; ++y)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1513
		{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1514
		for(TInt x = 0; x<KConfigLcdHeight; ++x)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1515
			{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1516
			TUint8 r = 0x00;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1517
			TUint8 g = 0x00;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1518
			TUint8 b = 0x00;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1519
			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
  1520
			
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1521
			TUint16* px = reinterpret_cast<TUint16*>(pV) + y*KConfigLcdWidth + x;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1522
			*px = rgb;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1523
			}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1524
		}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1525
	
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1526
	__KTRACE_OPT(KEXTENSION,Kern::Printf("Splash SCreen -"));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1527
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1528
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1529
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1530
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1531
Get the size of the pallete
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1532
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1533
@return	the number of pallete entries
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1534
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1535
TInt DLcdPowerHandler::NumberOfPaletteEntries()		//only call when holding mutex
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1536
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1537
	// TO DO: (mandatory)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1538
	// Calculate the number of Palette entries - this is normally 
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1539
	// calculated from the bits per-pixel.
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1540
	// 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
  1541
	//
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1542
	TInt num = iVideoInfo.iIsPalettized ? 1<<iVideoInfo.iBitsPerPixel : 0;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1543
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1544
	__KTRACE_OPT(KEXTENSION,Kern::Printf("NumberOfPaletteEntries = %d", num));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1545
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1546
	return num;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1547
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1548
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1549
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1550
/** 
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1551
Retrieve the palette entry at a particular offset
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1552
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1553
@param	aEntry the palette index
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1554
@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
  1555
@return	KErrNone if successful
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1556
		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
  1557
		KErrArgument if aEntry is out of range
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1558
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1559
TInt DLcdPowerHandler::GetPaletteEntry(TInt aEntry, TInt* aColor)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1560
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1561
	NKern::FMWait(&iLock);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1562
	if (!iVideoInfo.iIsPalettized)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1563
		{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1564
		NKern::FMSignal(&iLock);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1565
		return KErrNotSupported;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1566
		}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1567
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1568
	if ((aEntry < 0) || (aEntry >= NumberOfPaletteEntries()))
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1569
		{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1570
		NKern::FMSignal(&iLock);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1571
		return KErrArgument;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1572
		}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1573
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1574
	// TO DO: (mandatory)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1575
	// read the RGB value of the palette entry into aColor
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1576
	// 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
  1577
	//		 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
  1578
	//
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1579
	NKern::FMSignal(&iLock);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1580
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1581
	__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
  1582
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1583
	return KErrNone;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1584
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1585
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1586
/** 
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1587
Set the palette entry at a particular offset
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1588
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1589
@param	aEntry the palette index
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1590
@param	aColor the RGB color to store
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1591
@return	KErrNone if successful
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1592
		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
  1593
		KErrArgument if aEntry is out of range
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1594
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1595
TInt DLcdPowerHandler::SetPaletteEntry(TInt aEntry, TInt aColor)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1596
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1597
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1598
	NKern::FMWait(&iLock);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1599
	if (!iVideoInfo.iIsPalettized)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1600
		{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1601
		NKern::FMSignal(&iLock);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1602
		return KErrNotSupported;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1603
		}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1604
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1605
	if ((aEntry < 0) || (aEntry >= NumberOfPaletteEntries()))	//check entry in range
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1606
		{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1607
		NKern::FMSignal(&iLock);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1608
		return KErrArgument;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1609
		}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1610
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1611
	// TO DO: (mandatory)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1612
	// 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
  1613
	// 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
  1614
	//		 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
  1615
	//
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1616
	__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
  1617
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1618
	return KErrNone;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1619
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1620
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1621
/**
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1622
a HAL entry handling function for HAL group attribute EHalGroupDisplay
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1623
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1624
@param	a1 an arbitrary argument
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1625
@param	a2 an arbitrary argument
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1626
@return	KErrNone if successful
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1627
*/
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1628
TInt DLcdPowerHandler::HalFunction(TInt aFunction, TAny* a1, TAny* a2)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1629
	{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1630
	TInt r=KErrNone;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1631
	switch(aFunction)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1632
		{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1633
		case EDisplayHalScreenInfo:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1634
			{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1635
			TPckgBuf<TScreenInfoV01> vPckg;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1636
			ScreenInfo(vPckg());
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1637
			Kern::InfoCopy(*(TDes8*)a1,vPckg);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1638
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1639
			}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1640
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1641
		case EDisplayHalWsRegisterSwitchOnScreenHandling:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1642
			iWsSwitchOnScreen=(TBool)a1;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1643
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1644
		
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1645
		case EDisplayHalWsSwitchOnScreen:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1646
			WsSwitchOnScreen();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1647
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1648
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1649
		case EDisplayHalMaxDisplayContrast:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1650
			{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1651
			TInt mc=KConfigLcdMaxDisplayContrast;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1652
			kumemput32(a1,&mc,sizeof(mc));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1653
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1654
			}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1655
		case EDisplayHalSetDisplayContrast:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1656
			__KTRACE_OPT(KEXTENSION,Kern::Printf("EDisplayHalSetDisplayContrast"));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1657
			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
  1658
				return KErrPermissionDenied;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1659
			r=SetContrast(TInt(a1));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1660
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1661
		
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1662
		case EDisplayHalDisplayContrast:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1663
			kumemput32(a1,&iContrast,sizeof(iContrast));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1664
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1665
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1666
		case EDisplayHalMaxDisplayBrightness:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1667
			{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1668
			TInt mc=KConfigLcdMaxDisplayBrightness;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1669
			kumemput32(a1,&mc,sizeof(mc));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1670
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1671
			}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1672
		
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1673
		case EDisplayHalSetDisplayBrightness:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1674
			__KTRACE_OPT(KEXTENSION,Kern::Printf("EDisplayHalSetDisplayBrightness"));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1675
			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
  1676
				return KErrPermissionDenied;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1677
			r=SetBrightness(TInt(a1));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1678
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1679
		
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1680
		case EDisplayHalDisplayBrightness:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1681
			kumemput32(a1,&iBrightness,sizeof(iBrightness));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1682
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1683
		
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1684
		case EDisplayHalSetBacklightOn:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1685
			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
  1686
				return KErrPermissionDenied;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1687
			if (Kern::MachinePowerStatus()<ELow)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1688
				r=KErrBadPower;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1689
			else
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1690
				SetBacklightState(TBool(a1));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1691
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1692
		
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1693
		case EDisplayHalBacklightOn:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1694
			kumemput32(a1,&iBacklightOn,sizeof(TInt));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1695
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1696
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1697
		case EDisplayHalModeCount:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1698
			{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1699
			TInt ndm = KConfigLcdNumberOfDisplayModes;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1700
			kumemput32(a1, &ndm, sizeof(ndm));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1701
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1702
			}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1703
		
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1704
		case EDisplayHalSetMode:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1705
			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
  1706
				return KErrPermissionDenied;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1707
			r = SetDisplayMode((TInt)a1);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1708
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1709
		
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1710
		case EDisplayHalMode:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1711
			kumemput32(a1, &iVideoInfo.iDisplayMode, sizeof(iVideoInfo.iDisplayMode));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1712
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1713
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1714
		case EDisplayHalSetPaletteEntry:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1715
			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
  1716
				return KErrPermissionDenied;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1717
			r = SetPaletteEntry((TInt)a1, (TInt)a2);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1718
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1719
		
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1720
		case EDisplayHalPaletteEntry:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1721
			{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1722
			TInt entry;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1723
			kumemget32(&entry, a1, sizeof(TInt));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1724
			TInt x;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1725
			r = GetPaletteEntry(entry, &x);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1726
			if (r == KErrNone)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1727
				kumemput32(a2, &x, sizeof(x));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1728
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1729
			}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1730
		
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1731
		case EDisplayHalSetState:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1732
			{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1733
			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
  1734
				return KErrPermissionDenied;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1735
			if ((TBool)a1)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1736
				{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1737
				WsSwitchOnScreen();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1738
				}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1739
			else
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1740
				{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1741
				WsSwitchOffScreen();
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1742
				}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1743
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1744
			}
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
		case EDisplayHalState:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1747
			kumemput32(a1, &iDisplayOn, sizeof(TBool));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1748
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1749
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1750
		case EDisplayHalColors:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1751
			{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1752
			TInt mdc = KConfigLcdMaxDisplayColors;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1753
			kumemput32(a1, &mdc, sizeof(mdc));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1754
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1755
			}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1756
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1757
		case EDisplayHalCurrentModeInfo:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1758
			{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1759
			TPckgBuf<TVideoInfoV01> vPckg;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1760
			r = GetCurrentDisplayModeInfo(vPckg(), (TBool)a2);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1761
			if (KErrNone == r)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1762
				Kern::InfoCopy(*(TDes8*)a1,vPckg);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1763
			}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1764
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1765
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1766
		case EDisplayHalSpecifiedModeInfo:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1767
			{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1768
			TPckgBuf<TVideoInfoV01> vPckg;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1769
			TInt mode;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1770
			kumemget32(&mode, a1, sizeof(mode));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1771
			r = GetSpecifiedDisplayModeInfo(mode, vPckg());
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1772
			if (KErrNone == r)
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1773
				Kern::InfoCopy(*(TDes8*)a2,vPckg);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1774
			}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1775
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1776
			
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1777
		case EDisplayHalSecure:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1778
			kumemput32(a1, &iSecureDisplay, sizeof(TBool));
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1779
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1780
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1781
		case EDisplayHalSetSecure:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1782
			{
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1783
			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
  1784
				return KErrPermissionDenied;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1785
			SwitchDisplay((TBool)a1);
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1786
			}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1787
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1788
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1789
		default:
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1790
			r=KErrNotSupported;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1791
			break;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1792
		}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1793
	return r;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1794
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1795
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1796
32
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1797
#ifdef ENABLE_GCE_MODE
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1798
DLcdPowerHandler* DLcdPowerHandler::pLcd = NULL;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1799
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1800
void DLcdPowerHandler::ChangeFrameBufferAddress(TUint32 aFbAddr)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1801
	{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1802
	//TODO: this is guess work
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1803
	//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
  1804
	//
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1805
	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
  1806
	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
  1807
	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
  1808
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1809
	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
  1810
	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
  1811
	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
  1812
	}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1813
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1814
#include <display.h>
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1815
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1816
class DDisplayPddBeagle : public DDisplayPdd
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1817
	{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1818
public:
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1819
	DDisplayPddBeagle();
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1820
	~DDisplayPddBeagle();
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1821
    virtual TInt  SetLegacyMode();
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1822
    virtual TInt  SetGceMode();
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1823
    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
  1824
	virtual TInt  PostUserBuffer(TBufferNode* aNode);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1825
	virtual TInt  PostCompositionBuffer(TBufferNode* aNode);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1826
    virtual TInt  PostLegacyBuffer();
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1827
    virtual TInt  CloseMsg();
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1828
    virtual TInt  CreateChannelSetup(TInt aUnit);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1829
   	virtual TBool  PostPending();
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1830
    virtual TDfcQue* DfcQ(TInt  aUnit);    
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1831
            
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1832
public:
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1833
	static void VSyncDfcFn(TAny* aChannel);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1834
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1835
private:
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1836
	TDfcQue* 			iDfcQ;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1837
	TVideoInfoV01    	iScreenInfo;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1838
    TBufferNode*     	iPendingBuffer;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1839
    TBufferNode*     	iActiveBuffer;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1840
    DChunk* 		 	iChunk;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1841
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1842
public:
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1843
	TDfc 		     	iVSyncDfc;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1844
	};
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1845
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1846
class DDisplayPddFactory : public DPhysicalDevice
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1847
	{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1848
public:
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1849
	DDisplayPddFactory();
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1850
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1851
	virtual TInt Install();
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1852
	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
  1853
	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
  1854
	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
  1855
	};
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1856
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1857
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
  1858
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1859
DDisplayPddBeagle::DDisplayPddBeagle():
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1860
	iPendingBuffer(NULL),
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1861
	iActiveBuffer(NULL),
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1862
	iChunk(NULL),
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1863
	iVSyncDfc(&VSyncDfcFn, this, KVSyncDfcPriority)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1864
	{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1865
	__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
  1866
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1867
	iPostFlag = EFalse;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1868
	}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1869
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1870
DDisplayPddBeagle::~DDisplayPddBeagle()
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1871
	{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1872
	__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
  1873
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1874
	//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
  1875
	if (iDfcQ)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1876
		{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1877
		iDfcQ=NULL;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1878
		}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1879
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1880
	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
  1881
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1882
	if(chunk)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1883
		{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1884
		Kern::ChunkClose(chunk);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1885
		}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1886
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1887
	}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1888
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1889
TInt DDisplayPddBeagle::SetLegacyMode()
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1890
	{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1891
	__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
  1892
    return KErrNone;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1893
	}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1894
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1895
TInt DDisplayPddBeagle::SetGceMode()
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1896
	{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1897
	__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
  1898
    PostCompositionBuffer(&iLdd->iCompositionBuffer[0]);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1899
    return KErrNone;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1900
	}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1901
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1902
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
  1903
	{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1904
	__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
  1905
	return KErrNone;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1906
	}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1907
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1908
TInt DDisplayPddBeagle::PostUserBuffer(TBufferNode* aNode)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1909
	{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1910
	__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
  1911
	if(iPendingBuffer)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1912
		{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1913
		iPendingBuffer->iState = EBufferFree;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1914
		if (!(iPendingBuffer->iType == EBufferTypeUser) )
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1915
			{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1916
			iPendingBuffer->iFree  = ETrue;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1917
			}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1918
		}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1919
	aNode->iState   = EBufferPending;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1920
	iPendingBuffer	= aNode;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1921
	iPostFlag		= ETrue;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1922
	
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1923
  	// Activate the posted buffer
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1924
	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
  1925
	DLcdPowerHandler::pLcd->ChangeFrameBufferAddress(physicalAddress);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1926
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1927
	/* 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
  1928
	iVSyncDfc.Enque();
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1929
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1930
	return KErrNone;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1931
	}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1932
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1933
TInt DDisplayPddBeagle::PostCompositionBuffer(TBufferNode* aNode)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1934
	{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1935
	__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
  1936
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1937
	if(iPendingBuffer)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1938
		{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1939
		iPendingBuffer->iState = EBufferFree;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1940
		if (iPendingBuffer->iType == EBufferTypeUser)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1941
			{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1942
			RequestComplete(RDisplayChannel::EReqPostUserBuffer, KErrCancel);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1943
			}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1944
		else
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1945
			{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1946
			iPendingBuffer->iFree  = ETrue;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1947
			}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1948
		}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1949
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1950
	aNode->iState	= EBufferPending;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1951
	aNode->iFree	= EFalse;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1952
	iPendingBuffer	= aNode;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1953
	iPostFlag		= ETrue;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1954
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1955
  	// Activate the posted buffer
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1956
	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
  1957
	DLcdPowerHandler::pLcd->ChangeFrameBufferAddress(physicalAddress);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1958
	
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1959
	/* 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
  1960
	iVSyncDfc.Enque();
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1961
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1962
	return KErrNone;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1963
	}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1964
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1965
TInt DDisplayPddBeagle::PostLegacyBuffer()
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1966
	{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1967
	__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
  1968
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1969
	if(iPendingBuffer)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1970
		{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1971
		iPendingBuffer->iState = EBufferFree;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1972
		if (iPendingBuffer->iType == EBufferTypeUser)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1973
			{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1974
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1975
			RequestComplete(RDisplayChannel::EReqPostUserBuffer, KErrCancel);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1976
			}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1977
		else
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1978
			{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1979
			iPendingBuffer->iFree  = ETrue;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1980
			}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1981
		}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1982
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1983
	iLdd->iLegacyBuffer[0].iState		= EBufferPending;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1984
	iLdd->iLegacyBuffer[0].iFree		= EFalse;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1985
	iPendingBuffer						= &iLdd->iLegacyBuffer[0];
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1986
	iPostFlag		= ETrue;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1987
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1988
  	// Activate the posted buffer
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1989
	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
  1990
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1991
	/* 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
  1992
	iVSyncDfc.Enque();
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1993
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1994
	return KErrNone;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1995
	}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1996
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1997
TInt DDisplayPddBeagle::CloseMsg()
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1998
	{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  1999
	__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
  2000
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2001
	iPendingBuffer  = NULL;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2002
	iActiveBuffer	= NULL;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2003
	iVSyncDfc.Cancel();
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2004
    return KErrNone;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2005
	}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2006
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2007
TInt DDisplayPddBeagle::CreateChannelSetup(TInt aUnit)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2008
	{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2009
	__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
  2010
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2011
	iScreenInfo = DLcdPowerHandler::pLcd->iVideoInfo;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2012
	iLdd->iUnit = aUnit;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2013
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2014
	iLdd->iDisplayInfo.iAvailableRotations			= RDisplayChannel::ERotationNormal;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2015
	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
  2016
	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
  2017
	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
  2018
	iLdd->iDisplayInfo.iNumCompositionBuffers		= KDisplayCBMax;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2019
	iLdd->iDisplayInfo.iBitsPerPixel				= iScreenInfo.iBitsPerPixel;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2020
    iLdd->iDisplayInfo.iRefreshRateHz = 60;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2021
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2022
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2023
	switch (iScreenInfo.iBitsPerPixel)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2024
		{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2025
		case 16:
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2026
			iLdd->iDisplayInfo.iPixelFormat = EUidPixelFormatRGB_565;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2027
			break;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2028
		case 24:
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2029
			iLdd->iDisplayInfo.iPixelFormat = EUidPixelFormatRGB_888;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2030
			break;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2031
		case 32:
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2032
			iLdd->iDisplayInfo.iPixelFormat = EUidPixelFormatARGB_8888;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2033
			break;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2034
		default:
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2035
			iLdd->iDisplayInfo.iPixelFormat = EUidPixelFormatUnknown;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2036
			break;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2037
		}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2038
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2039
	iLdd->iCurrentRotation = RDisplayChannel::ERotationNormal;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2040
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2041
	// 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
  2042
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2043
	DChunk* chunk = 0;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2044
	TLinAddr chunkKernelAddr  = 0;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2045
	TUint32 chunkMapAttr = 0;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2046
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2047
	// 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
  2048
	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
  2049
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2050
	__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
  2051
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2052
	TChunkCreateInfo info;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2053
	info.iType					 = TChunkCreateInfo::ESharedKernelMultiple;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2054
	info.iMaxSize				 = round;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2055
	info.iMapAttr				 = EMapAttrFullyBlocking;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2056
	info.iOwnsMemory			 = EFalse;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2057
	info.iDestroyedDfc			 = 0;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2058
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2059
	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
  2060
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2061
	__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
  2062
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2063
	if( r == KErrNone)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2064
		{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2065
		// map our chunk
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2066
		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
  2067
		__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
  2068
		if(r != KErrNone)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2069
			{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2070
			Kern::ChunkClose(chunk);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2071
			}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2072
		}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2073
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2074
	if ( r!= KErrNone)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2075
		{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2076
		return r;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2077
		}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2078
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2079
	iChunk	= chunk;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2080
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2081
	// init CB 0
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2082
	iLdd->iCompositionBuffer[0].iType			= EBufferTypeComposition;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2083
	iLdd->iCompositionBuffer[0].iBufferId		= 0;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2084
	iLdd->iCompositionBuffer[0].iFree			= ETrue;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2085
	iLdd->iCompositionBuffer[0].iState			= EBufferFree;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2086
	iLdd->iCompositionBuffer[0].iAddress		= chunkKernelAddr;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2087
	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
  2088
	iLdd->iCompositionBuffer[0].iChunk			= chunk;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2089
	iLdd->iCompositionBuffer[0].iHandle			= 0;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2090
	iLdd->iCompositionBuffer[0].iOffset			= 0;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2091
	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
  2092
	iLdd->iCompositionBuffer[0].iPendingRequest = 0;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2093
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2094
	// init CB 1
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2095
	iLdd->iCompositionBuffer[1].iType			= EBufferTypeComposition;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2096
	iLdd->iCompositionBuffer[1].iBufferId		= 1;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2097
	iLdd->iCompositionBuffer[1].iFree			= ETrue;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2098
	iLdd->iCompositionBuffer[1].iState			= EBufferFree;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2099
	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
  2100
	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
  2101
	iLdd->iCompositionBuffer[1].iChunk			= chunk;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2102
	iLdd->iCompositionBuffer[1].iHandle			= 0;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2103
	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
  2104
	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
  2105
	iLdd->iCompositionBuffer[1].iPendingRequest = 0;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2106
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2107
	iLdd->iCompositionBuffIdx					= 0;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2108
	//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
  2109
	iDfcQ= DLcdPowerHandler::pLcd->iDfcQ;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2110
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2111
	// Set the Post DFC.
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2112
	iVSyncDfc.SetDfcQ(iDfcQ);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2113
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2114
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2115
	return KErrNone;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2116
	}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2117
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2118
TBool DDisplayPddBeagle::PostPending()
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2119
	{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2120
	return (iPendingBuffer != NULL);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2121
	}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2122
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2123
TDfcQue * DDisplayPddBeagle::DfcQ(TInt aUnit)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2124
	{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2125
	return iDfcQ;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2126
	}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2127
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2128
void DDisplayPddBeagle::VSyncDfcFn(TAny* aChannel)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2129
	{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2130
	DDisplayPddBeagle * channel =(DDisplayPddBeagle*)aChannel;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2131
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2132
	if (channel->iPostFlag)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2133
		{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2134
		 channel->iPostFlag = EFalse;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2135
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2136
		if (channel->iActiveBuffer)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2137
			{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2138
			//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
  2139
			//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
  2140
			//active state.
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2141
			if (channel->iActiveBuffer->iType == EBufferTypeUser)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2142
				{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2143
				channel->RequestComplete(RDisplayChannel::EReqPostUserBuffer, KErrNone);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2144
				}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2145
			else
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2146
				{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2147
				channel->iActiveBuffer->iFree	= ETrue;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2148
				}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2149
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2150
			channel->iActiveBuffer->iState		= EBufferFree;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2151
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2152
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2153
			//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
  2154
			//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
  2155
			//send the notification.
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2156
			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
  2157
			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
  2158
				{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2159
				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
  2160
					{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2161
					channel->iActiveBuffer->iState = EBufferCompose;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2162
				    channel->RequestComplete(RDisplayChannel::EReqGetCompositionBuffer,KErrNone);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2163
				    }
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2164
			    }
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2165
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2166
			channel->iActiveBuffer				= NULL;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2167
			}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2168
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2169
		if (channel->iPendingBuffer)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2170
			{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2171
			__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
  2172
			channel->iActiveBuffer			= channel->iPendingBuffer;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2173
			channel->iActiveBuffer->iState	= EBufferActive;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2174
			channel->iPendingBuffer			= NULL;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2175
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2176
			channel->RequestComplete(RDisplayChannel::EReqWaitForPost,  KErrNone);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2177
			}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2178
		}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2179
	}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2180
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2181
DDisplayPddFactory::DDisplayPddFactory()
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2182
	{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2183
	__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
  2184
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2185
	iVersion		= TVersion(KDisplayChMajorVersionNumber,
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2186
                      KDisplayChMinorVersionNumber,
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2187
                      KDisplayChBuildVersionNumber);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2188
	}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2189
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2190
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
  2191
	{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2192
	__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
  2193
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2194
	DDisplayPddBeagle *device= new DDisplayPddBeagle() ;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2195
	aChannel=device;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2196
	if (!device)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2197
		{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2198
		return KErrNoMemory;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2199
		}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2200
	return KErrNone;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2201
	}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2202
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2203
TInt DDisplayPddFactory::Install()
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2204
	{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2205
	__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
  2206
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2207
	TBuf<32> name(RDisplayChannel::Name());
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2208
	_LIT(KPddExtension,".pdd");
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2209
	name.Append(KPddExtension);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2210
	return SetName(&name);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2211
	}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2212
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2213
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2214
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
  2215
	{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2216
	//Not supported
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2217
	}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2218
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2219
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
  2220
	{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2221
	__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
  2222
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2223
	if (!Kern::QueryVersionSupported(iVersion,aVer))
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2224
		{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2225
		return KErrNotSupported;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2226
		}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2227
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2228
	if (aUnit != 0)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2229
		{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2230
		return KErrNotSupported;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2231
		}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2232
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2233
	return KErrNone;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2234
	}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2235
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2236
#endif //ENABLE_GCE_MODE
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2237
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2238
DECLARE_STANDARD_EXTENSION()
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2239
	{
32
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2240
	__KTRACE_OPT(KEXTENSION, Kern::Printf("Creating DLcdPowerHandler"));
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2241
32
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2242
	TInt r = KErrNoMemory;
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2243
	DLcdPowerHandler* pH=new DLcdPowerHandler;
32
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2244
	if (!pH)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2245
		{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2246
		__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
  2247
		return r;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2248
		}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2249
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2250
	r = pH->Create();
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2251
	if (r != KErrNone)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2252
		{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2253
		__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
  2254
		return r;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2255
		}
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2256
32
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2257
#ifdef ENABLE_GCE_MODE
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2258
	__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
  2259
	r = KErrNoMemory;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2260
	DDisplayPddFactory * device = new DDisplayPddFactory;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2261
	if (!device)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2262
		{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2263
		__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
  2264
		return r;
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2265
		}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2266
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2267
	__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
  2268
	r = Kern::InstallPhysicalDevice(device);
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2269
	if (r != KErrNone)
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2270
		{
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2271
		__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
  2272
		}
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2273
#endif
161f6b2f6990 Bug 1471 - Display PDD for Symbian^3 proposed by iwanj@users.sourceforge.net
arunabha
parents: 21
diff changeset
  2274
0
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2275
	return r;
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2276
	}
6663340f3fc9 Add EPL'd beagleboard code
Pat Downey <patd@symbian.org>
parents:
diff changeset
  2277