RTEMS 7.0-rc1
Loading...
Searching...
No Matches
edid.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: GPL-2.0+-with-RTEMS-exception */
2
18/*
19 * Copyright (C) 2014 Jan Dolezal (dolezj21@fel.cvut.cz)
20 * CTU in Prague.
21 *
22 * The license and distribution terms for this file may be
23 * found in the file LICENSE in this distribution or at
24 * http://www.rtems.org/license/LICENSE.
25 */
26
27#ifndef _EDID_H
28#define _EDID_H
29
30#ifndef ASM /* ASM */
31
32#include <stdint.h>
33
34#ifdef __cplusplus
35extern "C" {
36#endif /* __cplusplus */
37
39#define EDID_INLINE_ROUTINE static inline
40
41/* VESA Enhanced Extended Display Identification Data (E-EDID) Proposed
42 Release A, March 27, 2007 */
43
44/* *** Detailed Timing Descriptor Flags *** */
45#define EDID1_DTD_Flag_InterlacedOff 7
46#define EDID1_DTD_Flag_InterlacedMask 0x1
47#define EDID1_DTD_Flag_StereoModeOff 0
48#define EDID1_DTD_Flag_StereoModeMask 0xC1
49/* values for stereo flag */
50#define EDID1_DTD_Stereo_FldSeqRightOnSync 0x40
51#define EDID1_DTD_Stereo_FldSeqLeftOnSync 0x80
52#define EDID1_DTD_Stereo_2wItlvdRightOnEven 0x41
53#define EDID1_DTD_Stereo_2wItlvdLeftOnEven 0x81
54#define EDID1_DTD_Stereo_4wInterleaved 0xC0
55#define EDID1_DTD_Stereo_SideBySideItlvd 0xC1
56/* Analog = 0, Digital = 1 */
57#define EDID1_DTD_Flag_DigitalOff 4
58#define EDID1_DTD_Flag_DigitalMask 0x1
59/* Analog */
60#define EDID1_DTD_BipolarAnalogComposSyncOff 3
61#define EDID1_DTD_BipolarAnalogComposSyncMask 0x1
62#define EDID1_DTD_WithSerrationsOff 2
63#define EDID1_DTD_WithSerrationsMask 0x1
64/* Digital */
65#define EDID1_DTD_DigitalSeparateSyncOff 3
66#define EDID1_DTD_DigitalSeparateSyncMask 0x1
67 /* when DigitalSeparateSync == 0 -> it is composite
68 and WithSerrations defined up in Analog part applies */
69#define EDID1_DTD_VerticalSyncIsPositiveOff 2
70#define EDID1_DTD_VerticalSyncIsPositiveMask 0x1
71#define EDID1_DTD_HorizontalSyncIsPositiveOff 1
72#define EDID1_DTD_HorizontalSyncIsPositiveMask 0x1
73
74typedef struct {
75 uint8_t PixelClock_div10000[2];
76 uint8_t HorizontalActiveLow;
77 uint8_t HorizontalBlankingLow;
78 uint8_t HorizontalBlanking_ActiveHigh;
79 uint8_t VerticalActiveLow;
80 uint8_t VerticalBlankingLow;
81 uint8_t VerticalBlanking_ActiveHigh;
82 uint8_t HorizontalSyncOffsetLow;
83 uint8_t HorizontalSyncPulseWidthLow;
84 uint8_t VerticalSyncPulseWidth_OffsetLow;
85 uint8_t Vert_Hor_SyncPulseWidth_Offset_High;
86 uint8_t HorizontalImageSizeLow;
87 uint8_t VerticalImageSizeLow;
88 uint8_t Vertical_HorizontalImageSizeHigh;
89 uint8_t HorizontalBorder;
90 uint8_t VerticalBorder;
91 uint8_t Flags;
92} RTEMS_PACKED EDID_detailed_timing_descriptor;
93
94EDID_INLINE_ROUTINE uint16_t DTD_horizontal_active (
95 EDID_detailed_timing_descriptor *dtd)
96{
97 return (dtd->HorizontalActiveLow |
98 (dtd->HorizontalBlanking_ActiveHigh & 0xF0) << 4);
99}
100
101EDID_INLINE_ROUTINE uint16_t DTD_horizontal_blanking (
102 EDID_detailed_timing_descriptor *dtd)
103{
104 return (dtd->HorizontalBlankingLow |
105 (dtd->HorizontalBlanking_ActiveHigh & 0xF) << 8);
106}
107
108EDID_INLINE_ROUTINE uint16_t DTD_vertical_active (
109 EDID_detailed_timing_descriptor *dtd)
110{
111 return (dtd->VerticalActiveLow |
112 (dtd->VerticalBlanking_ActiveHigh & 0xF0) << 4);
113}
114
115EDID_INLINE_ROUTINE uint16_t DTD_vertical_blanking (
116 EDID_detailed_timing_descriptor *dtd)
117{
118 return (dtd->VerticalBlankingLow |
119 (dtd->VerticalBlanking_ActiveHigh & 0xF) << 8);
120}
121
122EDID_INLINE_ROUTINE uint16_t DTD_vertical_sync_pulse_width (
123 EDID_detailed_timing_descriptor *dtd)
124{
125 return ((dtd->VerticalSyncPulseWidth_OffsetLow & 0xF) |
126 (dtd->Vert_Hor_SyncPulseWidth_Offset_High & 0x3) << 4);
127}
128
129EDID_INLINE_ROUTINE uint16_t DTD_vertical_sync_offset (
130 EDID_detailed_timing_descriptor *dtd)
131{
132 return ((dtd->VerticalSyncPulseWidth_OffsetLow >> 4) |
133 (dtd->Vert_Hor_SyncPulseWidth_Offset_High & 0xC) << 2);
134}
135
136EDID_INLINE_ROUTINE uint16_t DTD_horizontal_sync_pulse_width (
137 EDID_detailed_timing_descriptor *dtd)
138{
139 return (dtd->HorizontalSyncPulseWidthLow |
140 (dtd->Vert_Hor_SyncPulseWidth_Offset_High & 0x30) << 4);
141}
142
143EDID_INLINE_ROUTINE uint16_t DTD_horizontal_sync_offset (
144 EDID_detailed_timing_descriptor *dtd)
145{
146 return (dtd->HorizontalSyncOffsetLow |
147 (dtd->Vert_Hor_SyncPulseWidth_Offset_High & 0xC0) << 2);
148}
149
150EDID_INLINE_ROUTINE uint16_t DTD_vertical_image_size (
151 EDID_detailed_timing_descriptor *dtd)
152{
153 return (dtd->VerticalImageSizeLow |
154 (dtd->Vertical_HorizontalImageSizeHigh & 0xF) << 8);
155}
156
157EDID_INLINE_ROUTINE uint16_t DTD_horizontal_image_size (
158 EDID_detailed_timing_descriptor *dtd)
159{
160 return (dtd->HorizontalImageSizeLow |
161 (dtd->Vertical_HorizontalImageSizeHigh & 0xF0) << 4);
162}
163
164typedef struct {
165 uint8_t ColorPointWhitePointIndexNumber;
166 uint8_t ColorPointWhiteLowBits;
167 uint8_t ColorPointWhite_x;
168 uint8_t ColorPointWhite_y;
169 uint8_t ColorPointWhiteGamma;
170} RTEMS_PACKED EDID_color_point_data;
171
172/* Basic Display Parameters */
173/* Monitor Descriptor - Data Type Tag */
174#define EDID_DTT_MonitorSerialNumber 0xFF
175
176#define EDID_DTT_ASCIIString 0xFE
177
178#define EDID_DTT_MonitorRangeLimits 0xFD
179typedef struct {
180 uint8_t MinVerticalRateInHz;
181 uint8_t MaxVerticalRateInHz;
182 uint8_t MinHorizontalInKHz;
183 uint8_t MaxHorizontalInKHz;
184 uint8_t MaxSupportedPixelClockIn10MHz;
185/* see VESA, Generalized Timing Formula Standard - GTF
186 Version 1.0, December 18, 1996 */
187 uint8_t GTFStandard[8];
188} RTEMS_PACKED EDID_monitor_range_limits;
189
190#define EDID_DTT_MonitorName 0xFC
191
192#define EDID_DTT_AdditionalColorPointData 0xFB
193/* Standard Timing Identification */
194#define EDID_DTT_AdditionalSTI 0xFA
195
196#define EDID_DTT_DisplayColorManagement 0xF9
197
198#define EDID_DTT_CVT3ByteTimingCodes 0xF8
199
200#define EDID1_CVT_AspectRatioOff 2
201#define EDID1_CVT_AspectRatioMask 0x3
202#define EDID1_CVT_AddressableLinesHighOff 4
203#define EDID1_CVT_AddressableLinesHighMask 0xF
204 /* next 5 bits indicate supported vertical rates */
205#define EDID1_CVT_VerticalRate60HzRBOff 0
206#define EDID1_CVT_VerticalRate60HzRBMask 0x1
207#define EDID1_CVT_VerticalRate85HzOff 1
208#define EDID1_CVT_VerticalRate85HzMask 0x1
209#define EDID1_CVT_VerticalRate75HzOff 2
210#define EDID1_CVT_VerticalRate75HzMask 0x1
211#define EDID1_CVT_VerticalRate60HzOff 3
212#define EDID1_CVT_VerticalRate60HzMask 0x1
213#define EDID1_CVT_VerticalRate50HzOff 4
214#define EDID1_CVT_VerticalRate50HzMask 0x1
215#define EDID1_CVT_PreferredVerticalRateOff 5
216#define EDID1_CVT_PreferredVerticalRateMask 0x3
217
218#define EDID_CVT_AspectRatio_4_3 0
219#define EDID_CVT_AspectRatio_16_9 1
220#define EDID_CVT_AspectRatio_16_10 2
221#define EDID_CVT_AspectRatio_15_9 3
222#define EDID_CVT_PrefVertRate50Hz 0
223#define EDID_CVT_PrefVertRate60Hz 1
224#define EDID_CVT_PrefVertRate75Hz 2
225#define EDID_CVT_PrefVertRate85Hz 3
226typedef struct {
227 uint8_t AddressableLinesLow;
228 uint8_t AspectRatio_AddressableLinesHigh;
229 uint8_t VerticalRate_PreferredVerticalRate;
230} RTEMS_PACKED EDID_CVT_3_byte_code_descriptor;
231typedef struct {
232 uint8_t VersionNumber;
233 EDID_CVT_3_byte_code_descriptor cvt[4];
234} RTEMS_PACKED EDID_CVT_timing_codes_3B;
235
236EDID_INLINE_ROUTINE uint16_t edid1_CVT_addressable_lines_high (
237 EDID_CVT_3_byte_code_descriptor *cvt)
238{
239 return (cvt->AddressableLinesLow |
240 (cvt->VerticalRate_PreferredVerticalRate &
241 (EDID1_CVT_AddressableLinesHighMask<<EDID1_CVT_AddressableLinesHighOff)
242 ) << (8-EDID1_CVT_AddressableLinesHighOff) );
243}
244
245EDID_INLINE_ROUTINE uint8_t edid1_CVT_aspect_ratio (
246 EDID_CVT_3_byte_code_descriptor *cvt)
247{
248 return (cvt->AspectRatio_AddressableLinesHigh >> EDID1_CVT_AspectRatioOff) &
249 EDID1_CVT_AspectRatioMask;
250}
251
252#define EDID_DTT_EstablishedTimingsIII 0xF7
253typedef struct {
254 uint8_t RevisionNumber;
255 uint8_t EST_III[12];
256} RTEMS_PACKED EDID_established_timings_III;
257enum EST_III {
258 EST_1152x864_75Hz = 0,
259 EST_1024x768_85Hz = 1,
260 EST_800x600_85Hz = 2,
261 EST_848x480_60Hz = 3,
262 EST_640x480_85Hz = 4,
263 EST_720x400_85Hz = 5,
264 EST_640x400_85Hz = 6,
265 EST_640x350_85Hz = 7,
266
267 EST_1280x1024_85Hz = 8,
268 EST_1280x1024_60Hz = 9,
269 EST_1280x960_85Hz = 10,
270 EST_1280x960_60Hz = 11,
271 EST_1280x768_85Hz = 12,
272 EST_1280x768_75Hz = 13,
273 EST_1280x768_60Hz = 14,
274 EST_1280x768_60HzRB = 15,
275
276 EST_1400x1050_75Hz = 16,
277 EST_1400x1050_60Hz = 17,
278 EST_1400x1050_60HzRB= 18,
279 EST_1400x900_85Hz = 19,
280 EST_1400x900_75Hz = 20,
281 EST_1400x900_60Hz = 21,
282 EST_1400x900_60HzRB = 22,
283 EST_1360x768_60Hz = 23,
284
285 EST_1600x1200_70Hz = 24,
286 EST_1600x1200_65Hz = 25,
287 EST_1600x1200_60Hz = 26,
288 EST_1680x1050_85Hz = 27,
289 EST_1680x1050_75Hz = 28,
290 EST_1680x1050_60Hz = 29,
291 EST_1680x1050_60HzRB= 30,
292 EST_1400x1050_85Hz = 31,
293
294 EST_1920x1200_60Hz = 32,
295 EST_1920x1200_60HzRB= 33,
296 EST_1856x1392_75Hz = 34,
297 EST_1856x1392_60Hz = 35,
298 EST_1792x1344_75Hz = 36,
299 EST_1792x1344_60Hz = 37,
300 EST_1600x1200_85Hz = 38,
301 EST_1600x1200_75Hz = 39,
302
303 EST_1920x1440_75Hz = 44,
304 EST_1920x1440_60Hz = 45,
305 EST_1920x1200_85Hz = 46,
306 EST_1920x1200_75Hz = 47,
307};
308
309#define EDID_DTT_DescriptorSpaceUnused 0x10
310/* DTT 0x0 - 0xF are manufacturer specific */
311
312typedef struct {
313 uint8_t Flag0[2];
314 uint8_t Flag1;
315 uint8_t DataTypeTag;
316 uint8_t Flag2;
317 uint8_t DescriptorData[13];
318} RTEMS_PACKED EDID_monitor_descriptor;
319
321 EDID_detailed_timing_descriptor dtd;
322 EDID_monitor_descriptor md;
324
325#define EDID1_STI_ImageAspectRatioOff 0
326#define EDID1_STI_ImageAspectRatioMask 0x3
327#define EDID1_STI_RefreshRateOff 2
328#define EDID1_STI_RefreshRateMask 0x3F
329
330#define EDID_STI_DescriptorUnused 0x0101
331#define EDID_STI_AspectRatio_16_10 0
332#define EDID_STI_AspectRatio_4_3 1
333#define EDID_STI_AspectRatio_5_4 2
334#define EDID_STI_AspectRatio_16_9 3
335typedef struct {
336 uint8_t HorizontalActivePixels;
337 uint8_t ImageAspectRatio_RefreshRate;
338} RTEMS_PACKED EDID_standard_timing_identification;
339
340/* Video Input Definition */
341/* Analog = 0, Digital = 1 */
342#define EDID1_VID_DigitalSignalLevelOff 7
343#define EDID1_VID_DigitalSignalLevelMask 0x1
344/* for EDID1_VID_DigitalSignalLevelOff = 1 (Digital) */
345#define EDID1_VID_ColorBitDepthOff 4
346#define EDID1_VID_ColorBitDepthMask 0x7 /* see CBD */
347#define EDID1_VID_DigitalVideoStandardSuppOff 0
348#define EDID1_VID_DigitalVideoStandardSuppMask 0xF /* see DVS */
349/* for EDID1_VID_DigitalSignalLevelOff = 0 (Analog) */
350#define EDID1_VID_SignalLevelStandardOff 5
351#define EDID1_VID_SignalLevelStandardMask 0x3
352#define EDID1_VID_VideoSetupBlankOff 4
353#define EDID1_VID_VideoSetupBlankMask 0x1
354#define EDID1_VID_SeparateSyncHandVSignalsOff 3
355#define EDID1_VID_SeparateSyncHandVSignalsMask 0x1
356#define EDID1_VID_SyncSignalOnHorizontalOff 2
357#define EDID1_VID_SyncSignalOnHorizontalMask 0x1
358#define EDID1_VID_SyncSignalOnGreenOff 1
359#define EDID1_VID_SyncSignalOnGreenMask 0x1
360#define EDID1_VID_SerationOnVerticalSyncOff 0
361#define EDID1_VID_SerationOnVerticalSyncMask 0x1
362/* Analog Interface Data Format - Signal Level Standard */
363#define EDID_SLS_0700_0300_1000Vpp 0x0
364#define EDID_SLS_0714_0286_1000Vpp 0x1
365#define EDID_SLS_1000_0400_1400Vpp 0x2
366#define EDID_SLS_0700_0000_0700Vpp 0x3
367
368/* Color Bit Depths */
369#define CBD_undef 0x0
370#define CBD_6bPerPrimaryColor 0x1
371#define CBD_8bPerPrimaryColor 0x2
372#define CBD_10bPerPrimaryColor 0x3
373#define CBD_12bPerPrimaryColor 0x4
374#define CBD_14bPerPrimaryColor 0x5
375#define CBD_16bPerPrimaryColor 0x6
376#define CBD_reserved 0x7
377
378/* Digital Video Standard Supported */
379#define DVS_undef 0x0
380#define DVS_DVI 0x1
381#define DVS_HDMI_a 0x2
382#define DVS_HDMI_b 0x3
383#define DVS_MDDI 0x4
384#define DVS_DiplayPort 0x5
385
386/* Feature Support */
387#define EDID1_Feature_GTFSupported_mask 0x1
388#define EDID1_Feature_GTFSupported_off 0
389#define EDID1_Feature_PreferredTimingMode_mask 0x1
390#define EDID1_Feature_PreferredTimingMode_off 1
391#define EDID1_Feature_StandardDefaultColorSpace_mask 0x1
392#define EDID1_Feature_StandardDefaultColorSpace_off 2
393#define EDID1_Feature_DisplayType_mask 0x2
394#define EDID1_Feature_DisplayType_off 3
395 /* Refer to VESA DPMS Specification */
396#define EDID1_Feature_ActiveOff_mask 0x1
397#define EDID1_Feature_ActiveOff_off 5
398#define EDID1_Feature_Suspend_mask 0x1
399#define EDID1_Feature_Suspend_off 6
400#define EDID1_Feature_StandBy_mask 0x1
401#define EDID1_Feature_StandBy_off 7
402 /* analog - Display Color Type */
403#define EDID_DisplayType_Monochrome 0
404#define EDID_DisplayType_RGBcolor 1
405#define EDID_DisplayType_nonRGBcolor 2
406#define EDID_DisplayType_undef 3
407 /* digital - Supported Color Encoding Formats */
408#define EDID_DisplayType_RGB444 0
409#define EDID_DisplayType_RGB444YCrCb444 1
410#define EDID_DisplayType_RGB444YCrCb422 2
411#define EDID_DisplayType_RGB444YCrCb444YCrCb422 3
412
413typedef struct {
414 uint8_t Header[8];
415/* Vendor Product Identification */
416 uint8_t IDManufacturerName[2];
417 uint8_t IDProductCode[2];
418 uint8_t IDSerialNumber[4];
419 uint8_t WeekofManufacture;
420 uint8_t YearofManufacture;
421/* EDID Structure Version Revision Level */
422 uint8_t Version;
423 uint8_t Revision;
424/* Basic Display Parameters Features */
425 /* Video Input Definition */
426 uint8_t VideoInputDefinition;
427 uint8_t MaxHorizontalImageSize;
428 uint8_t MaxVerticalImageSize;
429 uint8_t DisplayTransferCharacteristic;
430 /* Feature Support */
431 uint8_t Features;
432/* Color Characteristics */
433 uint8_t GreenRedLow;
434 uint8_t WhiteBlueLow;
435 uint8_t RedXHigh;
436 uint8_t RedYHigh;
437 uint8_t GreenXHigh;
438 uint8_t GreenYHigh;
439 uint8_t BlueXHigh;
440 uint8_t BlueYHigh;
441 uint8_t WhiteXHigh;
442 uint8_t WhiteYHigh;
443/* Established Timings I, II, Manufacturer's */
444 uint8_t EST_I_II_Man[3];
445/* Standard Timing Identification */
446 EDID_standard_timing_identification STI[8];
447/* Detailed Timing Descriptions / Monitor Descriptions */
448 union EDID_DTD_MD dtd_md[4];
449 uint8_t ExtensionFlag;
450 uint8_t Checksum;
451} RTEMS_PACKED EDID_edid1;
452
453EDID_INLINE_ROUTINE uint16_t edid1_RedX (EDID_edid1 *edid) {
454 return (edid->RedXHigh<<2) | (edid->GreenRedLow>>6);
455}
456EDID_INLINE_ROUTINE uint16_t edid1_RedY (EDID_edid1 *edid) {
457 return (edid->RedYHigh<<2) | (edid->GreenRedLow>>4)&&0x3;
458}
459EDID_INLINE_ROUTINE uint16_t edid1_GreenX (EDID_edid1 *edid) {
460 return (edid->GreenXHigh<<2) | (edid->GreenRedLow>>2)&&0x3;
461}
462EDID_INLINE_ROUTINE uint16_t edid1_GreenY (EDID_edid1 *edid) {
463 return (edid->GreenYHigh<<2) | (edid->GreenRedLow&0x3);
464}
465EDID_INLINE_ROUTINE uint16_t edid1_BlueX (EDID_edid1 *edid) {
466 return (edid->BlueXHigh<<2) | (edid->WhiteBlueLow>>6);
467}
468EDID_INLINE_ROUTINE uint16_t edid1_BlueY (EDID_edid1 *edid) {
469 return (edid->BlueYHigh<<2) | (edid->WhiteBlueLow>>4)&&0x3;
470}
471EDID_INLINE_ROUTINE uint16_t edid1_WhiteX (EDID_edid1 *edid) {
472 return (edid->WhiteXHigh<<2) | (edid->WhiteBlueLow>>2)&&0x3;
473}
474EDID_INLINE_ROUTINE uint16_t edid1_WhiteY (EDID_edid1 *edid) {
475 return (edid->WhiteYHigh<<2) | (edid->WhiteBlueLow&0x3);
476}
477
478EDID_INLINE_ROUTINE int edid1_STI_is_unused (
479 const EDID_standard_timing_identification *edid_sti) {
480 return (edid_sti->HorizontalActivePixels ==
481 (uint8_t)EDID_STI_DescriptorUnused) &&
482 (edid_sti->ImageAspectRatio_RefreshRate ==
483 (uint8_t)(EDID_STI_DescriptorUnused >> 8));
484}
485
486enum edid1_established_timings {
487/* Established Timings I */
488 EST_800x600_60Hz = 0,
489 EST_800x600_56Hz = 1,
490 EST_640x480_75Hz = 2,
491 EST_640x480_72Hz = 3,
492 EST_640x480_67Hz = 4,
493 EST_640x480_60Hz = 5,
494 EST_720x400_88Hz = 6,
495 EST_720x400_70Hz = 7,
496/* Established Timings II */
497 EST_1280x1024_75Hz = 8,
498 EST_1024x768_75Hz = 9,
499 EST_1024x768_70Hz = 10,
500 EST_1024x768_60Hz = 11,
501 EST_1024x768_87Hz = 12,
502 EST_832x624_75Hz = 13,
503 EST_800x600_75Hz = 14,
504 EST_800x600_72Hz = 15,
505/* Manufacturer's Timings */
506 EST_1152x870_75Hz = 23,
507};
508
509EDID_INLINE_ROUTINE uint8_t edid1_established_tim (
510 EDID_edid1 *edid,
511 enum edid1_established_timings est)
512{
513 return (uint8_t)(edid->EST_I_II_Man[est/8] & (est%8));
514}
515
516#ifdef __cplusplus
517}
518#endif /* __cplusplus */
519
520#endif /* ASM */
521
522#endif /* _VBE_H */
This header file provides basic definitions used by the API and the implementation.
Used for passing and retrieving registers content to/from real mode interrupt call.
Definition: realmode_int.h:45
Definition: edid.h:320