#ifndef OVL_DRVIF_H
#define OVL_DRVIF_H

#ifdef CC_MTK_LOADER
	#define DEFINE_IS_LOG(level, fmt...) Printf(fmt)
#else /* CC_MTK_LOADER */
	#define DEFINE_IS_LOG OSD_IsLog
#endif /* CC_MTK_LOADER */

#include "x_debug.h"


#define FORMAT_RGB565       0
#define FORMAT_RGB888       1
#define FORMAT_ARGB8888     2
#define FORMAT_PARGB8888    3
#define FORMAT_UYVY         4
#define FORMAT_YUYV         5
#define FORMAT_RGBX8888     6
#define FORMAT_MAX          7

#define OVL_DIRECTLINK_MODE 1
#define OVL_DECOUPLE_MODE   2
#define OVL_MULTIPLE_MODE   3

#define OVL_LAYER_0         0
#define OVL_LAYER_1         1
#define OVL_LAYER_2         2
#define OVL_LAYER_3         3

#define OVL_0               0
#define OVL_1               1
#define WDMA_0              0
#define WDMA_1              1

extern void OVL_Init(BOOL twopath);
extern void OVL_Set_Mode(UINT32 mode);
extern void OVL_Set_Mode_Hwc(UINT32 mode);
extern UINT32 OVL_Get_Mode_Hwc(void);
extern void OVL_Set_Dual_Mode(BOOL enable);
extern BOOL OVL_Get_Dual_Mode(void);
extern void OVL_Time_Measure(UINT32 mode);
extern void OVL_Set_Layer_Status(UINT32 ovl_idx, UINT32 layer, UINT32 status);
extern void OVL_Set_Layer_AFBC_Status(UINT32 ovl_idx, UINT32 layer, UINT32 status);
extern void OVL_Set_Layer_En(UINT32 layer, UINT32 type);
extern void OVL_Set_Layer_AFBC_En(UINT32 layer,UINT32 type);
extern void OVL_Set_Layer_Format(UINT32 layer, UINT32 type);
extern void OVL_Set_Layer_Alpha_En(UINT32 layer, UINT32 alpha_en);
extern void OVL_Set_Layer_Alpha(UINT32 layer, UINT32 alpha);
extern void OVL_Set_LayerConst_En(UINT32 ovl_idx,UINT32 lc_en);
extern void OVL_Set_LayerConst_Clr(UINT32 ovl_idx,UINT32 lc_color);
extern void OVL_Set_LayerConst_Idx(UINT32 ovl_idx,UINT32 lc_idx);
extern void OVL_Set_LayerConst_Size(UINT32 ovl_idx,UINT32 width, UINT32 height);
extern void OVL_Set_LayerConst_Offset(UINT32 ovl_idx,UINT32 x,UINT32 y);
extern void OVL_Set_LayerConst_Alpha(UINT32 ovl_idx,UINT32 lc_alpha);
extern void OVL_Set_Layer_Size(UINT32 ovl, UINT32 layer, UINT32 width, UINT32 height);
extern void OVL_Set_Layer_Offset(UINT32 ovl, UINT32 layer, UINT32 x, UINT32 y);
extern void OVL_Set_Roi_Size(UINT32 ovl, UINT32 width, UINT32 height);
extern void OVL_Set_Premultiplied(UINT32 ovl_idx, UINT32 layer_idx, UINT32 flag);
extern void OVL_Set_Premultiplied_Format(UINT32 ovl_idx, UINT32 layer_idx, UINT32 flag, UINT32 format);
void OVL_Set_Layer_Addr(UINT32 ovl, UINT32 layer, UINT32 addr);
void OVL_Set_Layer_AFBC_HDR_Addr(UINT32 ovl, UINT32 layer, UINT32 addr);
void OVL_Set_Layer_Pitch(UINT32 ovl, UINT32 layer);
extern void OVL_Set_Pitch(UINT32 ovl, UINT32 layer, UINT32 stride, BOOL afbcen);
extern void OVL_Set_Pitch_From_Stride(UINT32 ovl, UINT32 layer, UINT32 stride);
extern void OVL_Update_Layer_Pitch(UINT32 layer);
extern void OVL_Flip(UINT32 layer, UINT32 type);
extern void OVL_Clip(UINT32 layer, UINT32 left, UINT32 right, UINT32 top, UINT32 bottom);
extern void OVL_Clip_Each(UINT32 layer, UINT32 left, UINT32 right, UINT32 top, UINT32 bottom, UINT32 ovl_idx);

void OVL_Set_WDMA_Addr(UINT32 wdma, UINT32 addr);
extern void OVL_Set_WDMA_Size(UINT32 wdma, UINT32 width, UINT32 height);
extern void OVL_Set_WDMA_Clip_Size(UINT32 wdma, UINT32 width, UINT32 height);
extern void OVL_Set_WDMA_Format(UINT32 type);
extern void OVL_Set_WDMA_Pitch(void);
extern void OVL_Set_Debug_Level(UINT32 level);
extern void OVL_Set_Test_Address(UINT32 idx,UINT32 value);
extern void OVL_Query(void);
extern void OVL_Pattern(UINT32 ovl_mode, UINT32 pattern_mode, UINT32 ovl_idx, UINT32 color);
extern void OVL_Print_Debug_Info(UINT32 loopTime, UINT32 loopPeriod);
extern void OVL_Unit_Test(UINT32 type, UINT32 ovl_idx,UINT32 loopTime);
extern void OVL_Unit_Test_CMP(BOOL decoupleMode, UINT32 size);
extern void OVL_Wait_Register_Update_Time(void);
extern void OVL_Wait(void);
extern void OVL_Unlock(void);
extern void OVL_Enable_M4U(void);
extern void OVL_Disable_M4U(void);
extern void OVL_M4U_Test_FHD(UINT32 mode, UINT32 layercnt, void *wdma_cpu_addr);
extern void OVL_WDMA_Trigger(UINT32 wdma_idx);
extern void OVL_SetClk(void);
BOOL OVL_Cmp_Mem(UINT32 goldAddr, UINT32 resAddr, UINT32 size,UINT32 format);
UINT32 OVL_Alloc_Memory(void);
BOOL OVL_Init_Buffer(void);
void OVL_Calculate_Pitch(UINT32 width, UINT32 format, UINT32 afbcEn, UINT32* pitch);
extern UINT32 OVL_Calculate_Bpp(UINT32 format);
void OVL_Calculate_Header_Pitch(UINT32 width, UINT32 format, UINT32* pitchHdr);
void OVL_Calculate_Flip_Addr(UINT32 type, UINT32 pitch, UINT32 srcH, UINT32* addr);
void OVL_Calculate_Flip_Addr_OVL1(UINT32 type, UINT32 pitch, UINT32 srcH, UINT32* addr);
//void OVL_Calculate_Right_Addr_Offset(UINT32 width, UINT32 format, UINT32 afbcEn, UINT32* pitch);
void OVL_Clear_OVL_Status(UINT32 ovl);
void OVL_Clear_WDMA_Status(UINT32 wdma);
BOOL OVL_OVL_Frame_Completed(UINT32 ovl);
BOOL OVL_WDMA_Frame_Completed(UINT32 wdma);
void OVL_Unit_Test_FHD(UINT32 ovl_idx,UINT32 fourlayer);
void OVL_Unit_Test_FHD_ARGB8888_AFBC(void);
void OVL_Unit_Test_UHD_ARGB8888(UINT32 layer_cnt,UINT32 mode);
void OVL_Unit_Test_UHD_ARGB8888_AFBC(UINT32 mode);
void OVL_Unit_Test_Directlink_Decouple_Switch(UINT32 loopTime);
void OVL_Unit_Test_FHD_DirectLink(UINT32 mode);
void OVL_Unit_Test_FHD_AFBC_DirectLink(UINT32 mode);
void OVL_Unit_Test_Cursor_Shift(UINT32 mode, UINT32 offset);
void OVL_Unit_Test_OVL2Path(UINT32 width, UINT32 height);



#endif
