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