/**
 * @file hv_drv_OsdPalette.h
 * @brief Osd driver layer palette interface.
 * @verbatim
 * ==============================================================================
 *                        ##### How to use this driver #####
 * ==============================================================================
 * (+) Use Hv_Drv_OsdPalette_Init(...) to init palette offset.
 * (+) Use Hv_Drv_OsdLogoPalette_Init(...) to init logo palette offset.
 * (+) Use Hv_Drv_OsdPalette_SetChangeRange(...) to record palette change range.
 * (+) Use Hv_Drv_OsdPalette_TransferPalette(...) to transfer palette change to OSD SRAM.
 * @endverbatim
 *
 * @author HiView SoC Software Team
 * @version 0.0.1
 * @date 2022-08-22
 */


#ifndef __HV_DRV_OSDPALETTE_H
#define __HV_DRV_OSDPALETTE_H

#include "hv_cal_Osd.h"

/**
 * @brief palette data copy
 * @param[in] usOffset color offset within palette, 0~511
 * @param[in] uiSrcAddr source address in DDR
 * @param[in] usLength data length to copy
 * @return VOID without return
 */
VOID Hv_Drv_OsdPalette_Copy(USHORT16 usOffset, UINT32 uiSrcAddr, USHORT16 usLength);

/**
 * @brief move colors of the same window from usSrcOffset to usDstOffset
 * @param[in] usSrcOffset source color offset, 0~511
 * @param[in] usDstOffset destination color offset, 0~511
 * @param[in] usColorCounts color counts to move
 * @return VOID without return
 */
VOID Hv_Drv_OsdPalette_Move(USHORT16 usSrcOffset, USHORT16 usDstOffset, USHORT16 usColorCounts);

/**
 * @brief set Palette change range
 * @param[in] enType palette change type OSD_SRAM_CHANGE_NONE: palette area clean
 *                                       OSD_SRAM_CHANGE_PARTIAL: partial area of palette dirty
 *                                       OSD_SRAM_CHANGE_FULL: whole area of palette dirty
 * @param[in] uiChangeStart start position of this change
 * @param[in] uiChangeEnd end position of this change
 * @return VOID without return
 */
VOID Hv_Drv_OsdPalette_SetChangeRange(OsdSRAMChangeType enType,
                        UINT32 uiChangeStart, UINT32 uiChangeEnd);

/**
 * @brief transfer palette change area to OSD SRAM
 * @param[in] None
 * @return VOID without return
 */
VOID Hv_Drv_OsdPalette_TransferPalette(VOID);

/**
 * @brief change Palette color
 * @param[in] enWinIndex Window id
 * @param[in] usColorIndex Color index in palette
 * @param[in] uiBGR RGB888value
 * @return VOID without return
 */
VOID Hv_Drv_OsdPalette_ChangeColor(OsdWindowPhyId enWinIndex, USHORT16 usColorIndex, UINT32 uiBGR);

UINT32 Hv_Drv_OsdPalette_GetColor(OsdWindowPhyId enWinIndex, USHORT16 usColorIndex);

UINT32 Hv_Drv_OsdPalette_GetPaletteColor(USHORT16 usColorIndex);

/**
 * @brief palette data init function
 * @param[in] None
 * @return VOID without return
 */
VOID Hv_Drv_OsdPalette_Init(VOID);

#if (HV_PROJECT_CONFIG_OSD_LOGO_USE_SCENE == HV_CONFIG_ON)
/**
 * @brief logo palette data init function
 * @param[in] None
 * @return VOID without return
 */
VOID Hv_Drv_OsdLogoPalette_Init(VOID);
#endif

#endif
