dwl.h 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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 : Sytem Wrapper Layer
  17. --
  18. ------------------------------------------------------------------------------
  19. --
  20. -- Version control information, please leave untouched.
  21. --
  22. -- $RCSfile: dwl.h,v $
  23. -- $Revision: 1.21 $
  24. -- $Date: 2010/12/01 12:31:03 $
  25. --
  26. ------------------------------------------------------------------------------*/
  27. #ifndef __DWL_H__
  28. #define __DWL_H__
  29. #ifdef __cplusplus
  30. extern "C"
  31. {
  32. #endif
  33. #include "basetype.h"
  34. #include "decapicommon.h"
  35. #define DWL_OK 0
  36. #define DWL_ERROR -1
  37. #define DWL_HW_WAIT_OK DWL_OK
  38. #define DWL_HW_WAIT_ERROR DWL_ERROR
  39. #define DWL_HW_WAIT_TIMEOUT 1
  40. #define DWL_CLIENT_TYPE_H264_DEC 1U
  41. #define DWL_CLIENT_TYPE_MPEG4_DEC 2U
  42. #define DWL_CLIENT_TYPE_JPEG_DEC 3U
  43. #define DWL_CLIENT_TYPE_PP 4U
  44. #define DWL_CLIENT_TYPE_VC1_DEC 5U
  45. #define DWL_CLIENT_TYPE_MPEG2_DEC 6U
  46. #define DWL_CLIENT_TYPE_VP6_DEC 7U
  47. #define DWL_CLIENT_TYPE_AVS_DEC 9U /* TODO: fix */
  48. #define DWL_CLIENT_TYPE_RV_DEC 8U
  49. #define DWL_CLIENT_TYPE_VP8_DEC 10U
  50. /* Linear memory area descriptor */
  51. typedef struct DWLLinearMem
  52. {
  53. u32 *virtualAddress;
  54. u32 busAddress;
  55. u32 size;
  56. } DWLLinearMem_t;
  57. /* DWLInitParam is used to pass parameters when initializing the DWL */
  58. typedef struct DWLInitParam
  59. {
  60. u32 clientType;
  61. } DWLInitParam_t;
  62. /* Hardware configuration description */
  63. typedef struct DWLHwConfig
  64. {
  65. u32 maxDecPicWidth; /* Maximum video decoding width supported */
  66. u32 maxPpOutPicWidth; /* Maximum output width of Post-Processor */
  67. u32 h264Support; /* HW supports h.264 */
  68. u32 jpegSupport; /* HW supports JPEG */
  69. u32 mpeg4Support; /* HW supports MPEG-4 */
  70. u32 customMpeg4Support; /* HW supports custom MPEG-4 features */
  71. u32 vc1Support; /* HW supports VC-1 Simple */
  72. u32 mpeg2Support; /* HW supports MPEG-2 */
  73. u32 ppSupport; /* HW supports post-processor */
  74. u32 ppConfig; /* HW post-processor functions bitmask */
  75. u32 sorensonSparkSupport; /* HW supports Sorenson Spark */
  76. u32 refBufSupport; /* HW supports reference picture buffering */
  77. u32 tiledModeSupport; /* HW supports tiled reference pictuers */
  78. u32 vp6Support; /* HW supports VP6 */
  79. u32 vp7Support; /* HW supports VP7 */
  80. u32 vp8Support; /* HW supports VP8 */
  81. u32 avsSupport; /* HW supports AVS */
  82. u32 jpegESupport; /* HW supports JPEG extensions */
  83. u32 rvSupport; /* HW supports REAL */
  84. u32 mvcSupport; /* HW supports H264 MVC extension */
  85. u32 webpSupport; /* HW supports WebP (VP8 snapshot) */
  86. u32 ecSupport; /* one of the EC values defined above */
  87. u32 strideSupport; /* HW supports separate Y and C strides */
  88. u32 fieldDpbSupport;
  89. } DWLHwConfig_t;
  90. typedef struct DWLHwFuseStatus
  91. {
  92. u32 h264SupportFuse; /* HW supports h.264 */
  93. u32 mpeg4SupportFuse; /* HW supports MPEG-4 */
  94. u32 mpeg2SupportFuse; /* HW supports MPEG-2 */
  95. u32 sorensonSparkSupportFuse; /* HW supports Sorenson Spark */
  96. u32 jpegSupportFuse; /* HW supports JPEG */
  97. u32 vp6SupportFuse; /* HW supports VP6 */
  98. u32 vp7SupportFuse; /* HW supports VP6 */
  99. u32 vp8SupportFuse; /* HW supports VP6 */
  100. u32 vc1SupportFuse; /* HW supports VC-1 Simple */
  101. u32 jpegProgSupportFuse; /* HW supports Progressive JPEG */
  102. u32 ppSupportFuse; /* HW supports post-processor */
  103. u32 ppConfigFuse; /* HW post-processor functions bitmask */
  104. u32 maxDecPicWidthFuse; /* Maximum video decoding width supported */
  105. u32 maxPpOutPicWidthFuse; /* Maximum output width of Post-Processor */
  106. u32 refBufSupportFuse; /* HW supports reference picture buffering */
  107. u32 avsSupportFuse; /* one of the AVS values defined above */
  108. u32 rvSupportFuse; /* one of the REAL values defined above */
  109. u32 mvcSupportFuse;
  110. u32 customMpeg4SupportFuse; /* Fuse for custom MPEG-4 */
  111. } DWLHwFuseStatus_t;
  112. /* HW ID retriving, static implementation */
  113. u32 DWLReadAsicID(void);
  114. /* HW configuration retrieving, static implementation */
  115. void DWLReadAsicConfig(DWLHwConfig_t * pHwCfg);
  116. /* HW fuse retrieving, static implementation */
  117. void DWLReadAsicFuseStatus(DWLHwFuseStatus_t * pHwFuseSts);
  118. /* DWL initilaization and release */
  119. const void *DWLInit(DWLInitParam_t * param);
  120. i32 DWLRelease(const void *instance);
  121. /* HW sharing */
  122. i32 DWLReserveHw(const void *instance);
  123. void DWLReleaseHw(const void *instance);
  124. /* Frame buffers memory */
  125. i32 DWLMallocRefFrm(const void *instance, u32 size, DWLLinearMem_t * info);
  126. void DWLFreeRefFrm(const void *instance, DWLLinearMem_t * info);
  127. /* SW/HW shared memory */
  128. i32 DWLMallocLinear(const void *instance, u32 size, DWLLinearMem_t * info);
  129. void DWLFreeLinear(const void *instance, DWLLinearMem_t * info);
  130. /* D-Cache coherence */
  131. void DWLDCacheRangeFlush(const void *instance, DWLLinearMem_t * info); /* NOT in use */
  132. void DWLDCacheRangeRefresh(const void *instance, DWLLinearMem_t * info); /* NOT in use */
  133. /* Register access */
  134. void DWLWriteReg(const void *instance, u32 offset, u32 value);
  135. u32 DWLReadReg(const void *instance, u32 offset);
  136. void DWLWriteRegAll(const void *instance, const u32 * table, u32 size); /* NOT in use */
  137. void DWLReadRegAll(const void *instance, u32 * table, u32 size); /* NOT in use */
  138. /* HW starting/stopping */
  139. void DWLEnableHW(const void *instance, u32 offset, u32 value);
  140. void DWLDisableHW(const void *instance, u32 offset, u32 value);
  141. /* HW synchronization */
  142. i32 DWLWaitHwReady(const void *instance, u32 timeout);
  143. /* SW/SW shared memory */
  144. void *DWLmalloc(u32 n);
  145. void DWLfree(void *p);
  146. void *DWLcalloc(u32 n, u32 s);
  147. void *DWLmemcpy(void *d, const void *s, u32 n);
  148. void *DWLmemset(void *d, i32 c, u32 n);
  149. void DWLCleanCache(void);
  150. #ifdef __cplusplus
  151. }
  152. #endif
  153. #endif /* __DWL_H__ */