|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Minimalistic frame buffer driver |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef _SYBORG_FB_H |
|
19 #define _SYBORG_FB_H |
|
20 |
|
21 #include <videodriver.h> |
|
22 #include <nkern.h> |
|
23 #include <kernel.h> |
|
24 #include <kpower.h> |
|
25 #include <system.h> |
|
26 |
|
27 _LIT(KLitLcd,"SYBORG_FB"); |
|
28 |
|
29 const TUint KConfigLcdWidth = 640; |
|
30 const TUint KConfigLcdHeight = 480; |
|
31 const TInt KConfigLcdWidthInTwips = 9638; |
|
32 const TInt KConfigLcdHeightInTwips = 7370; |
|
33 const TBool KConfigIsMono = 0; |
|
34 const TBool KConfigIsPalettized = 0; |
|
35 const TInt KCOnfigOffsetToFirstPixel = 0; |
|
36 const TBool KConfigPixelOrderRGB = 0; |
|
37 const TBool KConfigPixelOrderLandscape = 1; |
|
38 const TInt KConfigLcdDisplayMode = 2; |
|
39 //const TInt KConfigLcdDisplayMode = 1; |
|
40 const TInt KConfigLcdNumberOfDisplayModes = 3; |
|
41 |
|
42 |
|
43 const TInt KConfigBitsPerPixel = 24; |
|
44 const TInt KCOnfigOffsetBetweenLines = 2560; |
|
45 |
|
46 class DLcdPowerHandler : public DPowerHandler |
|
47 { |
|
48 public: // from DPowerHandler |
|
49 void PowerDown(TPowerState); |
|
50 void PowerUp(); |
|
51 public: // to prevent a race condition with WServer trying to power up/down at the same time |
|
52 void PowerUpDfc(); |
|
53 void PowerDownDfc(); |
|
54 public: |
|
55 DLcdPowerHandler(); |
|
56 TInt Create(); |
|
57 void DisplayOn(); |
|
58 void DisplayOff(); |
|
59 TInt HalFunction(TInt aFunction, TAny* a1, TAny* a2); |
|
60 |
|
61 void PowerUpLcd(TBool aSecure); |
|
62 void PowerDownLcd(); |
|
63 |
|
64 void ScreenInfo(TScreenInfoV01& aInfo); |
|
65 void WsSwitchOnScreen(); |
|
66 void WsSwitchOffScreen(); |
|
67 void HandleMsg(TMessageBase* aMsg); |
|
68 void SwitchDisplay(TBool aSecure); |
|
69 |
|
70 private: |
|
71 TInt GetCurrentDisplayModeInfo(TVideoInfoV01& aInfo, TBool aSecure); |
|
72 TInt GetSpecifiedDisplayModeInfo(TInt aMode, TVideoInfoV01& aInfo); |
|
73 TInt SetDisplayMode(TInt aMode); |
|
74 TInt AllocateFrameBuffer(); |
|
75 |
|
76 TBool iDisplayOn; |
|
77 DPlatChunkHw* iChunk; |
|
78 DPlatChunkHw* iSecureChunk; |
|
79 TBool iWsSwitchOnScreen; |
|
80 TBool iSecureDisplay; |
|
81 |
|
82 public: |
|
83 TDfcQue* iDfcQ; |
|
84 TMessageQue iMsgQ; // to prevent a race condition with Power Manager trying to power up/down at the same time |
|
85 TDfc iPowerUpDfc; |
|
86 TDfc iPowerDownDfc; |
|
87 |
|
88 private: |
|
89 TVideoInfoV01 iVideoInfo; |
|
90 TVideoInfoV01 iSecureVideoInfo; |
|
91 NFastMutex iLock; |
|
92 TPhysAddr ivRamPhys; |
|
93 TPhysAddr iSecurevRamPhys; |
|
94 |
|
95 public: |
|
96 TLinAddr iPortAddr; |
|
97 |
|
98 enum { |
|
99 FB_ID = 0, |
|
100 FB_BASE = 1, |
|
101 FB_HEIGHT = 2, |
|
102 FB_WIDTH = 3, |
|
103 FB_ORIENTATION = 4, |
|
104 FB_BLANK = 5, |
|
105 FB_INT_MASK = 6, |
|
106 /* begin new interface */ |
|
107 FB_INTERRUPT_CAUSE = 7, |
|
108 FB_BPP = 8, |
|
109 FB_COLOR_ORDER = 9, |
|
110 FB_BYTE_ORDER = 10, |
|
111 FB_PIXEL_ORDER = 11, |
|
112 FB_ROW_PITCH = 12, |
|
113 FB_ENABLED = 13, |
|
114 FB_PALETTE_START = 0x400 >> 2, |
|
115 FB_PALETTE_END = FB_PALETTE_START+256-1, |
|
116 /* end new interface */ |
|
117 }; |
|
118 |
|
119 #define FB_INT_VSYNC (1U << 0) |
|
120 #define FB_INT_BASE_UPDATE_DONE (1U << 1) |
|
121 |
|
122 }; |
|
123 |
|
124 #endif |