mt8193hdcp.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. #ifndef __mt8193hdcp_h__
  2. #define __mt8193hdcp_h__
  3. #ifdef HDMI_MT8193_SUPPORT
  4. enum {
  5. HDMI_PLUG_OUT = 0,
  6. HDMI_PLUG_IN_AND_SINK_POWER_ON,
  7. HDMI_PLUG_IN_ONLY,
  8. HDMI_PLUG_IN_EDID,
  9. HDMI_PLUG_IN_CEC,
  10. HDMI_PLUG_IN_POWER_EDID
  11. };
  12. #define HDMI_NFY_PLUG_STATE_T enum _HDMI_NFY_PLUG_STATE_T
  13. enum _HDMI_NFY_EDID_STATE_T {
  14. HDMI_EDID_NOT_READY = 0,
  15. HDMI_EDID_IS_READY,
  16. HDMI_EDID_IS_ERROR
  17. };
  18. #define HDMI_NFY_EDID_STATE_T enum _HDMI_NFY_EDID_STATE_T
  19. enum _HDCP_CTRL_STATE_T {
  20. HDCP_RECEIVER_NOT_READY = 0x00,
  21. HDCP_READ_EDID,
  22. HDCP_INIT_AUTHENTICATION,
  23. HDCP_WAIT_R0,
  24. HDCP_COMPARE_R0,
  25. HDCP_WAIT_RI,
  26. HDCP_CHECK_LINK_INTEGRITY,
  27. HDCP_RE_DO_AUTHENTICATION,
  28. HDCP_RE_COMPARE_RI,
  29. HDCP_RE_COMPARE_R0,
  30. HDCP_CHECK_REPEATER,
  31. HDCP_WAIT_KSV_LIST,
  32. HDCP_READ_KSV_LIST,
  33. HDCP_COMPARE_V,
  34. HDCP_RETRY_FAIL,
  35. HDCP_WAIT_RESET_OK,
  36. HDCP_WAIT_RES_CHG_OK,
  37. HDCP_WAIT_SINK_UPDATE_RI_DDC_PORT
  38. };
  39. #define HDCP_CTRL_STATE_T enum _HDCP_CTRL_STATE_T
  40. enum _HDMI_CTRL_STATE_T {
  41. HDMI_STATE_IDLE = 0,
  42. HDMI_STATE_HOT_PLUG_OUT,
  43. HDMI_STATE_HOT_PLUGIN_AND_POWER_ON,
  44. HDMI_STATE_HOT_PLUG_IN_ONLY,
  45. HDMI_STATE_READ_EDID,
  46. HDMI_STATE_POWER_ON_READ_EDID,
  47. HDMI_STATE_POWER_ON_HOT_PLUG_OUT,
  48. };
  49. #define HDMI_CTRL_STATE_T enum _HDMI_CTRL_STATE_T
  50. enum _HDMI_HDCP_KEY_T {
  51. EXTERNAL_KEY = 0,
  52. INTERNAL_NOENCRYPT_KEY,
  53. INTERNAL_ENCRYPT_KEY
  54. };
  55. #define HDMI_HDCP_KEY_T enum _HDMI_HDCP_KEY_T
  56. enum _HDMI_SHARE_INFO_TYPE_T {
  57. SI_EDID_VSDB_EXIST = 0,
  58. SI_HDMI_RECEIVER_STATUS,
  59. SI_HDMI_PORD_OFF_PLUG_ONLY,
  60. SI_EDID_EXT_BLOCK_NO,
  61. SI_EDID_PARSING_RESULT,
  62. SI_HDMI_SUPPORTS_AI,
  63. SI_HDMI_HDCP_RESULT,
  64. SI_REPEATER_DEVICE_COUNT,
  65. SI_HDMI_CEC_LA,
  66. SI_HDMI_CEC_ACTIVE_SOURCE,
  67. SI_HDMI_CEC_PROCESS,
  68. SI_HDMI_CEC_PARA0,
  69. SI_HDMI_CEC_PARA1,
  70. SI_HDMI_CEC_PARA2,
  71. SI_HDMI_NO_HDCP_TEST,
  72. SI_HDMI_SRC_CONTROL,
  73. SI_A_CODE_MODE,
  74. SI_EDID_AUDIO_CAPABILITY,
  75. SI_HDMI_AUDIO_INPUT_SOURCE,
  76. SI_HDMI_AUDIO_CH_NUM,
  77. SI_HDMI_DVD_AUDIO_PROHIBIT,
  78. SI_DVD_HDCP_REVOCATION_RESULT
  79. };
  80. #define HDMI_SHARE_INFO_TYPE_T enum _HDMI_SHARE_INFO_TYPE_T
  81. #define MAX_HDMI_SHAREINFO 64
  82. /* Notice: there are three device ID for SiI9993 (Receiver) */
  83. #define RX_ID 0x3A /* Max'0308'04, 0x74 */
  84. /* (2.2) Define the desired register address of receiver */
  85. /* Software Reset Register */
  86. #define RX_REG_SRST 0x05
  87. /* An register (total 8 bytes, address from 0x18 ~ 0x1F) */
  88. #define RX_REG_HDCP_AN 0x18
  89. /* Aksv register (total 5 bytes, address from 0x10 ~ 0x14) */
  90. #define RX_REG_HDCP_AKSV 0x10
  91. /* Bksv register (total 5 bytes, address from 0x00 ~ 0x04) */
  92. #define RX_REG_HDCP_BKSV 0x00
  93. /* BCAPS register */
  94. #define RX_REG_BCAPS 0x40
  95. #define RX_BIT_ADDR_RPTR 0x40 /* bit 6 */
  96. #define RX_BIT_ADDR_READY 0x20 /* bit 5 */
  97. #define RX_REG_BSTATUS1 0x41
  98. #define DEVICE_COUNT_MASK 0xff
  99. #define MAX_DEVS_EXCEEDED (0x01<<7)
  100. #define MAX_CASCADE_EXCEEDED (0x01<<3)
  101. #define RX_REG_KSV_FIFO 0x43
  102. #define RX_REG_REPEATER_V 0x20
  103. /* Ri register (total 2 bytes, address from 0x08 ~ 0x09) */
  104. #define RX_REG_RI 0x08
  105. /* (2) Define the counter for An register byte */
  106. #define HDCP_AN_COUNT 8
  107. /* (3) Define the counter for HDCP Aksv register byte */
  108. #define HDCP_AKSV_COUNT 5
  109. /* (3) Define the counter for HDCP Bksv register byte */
  110. #define HDCP_BKSV_COUNT 5
  111. /* (4) Define the counter for Ri register byte */
  112. #define HDCP_RI_COUNT 2
  113. #define HDCP_WAIT_5MS_TIMEOUT 5 /* 5 ms, */
  114. #define HDCP_WAIT_10MS_TIMEOUT 10 /* 10 ms, */
  115. #define HDCP_WAIT_300MS_TIMEOUT 300 /* 10 ms, */
  116. #define HDCP_WAIT_R0_TIMEOUT 100 /* 25//for timer 5ms // 100 ms, */
  117. #define HDCP_WAIT_KSV_LIST_TIMEOUT 100 /* 4600//5000//5500//1100//for timer 5ms //5000 // 5.5 sec */
  118. #define HDCP_WAIT_KSV_LIST_RETRY_TIMEOUT 100
  119. #define HDCP_WAIT_RI_TIMEOUT 2500 /* 500//for timer 5ms //2000 // 2.5 sec, */
  120. #define HDCP_WAIT_RE_DO_AUTHENTICATION 200 /* 20////for timer 20ms 200 //kenny 100->200 */
  121. #define HDCP_WAIT_RECEIVER_READY 1000 /* 50//for 20ms timer //1000 // 1 sec, 50*20ms */
  122. #define HDCP_WAIT_RES_CHG_OK_TIMEOUE 500 /* 30//6 */
  123. #define HDCP_WAIT_V_RDY_TIMEOUE 500 /* 30//6 */
  124. #define HDCP_CHECK_KSV_LIST_RDY_RETRY_COUNT 56 /* 10 */
  125. #define HDMI_H0 0x67452301
  126. #define HDMI_H1 0xefcdab89
  127. #define HDMI_H2 0x98badcfe
  128. #define HDMI_H3 0x10325476
  129. #define HDMI_H4 0xc3d2e1f0
  130. #define HDMI_K0 0x5a827999
  131. #define HDMI_K1 0x6ed9eba1
  132. #define HDMI_K2 0x8f1bbcdc
  133. #define HDMI_K3 0xca62c1d6
  134. /* for HDCP key access method */
  135. #define HOST_ACCESS 1 /* Key accessed by host */
  136. #define NON_HOST_ACCESS_FROM_EEPROM 2 /* Key auto accessed by HDCP hardware from eeprom */
  137. #define NON_HOST_ACCESS_FROM_MCM 3 /* Key auto accessed by HDCP hardware from MCM */
  138. #define NON_HOST_ACCESS_FROM_GCPU 4
  139. /* for HDCP */
  140. #define KSV_BUFF_SIZE 192
  141. #define HDCP_KEY_RESERVE 287
  142. extern unsigned char _bflagvideomute;
  143. extern unsigned char _bflagaudiomute;
  144. extern void vHDCPReset(void);
  145. extern void vHDCPInitAuth(void);
  146. extern void vDisableHDCP(unsigned char fgDisableHdcp);
  147. extern void HdcpService(HDCP_CTRL_STATE_T e_hdcp_state);
  148. extern unsigned int i4SharedInfo(unsigned int u4Index);
  149. extern void vSetSharedInfo(unsigned int u4Index, unsigned int i4Value);
  150. extern void vSendHdmiCmd(unsigned char u8cmd);
  151. extern void vClearHdmiCmd(void);
  152. extern unsigned char bCheckHDCPStatus(unsigned char bMode);
  153. extern unsigned char bReadGRLInt(void);
  154. extern void bClearGRLInt(unsigned char bInt);
  155. extern void vSetHDCPState(HDCP_CTRL_STATE_T e_state);
  156. extern unsigned char bReadHdmiIntMask(void);
  157. extern void vMoveHDCPInternalKey(HDMI_HDCP_KEY_T key);
  158. extern void vInitHdcpKeyGetMethod(unsigned char bMethod);
  159. extern void mt8193_hdcpkey(unsigned char *pbhdcpkey);
  160. extern void vShowHdcpRawData(void);
  161. extern void mt8193_mutehdmi(unsigned char u1flagvideomute, unsigned char u1flagaudiomute);
  162. #endif
  163. #endif