summaryrefslogtreecommitdiff
path: root/tvapi/libtv/tvsetting/TvKeyData.h (plain)
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"
69int ReadKeyData(const char *key_name, unsigned char data_buf[]);
70int WriteKeyData(const char *key_name, int wr_size, char data_buf[]);
71
72int KeyData_SaveProjectID(int rw_val);
73int KeyData_ReadProjectID();
74
75int KeyData_GetMacAddressDataLen();
76int KeyData_ReadMacAddress(unsigned char data_buf[]);
77int KeyData_SaveMacAddress(unsigned char data_buf[]);
78
79int KeyData_GetBarCodeDataLen();
80int KeyData_ReadBarCode(unsigned char data_buf[]);
81int KeyData_SaveBarCode(unsigned char data_buf[]);
82
83int SSMReadHDCPKey(unsigned char hdcp_key_buf[]);
84int SSMSaveHDCPKey(unsigned char hdcp_key_buf[]);
85int SSMSetHDCPKey();
86int SSMGetHDCPKeyDataLen();
87int SSMRefreshHDCPKey();
88
89
90int SSMReadHDMIEdid(int port, unsigned char hdmi_edid_buf[]);
91int SSMSetHDMIEdid(int port);
92
93int SSMSaveRGBOGOValue(int offset, int size, unsigned char data_buf[]);
94int SSMReadRGBOGOValue(int offset, int size, unsigned char data_buf[]);
95
96int SSMReadAudioNoLinePoints(int offset, int size, unsigned char tmp_buf[]);
97int SSMSaveAudioNoLinePoints(int offset, int size, unsigned char tmp_buf[]);
98int CreateMacAddressStartWorkThread();
99
100int GetSSMHandleHDCPKeyEnableCFG();
101int GetSSMHandleHDCPKeyDemoEnableCFG();
102int SSMSetDefaultHDCPKey(unsigned char hdcp_key_buf[]);
103int RealHandleHDCPKey(unsigned char hdcp_key_buf[]);
104int GetHDCPKeyFromFile(int rd_off, int rd_size, unsigned char data_buf[]);
105int SaveHDCPKeyToFile(int wr_off, int wr_size, unsigned char data_buf[]);
106
107int GetHDMIEdidFromFile(int rd_off, int rd_size, int port, unsigned char data_buf[]);
108int RealHandleHDMIEdid(unsigned char hdmi_edid_buf[]);
109int GetSSMHandleHDMIEdidByCustomerEnableCFG();
110int AppendEdidPrefixCode(unsigned char customer_hdmi_edid_buf[], unsigned char hdmi_edid_buf[]);
111
112int GetRGBOGOFromFile(int rd_off, int rd_size, unsigned char data_buf[]);
113int SaveRGBOGOToFile(int wr_off, int wr_size, unsigned char data_buf[]);
114
115int GetAudioNoLinePointsDataFromFile(int offset, int size, unsigned char data_buf[]);
116int SaveAudioNoLinePointsDataToFile(int offset, int size, unsigned char data_buf[]);
117
118#ifdef __cplusplus
119extern "C" {
120#endif
121
122#ifdef __cplusplus
123}
124#endif
125
126#endif //__TV_KEY_DATA_H__
127