/**
 * @file hv_cal_OsdGrid.c
 * @brief Osd Cal Grid interface file.
 * @details This file provides the following functions: \n
 *          (1) Osd CAL layer initialization functions \n
 *
 * @author HiView SoC Software Team
 * @version 1.0.0
 * @date 2022-08-31
 * @copyright Copyright(c),2022-8, Hiview Software. All rights reserved.
 * @par History:
 * <table>
 * <tr><th>Author         <th>Date        <th>Change Description
 * <tr><td>OSD Group      <td>2022-08-31   <td>create
 * </table>
*/

#include "hv_drv_Osd.h"
#include "hv_cal_Osd.h"

static OsdGridPhyId g_enCurrentGridIndex = PHY_WIN0_GRID_0;

static OsdWindowPhyId Hv_Cal_OsdGrid_GetWindowIndex(VOID)
{
    return g_enCurrentGridIndex >> 1;
}

static UINT32 Hv_Cal_OsdGrid_GetBaseAddr(VOID)
{
    OsdWindowPhyId enWinIndex = Hv_Cal_OsdGrid_GetWindowIndex();
    UINT32 uiBaseAddr = Hv_Cal_OsdWindow_GetBaseAddr(enWinIndex);

    if (OSD_WINDOW_IS_NORMAL(enWinIndex))
    {
        return uiBaseAddr + _NORMAL_WIN_GRID_OFFSET + (g_enCurrentGridIndex - (enWinIndex << 1)) * OSD_GRID_SIZE;
    }
    else
    {
        return uiBaseAddr + _RECT_WIN_GRID_OFFSET + (g_enCurrentGridIndex - (enWinIndex << 1)) * OSD_GRID_SIZE;
    }
}

static INT32 Hv_Cal_OsdGrid_GetAddrOffset(VOID)
{
    OsdWindowPhyId enWinIndex = Hv_Cal_OsdGrid_GetWindowIndex();
    INT32 iAddrOff = 0;

    iAddrOff = enWinIndex * OSD_WIN_SIZE + (g_enCurrentGridIndex - (enWinIndex << 1)) * OSD_GRID_SIZE;

    if (!OSD_WINDOW_IS_NORMAL(enWinIndex))
    {
        iAddrOff += _RECT_WIN_GRID_OFFSET - _NORMAL_WIN_GRID_OFFSET;
    }

    return iAddrOff;
}

VOID Hv_Cal_OsdGrid_SetCurrentGrid(OsdGridPhyId enIndex)
{
    HV_ASSERT_TRUE_VOID(enIndex < PHY_GRID_ID_MAX);

    g_enCurrentGridIndex = enIndex;
}

VOID Hv_Cal_OsdGrid_SetEnable(OsdRegionType enType, BOOL bEnable)
{
    INT32 iAddrOff = Hv_Cal_OsdGrid_GetAddrOffset();

    if (OSD_REGION_NO_HIGHLIGHT == enType)
    {
        HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_80, iAddrOff, reg_00_rect0_enable_rect20, bEnable);
    }
    else if (OSD_REGION_HIGHLIGHT == enType)
    {
        HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_80, iAddrOff, reg_00_rect1_enable_rect20, bEnable);
    }
    else
    {
        return;
    }
}

BOOL Hv_Cal_OsdGrid_GetEnable(OsdRegionType enType)
{
    INT32 iAddrOff = Hv_Cal_OsdGrid_GetAddrOffset();
    HV_R32_DECL_VAR();

    if (OSD_REGION_NO_HIGHLIGHT == enType)
    {
        return HV_R32_FIELD_EX(OSD_KV_WIN_P4_00_80, iAddrOff, reg_00_rect0_enable_rect20);
    }
    else if (OSD_REGION_HIGHLIGHT == enType)
    {
        return HV_R32_FIELD_EX(OSD_KV_WIN_P4_00_80, iAddrOff, reg_00_rect1_enable_rect20);
    }
    else
    {
        return HV_FALSE;
    }
}

VOID Hv_Cal_OsdGrid_SetPos(USHORT16 usX, USHORT16 usY)
{
    INT32 iAddrOff = Hv_Cal_OsdGrid_GetAddrOffset();

    HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_B8, iAddrOff, reg_00_start_x_rect20, usX + 1);
    HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_B8, iAddrOff, reg_00_start_y_rect20, usY + 1);
}

VOID Hv_Cal_OsdGrid_GetPos(USHORT16 *pusX, USHORT16 *pusY)
{
    INT32 iAddrOff = Hv_Cal_OsdGrid_GetAddrOffset();
    HV_R32_DECL_VAR();

    *pusX = HV_R32_FIELD_EX(OSD_KV_WIN_P4_00_B8, iAddrOff, reg_00_start_x_rect20);
    *pusX = (*pusX > 0) ? (*pusX - 1) : 0;
    *pusY = HV_R32_FIELD_EX(OSD_KV_WIN_P4_00_B8, iAddrOff, reg_00_start_y_rect20);
    *pusY = (*pusY > 0) ? (*pusY - 1) : 0;
}

VOID Hv_Cal_OsdGrid_SetRectNum(UCHAR8 ucHnum, UCHAR8 ucVnum)
{
    INT32 iAddrOff = Hv_Cal_OsdGrid_GetAddrOffset();

    /* IP restriction */
    ucHnum = (ucHnum > 0) ? (ucHnum - 1) : 0;
    ucHnum = (ucHnum > OSD_HNUM_MAX) ? OSD_HNUM_MAX : ucHnum;
    ucVnum = (ucVnum > OSD_VNUM_MAX) ? OSD_VNUM_MAX : ucVnum;

    HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_84, iAddrOff, reg_00_num_h_rect20, ucHnum);
    HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_84, iAddrOff, reg_00_num_v_rect20, ucVnum);
}

VOID Hv_Cal_OsdGrid_GetRectNum(UCHAR8 *pucHnum, UCHAR8 *pucVnum)
{
    INT32 iAddrOff = Hv_Cal_OsdGrid_GetAddrOffset();
    HV_R32_DECL_VAR();

    *pucHnum = HV_R32_FIELD_EX(OSD_KV_WIN_P4_00_84, iAddrOff, reg_00_num_h_rect20) + 1;
    *pucVnum = HV_R32_FIELD_EX(OSD_KV_WIN_P4_00_84, iAddrOff, reg_00_num_v_rect20);
}

VOID Hv_Cal_OsdGrid_SetRectSize(USHORT16 usWidth, USHORT16 usHeight)
{
    INT32 iAddrOff = Hv_Cal_OsdGrid_GetAddrOffset();

    /* IP restriction */
    usWidth = (usWidth > 0) ? (usWidth - 1) : 0;
    usHeight = (usHeight > 0) ? (usHeight - 1) : 0;

    HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_8C, iAddrOff, reg_00_size_x_rect20, usWidth);
    HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_8C, iAddrOff, reg_00_size_y_rect20, usHeight);
}

VOID Hv_Cal_OsdGrid_GetRectSize(USHORT16 *pusWidth, USHORT16 *pusHeight)
{
    INT32 iAddrOff = Hv_Cal_OsdGrid_GetAddrOffset();
    HV_R32_DECL_VAR();

    *pusWidth = HV_R32_FIELD_EX(OSD_KV_WIN_P4_00_8C, iAddrOff, reg_00_size_x_rect20) + 1;
    *pusHeight = HV_R32_FIELD_EX(OSD_KV_WIN_P4_00_8C, iAddrOff, reg_00_size_y_rect20) + 1;
}

VOID Hv_Cal_OsdGrid_SetSpace(UCHAR8 ucHSpace, UCHAR8 ucVSpace)
{
    INT32 iAddrOff = Hv_Cal_OsdGrid_GetAddrOffset();

    /* IP restriction */
    ucHSpace = (ucHSpace == 0xFF) ? 0xFF : (ucHSpace + 1);
    ucVSpace = (ucVSpace == 0xFF) ? 0xFF : (ucVSpace + 1);

    HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_84, iAddrOff, reg_00_h_space_rect20, ucHSpace);
    HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_84, iAddrOff, reg_00_v_space_rect20, ucVSpace);
}

VOID Hv_Cal_OsdGrid_GetSpace(UCHAR8 *pucHSpace, UCHAR8 *pucVSpace)
{
    INT32 iAddrOff = Hv_Cal_OsdGrid_GetAddrOffset();
    HV_R32_DECL_VAR();

    *pucHSpace = HV_R32_FIELD_EX(OSD_KV_WIN_P4_00_84, iAddrOff, reg_00_h_space_rect20);
    *pucHSpace = (*pucHSpace > 0) ? (*pucHSpace - 1) : 0;
    *pucVSpace = HV_R32_FIELD_EX(OSD_KV_WIN_P4_00_84, iAddrOff, reg_00_v_space_rect20);
    *pucVSpace = (*pucVSpace > 0) ? (*pucVSpace - 1) : 0;
}

VOID Hv_Cal_OsdGrid_SetRectBorderEnable(OsdRegionType enType, BOOL bEnable)
{
    INT32 iAddrOff = Hv_Cal_OsdGrid_GetAddrOffset();

    if (OSD_REGION_NO_HIGHLIGHT == enType)
    {
        HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_80, iAddrOff, reg_00_rect0_border_enable_rect20, bEnable);
    }
    else if (OSD_REGION_HIGHLIGHT == enType)
    {
        HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_80, iAddrOff, reg_00_rect1_border_enable_rect20, bEnable);
    }
    else
    {
        return;
    }
}

VOID Hv_Cal_OsdGrid_SetRectBorderType(OsdRectBorderType enType)
{
    INT32 iAddrOff = Hv_Cal_OsdGrid_GetAddrOffset();
    INT32 iTypeValue = 0;

    if (OSD_BORDER_2D == enType)
    {
        iTypeValue = 0;
    }
    else if (OSD_BORDER_3D == enType)
    {
        iTypeValue = 0x8;
    }
    else
    {
        return;
    }

    HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_80, iAddrOff, reg_00_border_type_rect20, iTypeValue);
}

VOID Hv_Cal_OsdGrid_SetRectBorderSize(UCHAR8 ucSizeX, UCHAR8 ucSizeY)
{
    INT32 iAddrOff = Hv_Cal_OsdGrid_GetAddrOffset();

    /* IP restriction */
    ucSizeX = (ucSizeX > 0) ? (ucSizeX - 1) : 0;
    ucSizeX = (ucSizeX > OSD_BORDER_SIZE_MAX) ? OSD_BORDER_SIZE_MAX : ucSizeX;
    ucSizeY = (ucSizeY > 0) ? (ucSizeY - 1) : 0;
    ucSizeY = (ucSizeY > OSD_BORDER_SIZE_MAX) ? OSD_BORDER_SIZE_MAX : ucSizeY;

    HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_80, iAddrOff, reg_00_border_size_x_rect20, ucSizeX);
    HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_80, iAddrOff, reg_00_border_size_y_rect20, ucSizeY);
}

VOID Hv_Cal_OsdGrid_SetRectBorderColor(OsdRegionType enType, USHORT16 usTopColor, USHORT16 usBottomColor, USHORT16 usLeftColor, USHORT16 usRightColor)
{
    INT32 iAddrOff = Hv_Cal_OsdGrid_GetAddrOffset();

    if (OSD_REGION_NO_HIGHLIGHT == enType)
    {
        HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_90, iAddrOff, reg_00_rect0_border_color0_rect20, usTopColor);
        HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_90, iAddrOff, reg_00_rect0_border_color1_rect20, usBottomColor);
        HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_94, iAddrOff, reg_00_rect0_border_color2_rect20, usLeftColor);
        HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_94, iAddrOff, reg_00_rect0_border_color3_rect20, usRightColor);
    }
    else if (OSD_REGION_HIGHLIGHT == enType)
    {
        HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_A4, iAddrOff, reg_00_rect1_border_color0_rect20, usTopColor);
        HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_A4, iAddrOff, reg_00_rect1_border_color1_rect20, usBottomColor);
        HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_A8, iAddrOff, reg_00_rect1_border_color2_rect20, usLeftColor);
        HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_A8, iAddrOff, reg_00_rect1_border_color3_rect20, usRightColor);
    }
    else
    {
        return;
    }
}

VOID Hv_Cal_OsdGrid_SetRectShadowEnable(OsdRegionType enType, BOOL bEnable)
{
    INT32 iAddrOff = Hv_Cal_OsdGrid_GetAddrOffset();

    if (OSD_REGION_NO_HIGHLIGHT == enType)
    {
        HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_80, iAddrOff, reg_00_rect0_shadow_enable_rect20, bEnable);
    }
    else if (OSD_REGION_HIGHLIGHT == enType)
    {
        HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_80, iAddrOff, reg_00_rect1_shadow_enable_rect20, bEnable);
    }
    else
    {
        return;
    }
}

VOID Hv_Cal_OsdGrid_SetRectShadowType(OsdRectShadowType enType)
{
    HV_ASSERT_TRUE_VOID(enType < OSD_SHADOW_MAX);

    INT32 iAddrOff = Hv_Cal_OsdGrid_GetAddrOffset();

    HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_80, iAddrOff, reg_00_shadow_type_rect20, enType);
}

VOID Hv_Cal_OsdGrid_SetRectShadowSize(UCHAR8 ucSizeX, UCHAR8 ucSizeY)
{
    INT32 iAddrOff = Hv_Cal_OsdGrid_GetAddrOffset();

    /* IP restriction */
    ucSizeX = (ucSizeX > 0) ? (ucSizeX - 1) : 0;
    ucSizeX = (ucSizeX > OSD_SHADOW_SIZE_MAX) ? OSD_SHADOW_SIZE_MAX : ucSizeX;
    ucSizeY = (ucSizeY > 0) ? (ucSizeY - 1) : 0;
    ucSizeY = (ucSizeY > OSD_SHADOW_SIZE_MAX) ? OSD_SHADOW_SIZE_MAX : ucSizeY;

    HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_80, iAddrOff, reg_00_shadow_size_x_rect20, ucSizeX);
    HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_80, iAddrOff, reg_00_shadow_size_y_rect20, ucSizeY);
}

VOID Hv_Cal_OsdGrid_SetRectShadowColor(OsdRegionType enType, USHORT16 usColor)
{
    INT32 iAddrOff = Hv_Cal_OsdGrid_GetAddrOffset();

    if (OSD_REGION_NO_HIGHLIGHT == enType)
    {
        HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_98, iAddrOff, reg_00_rect0_shadow_color_rect20, usColor);
    }
    else if (OSD_REGION_HIGHLIGHT == enType)
    {
        HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_AC, iAddrOff, reg_00_rect1_shadow_color_rect20, usColor);
    }
    else
    {
        return;
    }
}

VOID Hv_Cal_OsdGrid_SetRectBackgroundEnable(OsdRegionType enType, BOOL bEnable)
{
    INT32 iAddrOff = Hv_Cal_OsdGrid_GetAddrOffset();

    if (OSD_REGION_NO_HIGHLIGHT == enType)
    {
        HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_80, iAddrOff, reg_00_rect0_fill_rect20, bEnable);
    }
    else if (OSD_REGION_HIGHLIGHT == enType)
    {
        HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_80, iAddrOff, reg_00_rect1_fill_rect20, bEnable);
    }
    else
    {
        return;
    }
}

VOID Hv_Cal_OsdGrid_SetRectBackgroundGradientEnable(OsdRegionType enType, BOOL bEnable)
{
    INT32 iAddrOff = Hv_Cal_OsdGrid_GetAddrOffset();

    if (OSD_REGION_NO_HIGHLIGHT == enType)
    {
        HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_80, iAddrOff, reg_00_rect0_gradient_enable_rect20, bEnable);
    }
    else if (OSD_REGION_HIGHLIGHT == enType)
    {
        HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_80, iAddrOff, reg_00_rect1_gradient_enable_rect20, bEnable);
    }
    else
    {
        return;
    }
}

VOID Hv_Cal_OsdGrid_SetRectBackgroundColor(OsdRegionType enType, USHORT16 usStartColor, USHORT16 usEndColor)
{
    INT32 iAddrOff = Hv_Cal_OsdGrid_GetAddrOffset();

    if (OSD_REGION_NO_HIGHLIGHT == enType)
    {
        HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_A0, iAddrOff, reg_00_rect0_bg_start_color_rect20, usStartColor);
        HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_A0, iAddrOff, reg_00_rect0_bg_end_color_rect20, usEndColor);
    }
    else if (OSD_REGION_HIGHLIGHT == enType)
    {
        HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_B4, iAddrOff, reg_00_rect1_bg_start_color_rect20, usStartColor);
        HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_B4, iAddrOff, reg_00_rect1_bg_end_color_rect20, usEndColor);
    }
    else
    {
        return;
    }
}

VOID Hv_Cal_OsdGrid_SetRectGradientType(OsdRegionType enType, OsdGradientType enGradientType)
{
    HV_ASSERT_TRUE_VOID(enGradientType < OSD_GRADIENT_MAX);

    INT32 iAddrOff = Hv_Cal_OsdGrid_GetAddrOffset();

    if (OSD_REGION_NO_HIGHLIGHT == enType)
    {
        HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_98, iAddrOff, reg_00_rect0_gradient_type_rect20, enGradientType);
    }
    else if (OSD_REGION_HIGHLIGHT == enType)
    {
        HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_AC, iAddrOff, reg_00_rect1_gradient_type_rect20, enGradientType);
    }
    else
    {
        return;
    }
}

VOID Hv_Cal_OsdGrid_SetRectGradientStep(OsdRegionType enType, USHORT16 usStepR, USHORT16 usStepG, USHORT16 usStepB)
{
    INT32 iAddrOff = Hv_Cal_OsdGrid_GetAddrOffset();

    if (OSD_REGION_NO_HIGHLIGHT == enType)
    {
        HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_9C, iAddrOff, reg_00_rect0_gradient_step_factor_r_rect20, usStepR);
        HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_9C, iAddrOff, reg_00_rect0_gradient_step_factor_g_rect20, usStepG);
        HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_9C, iAddrOff, reg_00_rect0_gradient_step_factor_b_rect20, usStepB);
    }
    else if (OSD_REGION_HIGHLIGHT == enType)
    {
        HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_B0, iAddrOff, reg_00_rect1_gradient_step_factor_r_rect20, usStepR);
        HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_B0, iAddrOff, reg_00_rect1_gradient_step_factor_g_rect20, usStepG);
        HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_B0, iAddrOff, reg_00_rect1_gradient_step_factor_b_rect20, usStepB);
    }
    else
    {
        return;
    }
}

VOID Hv_Cal_OsdGrid_SetHighlightHRange(UCHAR8 ucHStartNum, UCHAR8 ucHEndNum)
{
    INT32 iAddrOff = Hv_Cal_OsdGrid_GetAddrOffset();

    /* IP restriction */
    ucHStartNum = (ucHStartNum > 0) ? (ucHStartNum - 1) : 0;
    ucHStartNum = (ucHStartNum > OSD_HL_HNUM_MAX) ? OSD_HL_HNUM_MAX : ucHStartNum;
    ucHEndNum = (ucHEndNum > 0) ? (ucHEndNum - 1) : 0;
    ucHEndNum = (ucHEndNum > OSD_HL_HNUM_MAX) ? OSD_HL_HNUM_MAX : ucHEndNum;

    HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_84, iAddrOff, reg_00_hl_rect_num_h0_rect20, ucHStartNum);
    HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_88, iAddrOff, reg_00_hl_rect_num_h1_rect20, ucHEndNum);
}

VOID Hv_Cal_OsdGrid_SetHighlightVRange(UCHAR8 ucVStartNum, UCHAR8 ucVEndNum)
{
    INT32 iAddrOff = Hv_Cal_OsdGrid_GetAddrOffset();

    /* IP restriction */
    ucVStartNum = (ucVStartNum > 0) ? (ucVStartNum - 1) : 0;
    ucVStartNum = (ucVStartNum > OSD_HL_VNUM_MAX) ? OSD_HL_VNUM_MAX : ucVStartNum;
    ucVEndNum = (ucVEndNum > 0) ? (ucVEndNum - 1) : 0;
    ucVEndNum = (ucVEndNum > OSD_HL_VNUM_MAX) ? OSD_HL_VNUM_MAX : ucVEndNum;

    HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_84, iAddrOff, reg_00_hl_rect_num_v0_rect20, ucVStartNum);
    HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_88, iAddrOff, reg_00_hl_rect_num_v1_rect20, ucVEndNum);
}

VOID Hv_Cal_OsdGrid_SetHighlightMode(OsdHighLightMode enMode)
{
    HV_ASSERT_TRUE_VOID(enMode < OSD_HIGHLIGHT_MAX);

    INT32 iAddrOff = Hv_Cal_OsdGrid_GetAddrOffset();

    HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_8C, iAddrOff, reg_00_hl_mode_select_rect20, enMode);
}

VOID Hv_Cal_OsdGrid_SetHighlightHMode(OsdHighLightAxisMode enMode)
{
    HV_ASSERT_TRUE_VOID(enMode < MATCH_MAX);

    INT32 iAddrOff = Hv_Cal_OsdGrid_GetAddrOffset();

    HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_8C, iAddrOff, reg_00_hl_mode_h_rect20, enMode);
}

VOID Hv_Cal_OsdGrid_SetHighlightVMode(OsdHighLightAxisMode enMode)
{
    HV_ASSERT_TRUE_VOID(enMode < MATCH_MAX);

    INT32 iAddrOff = Hv_Cal_OsdGrid_GetAddrOffset();

    HV_W32_FIELD_EX(OSD_KV_WIN_P4_00_8C, iAddrOff, reg_00_hl_mode_v_rect20, enMode);
}


