RDK Documentation (Open Sourced RDK Components)
edid-parser.hpp
1 /*
2  * If not stated otherwise in this file or this component's Licenses.txt file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2019 RDK Management
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18 */
19 
20 #if !defined(__EDID_PARSER_H__)
21 #define __EDID_PARSER_H__
22 
23 #include <stddef.h>
24 #include <stdint.h>
25 
26 namespace edid_parser {
27 
28 enum edid_status_e {
29  EDID_STATUS_OK,
30  EDID_STATUS_INVALID_PARAMETER,
31  EDID_STATUS_NOT_SUPPORTED,
32  EDID_STATUS_INVALID_HEADER,
33  EDID_STATUS_INVALID_CHECKSUM
34 };
35 
36 enum edid_native_e {
37  EDID_NATIVE,
38  EDID_NOT_NATIVE
39 };
40 
41 enum edid_progressive_e {
42  EDID_PROGRESSIVE,
43  EDID_INTERLACED
44 };
45 
46 enum HDR_standard_t {
47  HDR_standard_NONE = 0x0,
48  HDR_standard_HDR10 = 0x01, // SMPTE ST 2084
49  HDR_standard_HLG = 0x02, // Hybrid Log-Gamma
50  HDR_standard_DolbyVersion = 0x04, // ?
51  HDR_standard_SDR = 0x08, // Traditional gamma - SDR Luminance Range
52  HDR_standard_Traditional_HDR = 0x10 // Traditional gamma - HDR Luminance Range
53 };
54 
55 struct edid_res_t {
56  int width;
57  int height;
58  int refresh;
59  edid_progressive_e progressive;
60  edid_native_e native;
61 };
62 
63 enum colorimetry_info_t {
64  COLORIMETRY_INFO_NONE = 0x0,
65  COLORIMETRY_INFO_XVYCC601 = 0x01,
66  COLORIMETRY_INFO_XVYCC709 = 0x02,
67  COLORIMETRY_INFO_SYCC601 = 0x04,
68  COLORIMETRY_INFO_ADOBEYCC601 = 0x08,
69  COLORIMETRY_INFO_ADOBERGB = 0x10,
70  COLORIMETRY_INFO_BT2020CL = 0x20,
71  COLORIMETRY_INFO_BT2020NCL = 0x40,
72  COLORIMETRY_INFO_BT2020RGB = 0x80,
73  COLORIMETRY_INFO_DCI_P3 = 0x100
74 };
75 
76 struct edid_data_t {
77  edid_res_t res;
78  // bitmask of HDR_standard_t values
79  uint8_t hdr_capabilities;
80  char manufacturer_name[4]; /* Manufacturer name of the display device.*/
81  int32_t product_code; /* Product code of the display device. */
82  int32_t serial_number; /* Serial number of the display device. */
83  int32_t manufacture_week; /* Manufacturing week of the display device. */
84  int32_t manufacture_year; /* Manufacturing year of the display device. */
85  uint8_t edid_version[2]; /* EDID version. */
86  uint8_t physical_address_a; /* Physical Address for HDMI node A */
87  uint8_t physical_address_b; /* Physical Address for HDMI node B */
88  uint8_t physical_address_c; /* Physical Address for HDMI node C */
89  uint8_t physical_address_d; /* Physical Address for HDMI node D */
90  char monitor_name[14]; /* Connected display monitor name. */
91  uint32_t colorimetry_info; /* bitmask of enum colorimetry_info_t */
92 };
93 
94 edid_status_e EDID_Parse(unsigned char* bytes, size_t count, edid_data_t* data_ptr);
95 edid_status_e EDID_Verify(unsigned char* bytes, size_t count);
96 }
97 #endif /* __EDID_PARSER_H__ */
edid_parser::edid_res_t
Definition: edid-parser.hpp:55
edid_parser::edid_data_t
Definition: edid-parser.hpp:76