TianoCore EDK2 master
Loading...
Searching...
No Matches
LcdPlatformLib.h
Go to the documentation of this file.
1
8#ifndef LCD_PLATFORM_LIB_H_
9#define LCD_PLATFORM_LIB_H_
10
12
13#define LCD_VRAM_SIZE SIZE_8MB
14
15// Modes definitions
16#define VGA 0
17#define SVGA 1
18#define XGA 2
19#define SXGA 3
20#define WSXGA 4
21#define UXGA 5
22#define HD 6
23#define WVGA 7
24#define QHD 8
25#define WSVGA 9
26#define HD720 10
27#define WXGA 11
28
29// VGA Mode: 640 x 480
30#define VGA_H_RES_PIXELS 640
31#define VGA_V_RES_PIXELS 480
32#define VGA_OSC_FREQUENCY 23750000 /* 0x016A6570 */
33
34#define VGA_H_SYNC ( 80 - 1)
35#define VGA_H_FRONT_PORCH ( 16 - 1)
36#define VGA_H_BACK_PORCH ( 64 - 1)
37
38#define VGA_V_SYNC ( 4 - 1)
39#define VGA_V_FRONT_PORCH ( 3 - 1)
40#define VGA_V_BACK_PORCH ( 13 - 1)
41
42// SVGA Mode: 800 x 600
43#define SVGA_H_RES_PIXELS 800
44#define SVGA_V_RES_PIXELS 600
45#define SVGA_OSC_FREQUENCY 38250000 /* 0x0247A610 */
46
47#define SVGA_H_SYNC ( 80 - 1)
48#define SVGA_H_FRONT_PORCH ( 32 - 1)
49#define SVGA_H_BACK_PORCH (112 - 1)
50
51#define SVGA_V_SYNC ( 4 - 1)
52#define SVGA_V_FRONT_PORCH ( 3 - 1)
53#define SVGA_V_BACK_PORCH ( 17 - 1)
54
55// XGA Mode: 1024 x 768
56#define XGA_H_RES_PIXELS 1024
57#define XGA_V_RES_PIXELS 768
58#define XGA_OSC_FREQUENCY 63500000 /* 0x03C8EEE0 */
59
60#define XGA_H_SYNC (104 - 1)
61#define XGA_H_FRONT_PORCH ( 48 - 1)
62#define XGA_H_BACK_PORCH (152 - 1)
63
64#define XGA_V_SYNC ( 4 - 1)
65#define XGA_V_FRONT_PORCH ( 3 - 1)
66#define XGA_V_BACK_PORCH ( 23 - 1)
67
68// SXGA Mode: 1280 x 1024
69#define SXGA_H_RES_PIXELS 1280
70#define SXGA_V_RES_PIXELS 1024
71#define SXGA_OSC_FREQUENCY 109000000 /* 0x067F3540 */
72
73#define SXGA_H_SYNC (136 - 1)
74#define SXGA_H_FRONT_PORCH ( 80 - 1)
75#define SXGA_H_BACK_PORCH (216 - 1)
76
77#define SXGA_V_SYNC ( 7 - 1)
78#define SXGA_V_FRONT_PORCH ( 3 - 1)
79#define SXGA_V_BACK_PORCH ( 29 - 1)
80
81// WSXGA+ Mode: 1680 x 1050
82#define WSXGA_H_RES_PIXELS 1680
83#define WSXGA_V_RES_PIXELS 1050
84#define WSXGA_OSC_FREQUENCY 147000000 /* 0x08C30AC0 */
85
86#define WSXGA_H_SYNC (170 - 1)
87#define WSXGA_H_FRONT_PORCH (104 - 1)
88#define WSXGA_H_BACK_PORCH (274 - 1)
89
90#define WSXGA_V_SYNC ( 5 - 1)
91#define WSXGA_V_FRONT_PORCH ( 4 - 1)
92#define WSXGA_V_BACK_PORCH ( 41 - 1)
93
94// UXGA Mode: 1600 x 1200
95#define UXGA_H_RES_PIXELS 1600
96#define UXGA_V_RES_PIXELS 1200
97#define UXGA_OSC_FREQUENCY 161000000 /* 0x0998AA40 */
98
99#define UXGA_H_SYNC (168 - 1)
100#define UXGA_H_FRONT_PORCH (112 - 1)
101#define UXGA_H_BACK_PORCH (280 - 1)
102
103#define UXGA_V_SYNC ( 4 - 1)
104#define UXGA_V_FRONT_PORCH ( 3 - 1)
105#define UXGA_V_BACK_PORCH ( 38 - 1)
106
107// HD Mode: 1920 x 1080
108#define HD_H_RES_PIXELS 1920
109#define HD_V_RES_PIXELS 1080
110#define HD_OSC_FREQUENCY 165000000 /* 0x09D5B340 */
111
112#define HD_H_SYNC ( 79 - 1)
113#define HD_H_FRONT_PORCH (128 - 1)
114#define HD_H_BACK_PORCH (328 - 1)
115
116#define HD_V_SYNC ( 5 - 1)
117#define HD_V_FRONT_PORCH ( 3 - 1)
118#define HD_V_BACK_PORCH ( 32 - 1)
119
120// WVGA Mode: 800 x 480
121#define WVGA_H_RES_PIXELS 800
122#define WVGA_V_RES_PIXELS 480
123#define WVGA_OSC_FREQUENCY 29500000 /* 0x01C22260 */
124#define WVGA_H_SYNC ( 72 - 1)
125#define WVGA_H_FRONT_PORCH ( 24 - 1)
126#define WVGA_H_BACK_PORCH ( 96 - 1)
127#define WVGA_V_SYNC ( 7 - 1)
128#define WVGA_V_FRONT_PORCH ( 3 - 1)
129#define WVGA_V_BACK_PORCH ( 10 - 1)
130
131// QHD Mode: 960 x 540
132#define QHD_H_RES_PIXELS 960
133#define QHD_V_RES_PIXELS 540
134#define QHD_OSC_FREQUENCY 40750000 /* 0x026DCBB0 */
135#define QHD_H_SYNC ( 96 - 1)
136#define QHD_H_FRONT_PORCH ( 32 - 1)
137#define QHD_H_BACK_PORCH (128 - 1)
138#define QHD_V_SYNC ( 5 - 1)
139#define QHD_V_FRONT_PORCH ( 3 - 1)
140#define QHD_V_BACK_PORCH ( 14 - 1)
141
142// WSVGA Mode: 1024 x 600
143#define WSVGA_H_RES_PIXELS 1024
144#define WSVGA_V_RES_PIXELS 600
145#define WSVGA_OSC_FREQUENCY 49000000 /* 0x02EBAE40 */
146#define WSVGA_H_SYNC (104 - 1)
147#define WSVGA_H_FRONT_PORCH ( 40 - 1)
148#define WSVGA_H_BACK_PORCH (144 - 1)
149#define WSVGA_V_SYNC ( 10 - 1)
150#define WSVGA_V_FRONT_PORCH ( 3 - 1)
151#define WSVGA_V_BACK_PORCH ( 11 - 1)
152
153// HD720 Mode: 1280 x 720
154#define HD720_H_RES_PIXELS 1280
155#define HD720_V_RES_PIXELS 720
156#define HD720_OSC_FREQUENCY 74500000 /* 0x0470C7A0 */
157#define HD720_H_SYNC (128 - 1)
158#define HD720_H_FRONT_PORCH ( 64 - 1)
159#define HD720_H_BACK_PORCH (192 - 1)
160#define HD720_V_SYNC ( 5 - 1)
161#define HD720_V_FRONT_PORCH ( 3 - 1)
162#define HD720_V_BACK_PORCH ( 20 - 1)
163
164// WXGA Mode: 1280 x 800
165#define WXGA_H_RES_PIXELS 1280
166#define WXGA_V_RES_PIXELS 800
167#define WXGA_OSC_FREQUENCY 83500000 /* 0x04FA1BE0 */
168#define WXGA_H_SYNC (128 - 1)
169#define WXGA_H_FRONT_PORCH ( 72 - 1)
170#define WXGA_H_BACK_PORCH (200 - 1)
171#define WXGA_V_SYNC ( 6 - 1)
172#define WXGA_V_FRONT_PORCH ( 3 - 1)
173#define WXGA_V_BACK_PORCH ( 22 - 1)
174
175// Colour Masks
176#define LCD_24BPP_RED_MASK 0x00FF0000
177#define LCD_24BPP_GREEN_MASK 0x0000FF00
178#define LCD_24BPP_BLUE_MASK 0x000000FF
179#define LCD_24BPP_RESERVED_MASK 0xFF000000
180
181#define LCD_16BPP_555_RED_MASK 0x00007C00
182#define LCD_16BPP_555_GREEN_MASK 0x000003E0
183#define LCD_16BPP_555_BLUE_MASK 0x0000001F
184#define LCD_16BPP_555_RESERVED_MASK 0x00000000
185
186#define LCD_16BPP_565_RED_MASK 0x0000F800
187#define LCD_16BPP_565_GREEN_MASK 0x000007E0
188#define LCD_16BPP_565_BLUE_MASK 0x0000001F
189#define LCD_16BPP_565_RESERVED_MASK 0x00008000
190
191#define LCD_12BPP_444_RED_MASK 0x00000F00
192#define LCD_12BPP_444_GREEN_MASK 0x000000F0
193#define LCD_12BPP_444_BLUE_MASK 0x0000000F
194#define LCD_12BPP_444_RESERVED_MASK 0x0000F000
195
199typedef enum {
200 LcdBitsPerPixel_1 = 0,
201 LcdBitsPerPixel_2,
202 LcdBitsPerPixel_4,
203 LcdBitsPerPixel_8,
204 LcdBitsPerPixel_16_555,
205 LcdBitsPerPixel_24,
206 LcdBitsPerPixel_16_565,
207 LcdBitsPerPixel_12_444,
208 LcdBitsPerPixel_Max
209} LCD_BPP;
210
211// Display timing settings.
212typedef struct {
213 UINT32 Resolution;
214 UINT32 Sync;
215 UINT32 BackPorch;
216 UINT32 FrontPorch;
218
228 IN EFI_HANDLE Handle
229 );
230
245 OUT EFI_PHYSICAL_ADDRESS *VramBaseAddress,
246 OUT UINTN *VramSize
247 );
248
256UINT32
258 VOID
259 );
260
271 IN UINT32 ModeNumber
272 );
273
286 IN UINT32 ModeNumber,
288 );
289
306 IN UINT32 ModeNumber,
307 OUT SCAN_TIMINGS **Horizontal,
308 OUT SCAN_TIMINGS **Vertical
309 );
310
323 IN UINT32 ModeNumber,
324 OUT LCD_BPP *Bpp
325 );
326
327#endif /* LCD_PLATFORM_LIB_H_ */
UINT64 UINTN
UINT32 LcdPlatformGetMaxMode(VOID)
EFI_STATUS LcdPlatformQueryMode(IN UINT32 ModeNumber, OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info)
EFI_STATUS LcdPlatformGetBpp(IN UINT32 ModeNumber, OUT LCD_BPP *Bpp)
LCD_BPP
EFI_STATUS LcdPlatformInitializeDisplay(IN EFI_HANDLE Handle)
EFI_STATUS LcdPlatformGetTimings(IN UINT32 ModeNumber, OUT SCAN_TIMINGS **Horizontal, OUT SCAN_TIMINGS **Vertical)
EFI_STATUS LcdPlatformGetVram(OUT EFI_PHYSICAL_ADDRESS *VramBaseAddress, OUT UINTN *VramSize)
EFI_STATUS LcdPlatformSetMode(IN UINT32 ModeNumber)
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
UINT64 EFI_PHYSICAL_ADDRESS
Definition: UefiBaseType.h:50
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33