]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_R5_UltraScale_MPSoC/RTOSDemo_R5_bsp/psu_cortexr5_0/libsrc/video_common_v4_3/src/xvidc_edid.h
Update Zynq, MPSoc Cortex-A53 and MPSoc Cortex-R5 demo projects to build with the...
[freertos] / FreeRTOS / Demo / CORTEX_R5_UltraScale_MPSoC / RTOSDemo_R5_bsp / psu_cortexr5_0 / libsrc / video_common_v4_3 / src / xvidc_edid.h
1 /*******************************************************************************
2  *
3  * Copyright (C) 2017 Xilinx, Inc.  All rights reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a copy
6  * of this software and associated documentation files (the "Software"), to deal
7  * in the Software without restriction, including without limitation the rights
8  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9  * copies of the Software, and to permit persons to whom the Software is
10  * furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in
13  * all copies or substantial portions of the Software.
14  *
15  * Use of the Software is limited solely to applications:
16  * (a) running on a Xilinx device, or
17  * (b) that interact with a Xilinx device through a bus or interconnect.
18  *
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22  * XILINX  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
24  * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25  * SOFTWARE.
26  *
27  * Except as contained in this notice, the name of the Xilinx shall not be used
28  * in advertising or otherwise to promote the sale, use or other dealings in
29  * this Software without prior written authorization from Xilinx.
30  *
31 *******************************************************************************/
32 /******************************************************************************/
33 /**
34  *
35  * @file xvidc_edid.h
36  * @addtogroup video_common_v4_2
37  * @{
38  *
39  * Contains macros, definitions, and function declarations related to the
40  * Extended Display Identification Data (EDID) structure which is present in all
41  * monitors. All content in this file is agnostic of communication interface
42  * protocol.
43  *
44  * @note        None.
45  *
46  * <pre>
47  * MODIFICATION HISTORY:
48  *
49  * Ver   Who  Date     Changes
50  * ----- ---- -------- -----------------------------------------------
51  * 1.0   als  11/09/14 Initial release.
52  * 2.2   als  02/01/16 Functions with pointer arguments that don't modify
53  *                     contents now const.
54  * 4.0   aad  10/26/16 Functions which return fixed point values instead of
55  *                     float
56  * </pre>
57  *
58 *******************************************************************************/
59
60 #ifndef XVIDC_EDID_H_
61 /* Prevent circular inclusions by using protection macros. */
62 #define XVIDC_EDID_H_
63
64 #ifdef __cplusplus
65 extern "C" {
66 #endif
67 /******************************* Include Files ********************************/
68
69 #include "xstatus.h"
70 #include "xvidc.h"
71
72 /************************** Constant Definitions ******************************/
73
74 /** @name Address mapping for the base EDID block.
75  * @{
76  */
77 #define XVIDC_EDID_HEADER                               0x00
78 /* Vendor and product identification. */
79 #define XVIDC_EDID_VPI_ID_MAN_NAME0                     0x08
80 #define XVIDC_EDID_VPI_ID_MAN_NAME1                     0x09
81 #define XVIDC_EDID_VPI_ID_PROD_CODE_LSB                 0x0A
82 #define XVIDC_EDID_VPI_ID_PROD_CODE_MSB                 0x0B
83 #define XVIDC_EDID_VPI_ID_SN0                           0x0C
84 #define XVIDC_EDID_VPI_ID_SN1                           0x0D
85 #define XVIDC_EDID_VPI_ID_SN2                           0x0E
86 #define XVIDC_EDID_VPI_ID_SN3                           0x0F
87 #define XVIDC_EDID_VPI_WEEK_MAN                         0x10
88 #define XVIDC_EDID_VPI_YEAR                             0x11
89 /* EDID structure version and revision. */
90 #define XVIDC_EDID_STRUCT_VER                           0x12
91 #define XVIDC_EDID_STRUCT_REV                           0x13
92 /* Basic display parameters and features. */
93 #define XVIDC_EDID_BDISP_VID                            0x14
94 #define XVIDC_EDID_BDISP_H_SSAR                         0x15
95 #define XVIDC_EDID_BDISP_V_SSAR                         0x16
96 #define XVIDC_EDID_BDISP_GAMMA                          0x17
97 #define XVIDC_EDID_BDISP_FEATURE                        0x18
98 /* Color characteristics (display x,y chromaticity coordinates). */
99 #define XVIDC_EDID_CC_RG_LOW                            0x19
100 #define XVIDC_EDID_CC_BW_LOW                            0x1A
101 #define XVIDC_EDID_CC_REDX_HIGH                         0x1B
102 #define XVIDC_EDID_CC_REDY_HIGH                         0x1C
103 #define XVIDC_EDID_CC_GREENX_HIGH                       0x1D
104 #define XVIDC_EDID_CC_GREENY_HIGH                       0x1E
105 #define XVIDC_EDID_CC_BLUEX_HIGH                        0x1F
106 #define XVIDC_EDID_CC_BLUEY_HIGH                        0x20
107 #define XVIDC_EDID_CC_WHITEX_HIGH                       0x21
108 #define XVIDC_EDID_CC_WHITEY_HIGH                       0x22
109 /* Established timings. */
110 #define XVIDC_EDID_EST_TIMINGS_I                        0x23
111 #define XVIDC_EDID_EST_TIMINGS_II                       0x24
112 #define XVIDC_EDID_EST_TIMINGS_MAN                      0x25
113 /* Standard timings. */
114 #define XVIDC_EDID_STD_TIMINGS_H(N)                     (0x26 + 2 * (N - 1))
115 #define XVIDC_EDID_STD_TIMINGS_AR_FRR(N)                (0x27 + 2 * (N - 1))
116 /* 18 byte descriptors. */
117 #define XVIDC_EDID_18BYTE_DESCRIPTOR(N)                 (0x36 + 18 * (N - 1))
118 #define XVIDC_EDID_PTM                  (XVIDC_EDID_18BYTE_DESCRIPTOR(1))
119 /* - Detailed timing descriptor (DTD) / Preferred timing mode (PTM). */
120 #define XVIDC_EDID_DTD_PTM_PIXEL_CLK_KHZ_LSB            0x00
121 #define XVIDC_EDID_DTD_PTM_PIXEL_CLK_KHZ_MSB            0x01
122 #define XVIDC_EDID_DTD_PTM_HRES_LSB                     0x02
123 #define XVIDC_EDID_DTD_PTM_HBLANK_LSB                   0x03
124 #define XVIDC_EDID_DTD_PTM_HRES_HBLANK_U4               0x04
125 #define XVIDC_EDID_DTD_PTM_VRES_LSB                     0x05
126 #define XVIDC_EDID_DTD_PTM_VBLANK_LSB                   0x06
127 #define XVIDC_EDID_DTD_PTM_VRES_VBLANK_U4               0x07
128 #define XVIDC_EDID_DTD_PTM_HFPORCH_LSB                  0x08
129 #define XVIDC_EDID_DTD_PTM_HSPW_LSB                     0x09
130 #define XVIDC_EDID_DTD_PTM_VFPORCH_VSPW_L4              0x0A
131 #define XVIDC_EDID_DTD_PTM_XFPORCH_XSPW_U2              0x0B
132 #define XVIDC_EDID_DTD_PTM_HIMGSIZE_MM_LSB              0x0C
133 #define XVIDC_EDID_DTD_PTM_VIMGSIZE_MM_LSB              0x0D
134 #define XVIDC_EDID_DTD_PTM_XIMGSIZE_MM_U4               0x0E
135 #define XVIDC_EDID_DTD_PTM_HBORDER                      0x0F
136 #define XVIDC_EDID_DTD_PTM_VBORDER                      0x10
137 #define XVIDC_EDID_DTD_PTM_SIGNAL                       0x11
138
139 /* Extension block count. */
140 #define XVIDC_EDID_EXT_BLK_COUNT                        0x7E
141 /* Checksum. */
142 #define XVIDC_EDID_CHECKSUM                             0x7F
143 /* @} */
144
145 /******************************************************************************/
146
147 /** @name Extended Display Identification Data: Masks, shifts, and values.
148  * @{
149  */
150 #define XVIDC_EDID_VPI_ID_MAN_NAME0_CHAR0_SHIFT         2
151 #define XVIDC_EDID_VPI_ID_MAN_NAME0_CHAR0_MASK          (0x1F << 2)
152 #define XVIDC_EDID_VPI_ID_MAN_NAME0_CHAR1_MASK          0x03
153 #define XVIDC_EDID_VPI_ID_MAN_NAME0_CHAR1_POS           3
154 #define XVIDC_EDID_VPI_ID_MAN_NAME1_CHAR1_SHIFT         5
155 #define XVIDC_EDID_VPI_ID_MAN_NAME1_CHAR2_MASK          0x1F
156
157 /* Basic display parameters and features: Video input definition. */
158 #define XVIDC_EDID_BDISP_VID_VSI_SHIFT                  7
159 #define XVIDC_EDID_BDISP_VID_VSI_MASK                   (0x01 << 7)
160 #define XVIDC_EDID_BDISP_VID_ANA_SLS_SHIFT              5
161 #define XVIDC_EDID_BDISP_VID_ANA_SLS_MASK               (0x03 << 5)
162 #define XVIDC_EDID_BDISP_VID_ANA_SLS_0700_0300_1000     0x0
163 #define XVIDC_EDID_BDISP_VID_ANA_SLS_0714_0286_1000     0x1
164 #define XVIDC_EDID_BDISP_VID_ANA_SLS_1000_0400_1400     0x2
165 #define XVIDC_EDID_BDISP_VID_ANA_SLS_0700_0000_0700     0x3
166 #define XVIDC_EDID_BDISP_VID_ANA_VID_SETUP_MASK         (0x01 << 4)
167 #define XVIDC_EDID_BDISP_VID_ANA_SEP_SYNC_HV_MASK       (0x01 << 3)
168 #define XVIDC_EDID_BDISP_VID_ANA_COMP_SYNC_H_MASK       (0x01 << 2)
169 #define XVIDC_EDID_BDISP_VID_ANA_COMP_SYNC_G_MASK       (0x01 << 1)
170 #define XVIDC_EDID_BDISP_VID_ANA_SERR_V_SYNC_MASK       (0x01)
171 #define XVIDC_EDID_BDISP_VID_DIG_BPC_SHIFT              4
172 #define XVIDC_EDID_BDISP_VID_DIG_BPC_MASK               (0x7 << 4)
173 #define XVIDC_EDID_BDISP_VID_DIG_BPC_UNDEF              0x0
174 #define XVIDC_EDID_BDISP_VID_DIG_BPC_6                  0x1
175 #define XVIDC_EDID_BDISP_VID_DIG_BPC_8                  0x2
176 #define XVIDC_EDID_BDISP_VID_DIG_BPC_10                 0x3
177 #define XVIDC_EDID_BDISP_VID_DIG_BPC_12                 0x4
178 #define XVIDC_EDID_BDISP_VID_DIG_BPC_14                 0x5
179 #define XVIDC_EDID_BDISP_VID_DIG_BPC_16                 0x6
180 #define XVIDC_EDID_BDISP_VID_DIG_VIS_MASK               0xF
181 #define XVIDC_EDID_BDISP_VID_DIG_VIS_UNDEF              0x0
182 #define XVIDC_EDID_BDISP_VID_DIG_VIS_DVI                0x1
183 #define XVIDC_EDID_BDISP_VID_DIG_VIS_HDMIA              0x2
184 #define XVIDC_EDID_BDISP_VID_DIG_VIS_HDMIB              0x3
185 #define XVIDC_EDID_BDISP_VID_DIG_VIS_MDDI               0x4
186 #define XVIDC_EDID_BDISP_VID_DIG_VIS_DP                 0x5
187
188 /* Basic display parameters and features: Feature support. */
189 #define XVIDC_EDID_BDISP_FEATURE_PM_STANDBY_MASK        (0x1 << 7)
190 #define XVIDC_EDID_BDISP_FEATURE_PM_SUSPEND_MASK        (0x1 << 6)
191 #define XVIDC_EDID_BDISP_FEATURE_PM_OFF_VLP_MASK        (0x1 << 5)
192 #define XVIDC_EDID_BDISP_FEATURE_ANA_COLORTYPE_SHIFT    3
193 #define XVIDC_EDID_BDISP_FEATURE_ANA_COLORTYPE_MASK     (0x3 << 3)
194 #define XVIDC_EDID_BDISP_FEATURE_ANA_COLORTYPE_MCG      0x0
195 #define XVIDC_EDID_BDISP_FEATURE_ANA_COLORTYPE_RGB      0x1
196 #define XVIDC_EDID_BDISP_FEATURE_ANA_COLORTYPE_NRGB     0x2
197 #define XVIDC_EDID_BDISP_FEATURE_ANA_COLORTYPE_UNDEF    0x3
198 #define XVIDC_EDID_BDISP_FEATURE_DIG_COLORENC_YCRCB444_MASK     (0x1 << 3)
199 #define XVIDC_EDID_BDISP_FEATURE_DIG_COLORENC_YCRCB422_MASK     (0x1 << 4)
200 #define XVIDC_EDID_BDISP_FEATURE_SRGB_DEF_MASK          (0x1 << 2)
201 #define XVIDC_EDID_BDISP_FEATURE_PTM_INC_MASK           (0x1 << 1)
202 #define XVIDC_EDID_BDISP_FEATURE_CONTFREQ_MASK          (0x1)
203
204 /* Color characteristics (display x,y chromaticity coordinates). */
205 #define XVIDC_EDID_CC_HIGH_SHIFT                        2
206 #define XVIDC_EDID_CC_RBX_LOW_SHIFT                     6
207 #define XVIDC_EDID_CC_RBY_LOW_SHIFT                     4
208 #define XVIDC_EDID_CC_RBY_LOW_MASK                      (0x3 << 4)
209 #define XVIDC_EDID_CC_GWX_LOW_SHIFT                     2
210 #define XVIDC_EDID_CC_GWX_LOW_MASK                      (0x3 << 2)
211 #define XVIDC_EDID_CC_GWY_LOW_MASK                      (0x3)
212 #define XVIDC_EDID_CC_GREENY_HIGH                       0x1E
213 #define XVIDC_EDID_CC_BLUEX_HIGH                        0x1F
214 #define XVIDC_EDID_CC_BLUEY_HIGH                        0x20
215 #define XVIDC_EDID_CC_WHITEX_HIGH                       0x21
216 #define XVIDC_EDID_CC_WHITEY_HIGH                       0x22
217
218 /* Established timings. */
219 #define XVIDC_EDID_EST_TIMINGS_I_720x400_70_MASK        (0x1 << 7)
220 #define XVIDC_EDID_EST_TIMINGS_I_720x400_88_MASK        (0x1 << 6)
221 #define XVIDC_EDID_EST_TIMINGS_I_640x480_60_MASK        (0x1 << 5)
222 #define XVIDC_EDID_EST_TIMINGS_I_640x480_67_MASK        (0x1 << 4)
223 #define XVIDC_EDID_EST_TIMINGS_I_640x480_72_MASK        (0x1 << 3)
224 #define XVIDC_EDID_EST_TIMINGS_I_640x480_75_MASK        (0x1 << 2)
225 #define XVIDC_EDID_EST_TIMINGS_I_800x600_56_MASK        (0x1 << 1)
226 #define XVIDC_EDID_EST_TIMINGS_I_800x600_60_MASK        (0x1)
227 #define XVIDC_EDID_EST_TIMINGS_II_800x600_72_MASK       (0x1 << 7)
228 #define XVIDC_EDID_EST_TIMINGS_II_800x600_75_MASK       (0x1 << 6)
229 #define XVIDC_EDID_EST_TIMINGS_II_832x624_75_MASK       (0x1 << 5)
230 #define XVIDC_EDID_EST_TIMINGS_II_1024x768_87_MASK      (0x1 << 4)
231 #define XVIDC_EDID_EST_TIMINGS_II_1024x768_60_MASK      (0x1 << 3)
232 #define XVIDC_EDID_EST_TIMINGS_II_1024x768_70_MASK      (0x1 << 2)
233 #define XVIDC_EDID_EST_TIMINGS_II_1024x768_75_MASK      (0x1 << 1)
234 #define XVIDC_EDID_EST_TIMINGS_II_1280x1024_75_MASK     (0x1)
235 #define XVIDC_EDID_EST_TIMINGS_MAN_1152x870_75_MASK     (0x1 << 7)
236 #define XVIDC_EDID_EST_TIMINGS_MAN_MASK                 (0x7F)
237
238 /* Standard timings. */
239 #define XVIDC_EDID_STD_TIMINGS_AR_SHIFT                 6
240 #define XVIDC_EDID_STD_TIMINGS_AR_16_10                 0x0
241 #define XVIDC_EDID_STD_TIMINGS_AR_4_3                   0x1
242 #define XVIDC_EDID_STD_TIMINGS_AR_5_4                   0x2
243 #define XVIDC_EDID_STD_TIMINGS_AR_16_9                  0x3
244 #define XVIDC_EDID_STD_TIMINGS_FRR_MASK                 (0x3F)
245
246 /* Detailed timing descriptor (DTD) / Preferred timing mode (PTM). */
247 #define XVIDC_EDID_DTD_PTM_XRES_XBLANK_U4_XBLANK_MASK           0x0F
248 #define XVIDC_EDID_DTD_PTM_XRES_XBLANK_U4_XRES_MASK             0xF0
249 #define XVIDC_EDID_DTD_PTM_XRES_XBLANK_U4_XRES_SHIFT            4
250 #define XVIDC_EDID_DTD_PTM_VFPORCH_VSPW_L4_VSPW_MASK            0x0F
251 #define XVIDC_EDID_DTD_PTM_VFPORCH_VSPW_L4_VFPORCH_MASK         0xF0
252 #define XVIDC_EDID_DTD_PTM_VFPORCH_VSPW_L4_VFPORCH_SHIFT        4
253 #define XVIDC_EDID_DTD_PTM_XFPORCH_XSPW_U2_HFPORCH_MASK         0xC0
254 #define XVIDC_EDID_DTD_PTM_XFPORCH_XSPW_U2_HSPW_MASK            0x30
255 #define XVIDC_EDID_DTD_PTM_XFPORCH_XSPW_U2_VFPORCH_MASK         0x0C
256 #define XVIDC_EDID_DTD_PTM_XFPORCH_XSPW_U2_VSPW_MASK            0x03
257 #define XVIDC_EDID_DTD_PTM_XFPORCH_XSPW_U2_HFPORCH_SHIFT        6
258 #define XVIDC_EDID_DTD_PTM_XFPORCH_XSPW_U2_HSPW_SHIFT           4
259 #define XVIDC_EDID_DTD_PTM_XFPORCH_XSPW_U2_VFPORCH_SHIFT        2
260 #define XVIDC_EDID_DTD_PTM_XIMGSIZE_MM_U4_VIMGSIZE_MM_MASK      0x0F
261 #define XVIDC_EDID_DTD_PTM_XIMGSIZE_MM_U4_HIMGSIZE_MM_MASK      0xF0
262 #define XVIDC_EDID_DTD_PTM_XIMGSIZE_MM_U4_HIMGSIZE_MM_SHIFT     4
263 #define XVIDC_EDID_DTD_PTM_SIGNAL_INTERLACED_MASK               0x80
264 #define XVIDC_EDID_DTD_PTM_SIGNAL_INTERLACED_SHIFT              7
265 #define XVIDC_EDID_DTD_PTM_SIGNAL_HPOLARITY_MASK                0x02
266 #define XVIDC_EDID_DTD_PTM_SIGNAL_VPOLARITY_MASK                0x04
267 #define XVIDC_EDID_DTD_PTM_SIGNAL_HPOLARITY_SHIFT               1
268 #define XVIDC_EDID_DTD_PTM_SIGNAL_VPOLARITY_SHIFT               2
269 /* @} */
270
271 /******************* Macros (Inline Functions) Definitions ********************/
272
273 #define XVidC_EdidIsHeaderValid(E) \
274         !memcmp(E, "\x00\xFF\xFF\xFF\xFF\xFF\xFF\x00", 8)
275
276 /* Vendor and product identification: ID manufacturer name. */
277 /* void XVidC_EdidGetManName(const u8 *EdidRaw, char ManName[4]); */
278
279 /* Vendor and product identification: ID product code. */
280 #define XVidC_EdidGetIdProdCode(E) \
281         ((u16)((E[XVIDC_EDID_VPI_ID_PROD_CODE_MSB] << 8) | \
282         E[XVIDC_EDID_VPI_ID_PROD_CODE_LSB]))
283
284 /* Vendor and product identification: ID serial number. */
285 #define XVidC_EdidGetIdSn(E) \
286         ((u32)((E[XVIDC_EDID_VPI_ID_SN3] << 24) | \
287         (E[XVIDC_EDID_VPI_ID_SN2] << 16) | (E[XVIDC_EDID_VPI_ID_SN1] << 8) | \
288         E[XVIDC_EDID_VPI_ID_SN0]))
289
290 /* Vendor and product identification: Week and year of manufacture or model
291  * year. */
292 #define XVidC_EdidGetManWeek(E)         (E[XVIDC_EDID_VPI_WEEK_MAN])
293 #define XVidC_EdidGetModManYear(E)      (E[XVIDC_EDID_VPI_YEAR] + 1990)
294 #define XVidC_EdidIsYearModel(E)        (XVidC_EdidGetManWeek(E) == 0xFF)
295 #define XVidC_EdidIsYearMan(E)          (XVidC_EdidGetManWeek(E) != 0xFF)
296
297 /* EDID structure version and revision. */
298 #define XVidC_EdidGetStructVer(E)       (E[XVIDC_EDID_STRUCT_VER])
299 #define XVidC_EdidGetStructRev(E)       (E[XVIDC_EDID_STRUCT_REV])
300
301 /* Basic display parameters and features: Video input definition. */
302 #define XVidC_EdidIsDigitalSig(E) \
303         ((E[XVIDC_EDID_BDISP_VID] & XVIDC_EDID_BDISP_VID_VSI_MASK) != 0)
304 #define XVidC_EdidIsAnalogSig(E) \
305         ((E[XVIDC_EDID_BDISP_VID] & XVIDC_EDID_BDISP_VID_VSI_MASK) == 0)
306 #define XVidC_EdidGetAnalogSigLvlStd(E) \
307         ((E[XVIDC_EDID_BDISP_VID] & XVIDC_EDID_BDISP_VID_ANA_SLS_MASK) >> \
308         XVIDC_EDID_BDISP_VID_ANA_SLS_SHIFT)
309 #define XVidC_EdidGetAnalogSigVidSetup(E) \
310         ((E[XVIDC_EDID_BDISP_VID] & \
311         XVIDC_EDID_BDISP_VID_ANA_VID_SETUP_MASK) != 0)
312 #define XVidC_EdidSuppAnalogSigSepSyncHv(E) \
313         ((E[XVIDC_EDID_BDISP_VID] & \
314         XVIDC_EDID_BDISP_VID_ANA_SEP_SYNC_HV_MASK) != 0)
315 #define XVidC_EdidSuppAnalogSigCompSyncH(E) \
316         ((E[XVIDC_EDID_BDISP_VID] & \
317         XVIDC_EDID_BDISP_VID_ANA_COMP_SYNC_H_MASK) != 0)
318 #define XVidC_EdidSuppAnalogSigCompSyncG(E) \
319         ((E[XVIDC_EDID_BDISP_VID] & \
320         XVIDC_EDID_BDISP_VID_ANA_COMP_SYNC_G_MASK) != 0)
321 #define XVidC_EdidSuppAnalogSigSerrVsync(E) \
322         ((E[XVIDC_EDID_BDISP_VID] & \
323         XVIDC_EDID_BDISP_VID_ANA_SERR_V_SYNC_MASK) != 0)
324 /* XVidC_ColorDepth XVidC_EdidGetColorDepth(const u8 *EdidRaw); */
325 #define XVidC_EdidGetDigitalSigIfaceStd(E) \
326         (E[XVIDC_EDID_BDISP_VID] & XVIDC_EDID_BDISP_VID_DIG_VIS_MASK)
327
328 /* Basic display parameters and features: Horizontal and vertical screen size or
329  * aspect ratio. */
330 #define XVidC_EdidIsSsArDefined(E) \
331         ((E[XVIDC_EDID_BDISP_H_SSAR] | E[XVIDC_EDID_BDISP_V_SSAR]) != 0)
332 #define XVidC_EdidGetSsArH(E)   E[XVIDC_EDID_BDISP_H_SSAR]
333 #define XVidC_EdidGetSsArV(E)   E[XVIDC_EDID_BDISP_V_SSAR]
334 #define XVidC_EdidIsSsArSs(E) \
335         ((XVidC_EdidGetSsArH(E) != 0) && (XVidC_EdidGetSsArV(E) != 0))
336 #define XVidC_EdidIsSsArArL(E) \
337         ((XVidC_EdidGetSsArH(E) != 0) && (XVidC_EdidGetSsArV(E) == 0))
338 #define XVidC_EdidIsSsArArP(E) \
339         ((XVidC_EdidGetSsArH(E) == 0) && (XVidC_EdidGetSsArV(E) != 0))
340 #define XVidC_EdidGetSsArArL(E) \
341         ((float)((XVidC_EdidGetSsArH(E) + 99.0) / 100.0))
342 #define XVidC_EdidGetSsArArP(E) \
343         ((float)(100.0 / (XVidC_EdidGetSsArV(E) + 99.0)))
344
345 /* Basic display parameters and features: Gamma. */
346 #define XVidC_EdidIsGammaInExt(E)       (E[XVIDC_EDID_BDISP_GAMMA] == 0xFF)
347 #define XVidC_EdidGetGamma(E) \
348         ((float)((E[XVIDC_EDID_BDISP_GAMMA] + 100.0) / 100.0))
349
350 /* Basic display parameters and features: Feature support. */
351 #define XVidC_EdidSuppFeaturePmStandby(E) \
352         ((E[XVIDC_EDID_BDISP_FEATURE] & \
353         XVIDC_EDID_BDISP_FEATURE_PM_STANDBY_MASK) != 0)
354 #define XVidC_EdidSuppFeaturePmSuspend(E) \
355         ((E[XVIDC_EDID_BDISP_FEATURE] & \
356         XVIDC_EDID_BDISP_FEATURE_PM_SUSPEND_MASK) != 0)
357 #define XVidC_EdidSuppFeaturePmOffVlp(E) \
358         ((E[XVIDC_EDID_BDISP_FEATURE] & \
359         XVIDC_EDID_BDISP_FEATURE_PM_OFF_VLP_MASK) != 0)
360 #define XVidC_EdidGetFeatureAnaColorType(E) \
361         ((E[XVIDC_EDID_BDISP_FEATURE] & \
362         XVIDC_EDID_BDISP_FEATURE_ANA_COLORTYPE_MASK) >> \
363         XVIDC_EDID_BDISP_FEATURE_ANA_COLORTYPE_SHIFT)
364 #define XVidC_EdidSuppFeatureDigColorEncYCrCb444(E) \
365         ((E[XVIDC_EDID_BDISP_FEATURE] & \
366         XVIDC_EDID_BDISP_FEATURE_DIG_COLORENC_YCRCB444_MASK) != 0)
367 #define XVidC_EdidSuppFeatureDigColorEncYCrCb422(E) \
368         ((E[XVIDC_EDID_BDISP_FEATURE] & \
369         XVIDC_EDID_BDISP_FEATURE_DIG_COLORENC_YCRCB422_MASK) != 0)
370 #define XVidC_EdidIsFeatureSrgbDef(E) \
371         ((E[XVIDC_EDID_BDISP_FEATURE] & \
372         XVIDC_EDID_BDISP_FEATURE_SRGB_DEF_MASK) != 0)
373 #define XVidC_EdidIsFeaturePtmInc(E) \
374         ((E[XVIDC_EDID_BDISP_FEATURE] & \
375         XVIDC_EDID_BDISP_FEATURE_PTM_INC_MASK) != 0)
376 #define XVidC_EdidIsFeatureContFreq(E) \
377         ((E[XVIDC_EDID_BDISP_FEATURE] & \
378         XVIDC_EDID_BDISP_FEATURE_CONTFREQ_MASK) != 0)
379
380 /* Established timings. */
381 #define XVidC_EdidSuppEstTimings720x400_70(E) \
382         ((E[XVIDC_EDID_EST_TIMINGS_I] & \
383         XVIDC_EDID_EST_TIMINGS_I_720x400_70_MASK) != 0)
384 #define XVidC_EdidSuppEstTimings720x400_88(E) \
385         ((E[XVIDC_EDID_EST_TIMINGS_I] & \
386         XVIDC_EDID_EST_TIMINGS_I_720x400_88_MASK) != 0)
387 #define XVidC_EdidSuppEstTimings640x480_60(E) \
388         ((E[XVIDC_EDID_EST_TIMINGS_I] & \
389         XVIDC_EDID_EST_TIMINGS_I_640x480_60_MASK) != 0)
390 #define XVidC_EdidSuppEstTimings640x480_67(E) \
391         ((E[XVIDC_EDID_EST_TIMINGS_I] & \
392         XVIDC_EDID_EST_TIMINGS_I_640x480_67_MASK) != 0)
393 #define XVidC_EdidSuppEstTimings640x480_72(E) \
394         ((E[XVIDC_EDID_EST_TIMINGS_I] & \
395         XVIDC_EDID_EST_TIMINGS_I_640x480_72_MASK) != 0)
396 #define XVidC_EdidSuppEstTimings640x480_75(E) \
397         ((E[XVIDC_EDID_EST_TIMINGS_I] & \
398         XVIDC_EDID_EST_TIMINGS_I_640x480_75_MASK) != 0)
399 #define XVidC_EdidSuppEstTimings800x600_56(E) \
400         ((E[XVIDC_EDID_EST_TIMINGS_I] & \
401         XVIDC_EDID_EST_TIMINGS_I_800x600_56_MASK) != 0)
402 #define XVidC_EdidSuppEstTimings800x600_60(E) \
403         ((E[XVIDC_EDID_EST_TIMINGS_I] & \
404         XVIDC_EDID_EST_TIMINGS_I_800x600_60_MASK) != 0)
405 #define XVidC_EdidSuppEstTimings800x600_72(E) \
406         ((E[XVIDC_EDID_EST_TIMINGS_II] & \
407         XVIDC_EDID_EST_TIMINGS_II_800x600_72_MASK) != 0)
408 #define XVidC_EdidSuppEstTimings800x600_75(E) \
409         ((E[XVIDC_EDID_EST_TIMINGS_II] & \
410         XVIDC_EDID_EST_TIMINGS_II_800x600_75_MASK) != 0)
411 #define XVidC_EdidSuppEstTimings832x624_75(E) \
412         ((E[XVIDC_EDID_EST_TIMINGS_II] & \
413         XVIDC_EDID_EST_TIMINGS_II_832x624_75_MASK) != 0)
414 #define XVidC_EdidSuppEstTimings1024x768_87(E) \
415         ((E[XVIDC_EDID_EST_TIMINGS_II] & \
416         XVIDC_EDID_EST_TIMINGS_II_1024x768_87_MASK) != 0)
417 #define XVidC_EdidSuppEstTimings1024x768_60(E) \
418         ((E[XVIDC_EDID_EST_TIMINGS_II] & \
419         XVIDC_EDID_EST_TIMINGS_II_1024x768_60_MASK) != 0)
420 #define XVidC_EdidSuppEstTimings1024x768_70(E) \
421         ((E[XVIDC_EDID_EST_TIMINGS_II] & \
422         XVIDC_EDID_EST_TIMINGS_II_1024x768_70_MASK) != 0)
423 #define XVidC_EdidSuppEstTimings1024x768_75(E) \
424         ((E[XVIDC_EDID_EST_TIMINGS_II] & \
425         XVIDC_EDID_EST_TIMINGS_II_1024x768_75_MASK) != 0)
426 #define XVidC_EdidSuppEstTimings1280x1024_75(E) \
427         ((E[XVIDC_EDID_EST_TIMINGS_II] & \
428         XVIDC_EDID_EST_TIMINGS_II_1280x1024_75_MASK) != 0)
429 #define XVidC_EdidSuppEstTimings1152x870_75(E) \
430         ((E[XVIDC_EDID_EST_TIMINGS_MAN] & \
431         XVIDC_EDID_EST_TIMINGS_MAN_1152x870_75_MASK) != 0)
432 #define XVidC_EdidGetTimingsMan(E) \
433         (E[XVIDC_EDID_EST_TIMINGS_MAN] & XVIDC_EDID_EST_TIMINGS_MAN_MASK)
434
435 /* Standard timings. */
436 #define XVidC_EdidGetStdTimingsH(E, N) \
437         ((E[XVIDC_EDID_STD_TIMINGS_H(N)] + 31) * 8)
438 #define XVidC_EdidGetStdTimingsAr(E, N) \
439         (E[XVIDC_EDID_STD_TIMINGS_AR_FRR(N)] >> XVIDC_EDID_STD_TIMINGS_AR_SHIFT)
440 #define XVidC_EdidGetStdTimingsFrr(E, N) \
441         ((E[XVIDC_EDID_STD_TIMINGS_AR_FRR(N)] & \
442         XVIDC_EDID_STD_TIMINGS_FRR_MASK) + 60)
443 /* u16 XVidC_EdidGetStdTimingsV(const u8 *EdidRaw, u8 StdTimingsNum); */
444 #define XVidC_EdidIsDtdPtmInterlaced(E) \
445         ((E[XVIDC_EDID_PTM + XVIDC_EDID_DTD_PTM_SIGNAL] & \
446         XVIDC_EDID_DTD_PTM_SIGNAL_INTERLACED_MASK) >> \
447         XVIDC_EDID_DTD_PTM_SIGNAL_INTERLACED_SHIFT)
448
449 /* Extension block count. */
450 #define XVidC_EdidGetExtBlkCount(E)     (E[XVIDC_EDID_EXT_BLK_COUNT])
451
452 /* Checksum. */
453 #define XVidC_EdidGetChecksum(E)        (E[XVIDC_EDID_CHECKSUM])
454
455 /**************************** Function Prototypes *****************************/
456
457 /* Vendor and product identification: ID manufacturer name. */
458 void XVidC_EdidGetManName(const u8 *EdidRaw, char ManName[4]);
459
460 /* Basic display parameters and features: Video input definition. */
461 XVidC_ColorDepth XVidC_EdidGetColorDepth(const u8 *EdidRaw);
462
463 /* Color characteristics (display x,y chromaticity coordinates). */
464 int XVidC_EdidGetCcRedX(const u8 *EdidRaw);
465 int XVidC_EdidGetCcRedY(const u8 *EdidRaw);
466 int XVidC_EdidGetCcGreenX(const u8 *EdidRaw);
467 int XVidC_EdidGetCcGreenY(const u8 *EdidRaw);
468 int XVidC_EdidGetCcBlueX(const u8 *EdidRaw);
469 int XVidC_EdidGetCcBlueY(const u8 *EdidRaw);
470 int XVidC_EdidGetCcWhiteX(const u8 *EdidRaw);
471 int XVidC_EdidGetCcWhiteY(const u8 *EdidRaw);
472
473 /* Standard timings. */
474 u16 XVidC_EdidGetStdTimingsV(const u8 *EdidRaw, u8 StdTimingsNum);
475
476 /* Utility functions. */
477 u32 XVidC_EdidIsVideoTimingSupported(const u8 *EdidRaw,
478                 const XVidC_VideoTimingMode *VtMode);
479
480 #ifdef __cplusplus
481 }
482 #endif
483 #endif /* XVIDC_EDID_H_ */
484 /** @} */