• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  *
4  * HDF is dual licensed: you can use it either under the terms of
5  * the GPL, or the BSD license, at your option.
6  * See the LICENSE file in the root of this repository for complete details.
7  */
8 
9 #ifndef HDMI_DDC_H
10 #define HDMI_DDC_H
11 
12 #include "hdf_base.h"
13 #include "osal_mutex.h"
14 
15 #ifdef __cplusplus
16 #if __cplusplus
17 extern "C" {
18 #endif
19 #endif /* __cplusplus */
20 
21 /*
22  * DDC(Display Data Channel)
23  * The DDC channel is used by an HDMI Source to determine the capabilities and characteristics of
24  * the Sink by reading the E-EDID data structure.
25  * The DDC is also used to exchange point-to-point dynamic data between the Source and the Sink
26  * using a new DDC address for the HDMI Status and Control Data Channel(SCDC).
27  * In addition, The DDC is also used for HDCP to exchange key selection vector and other information.
28  */
29 #define HDMI_DDC_EDID_DEV_ADDRESS 0xA0
30 #define HDMI_DDC_SCDC_DEV_ADDRESS 0xA8
31 #define HDMI_DDC_HDCP_DEV_ADDRESS 0x74
32 
33 enum HdmiDdcDeviceType {
34     HDMI_DDC_DEV_EDID = 0,
35     HDMI_DDC_DEV_SCDC = 1,
36     HDMI_DDC_DEV_HDCP = 2,
37     HDMI_DDC_DEV_BUTT,
38 };
39 
40 enum HdmiDdcMode {
41     HDMI_DDC_MODE_READ_SINGLE_NO_ACK = 0,
42     HDMI_DDC_MODE_READ_SINGLE_ACK = 1,
43     HDMI_DDC_MODE_READ_MUTIL_NO_ACK = 2,
44     HDMI_DDC_MODE_READ_MUTIL_ACK = 3,
45     HDMI_DDC_MODE_READ_SEGMENT_NO_ACK = 4,
46     HDMI_DDC_MODE_READ_SEGMENT_ACK = 5,
47     HDMI_DDC_MODE_WRITE_MUTIL_NO_ACK = 6,
48     HDMI_DDC_MODE_WRITE_MUTIL_ACK = 7,
49     HDMI_DDC_MODE_BUTT,
50 };
51 
52 struct HdmiDdcCfg {
53     enum HdmiDdcDeviceType type;
54     enum HdmiDdcMode mode;
55     bool readFlag;
56     uint32_t devAddr;
57     uint8_t offset;
58     uint8_t segment;  /* see VESA spec. 1 segment is 256 bytes. */
59     uint32_t dataLen;
60     uint8_t *data;
61 };
62 
63 struct HdmiDdc {
64     struct OsalMutex ddcMutex;
65     bool init;
66     void *priv;
67 };
68 
69 int32_t HdmiDdcTransfer(struct HdmiDdc *ddc, struct HdmiDdcCfg *cfg);
70 
71 #ifdef __cplusplus
72 #if __cplusplus
73 }
74 #endif
75 #endif /* __cplusplus */
76 
77 #endif /* HDMI_DDC_H */
78