/** * @file hv_drv_OsdResource.h * @brief Osd driver layer resource management interface. * @verbatim * ============================================================================== * ##### How to use this driver ##### * ============================================================================== * (+) Use Hv_Drv_OsdResource_Init(...) to init resource management data . * @endverbatim * * @author HiView SoC Software Team * @version 0.0.1 * @date 2022-08-22 */ #ifndef __HV_DRV_OSDRESOURCE_H #define __HV_DRV_OSDRESOURCE_H #include "hv_comm_DataType.h" #include "hv_mw_OsdComm.h" #include "hv_res_OsdMoeRes.h" #define OSD_BANK_CAPACITY 512 #define OSD_EXCLUSIVE_BANK_CAPACITY 512 #define OSD_WINDOW_RESOURCE_SLOTS 8 #define OSD_SCENE_COUNT 8 #define OSD_SCENE_MAX_BANKS 8 #define OSD_SYSDMA_PORT_NUMBER (DMA_PORT0_CHANNEL0) /** * @brief resource initialization function * @param[in] None * @return VOID without return */ VOID Hv_Drv_OsdResource_Init(VOID); /** * @brief get resource current offset * @param[in] None * @return resource offset */ USHORT16 Hv_Drv_OsdResource_GetCurrentOffset(VOID); /** * @brief get resource size * @param[in] enSize resource size * @param[out] pucWidth resource width * @param[out] pucHeight resource height * @return VOID without return */ VOID Hv_Drv_OsdResource_GetSize(OsdResourceSize enSize, UCHAR8 *pucWidth, UCHAR8 *pucHeight); /** * @brief get resource bits * @param[in] enType resource type enum * @return resource bits */ UCHAR8 Hv_Drv_OsdResource_GetBits(OsdResourceType enType); /** * @brief convert userdefined resource size to OSD_RESOURCE_SIZE_USERDEFINED * @param[in] enSize resource size * @return resource size converted */ OsdResourceSize Hv_Drv_OsdResource_ConvertSize(OsdResourceSize enSize); /** * @brief get code array of block * @param[in] pstBlock block structure * @return code array */ const USHORT16* Hv_Drv_OsdResource_GetBlockCode(const OsdBlock *pstBlock); /** * @brief get font index by code * @param[in] ucBlockID block id * @param[in] usCode Unicode * @return font index */ USHORT16 Hv_Drv_OsdResource_SearchFontIndexByCode(UCHAR8 ucBlockID, USHORT16 usCode); /** * @brief find window resource by bankid * @param[in] ucBankID bank id * @param[in] bInsert if insert if not found * @return bank index */ UCHAR8 Hv_Drv_OsdResource_FindResource(UCHAR8 ucBankID, BOOL bInsert); /** * @brief search blank bank for current window * @param[in] None * @return blank bank index */ UCHAR8 Hv_Drv_OsdResource_SearchForBlank(VOID); /** * @brief find loaded block through blockid * @param[in] ucBlockID block id * @return loaded block structure */ OsdLoadedBlock *Hv_Drv_OsdResource_FindLoadedBlock(UCHAR8 ucBlockID); /** * @brief get id of block * @param[in] pstBlock block structure * @return block id */ UCHAR8 Hv_Drv_OsdResource_GetBlockId(const OsdBlock *pstBlock); /** * @brief get DDR address of block * @param[in] pstBlock block structure * @return DDR address of block */ const UCHAR8* Hv_Drv_OsdResource_GetBlockMatrixAddr(const OsdBlock *pstBlock); /** * @brief get RealWidth array of block * @param[in] pstBlock block structure * @return realwidth array */ const UCHAR8* Hv_Drv_OsdResource_GetRealWidth(const OsdBlock *pstBlock); /** * @brief clear loaded resource * @param[in] None * @return VOID without return */ VOID Hv_Drv_OsdResource_ClearLoadedResource(VOID); /** * @brief load resource for main menu * @param[in] None * @return VOID without return */ VOID Hv_Drv_OsdResource_LoadMenuResource(VOID); /** * @brief set resource change range * @param[in] enType index change type OSD_SRAM_CHANGE_NONE: resource area clean * OSD_SRAM_CHANGE_PARTIAL: partial area of resource dirty * OSD_SRAM_CHANGE_FULL: whole area of resource dirty * @param[in] uiChangeStart start position of this change * @param[in] uiChangeEnd end position of this change * @return VOID without return */ VOID Hv_Drv_OsdResource_SetChangeRange(OsdSRAMChangeType enType, UINT32 uiChangeStart, UINT32 uiChangeEnd); /** * @brief transfer resource to OSD SRAM * @param[in] None * @return VOID without return */ VOID Hv_Drv_OsdResource_TransferResource(VOID); /** * @brief set current language * @param[in] enLanguage language enum * @return VOID without return */ VOID Hv_Drv_OsdResource_SetLanguage(OsdLanguage enLanguage); /** * @brief set current language not clear buffer * @param[in] enLanguage language enum * @return VOID without return */ VOID Hv_Drv_OsdResource_SetLanguageOnly(OsdLanguage enLanguage); /** * @brief get resource count for one row * @param[in] pstFontInfo window font structure * @param[in] pstRowInfo row structure * @return resource count in one row */ UCHAR8 Hv_Drv_OsdResource_RowGetDynamicResourceCount( OsdPhyFontInfo *pstFontInfo, OsdRowInfo *pstRowInfo); /** * @brief allocate usSize bytes from resource buffer * @param[in] usSize bytes count * @return VOID without return value */ VOID Hv_Drv_OsdResource_AllocRegion(USHORT16 usSize); /** * @brief get current loaded bank * @param[in] None * @return loaded bank structure */ OsdLoadedBank* Hv_Drv_OsdResource_GetCurrentLoadedBank(VOID); /** * @brief create a new loaded bank * @param[in] enSize resource size * @param[in] enType resource bits * @return newly created loaded bank structure */ OsdLoadedBank* Hv_Drv_OsdResource_NewLoadedBank(OsdResourceSize enSize, OsdResourceType enType); /** * @brief reserve slots in current bank, create a new bank if not enough space * @param[in] enSize resource size * @param[in] enType resource bits * @param[in] usSlotsNeed slots demand * @return reserved slot offset in resource buffer */ USHORT16 Hv_Drv_OsdResource_PickLoadedBank(OsdResourceSize enSize, OsdResourceType enType, USHORT16 usSlotsNeed); /** * @brief dynamic load matrix for BANK * @param[in] pstLoadedBank loaded bank structure * @param[in] pucMatrixAddr matrix address in DDR * @param[in] usOffset offset within Matrix * @param[in] usCount matrix count to load * @return starting slot within loaded bank */ USHORT16 Hv_Drv_OsdResource_PickBankLoadMatrix(OsdLoadedBank *pstLoadedBank, const UCHAR8 *pucMatrixAddr, USHORT16 usOffset, USHORT16 usCount); /** * @brief dynamic load matrix for ROW * @param[in] pstRowInfo row structure * @param[in] pucMatrixAddr Matrix address in DDR * @param[in] usOffset offset within Matrix * @param[in] ucCount matrix count to load * @return starting slot within loaded bank */ USHORT16 Hv_Drv_OsdResource_PickRowLoadMatrix(OsdRowInfo *pstRowInfo, const UCHAR8 *pucMatrixAddr, USHORT16 usOffset, UCHAR8 ucCount); #ifdef HV_SCALER_DEBUG_VERSION extern USHORT16 g_usResourceRealTotalSize; extern USHORT16 g_usResourceRealTotalSizeMax; #endif #endif