blob: 3e4bfa4ebe74ad9faaa634fbe381d5f96e593b89
1 | #ifndef __TV_KEY_DATA_H__ |
2 | #define __TV_KEY_DATA_H__ |
3 | |
4 | #include <pthread.h> |
5 | #include <stdint.h> |
6 | |
7 | #include "../tv/CTvLog.h" |
8 | #define LOG_TAG "TvKeyData" |
9 | |
10 | #define SSM_CR_RGBOGO_LEN (256) |
11 | #define SSM_CR_RGBOGO_CHKSUM_LEN (2) |
12 | #define SSM_HDMI_PORT_MAX (3) |
13 | #define SSM_HDMI_EDID_SIZE (256) |
14 | |
15 | #if ANDROID_PLATFORM_SDK_VERSION == 19 |
16 | #define CS_KEY_DATA_NAME_DEV_PATH "/sys/class/aml_keys/aml_keys/key_name" |
17 | #define CS_KEY_DATA_READ_DEV_PATH "/sys/class/aml_keys/aml_keys/key_read" |
18 | #define CS_KEY_DATA_WRITE_DEV_PATH "/sys/class/aml_keys/aml_keys/key_write" |
19 | |
20 | #define CS_MAC_KEY_NAME "mac" |
21 | #define CS_BARCODE_KEY_NAME "usid" |
22 | #define CS_RX_HDCP_KEY_NAME "rxhdcp20" |
23 | #define CS_PROJECT_ID_KEY_NAME "projid" |
24 | #endif |
25 | |
26 | #if ANDROID_PLATFORM_SDK_VERSION >= 21 |
27 | #define CS_KEY_DATA_NAME_DEV_PATH "/sys/class/unifykeys/name" |
28 | #define CS_KEY_DATA_READ_DEV_PATH "/sys/class/unifykeys/read" |
29 | #define CS_KEY_DATA_WRITE_DEV_PATH "/sys/class/unifykeys/write" |
30 | |
31 | #define CS_MAC_KEY_NAME "mac" |
32 | #define CS_BARCODE_KEY_NAME "usid" |
33 | #define CS_RX_HDCP_KEY_NAME "hdcp2_rx" |
34 | #define CS_PROJECT_ID_KEY_NAME "projid" |
35 | #endif |
36 | |
37 | #define CC_MAX_KEY_DATA_SIZE (2048) |
38 | #define CC_MAX_FILE_PATH (256) |
39 | |
40 | #define CC_MAC_LEN (6) |
41 | #define CC_HDCP_KEY_TOTAL_SIZE (368) |
42 | #define CC_HDCP_KEY_HEAD_SIZE (40) |
43 | #define CC_HDCP_KEY_CONTENT_SIZE (CC_HDCP_KEY_TOTAL_SIZE - CC_HDCP_KEY_HEAD_SIZE) |
44 | |
45 | #define CC_CUSTOMER_HDMI_EDID_TOTAL_SIZE (SSM_HDMI_EDID_SIZE + 4) |
46 | |
47 | #define CS_MAC_ADDRESS_STARTWRK_EN_CFG "ssm.macaddr.startwork.en" |
48 | #define CS_BARCODE_LEN_CFG "ssm.barcode.len" |
49 | |
50 | #define CS_HDCP_KEY_EN_CFG "ssm.handle.hdcpkey.en" |
51 | #define CS_HDCP_KEY_DEMO_EN_CFG "ssm.handle.hdcpkey.demo.en" |
52 | #define CS_HDCP_KEY_FILE_PATH_CFG "ssm.handle.hdcpkey.file.path" |
53 | #define CS_HDCP_KEY_FILE_OFFSET_CFG "ssm.handle.hdcpkey.file.offset" |
54 | |
55 | |
56 | #define CS_HDMI_EDID_EN_CFG "ssm.handle.hdmi.edid.en" |
57 | #define CS_HDMI_EDID_USE_CFG "ssm.handle.hdmi.edid.use" |
58 | #define CS_HDMI_EDID_FILE_PATH_CFG "ssm.handle.hdmi.edid.file.path" |
59 | #define CS_HDMI_PORT1_EDID_FILE_PATH_CFG "ssm.handle.hdmi.port1.edid.file.path" |
60 | #define CS_HDMI_PORT2_EDID_FILE_PATH_CFG "ssm.handle.hdmi.port2.edid.file.path" |
61 | #define CS_HDMI_PORT3_EDID_FILE_PATH_CFG "ssm.handle.hdmi.port3.edid.file.path" |
62 | #define CS_HDMI_EDID_FILE_OFFSET_CFG "ssm.handle.hdmi.edid.file.offset" |
63 | |
64 | #define CS_RGBOGO_FILE_PATH_CFG "ssm.rgbogo.file.path" |
65 | #define CS_RGBOGO_FILE_OFFSET_CFG "ssm.rgbogo.file.offset" |
66 | |
67 | #define CS_AUDIO_NOLINEPOINTS_FILE_PATH_CFG "ssm.audio.nolinepoints.file.path" |
68 | #define CS_AUDIO_NOLINEPOINTS_FILE_OFFSET_CFG "ssm.audio.nolinepoints.file.offset" |
69 | int ReadKeyData(const char *key_name, unsigned char data_buf[]); |
70 | int WriteKeyData(const char *key_name, int wr_size, char data_buf[]); |
71 | |
72 | int KeyData_SaveProjectID(int rw_val); |
73 | int KeyData_ReadProjectID(); |
74 | |
75 | int KeyData_GetMacAddressDataLen(); |
76 | int KeyData_ReadMacAddress(unsigned char data_buf[]); |
77 | int KeyData_SaveMacAddress(unsigned char data_buf[]); |
78 | |
79 | int KeyData_GetBarCodeDataLen(); |
80 | int KeyData_ReadBarCode(unsigned char data_buf[]); |
81 | int KeyData_SaveBarCode(unsigned char data_buf[]); |
82 | |
83 | int SSMReadHDCPKey(unsigned char hdcp_key_buf[]); |
84 | int SSMSaveHDCPKey(unsigned char hdcp_key_buf[]); |
85 | int SSMSetHDCPKey(); |
86 | int SSMGetHDCPKeyDataLen(); |
87 | int SSMRefreshHDCPKey(); |
88 | |
89 | |
90 | int SSMReadHDMIEdid(int port, unsigned char hdmi_edid_buf[]); |
91 | int SSMSetHDMIEdid(int port); |
92 | |
93 | int SSMSaveRGBOGOValue(int offset, int size, unsigned char data_buf[]); |
94 | int SSMReadRGBOGOValue(int offset, int size, unsigned char data_buf[]); |
95 | |
96 | int SSMReadAudioNoLinePoints(int offset, int size, unsigned char tmp_buf[]); |
97 | int SSMSaveAudioNoLinePoints(int offset, int size, unsigned char tmp_buf[]); |
98 | int CreateMacAddressStartWorkThread(); |
99 | |
100 | int GetSSMHandleHDCPKeyEnableCFG(); |
101 | int GetSSMHandleHDCPKeyDemoEnableCFG(); |
102 | int SSMSetDefaultHDCPKey(unsigned char hdcp_key_buf[]); |
103 | int RealHandleHDCPKey(unsigned char hdcp_key_buf[]); |
104 | int GetHDCPKeyFromFile(int rd_off, int rd_size, unsigned char data_buf[]); |
105 | int SaveHDCPKeyToFile(int wr_off, int wr_size, unsigned char data_buf[]); |
106 | |
107 | int GetHDMIEdidFromFile(int rd_off, int rd_size, int port, unsigned char data_buf[]); |
108 | int RealHandleHDMIEdid(unsigned char hdmi_edid_buf[]); |
109 | int GetSSMHandleHDMIEdidByCustomerEnableCFG(); |
110 | int AppendEdidPrefixCode(unsigned char customer_hdmi_edid_buf[], unsigned char hdmi_edid_buf[]); |
111 | |
112 | int GetRGBOGOFromFile(int rd_off, int rd_size, unsigned char data_buf[]); |
113 | int SaveRGBOGOToFile(int wr_off, int wr_size, unsigned char data_buf[]); |
114 | |
115 | int GetAudioNoLinePointsDataFromFile(int offset, int size, unsigned char data_buf[]); |
116 | int SaveAudioNoLinePointsDataToFile(int offset, int size, unsigned char data_buf[]); |
117 | |
118 | #ifdef __cplusplus |
119 | extern "C" { |
120 | #endif |
121 | |
122 | #ifdef __cplusplus |
123 | } |
124 | #endif |
125 | |
126 | #endif //__TV_KEY_DATA_H__ |
127 |