2 * Copyright 2003, Thomas Kurschel. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
5 * Copyright 2006-2013 Haiku, Inc. All rights reserved.
6 * Distributed under the terms of the MIT License.
10 * Bill Randle, billr@neocat.org
16 #include "bendian_bitfield.h"
19 /*! Raw EDID data block.
21 Raw data are packed in a really weird way. Never even
22 think about using it directly, instead translate it via decode_edid()
26 #define EDID1_NUM_DETAILED_MONITOR_DESC 4
27 #define EDID1_NUM_STD_TIMING 8
28 #define EDID1_NUM_EXTRA_STD_TIMING 6
29 #define EDID1_EXTRA_STRING_LEN 13
30 #define EDID1_NUM_EXTRA_WHITEPOINTS 2
34 typedef struct _PACKED
{
35 int8 pad
[8]; // contains 0, -1, -1, -1, -1, -1, -1, 0
40 typedef struct _PACKED
{
41 BBITFIELD8_3 ( // manufacturer
43 c1
: 5, // add '@' to get ascii
58 typedef struct _PACKED
{
65 typedef struct _PACKED
{
67 input_type
: 1, // 1 : digital
68 input_voltage
: 2, // 0=0.7V/0.3V, 1=0.714V/0.286,
69 // 2=1V/0.4V, 3=0.7V/0V
70 setup
: 1, // true if voltage configurable
78 uint8 gamma
; // (x+100)/100
83 display_type
: 2, // 0=mono, 1=rgb, 2=multicolour
84 // since EDID version 1.1
86 preferred_timing_mode
: 1,
89 BBITFIELD8_4 ( // low bits of red_x etc.
101 uint8 red_x
; // all colours are 0.10 fixed point
112 // raw standard timing data
113 typedef union _PACKED
{
115 uint8 h_size
; // (x+31)*8
117 ratio
: 2, // 0=1:1, 1=3/4, 2=4/5, 3=9/16
118 refresh
: 6 // (x+60)
122 } edid1_std_timing_raw
;
125 // list of supported fixed timings
126 typedef struct _PACKED
{
141 res_1024x768x87i
: 1,
151 } edid1_established_timing
;
154 // types of detailed monitor description
156 EDID1_SERIAL_NUMBER
= 0xff,
157 EDID1_ASCII_DATA
= 0xfe,
158 EDID1_MONITOR_RANGES
= 0xfd,
159 EDID1_MONITOR_NAME
= 0xfc,
160 EDID1_ADD_COLOUR_POINTER
= 0xfb,
161 EDID1_ADD_STD_TIMING
= 0xfa,
162 EDID1_IS_DETAILED_TIMING
= 1
166 // monitor frequency range
167 typedef struct _PACKED
{
172 uint8 max_clock
; // in 10 MHz (!)
173 } edid1_monitor_range
;
176 // additional whitepoint
177 typedef struct _PACKED
{
186 uint8 gamma1
; // (x+100)/100
195 uint8 gamma2
; // (x+100)/100
196 } edid1_whitepoint_raw
;
199 // detailed timing description
200 typedef struct _PACKED
{
201 uint16 pixel_clock
; // in 10 kHz (!)
222 h_sync_width_high
: 2,
224 v_sync_width_high
: 2
236 stereo
: 2, // upper bit set - left on sync
237 // lower bit set - right on sync
242 } edid1_detailed_timing_raw
;
245 // detailed monitor description
246 typedef union _PACKED
{
247 edid1_detailed_timing_raw detailed_timing
;
250 uint8 monitor_desc_type
;
253 uint8 serial_number
[EDID1_EXTRA_STRING_LEN
];
254 uint8 ascii_data
[EDID1_EXTRA_STRING_LEN
];
255 uint8 monitor_name
[EDID1_EXTRA_STRING_LEN
];
256 edid1_monitor_range monitor_range
;
257 edid1_whitepoint_raw whitepoint
;
258 edid1_std_timing_raw std_timing
[EDID1_NUM_EXTRA_STD_TIMING
];
261 } edid1_detailed_monitor_raw
;
265 // everything is packed data, mixture of little endian and big endian
266 // and a bit brain dead overall - nothing your dad would be proud of
267 typedef struct _PACKED
{
268 edid1_header_raw header
; // 8 bytes
269 edid1_vendor_raw vendor
; // 10 bytes
270 edid1_version_raw version
; // 2 bytes
271 edid1_display_raw display
; // 15 bytes
272 edid1_established_timing established_timing
; // 3 bytes
273 edid1_std_timing_raw std_timing
[EDID1_NUM_STD_TIMING
];
274 // 8 a 2 bytes -> 16 bytes
276 // since EDID version 1.2
277 edid1_detailed_monitor_raw detailed_monitor
[EDID1_NUM_DETAILED_MONITOR_DESC
];
278 // 4 a 18 bytes -> 72 bytes
280 uint8 num_sections
; // 1 byte
281 uint8 check_sum
; // 1 byte
282 } edid1_raw
; // total: 128 bytes