deccfg.h 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. /*------------------------------------------------------------------------------
  2. -- --
  3. -- This software is confidential and proprietary and may be used --
  4. -- only as expressly authorized by a licensing agreement from --
  5. -- --
  6. -- Hantro Products Oy. --
  7. -- --
  8. -- (C) COPYRIGHT 2006 HANTRO PRODUCTS OY --
  9. -- ALL RIGHTS RESERVED --
  10. -- --
  11. -- The entire notice above must be reproduced --
  12. -- on all copies and should not be removed. --
  13. -- --
  14. --------------------------------------------------------------------------------
  15. --
  16. -- Description : Hardware decoder system configuration
  17. --
  18. --------------------------------------------------------------------------------
  19. --
  20. -- Version control information, please leave untouched.
  21. --
  22. -- $RCSfile: deccfg.h,v $
  23. -- $Revision: 1.16 $
  24. -- $Date: 2010/05/14 10:45:43 $
  25. --
  26. ------------------------------------------------------------------------------*/
  27. #ifndef __DEC_X170_CFG_H__
  28. #define __DEC_X170_CFG_H__
  29. /* predefined values of HW system parameters. DO NOT ALTER! */
  30. #define DEC_X170_LITTLE_ENDIAN 1
  31. #define DEC_X170_BIG_ENDIAN 0
  32. #define DEC_X170_BUS_BURST_LENGTH_UNDEFINED 0
  33. #define DEC_X170_BUS_BURST_LENGTH_4 4
  34. #define DEC_X170_BUS_BURST_LENGTH_8 8
  35. #define DEC_X170_BUS_BURST_LENGTH_16 16
  36. #define DEC_X170_ASIC_SERVICE_PRIORITY_DEFAULT 0
  37. #define DEC_X170_ASIC_SERVICE_PRIORITY_WR_1 1
  38. #define DEC_X170_ASIC_SERVICE_PRIORITY_WR_2 2
  39. #define DEC_X170_ASIC_SERVICE_PRIORITY_RD_1 3
  40. #define DEC_X170_ASIC_SERVICE_PRIORITY_RD_2 4
  41. #define DEC_X170_OUTPUT_FORMAT_RASTER_SCAN 0
  42. #define DEC_X170_OUTPUT_FORMAT_TILED 1
  43. /* end of predefined values */
  44. /* now what we use */
  45. #ifndef DEC_X170_USING_IRQ
  46. /* Control IRQ generation by decoder hardware */
  47. #define DEC_X170_USING_IRQ 1
  48. #endif
  49. #ifndef DEC_X170_ASIC_SERVICE_PRIORITY
  50. /* hardware intgernal prioriy scheme. better left unchanged */
  51. #define DEC_X170_ASIC_SERVICE_PRIORITY DEC_X170_ASIC_SERVICE_PRIORITY_DEFAULT
  52. #endif
  53. /* AXI single command multiple data disable not set */
  54. #define DEC_X170_SCMD_DISABLE 0
  55. /* Advanced prefetch disable flag. If disable flag is set, product shall
  56. * operate akin to 9190 and earlier products. */
  57. #define DEC_X170_APF_DISABLE 0
  58. #ifndef DEC_X170_BUS_BURST_LENGTH
  59. /* how long are the hardware data bursts; better left unchanged */
  60. #define DEC_X170_BUS_BURST_LENGTH DEC_X170_BUS_BURST_LENGTH_16
  61. #endif
  62. #ifndef DEC_X170_INPUT_STREAM_ENDIAN
  63. /* this should match the system endianess, so that Decoder reads */
  64. /* the input stream in the right order */
  65. #define DEC_X170_INPUT_STREAM_ENDIAN DEC_X170_LITTLE_ENDIAN
  66. #endif
  67. #ifndef DEC_X170_OUTPUT_PICTURE_ENDIAN
  68. /* this should match the system endianess, so that Decoder writes */
  69. /* the output pixel data in the right order */
  70. #define DEC_X170_OUTPUT_PICTURE_ENDIAN DEC_X170_LITTLE_ENDIAN
  71. #endif
  72. #ifndef DEC_X170_LATENCY_COMPENSATION
  73. /* compensation for bus latency; values up to 63 */
  74. #define DEC_X170_LATENCY_COMPENSATION 0
  75. #endif
  76. #ifndef DEC_X170_INTERNAL_CLOCK_GATING
  77. /* clock is gated from decoder structures that are not used */
  78. #define DEC_X170_INTERNAL_CLOCK_GATING 0
  79. #endif
  80. #ifndef DEC_X170_OUTPUT_FORMAT
  81. /* Decoder output picture format in external memory: Raster-scan or */
  82. /*macroblock tiled i.e. macroblock data written in consecutive addresses */
  83. #define DEC_X170_OUTPUT_FORMAT DEC_X170_OUTPUT_FORMAT_RASTER_SCAN
  84. #endif
  85. #ifndef DEC_X170_DATA_DISCARD_ENABLE
  86. #define DEC_X170_DATA_DISCARD_ENABLE 0
  87. #endif
  88. /* Decoder output data swap for 32bit words*/
  89. #ifndef DEC_X170_OUTPUT_SWAP_32_ENABLE
  90. #define DEC_X170_OUTPUT_SWAP_32_ENABLE 1
  91. #endif
  92. /* Decoder input data swap(excluding stream data) for 32bit words*/
  93. #ifndef DEC_X170_INPUT_DATA_SWAP_32_ENABLE
  94. #define DEC_X170_INPUT_DATA_SWAP_32_ENABLE 1
  95. #endif
  96. /* Decoder input stream swap for 32bit words */
  97. #ifndef DEC_X170_INPUT_STREAM_SWAP_32_ENABLE
  98. #define DEC_X170_INPUT_STREAM_SWAP_32_ENABLE 1
  99. #endif
  100. /* Decoder input data endian. Do not modify this! */
  101. #ifndef DEC_X170_INPUT_DATA_ENDIAN
  102. #define DEC_X170_INPUT_DATA_ENDIAN DEC_X170_BIG_ENDIAN
  103. #endif
  104. /* AXI bus read and write ID values used by HW. 0 - 255 */
  105. #ifndef DEC_X170_AXI_ID_R
  106. #define DEC_X170_AXI_ID_R 0
  107. #endif
  108. #ifndef DEC_X170_AXI_ID_W
  109. #define DEC_X170_AXI_ID_W 0
  110. #endif
  111. /* Check validity of values */
  112. /* data discard and tiled mode can not be on simultaneously */
  113. #if (DEC_X170_DATA_DISCARD_ENABLE && (DEC_X170_OUTPUT_FORMAT == DEC_X170_OUTPUT_FORMAT_TILED))
  114. #error "Bad value specified: DEC_X170_DATA_DISCARD_ENABLE && (DEC_X170_OUTPUT_FORMAT == DEC_X170_OUTPUT_FORMAT_TILED)"
  115. #endif
  116. #if (DEC_X170_OUTPUT_PICTURE_ENDIAN > 1)
  117. #error "Bad value specified for DEC_X170_OUTPUT_PICTURE_ENDIAN"
  118. #endif
  119. #if (DEC_X170_OUTPUT_FORMAT > 1)
  120. #error "Bad value specified for DEC_X170_OUTPUT_FORMAT"
  121. #endif
  122. #if (DEC_X170_BUS_BURST_LENGTH > 31)
  123. #error "Bad value specified for DEC_X170_AMBA_BURST_LENGTH"
  124. #endif
  125. #if (DEC_X170_ASIC_SERVICE_PRIORITY > 4)
  126. #error "Bad value specified for DEC_X170_ASIC_SERVICE_PRIORITY"
  127. #endif
  128. #if (DEC_X170_LATENCY_COMPENSATION > 63)
  129. #error "Bad value specified for DEC_X170_LATENCY_COMPENSATION"
  130. #endif
  131. #if (DEC_X170_OUTPUT_SWAP_32_ENABLE > 1)
  132. #error "Bad value specified for DEC_X170_OUTPUT_SWAP_32_ENABLE"
  133. #endif
  134. #if (DEC_X170_INPUT_DATA_SWAP_32_ENABLE > 1)
  135. #error "Bad value specified for DEC_X170_INPUT_DATA_SWAP_32_ENABLE"
  136. #endif
  137. #if (DEC_X170_INPUT_STREAM_SWAP_32_ENABLE > 1)
  138. #error "Bad value specified for DEC_X170_INPUT_STREAM_SWAP_32_ENABLE"
  139. #endif
  140. #if (DEC_X170_OUTPUT_SWAP_32_ENABLE > 1)
  141. #error "Bad value specified for DEC_X170_INPUT_DATA_ENDIAN"
  142. #endif
  143. #if (DEC_X170_DATA_DISCARD_ENABLE > 1)
  144. #error "Bad value specified for DEC_X170_DATA_DISCARD_ENABLE"
  145. #endif
  146. /* Common defines for the decoder */
  147. /* Number registers for the decoder */
  148. #define DEC_X170_REGISTERS 60
  149. /* Max amount of stream */
  150. #define DEC_X170_MAX_STREAM ((1<<24)-1)
  151. /* Timeout value for the DWLWaitHwReady() call. */
  152. /* Set to -1 for an unspecified value */
  153. #ifndef DEC_X170_TIMEOUT_LENGTH
  154. #define DEC_X170_TIMEOUT_LENGTH -1
  155. #endif
  156. /* Enable HW internal watchdog timeout IRQ */
  157. #define DEC_X170_HW_TIMEOUT_INT_ENA 1
  158. /* Memory wait states for reference buffer */
  159. #define DEC_X170_REFBU_WIDTH 64
  160. #define DEC_X170_REFBU_LATENCY 20
  161. #define DEC_X170_REFBU_NONSEQ 8
  162. #define DEC_X170_REFBU_SEQ 1
  163. #define DEC_SET_APF_THRESHOLD(regBase) \
  164. { \
  165. u32 apfTmpThreshold = 0; \
  166. SetDecRegister(regBase, HWIF_DEC_ADV_PRE_DIS, DEC_X170_APF_DISABLE ); \
  167. if((DEC_X170_APF_DISABLE) == 0) \
  168. { \
  169. if(DEC_X170_REFBU_SEQ) \
  170. apfTmpThreshold = DEC_X170_REFBU_NONSEQ/DEC_X170_REFBU_SEQ; \
  171. else \
  172. apfTmpThreshold = DEC_X170_REFBU_NONSEQ; \
  173. if( apfTmpThreshold > 63 ) \
  174. apfTmpThreshold = 63; \
  175. } \
  176. SetDecRegister(regBase, HWIF_APF_THRESHOLD, apfTmpThreshold ); \
  177. }
  178. /* Check validity of the stream addresses */
  179. #define X170_CHECK_BUS_ADDRESS(d) ((d) < 64 ? 1 : 0)
  180. #define X170_CHECK_VIRTUAL_ADDRESS(d) (((void*)(d) < (void*)64) ? 1 : 0)
  181. #endif /* __DEC_X170_CFG_H__ */