hv_drv_OsdResource.h 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. /**
  2. * @file hv_drv_OsdResource.h
  3. * @brief Osd driver layer resource management interface.
  4. * @verbatim
  5. * ==============================================================================
  6. * ##### How to use this driver #####
  7. * ==============================================================================
  8. * (+) Use Hv_Drv_OsdResource_Init(...) to init resource management data .
  9. * @endverbatim
  10. *
  11. * @author HiView SoC Software Team
  12. * @version 0.0.1
  13. * @date 2022-08-22
  14. */
  15. #ifndef __HV_DRV_OSDRESOURCE_H
  16. #define __HV_DRV_OSDRESOURCE_H
  17. #include "hv_comm_DataType.h"
  18. #include "hv_mw_OsdComm.h"
  19. #include "hv_res_OsdMoeRes.h"
  20. #define OSD_BANK_CAPACITY 512
  21. #define OSD_EXCLUSIVE_BANK_CAPACITY 512
  22. #define OSD_WINDOW_RESOURCE_SLOTS 8
  23. #define OSD_SCENE_COUNT 8
  24. #define OSD_SCENE_MAX_BANKS 8
  25. #define OSD_SYSDMA_PORT_NUMBER (DMA_PORT0_CHANNEL0)
  26. /**
  27. * @brief resource initialization function
  28. * @param[in] None
  29. * @return VOID without return
  30. */
  31. VOID Hv_Drv_OsdResource_Init(VOID);
  32. /**
  33. * @brief get resource current offset
  34. * @param[in] None
  35. * @return resource offset
  36. */
  37. USHORT16 Hv_Drv_OsdResource_GetCurrentOffset(VOID);
  38. /**
  39. * @brief get resource size
  40. * @param[in] enSize resource size
  41. * @param[out] pucWidth resource width
  42. * @param[out] pucHeight resource height
  43. * @return VOID without return
  44. */
  45. VOID Hv_Drv_OsdResource_GetSize(OsdResourceSize enSize, UCHAR8 *pucWidth, UCHAR8 *pucHeight);
  46. /**
  47. * @brief get resource bits
  48. * @param[in] enType resource type enum
  49. * @return resource bits
  50. */
  51. UCHAR8 Hv_Drv_OsdResource_GetBits(OsdResourceType enType);
  52. /**
  53. * @brief convert userdefined resource size to OSD_RESOURCE_SIZE_USERDEFINED
  54. * @param[in] enSize resource size
  55. * @return resource size converted
  56. */
  57. OsdResourceSize Hv_Drv_OsdResource_ConvertSize(OsdResourceSize enSize);
  58. /**
  59. * @brief get code array of block
  60. * @param[in] pstBlock block structure
  61. * @return code array
  62. */
  63. const USHORT16* Hv_Drv_OsdResource_GetBlockCode(const OsdBlock *pstBlock);
  64. /**
  65. * @brief get font index by code
  66. * @param[in] ucBlockID block id
  67. * @param[in] usCode Unicode
  68. * @return font index
  69. */
  70. USHORT16 Hv_Drv_OsdResource_SearchFontIndexByCode(UCHAR8 ucBlockID, USHORT16 usCode);
  71. /**
  72. * @brief find window resource by bankid
  73. * @param[in] ucBankID bank id
  74. * @param[in] bInsert if insert if not found
  75. * @return bank index
  76. */
  77. UCHAR8 Hv_Drv_OsdResource_FindResource(UCHAR8 ucBankID, BOOL bInsert);
  78. /**
  79. * @brief search blank bank for current window
  80. * @param[in] None
  81. * @return blank bank index
  82. */
  83. UCHAR8 Hv_Drv_OsdResource_SearchForBlank(VOID);
  84. /**
  85. * @brief find loaded block through blockid
  86. * @param[in] ucBlockID block id
  87. * @return loaded block structure
  88. */
  89. OsdLoadedBlock *Hv_Drv_OsdResource_FindLoadedBlock(UCHAR8 ucBlockID);
  90. /**
  91. * @brief get id of block
  92. * @param[in] pstBlock block structure
  93. * @return block id
  94. */
  95. UCHAR8 Hv_Drv_OsdResource_GetBlockId(const OsdBlock *pstBlock);
  96. /**
  97. * @brief get DDR address of block
  98. * @param[in] pstBlock block structure
  99. * @return DDR address of block
  100. */
  101. const UCHAR8* Hv_Drv_OsdResource_GetBlockMatrixAddr(const OsdBlock *pstBlock);
  102. /**
  103. * @brief get RealWidth array of block
  104. * @param[in] pstBlock block structure
  105. * @return realwidth array
  106. */
  107. const UCHAR8* Hv_Drv_OsdResource_GetRealWidth(const OsdBlock *pstBlock);
  108. /**
  109. * @brief clear loaded resource
  110. * @param[in] None
  111. * @return VOID without return
  112. */
  113. VOID Hv_Drv_OsdResource_ClearLoadedResource(VOID);
  114. /**
  115. * @brief load resource for main menu
  116. * @param[in] None
  117. * @return VOID without return
  118. */
  119. VOID Hv_Drv_OsdResource_LoadMenuResource(VOID);
  120. /**
  121. * @brief set resource change range
  122. * @param[in] enType index change type OSD_SRAM_CHANGE_NONE: resource area clean
  123. * OSD_SRAM_CHANGE_PARTIAL: partial area of resource dirty
  124. * OSD_SRAM_CHANGE_FULL: whole area of resource dirty
  125. * @param[in] uiChangeStart start position of this change
  126. * @param[in] uiChangeEnd end position of this change
  127. * @return VOID without return
  128. */
  129. VOID Hv_Drv_OsdResource_SetChangeRange(OsdSRAMChangeType enType, UINT32 uiChangeStart, UINT32 uiChangeEnd);
  130. /**
  131. * @brief transfer resource to OSD SRAM
  132. * @param[in] None
  133. * @return VOID without return
  134. */
  135. VOID Hv_Drv_OsdResource_TransferResource(VOID);
  136. /**
  137. * @brief set current language
  138. * @param[in] enLanguage language enum
  139. * @return VOID without return
  140. */
  141. VOID Hv_Drv_OsdResource_SetLanguage(OsdLanguage enLanguage);
  142. /**
  143. * @brief set current language not clear buffer
  144. * @param[in] enLanguage language enum
  145. * @return VOID without return
  146. */
  147. VOID Hv_Drv_OsdResource_SetLanguageOnly(OsdLanguage enLanguage);
  148. /**
  149. * @brief get resource count for one row
  150. * @param[in] pstFontInfo window font structure
  151. * @param[in] pstRowInfo row structure
  152. * @return resource count in one row
  153. */
  154. UCHAR8 Hv_Drv_OsdResource_RowGetDynamicResourceCount(
  155. OsdPhyFontInfo *pstFontInfo, OsdRowInfo *pstRowInfo);
  156. /**
  157. * @brief allocate usSize bytes from resource buffer
  158. * @param[in] usSize bytes count
  159. * @return VOID without return value
  160. */
  161. VOID Hv_Drv_OsdResource_AllocRegion(USHORT16 usSize);
  162. /**
  163. * @brief get current loaded bank
  164. * @param[in] None
  165. * @return loaded bank structure
  166. */
  167. OsdLoadedBank* Hv_Drv_OsdResource_GetCurrentLoadedBank(VOID);
  168. /**
  169. * @brief create a new loaded bank
  170. * @param[in] enSize resource size
  171. * @param[in] enType resource bits
  172. * @return newly created loaded bank structure
  173. */
  174. OsdLoadedBank* Hv_Drv_OsdResource_NewLoadedBank(OsdResourceSize enSize, OsdResourceType enType);
  175. /**
  176. * @brief reserve slots in current bank, create a new bank if not enough space
  177. * @param[in] enSize resource size
  178. * @param[in] enType resource bits
  179. * @param[in] usSlotsNeed slots demand
  180. * @return reserved slot offset in resource buffer
  181. */
  182. USHORT16 Hv_Drv_OsdResource_PickLoadedBank(OsdResourceSize enSize,
  183. OsdResourceType enType, USHORT16 usSlotsNeed);
  184. /**
  185. * @brief dynamic load matrix for BANK
  186. * @param[in] pstLoadedBank loaded bank structure
  187. * @param[in] pucMatrixAddr matrix address in DDR
  188. * @param[in] usOffset offset within Matrix
  189. * @param[in] usCount matrix count to load
  190. * @return starting slot within loaded bank
  191. */
  192. USHORT16 Hv_Drv_OsdResource_PickBankLoadMatrix(OsdLoadedBank *pstLoadedBank,
  193. const UCHAR8 *pucMatrixAddr, USHORT16 usOffset, USHORT16 usCount);
  194. /**
  195. * @brief dynamic load matrix for ROW
  196. * @param[in] pstRowInfo row structure
  197. * @param[in] pucMatrixAddr Matrix address in DDR
  198. * @param[in] usOffset offset within Matrix
  199. * @param[in] ucCount matrix count to load
  200. * @return starting slot within loaded bank
  201. */
  202. USHORT16 Hv_Drv_OsdResource_PickRowLoadMatrix(OsdRowInfo *pstRowInfo,
  203. const UCHAR8 *pucMatrixAddr, USHORT16 usOffset, UCHAR8 ucCount);
  204. #ifdef HV_SCALER_DEBUG_VERSION
  205. extern USHORT16 g_usResourceRealTotalSize;
  206. extern USHORT16 g_usResourceRealTotalSizeMax;
  207. #endif
  208. #endif