1 /* 2 * Copyright 2003, Thomas Kurschel. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _EDID_H 6 #define _EDID_H 7 8 //! Extended Display Identification Data (EDID) 9 10 #include "edid_raw.h" 11 12 13 // vendor info 14 typedef struct { 15 char manufacturer[4]; 16 uint16 prod_id; 17 uint32 serial; 18 uint8 week; 19 uint16 year; 20 } edid1_vendor; 21 22 // version info 23 typedef struct { 24 uint8 version; 25 uint8 revision; 26 } edid1_version; 27 28 // analog input parameters 29 typedef struct { 30 uint8 input_voltage; // 0=0.7V/0.3V, 1=0.714V/0.286, 31 // 2=1V/0.4V, 3=0.7V/0V 32 bool setup; // true if voltage configurable 33 bool sep_sync; 34 bool comp_sync; 35 bool sync_on_green; 36 bool sync_serr; 37 } edid1_analog_params; 38 39 40 // digital input parameters 41 typedef struct { 42 uint8 bit_depth; 43 uint8 interface; 44 } edid1_digital_params; 45 46 // display info 47 typedef struct { 48 uint8 input_type; 49 edid1_analog_params analog_params; 50 edid1_digital_params digital_params; 51 52 uint8 h_size; 53 uint8 v_size; 54 uint8 gamma; // (x+100)/100 55 BBITFIELD8_7 ( 56 dpms_standby : 1, 57 dpms_suspend : 1, 58 dpms_off : 1, 59 display_type : 2, // 0=mono, 1=rgb, 2=multicolour 60 // since EDID version 1.1 61 std_colour_space : 1, 62 preferred_timing_mode : 1, 63 gtf_supported : 1 64 ); 65 uint16 red_x; // all colours are 0.10 fixed point 66 uint16 red_y; 67 uint16 green_x; 68 uint16 green_y; 69 uint16 blue_x; 70 uint16 blue_y; 71 uint16 white_x; 72 uint16 white_y; 73 } edid1_display; 74 75 // standard timing data 76 typedef struct { 77 uint16 h_size; 78 uint16 v_size; 79 uint16 id; 80 uint8 ratio; 81 uint8 refresh; 82 } edid1_std_timing; 83 84 // additional whitepoint 85 typedef struct { 86 uint8 index; 87 uint16 white_x; 88 uint16 white_y; 89 uint8 gamma; // (x+100)/100 90 } edid1_whitepoint; 91 92 // detailed timing description 93 typedef struct { 94 uint16 pixel_clock; // in 10 kHz 95 uint16 h_active; 96 uint16 h_blank; 97 uint16 v_active; 98 uint16 v_blank; 99 uint16 h_sync_off; 100 uint16 h_sync_width; 101 uint16 v_sync_off; 102 uint16 v_sync_width; 103 uint16 h_size; 104 uint16 v_size; 105 uint16 h_border; 106 uint16 v_border; 107 BBITFIELD8_4 ( 108 interlaced : 1, 109 stereo : 2, // upper bit set - left on sync 110 // lower bit set - right on sync 111 sync : 2, 112 misc : 2 113 ); 114 } edid1_detailed_timing; 115 116 // detailed monitor description 117 typedef struct { 118 uint8 monitor_desc_type; 119 union { 120 char serial_number[EDID1_EXTRA_STRING_LEN]; 121 char ascii_data[EDID1_EXTRA_STRING_LEN]; 122 edid1_monitor_range monitor_range; 123 char monitor_name[EDID1_EXTRA_STRING_LEN]; 124 edid1_whitepoint whitepoint[EDID1_NUM_EXTRA_WHITEPOINTS]; 125 edid1_std_timing std_timing[EDID1_NUM_EXTRA_STD_TIMING]; 126 edid1_detailed_timing detailed_timing; 127 } data; 128 } edid1_detailed_monitor; 129 130 // CTA data block 131 typedef struct cta_info { 132 uint8 tag; 133 uint8 revision; 134 uint8 num_native_detailed; 135 bool ycbcr422_supported; 136 bool ycbcr444_supported; 137 bool audio_supported; 138 bool underscan; 139 edid1_detailed_timing detailed_timing[6]; 140 uint8 num_data_blocks; 141 cta_data_block data_blocks[8]; 142 } cta_info; 143 144 145 // DisplayID data block 146 typedef struct displayid_info { 147 uint8 tag; 148 uint8 version; 149 uint8 extension_count; 150 } displayid_info; 151 152 // EDID data block 153 typedef struct edid1_info { 154 edid1_vendor vendor; 155 edid1_version version; 156 edid1_display display; 157 edid1_established_timing established_timing; 158 edid1_std_timing std_timing[EDID1_NUM_STD_TIMING]; 159 160 // since EDID version 1.2 161 edid1_detailed_monitor detailed_monitor[EDID1_NUM_DETAILED_MONITOR_DESC]; 162 163 uint8 num_sections; 164 165 // optional 166 cta_info cta_block; 167 displayid_info displayid_block; 168 } edid1_info; 169 170 171 #define EDID_VERSION_1 1 172 173 #ifdef __cplusplus 174 extern "C" { 175 #endif 176 177 void edid_decode(edid1_info *edid, const edid1_raw *raw); 178 void edid_dump(edid1_info *edid); 179 180 #ifdef __cplusplus 181 } 182 #endif 183 184 #endif // _EDID_H 185