si_infoframe.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. /*
  2. SiI8348 Linux Driver
  3. Copyright (C) 2013 Silicon Image, Inc.
  4. This program is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU General Public License as
  6. published by the Free Software Foundation version 2.
  7. This program is distributed AS-IS WITHOUT ANY WARRANTY of any
  8. kind, whether express or implied; INCLUDING without the implied warranty
  9. of MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE or NON-INFRINGEMENT. See
  10. the GNU General Public License for more details at http://www.gnu.org/licenses/gpl-2.0.html.
  11. */
  12. #if !defined(SI_INFOFRAME_H)
  13. #define SI_INFOFRAME_H
  14. #include "sii_hal.h"
  15. typedef struct __attribute__((__packed__)) _info_frame_header_t {
  16. uint8_t type_code;
  17. uint8_t version_number;
  18. uint8_t length;
  19. } info_frame_header_t;
  20. typedef enum
  21. {
  22. acsRGB = 0
  23. ,acsYCbCr422 = 1
  24. ,acsYCbCr444 = 2
  25. ,acsFuture = 3
  26. }AviColorSpace_e;
  27. /*
  28. * AVI Info Frame Structure
  29. */
  30. typedef struct __attribute__((__packed__)) _avi_info_frame_data_byte_1_t {
  31. uint8_t ScanInfo:2;
  32. uint8_t BarInfo:2;
  33. uint8_t ActiveFormatInfoPresent:1;
  34. AviColorSpace_e colorSpace:2;
  35. uint8_t futureMustBeZero:1;
  36. } avi_info_frame_data_byte_1_t;
  37. typedef struct __attribute__((__packed__)) _avi_info_frame_data_byte_2_t {
  38. uint8_t ActiveFormatAspectRatio:4;
  39. uint8_t PictureAspectRatio:2;
  40. uint8_t Colorimetry:2;
  41. } avi_info_frame_data_byte_2_t;
  42. typedef struct __attribute__((__packed__)) _avi_info_frame_data_byte_3_t {
  43. uint8_t NonUniformPictureScaling:2;
  44. uint8_t RGBQuantizationRange:2;
  45. uint8_t ExtendedColorimetry:3;
  46. uint8_t ITContent:1;
  47. } avi_info_frame_data_byte_3_t;
  48. typedef struct __attribute__((__packed__)) _avi_info_frame_data_byte_4_t {
  49. uint8_t VIC:7;
  50. uint8_t futureMustBeZero:1;
  51. } avi_info_frame_data_byte_4_t;
  52. typedef enum
  53. {
  54. cnGraphics = 0
  55. ,cnPhoto = 1
  56. ,cnCinema = 2
  57. ,cnGame = 3
  58. }BitsContent_e;
  59. typedef enum
  60. {
  61. aqLimitedRange = 0
  62. ,aqFullRange = 1
  63. ,aqReserved0 = 2
  64. ,aqReserved1 = 3
  65. }AviQuantization_e;
  66. typedef struct __attribute__((__packed__)) _avi_info_frame_data_byte_5_t {
  67. uint8_t pixelRepetionFactor:4;
  68. BitsContent_e content :2;
  69. AviQuantization_e quantization :2;
  70. } avi_info_frame_data_byte_5_t;
  71. typedef struct __attribute__((__packed__)) _hw_avi_named_payload_t {
  72. uint8_t checksum;
  73. union {
  74. struct __attribute__((__packed__)) {
  75. avi_info_frame_data_byte_1_t pb1;
  76. avi_info_frame_data_byte_2_t colorimetryAspectRatio;
  77. avi_info_frame_data_byte_3_t pb3;
  78. avi_info_frame_data_byte_4_t VIC;
  79. avi_info_frame_data_byte_5_t pb5;
  80. uint8_t LineNumEndTopBarLow;
  81. uint8_t LineNumEndTopBarHigh;
  82. uint8_t LineNumStartBottomBarLow;
  83. uint8_t LineNumStartBottomBarHigh;
  84. uint8_t LineNumEndLeftBarLow;
  85. uint8_t LineNumEndLeftBarHigh;
  86. uint8_t LineNumStartRightBarLow;
  87. uint8_t LineNumStartRightBarHigh;
  88. } bitFields;
  89. uint8_t infoFrameData[13];
  90. } ifData_u;
  91. } hw_avi_named_payload_t;
  92. // this union overlays the TPI HW for AVI InfoFrames, starting at REG_TPI_AVI_CHSUM.
  93. typedef union _hw_avi_payload_t {
  94. hw_avi_named_payload_t namedIfData;
  95. uint8_t ifData[14];
  96. } hw_avi_payload_t;
  97. typedef struct __attribute__((__packed__)) _avi_payload_t {
  98. hw_avi_payload_t hwPayLoad;
  99. uint8_t byte_14;
  100. uint8_t byte_15;
  101. } avi_payload_t;
  102. typedef struct __attribute__((__packed__)) _avi_info_frame_t {
  103. info_frame_header_t header;
  104. avi_payload_t payLoad;
  105. } avi_info_frame_t;
  106. // these values determine the interpretation of PB5
  107. typedef enum
  108. {
  109. hvfNoAdditionalHDMIVideoFormatPresent =0
  110. ,hvfExtendedResolutionFormatPresent =1
  111. ,hvf3DFormatIndicationPresent =2
  112. }HDMI_Video_Format_e;
  113. typedef enum {
  114. tdsFramePacking = 0x00
  115. ,tdsTopAndBottom = 0x06
  116. ,tdsSideBySide = 0x08
  117. } _3D_structure_e;
  118. typedef enum
  119. {
  120. tdedHorizontalSubSampling = 0x0
  121. ,tdedQuincunxOddLeftOddRight = 0x4
  122. ,tdedQuincunxOddLeftEvenRight = 0x5
  123. ,tdedQuincunxEvenLeftOddRight = 0x6
  124. ,tdedQuincunxEvenLeftEvenRight= 0x7
  125. }ThreeDExtData_e;
  126. typedef enum
  127. {
  128. tdmdParallaxIso23022_3Section6_x_2_2 = 0
  129. }ThreeDMetaDataType_e;
  130. typedef struct __attribute__((__packed__)) _vendor_specific_payload_t {
  131. uint8_t checksum;
  132. uint8_t IEEERegistrationIdentifier[3]; // must be 0x000C03 Little Endian
  133. struct __attribute__((__packed__)){
  134. unsigned reserved:5;
  135. HDMI_Video_Format_e HDMI_Video_Format:3; //HDMI_Video_Format_e
  136. } pb4;
  137. union {
  138. uint8_t HDMI_VIC;
  139. struct __attribute__((__packed__)) _ThreeDStructure {
  140. unsigned reserved:3;
  141. unsigned ThreeDMetaPresent:1;
  142. _3D_structure_e threeDStructure:4; //_3D_structure_e
  143. } ThreeDStructure;
  144. } pb5;
  145. struct __attribute__((__packed__)) {
  146. uint8_t reserved:4;
  147. uint8_t threeDExtData:4; //ThreeDExtData_e
  148. } pb6;
  149. struct __attribute__((__packed__)) _PB7 {
  150. uint8_t threeDMetaDataLength:5;
  151. uint8_t threeDMetaDataType:3; //ThreeDMetaDataType_e
  152. } pb7;
  153. } vendor_specific_payload_t;
  154. typedef struct __attribute__((__packed__)) _vendor_specific_info_frame_t {
  155. info_frame_header_t header;
  156. vendor_specific_payload_t payLoad;
  157. } vendor_specific_info_frame_t;
  158. /*
  159. * MPEG Info Frame Structure
  160. * Table 8-11 on page 141 of HDMI Spec v1.4
  161. */
  162. typedef struct __attribute__((__packed__)) {
  163. info_frame_header_t header;
  164. uint8_t checksum;
  165. uint8_t byte_1;
  166. uint8_t byte_2;
  167. uint8_t byte_3;
  168. uint8_t byte_4;
  169. uint8_t byte_5;
  170. uint8_t byte_6;
  171. } unr_info_frame_t;
  172. typedef struct __attribute__((__packed__)) _info_frame_t {
  173. union {
  174. info_frame_header_t header;
  175. avi_info_frame_t avi;
  176. vendor_specific_info_frame_t vendorSpecific;
  177. unr_info_frame_t unr;
  178. } body;
  179. } info_frame_t;
  180. typedef enum
  181. {
  182. // just define these three for now
  183. InfoFrameType_AVI
  184. ,InfoFrameType_VendorSpecific
  185. ,InfoFrameType_Audio
  186. }InfoFrameType_e;
  187. #define ENABLE_DUMP_INFOFRAME
  188. #ifdef ENABLE_DUMP_INFOFRAME //(
  189. void DumpIncomingInfoFrameImpl(char *pszId,char *pszFile,int iLine,info_frame_t *pInfoFrame,uint8_t length);
  190. #define DumpIncomingInfoFrame(pData,length) DumpIncomingInfoFrameImpl(#pData,__FILE__,__LINE__,(info_frame_t *)pData,length)
  191. #else //)(
  192. #define DumpIncomingInfoFrame(pData,length) /* do nothing */
  193. #endif //)
  194. #ifdef ENABLE_COLOR_SPACE_DEBUG_PRINT //(
  195. #define COLOR_SPACE_DEBUG_PRINT_WRAPPER(...) SiiOsDebugPrint(__FILE__,__LINE__,SII_OSAL_DEBUG_TX,__VA_ARGS__)
  196. #define COLOR_SPACE_DEBUG_PRINT(x) COLOR_SPACE_DEBUG_PRINT_WRAPPER x
  197. #else //)(
  198. #define COLOR_SPACE_DEBUG_PRINT(...) /* nothing */
  199. #endif //)
  200. #endif /* if !defined(SI_INFOFRAME_H) */