/* SPDX-License-Identifier: LGPL-2.1-only OR BSD-3-Clause */
/******************************************************************************
 *
 * This file is provided under a dual license.  When you use or
 * distribute this software, you may choose to be licensed under
 * version 2.1 of the GNU Lesser General Public License
 * ("LGPLv2.1 License") or BSD License.
 *
 * LGPLv2.1 License
 *
 * Copyright(C) 2019 MediaTek Inc.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of version 2.1 of the GNU Lesser General Public
 * License as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html for more
 * details.
 *
 * BSD LICENSE
 *
 * Copyright(C) 2019 MediaTek Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 *  * Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *  * Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *  * Neither the name of the copyright holder nor the names of its
 *    contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 *****************************************************************************/


#ifndef _HW_REGEN_H_
#define _HW_REGEN_H_

#include "x_hal_5381.h"

#define IO_REGEN_BASE  (IO_VIRT + 0x23000)


//Page PRE_RE_GEN_MAIN
#define PRE_RE_GEN_MAIN_00 (IO_REGEN_BASE  + 0x1B0)
    #define PRE_RE_GEN_MAIN_ATPG_OB Fld(1,31,AC_MSKB3)//[31:31]
    #define PRE_RE_GEN_MAIN_ATPG_CT Fld(1,30,AC_MSKB3)//[30:30]
    #define RG_M_SET_RES_FINISHED_O Fld(1,29,AC_MSKB3)//[29:29]
    #define RG_M_SET_RES_FINISHED_I Fld(1,28,AC_MSKB3)//[28:28]
    #define RG_M_SET_RES_CLEAR_O Fld(1,27,AC_MSKB3)//[27:27]
    #define RG_M_SET_RES_CLEAR_I Fld(1,26,AC_MSKB3)//[26:26]
    #define RG_M_SET_RES_ACTIVE Fld(1,25,AC_MSKB3)//[25:25]
    #define RG_M_SET_RES_MODE Fld(2,16,AC_MSKB2)//[17:16]
    #define RG_M_IN_FORMAT Fld(4,12,AC_MSKB1)//[15:12]
    #define RG_M_BYPASS_SET_RES_DB Fld(1,11,AC_MSKB1)//[11:11]
    #define RG_M_IN_DISP_R_SEL Fld(1,10,AC_MSKB1)//[10:10]
    #define RG_M_LR_PAIR_CTRL Fld(2,8,AC_MSKB1)//[9:8]
    #define RG_M_SET_RES_IN_TRIG_SEL Fld(1,5,AC_MSKB0)//[5:5]
    #define RG_M_EVEN_ONLY Fld(1,4,AC_MSKB0)//[4:4]
    #define RG_M_ODD_ONLY Fld(1,3,AC_MSKB0)//[3:3]
    #define RG_M_CLIP_EN Fld(1,2,AC_MSKB0)//[2:2]
    #define RG_M_REGEN_ENABLE Fld(1,1,AC_MSKB0)//[1:1]
    #define RG_M_REGEN_BYPASS Fld(1,0,AC_MSKB0)//[0:0]
#define PRE_RE_GEN_MAIN_01 (IO_REGEN_BASE  + 0x1B4)
    #define RG_M_IN_ACTIVE_HEIGHT Fld(16,16,AC_FULLW32)//[31:16]
    #define RG_M_IN_ACTIVE_WIDTH Fld(16,0,AC_FULLW10)//[15:0]
#define PRE_RE_GEN_MAIN_02 (IO_REGEN_BASE  + 0x1B8)
    #define RG_M_OUT_ACTIVE_HEIGHT Fld(16,16,AC_FULLW32)//[31:16]
    #define RG_M_OUT_ACTIVE_WIDTH Fld(16,0,AC_FULLW10)//[15:0]
#define PRE_RE_GEN_MAIN_03 (IO_REGEN_BASE  + 0x1BC)
    #define RG_M_V_START_L Fld(16,16,AC_FULLW32)//[31:16]
    #define RG_M_H_START_L Fld(16,0,AC_FULLW10)//[15:0]
#define PRE_RE_GEN_MAIN_04 (IO_REGEN_BASE  + 0x1C0)
    #define RG_M_V_START_R Fld(16,16,AC_FULLW32)//[31:16]
    #define RG_M_H_START_R Fld(16,0,AC_FULLW10)//[15:0]
#define PRE_RE_GEN_MAIN_05 (IO_REGEN_BASE  + 0x1C4)
    #define RG_M_IN_HEIGHT_MEASURE Fld(16,16,AC_FULLW32)//[31:16]
    #define RG_M_IN_WIDTH_MEASURE Fld(16,0,AC_FULLW10)//[15:0]
#define PRE_RE_GEN_MAIN_06 (IO_REGEN_BASE  + 0x1C8)
    #define RG_M_OUT_HEIGHT_MEASURE Fld(16,16,AC_FULLW32)//[31:16]
    #define RG_M_OUT_WIDTH_MEASURE Fld(16,0,AC_FULLW10)//[15:0]


//Page PRE_RE_GEN_PIP
#define PRE_RE_GEN_PIP_00 (IO_REGEN_BASE  + 0x3B0)
    #define PRE_RE_GEN_PIP_ATPG_OB Fld(1,31,AC_MSKB3)//[31:31]
    #define PRE_RE_GEN_PIP_ATPG_CT Fld(1,30,AC_MSKB3)//[30:30]
    #define RG_P_SET_RES_FINISHED_O Fld(1,29,AC_MSKB3)//[29:29]
    #define RG_P_SET_RES_FINISHED_I Fld(1,28,AC_MSKB3)//[28:28]
    #define RG_P_SET_RES_CLEAR_O Fld(1,27,AC_MSKB3)//[27:27]
    #define RG_P_SET_RES_CLEAR_I Fld(1,26,AC_MSKB3)//[26:26]
    #define RG_P_SET_RES_ACTIVE Fld(1,25,AC_MSKB3)//[25:25]
    #define RG_P_SET_RES_MODE Fld(2,16,AC_MSKB2)//[17:16]
    #define RG_P_IN_FORMAT Fld(4,12,AC_MSKB1)//[15:12]
    #define RG_P_BYPASS_SET_RES_DB Fld(1,11,AC_MSKB1)//[11:11]
    #define RG_P_IN_DISP_R_SEL Fld(1,10,AC_MSKB1)//[10:10]
    #define RG_P_LR_PAIR_CTRL Fld(2,8,AC_MSKB1)//[9:8]
    #define RG_P_INPUT_SEL Fld(1,7,AC_MSKB0)//[7:7]
    #define RG_P_SET_RES_IN_TRIG_SEL Fld(1,5,AC_MSKB0)//[5:5]
    #define RG_P_EVEN_ONLY Fld(1,4,AC_MSKB0)//[4:4]
    #define RG_P_ODD_ONLY Fld(1,3,AC_MSKB0)//[3:3]
    #define RG_P_CLIP_EN Fld(1,2,AC_MSKB0)//[2:2]
    #define RG_P_REGEN_ENABLE Fld(1,1,AC_MSKB0)//[1:1]
    #define RG_P_REGEN_BYPASS Fld(1,0,AC_MSKB0)//[0:0]
#define PRE_RE_GEN_PIP_01 (IO_REGEN_BASE  + 0x3B4)
    #define RG_P_IN_ACTIVE_HEIGHT Fld(16,16,AC_FULLW32)//[31:16]
    #define RG_P_IN_ACTIVE_WIDTH Fld(16,0,AC_FULLW10)//[15:0]
#define PRE_RE_GEN_PIP_02 (IO_REGEN_BASE  + 0x3B8)
    #define RG_P_OUT_ACTIVE_HEIGHT Fld(16,16,AC_FULLW32)//[31:16]
    #define RG_P_OUT_ACTIVE_WIDTH Fld(16,0,AC_FULLW10)//[15:0]
#define PRE_RE_GEN_PIP_03 (IO_REGEN_BASE  + 0x3BC)
    #define RG_P_V_START_L Fld(16,16,AC_FULLW32)//[31:16]
    #define RG_P_H_START_L Fld(16,0,AC_FULLW10)//[15:0]
#define PRE_RE_GEN_PIP_04 (IO_REGEN_BASE  + 0x3C0)
    #define RG_P_V_START_R Fld(16,16,AC_FULLW32)//[31:16]
    #define RG_P_H_START_R Fld(16,0,AC_FULLW10)//[15:0]
#define PRE_RE_GEN_PIP_05 (IO_REGEN_BASE  + 0x3C4)
    #define RG_P_IN_HEIGHT_MEASURE Fld(16,16,AC_FULLW32)//[31:16]
    #define RG_P_IN_WIDTH_MEASURE Fld(16,0,AC_FULLW10)//[15:0]
#define PRE_RE_GEN_PIP_06 (IO_REGEN_BASE  + 0x3C8)
    #define RG_P_OUT_HEIGHT_MEASURE Fld(16,16,AC_FULLW32)//[31:16]
    #define RG_P_OUT_WIDTH_MEASURE Fld(16,0,AC_FULLW10)//[15:0]





#endif
