xref: /utopia/UTPA2-700.0.x/modules/xc/drv/xc/include/drv_sc_DIP_scaling.h (revision 53ee8cc121a030b8d368113ac3e966b4705770ef)
1 //<MStar Software>
2 //******************************************************************************
3 // MStar Software
4 // Copyright (c) 2010 - 2012 MStar Semiconductor, Inc. All rights reserved.
5 // All software, firmware and related documentation herein ("MStar Software") are
6 // intellectual property of MStar Semiconductor, Inc. ("MStar") and protected by
7 // law, including, but not limited to, copyright law and international treaties.
8 // Any use, modification, reproduction, retransmission, or republication of all
9 // or part of MStar Software is expressly prohibited, unless prior written
10 // permission has been granted by MStar.
11 //
12 // By accessing, browsing and/or using MStar Software, you acknowledge that you
13 // have read, understood, and agree, to be bound by below terms ("Terms") and to
14 // comply with all applicable laws and regulations:
15 //
16 // 1. MStar shall retain any and all right, ownership and interest to MStar
17 //    Software and any modification/derivatives thereof.
18 //    No right, ownership, or interest to MStar Software and any
19 //    modification/derivatives thereof is transferred to you under Terms.
20 //
21 // 2. You understand that MStar Software might include, incorporate or be
22 //    supplied together with third party`s software and the use of MStar
23 //    Software may require additional licenses from third parties.
24 //    Therefore, you hereby agree it is your sole responsibility to separately
25 //    obtain any and all third party right and license necessary for your use of
26 //    such third party`s software.
27 //
28 // 3. MStar Software and any modification/derivatives thereof shall be deemed as
29 //    MStar`s confidential information and you agree to keep MStar`s
30 //    confidential information in strictest confidence and not disclose to any
31 //    third party.
32 //
33 // 4. MStar Software is provided on an "AS IS" basis without warranties of any
34 //    kind. Any warranties are hereby expressly disclaimed by MStar, including
35 //    without limitation, any warranties of merchantability, non-infringement of
36 //    intellectual property rights, fitness for a particular purpose, error free
37 //    and in conformity with any international standard.  You agree to waive any
38 //    claim against MStar for any loss, damage, cost or expense that you may
39 //    incur related to your use of MStar Software.
40 //    In no event shall MStar be liable for any direct, indirect, incidental or
41 //    consequential damages, including without limitation, lost of profit or
42 //    revenues, lost or damage of data, and unauthorized system use.
43 //    You agree that this Section 4 shall still apply without being affected
44 //    even if MStar Software has been modified by MStar in accordance with your
45 //    request or instruction for your use, except otherwise agreed by both
46 //    parties in writing.
47 //
48 // 5. If requested, MStar may from time to time provide technical supports or
49 //    services in relation with MStar Software to you for your use of
50 //    MStar Software in conjunction with your or your customer`s product
51 //    ("Services").
52 //    You understand and agree that, except otherwise agreed by both parties in
53 //    writing, Services are provided on an "AS IS" basis and the warranty
54 //    disclaimer set forth in Section 4 above shall apply.
55 //
56 // 6. Nothing contained herein shall be construed as by implication, estoppels
57 //    or otherwise:
58 //    (a) conferring any license or right to use MStar name, trademark, service
59 //        mark, symbol or any other identification;
60 //    (b) obligating MStar or any of its affiliates to furnish any person,
61 //        including without limitation, you and your customers, any assistance
62 //        of any kind whatsoever, or any information; or
63 //    (c) conferring any license or right under any intellectual property right.
64 //
65 // 7. These terms shall be governed by and construed in accordance with the laws
66 //    of Taiwan, R.O.C., excluding its conflict of law rules.
67 //    Any and all dispute arising out hereof or related hereto shall be finally
68 //    settled by arbitration referred to the Chinese Arbitration Association,
69 //    Taipei in accordance with the ROC Arbitration Law and the Arbitration
70 //    Rules of the Association by three (3) arbitrators appointed in accordance
71 //    with the said Rules.
72 //    The place of arbitration shall be in Taipei, Taiwan and the language shall
73 //    be English.
74 //    The arbitration award shall be final and binding to both parties.
75 //
76 //******************************************************************************
77 //<MStar Software>
78 ////////////////////////////////////////////////////////////////////////////////
79 //
80 // Copyright (c) 2008-2009 MStar Semiconductor, Inc.
81 // All rights reserved.
82 //
83 // Unless otherwise stipulated in writing, any and all information contained
84 // herein regardless in any format shall remain the sole proprietary of
85 // MStar Semiconductor Inc. and be kept in strict confidence
86 // ("MStar Confidential Information") by the recipient.
87 // Any unauthorized act including without limitation unauthorized disclosure,
88 // copying, use, reproduction, sale, distribution, modification, disassembling,
89 // reverse engineering and compiling of the contents of MStar Confidential
90 // Information is unlawful and strictly prohibited. MStar hereby reserves the
91 // rights to any and all damages, losses, costs and expenses resulting therefrom.
92 //
93 ////////////////////////////////////////////////////////////////////////////////
94 
95 #ifndef SC_DIP_H
96 #define SC_DIP_H
97 ////===========================>>SW DB Buffer
98 #ifdef DRV_SC_DIPSCALING_C
99 #define INTERFACE
100 #else
101 #define INTERFACE extern
102 #endif
103 
104 #define ALIGN_CHECK(value,factor) ((value + factor-1) & (~(factor-1)))
105 #define DIP_BYTE_PER_WORD       16UL
106 #define DIP_HVD_TILE_BLOCK_H    16UL
107 #define DIP_HVD_TILE_BLOCK_V    32UL
108 #define DWIN_W_LIMITE_OFT       31UL
109 #define DWIN_BYTE_PER_WORD      32UL
110 
111 typedef struct
112 {
113     MS_U16 u16H_CapStart;
114     MS_U16 u16H_CapSize;
115     MS_U16 u16V_CapStart;
116     MS_U16 u16V_CapSize;
117 
118     MS_U32 u32H_PreScalingRatio;
119     MS_U32 u32V_PreScalingRatio;
120 
121     MS_U16 u16DNROffset;
122     MS_U16 u16DNRFetch;
123 }SC_DIP_SWDB_INFO, *P_SC_DIP_SWDB_INFO;
124 
125 /// DWIN scan mode
126 typedef enum
127 {
128     GOPDWIN_SCAN_MODE_AUTO = 0,
129     GOPDWIN_SCAN_MODE_PROGRESSIVE = GOPDWIN_SCAN_MODE_AUTO,  ///< Progressive scan
130     GOPDWIN_SCAN_MODE_INTERLACE,  ///< Interlace scan
131     GOPDWIN_SCAN_MODE_MAX
132 } EN_XC_DWIN_SCAN_TYPE;
133 
134 /// DWIN source data format
135 typedef enum
136 {
137     /// YCrYCb.
138     XC_DWIN_DATA_FMT_YUV422 = 0,
139     /// RGB domain
140     XC_DWIN_DATA_FMT_RGB565,
141     /// RGB domain
142     XC_DWIN_DATA_FMT_ARGB8888,
143     /// YUV420 HVD tile fmt
144     XC_DWIN_DATA_FMT_YUV420,
145     /// YC separate 422
146     XC_DWIN_DATA_FMT_YC422,
147     /// YUV420 H265 tile fmt
148     XC_DWIN_DATA_FMT_YUV420_H265,
149     /// YUV420 H265 10 bits tile fmt
150     XC_DWIN_DATA_FMT_YUV420_H265_10BITS,
151     /// YUV420 planer
152     XC_DWIN_DATA_FMT_YUV420_PLANER,
153     /// YUV420 semi planer
154     XC_DWIN_DATA_FMT_YUV420_SEMI_PLANER,
155     XC_DWIN_DATA_FMT_MAX
156 } EN_DRV_XC_DWIN_DATA_FMT;
157 
158 /// DIP OP-TEE Operation mode
159 typedef enum
160 {
161     /// unLock_output.
162     XC_DIP_OPMODE_UNLOCK_OUTPUT = 0,
163     /// unLock_output.
164     XC_DIP_OPMODE_LOCK_OUTPUT = 1,
165     /// Enable.
166     XC_DIP_OPMODE_ENABLE = 2,
167     /// Disable.
168     XC_DIP_OPMODE_DISABLE = 3,
169 } EN_DRV_XC_DIP_OPERATIONMODE;
170 
171 typedef struct
172 {
173     MS_U32 u32PipeID;
174     MS_U32 u32SecureDMA;
175     MS_U32 u32OperationMode;
176     MS_U32 u32ReturnValue;
177 }DIP_CONFIG_PIPE;
178 
179 INTERFACE SC_DIP_SWDB_INFO stDIP_DBreg[MAX_DIP_WINDOW];         ///< SW double buffer
180 
181 void MDrv_XC_DIP_SWReset(void* pInstance,SCALER_DIP_WIN eWindow);
182 void MDrv_XC_DIP_Init(void* pInstance,SCALER_DIP_WIN eWindow);
183 void MDrv_XC_DIP_CMDQ_SetAction(void* pInstance,EN_XC_DIP_CMDQ_ACTION eAction, SCALER_DIP_WIN eWindow);
184 void MDrv_XC_DIP_CMDQ_SetOperations(void* pInstance, cmd_mload_utopia_interface *pOps, MS_BOOL bEnable, SCALER_DIP_WIN eWindow);
185 
186 void MDrv_XC_DWIN_init_swdb(void* pInstance,SCALER_DIP_WIN eWindow);
187 void MDrv_XC_DWIN_sw_db(void* pInstance,P_SC_DIP_SWDB_INFO pDBreg, SCALER_DIP_WIN eWindow);
188 void MDrv_XC_DWIN_SetInputSource(void* pInstance,INPUT_SOURCE_TYPE_t enInputSourceType, SCALER_DIP_WIN eWindow);
189 void MDrv_XC_DWIN_GetInputSource(void* pInstance,INPUT_SOURCE_TYPE_t *enInputSourceType,SCALER_DIP_WIN eWindow);
190 void MDrv_XC_DWIN_DisableInputSource(void* pInstance,MS_BOOL bDisable, SCALER_DIP_WIN eWindow);
191 void MDrv_XC_DWIN_SetFrameBufferAddress(void* pInstance,MS_PHY u64FBAddress, MS_PHY u64FBSize, SCALER_DIP_WIN eWindow);
192 void MDrv_XC_DWIN_set_capture_v_start(void* pInstance,MS_U16 u16Vstart , SCALER_DIP_WIN eWindow);
193 void MDrv_XC_DWIN_set_capture_h_start(void* pInstance,MS_U16 u16Vstart , SCALER_DIP_WIN eWindow);
194 void MDrv_XC_DWIN_set_capture_v_size(void* pInstance,MS_U16 u16Vsize , SCALER_DIP_WIN eWindow);
195 void MDrv_XC_DWIN_set_capture_h_size(void* pInstance,MS_U16 u16Hsize , SCALER_DIP_WIN eWindow);
196 void MDrv_XC_DWIN_set_capture_window(void* pInstance,SCALER_DIP_WIN eWindow);
197 void MDrv_XC_DWIN_get_capture_window(void* pInstance,MS_WINDOW_TYPE* capture_win,SCALER_DIP_WIN eWindow);
198 void MDrv_XC_DWIN_get_DE_Window(void* pInstance,MS_WINDOW_TYPE* psWin,SCALER_DIP_WIN eWindow);
199 void MDrv_XC_DWIN_EnableR2YCSC(void* pInstance,MS_BOOL benable, SCALER_DIP_WIN eWindow);
200 void MDrv_XC_DWIN_set_delayline(void* pInstance,MS_U8 u8DelayLines, SCALER_DIP_WIN eWindow );
201 void MDrv_XC_DWIN_set_prescaling_ratio(void* pInstance,INPUT_SOURCE_TYPE_t enInputSourceType, XC_DIP_InternalStatus *pSrcInfo, SCALER_DIP_WIN eWindow);
202 void MDrv_XC_DWIN_set_storeFrameNUM(void* pInstance,SCALER_DIP_WIN eWindow,MS_U8 u8FrameNum);
203 void MDrv_XC_DWIN_set_fetch_number_limit(void* pInstance,XC_DIP_InternalStatus *pSrcInfo, SCALER_DIP_WIN eWindow);
204 void MDrv_XC_DWIN_EnableIPAutoCoast(void* pInstance,MS_BOOL bEnable, SCALER_DIP_WIN eWindow);
205 void MDrv_XC_DWIN_Scaler_Field_Detect(void* pInstance,INPUT_SOURCE_TYPE_t enInputSrcType, EN_XC_DWIN_SCAN_TYPE enScanType, SCALER_DIP_WIN eWindow);
206 void MDrv_XC_DWIN_Disable_IPM_ReadWriteRequest(void* pInstance,MS_BOOL bDisable, SCALER_DIP_WIN eWindow);
207 void MDrv_XC_DWIN_SetMode(void* pInstance,INPUT_SOURCE_TYPE_t enInputSourceType, XC_DIP_InternalStatus *pSrcInfo, SCALER_DIP_WIN eWindow);
208 //==============Set===================
209 void MDrv_XC_DIP_SetWindow(void* pInstance,XC_SETWIN_INFO *pstXC_SetWin_Info, MS_U32 u32InitDataLen, SCALER_DIP_WIN eWindow);
210 void MDrv_XC_DIP_SetFRC(void* pInstance,MS_BOOL bEnable,MS_U16 u16In,MS_U16 u16Out,SCALER_DIP_WIN eWindow);
211 void MDrv_XC_DIP_SetWinProperty(void* pInstance,ST_XC_DIP_WINPROPERTY *pstDIPWinProperty, SCALER_DIP_WIN eWindow);
212 void MDrv_XC_DIP_CaptureOneFrame(void* pInstance,SCALER_DIP_WIN eWindow);
213 void MDrv_XC_DIP_CaptureOneFrame2(void* pInstance,SCALER_DIP_WIN eWindow);
214 void MDrv_XC_DIP_EnableIntr(void* pInstance,MS_U16 u8mask, MS_BOOL bEnable,SCALER_DIP_WIN eWindow);
215 void MDrv_XC_DIP_ClearIntr(void* pInstance,MS_U16 u16mask,SCALER_DIP_WIN eWindow);
216 void MDrv_XC_DIP_EnableCaptureStream(void* pInstance,MS_BOOL bEnable,SCALER_DIP_WIN eWindow);
217 void MDrv_XC_DIP_SelectSourceScanType(void* pInstance,EN_XC_DWIN_SCAN_TYPE enScan,SCALER_DIP_WIN eWindow);
218 void MDrv_XC_DIP_SetInterlaceWrite(void* pInstance,MS_BOOL bEnable,SCALER_DIP_WIN eWindow);
219 void MDrv_XC_DIP_SetDataFmt(void* pInstance,EN_DRV_XC_DWIN_DATA_FMT fmt,SCALER_DIP_WIN eWindow);
220 void MDrv_XC_DIP_SetAlphaValue(void* pInstance,MS_U8 u8AlphaVal,SCALER_DIP_WIN eWindow);
221 void MDrv_XC_DIP_SetY2R(void* pInstance,MS_BOOL bEnable,SCALER_DIP_WIN eWindow);
222 void MDrv_XC_DIP_SetUVSwap(void* pInstance,MS_BOOL bEnable,SCALER_DIP_WIN eWindow);
223 void MDrv_XC_DIP_SetYCSwap(void* pInstance,MS_BOOL bEnable,SCALER_DIP_WIN eWindow);
224 void MDrv_XC_DIP_SetRGBSwap(void* pInstance,MS_BOOL bEnable,SCALER_DIP_WIN eWindow);
225 void MDrv_XC_DIP_SetOutputCapture(void* pInstance,MS_BOOL bEnable,EN_XC_DIP_OP_CAPTURE eOpCapture,SCALER_DIP_WIN eWindow);
226 void MDrv_XC_DIP_SetMirror(void* pInstance,MS_BOOL bHMirror,MS_BOOL bVMirror,SCALER_DIP_WIN eWindow);
227 void MDrv_XC_DIP_SetDIPRProperty(void* pInstance,ST_XC_DIPR_PROPERTY *pstDIPRProperty, SCALER_DIP_WIN eWindow);
228 void MDrv_XC_DIP_SetDIPRProperty_EX(void* pInstance,ST_XC_DIPR_PROPERTY_EX *pstDIPRProperty_ex, SCALER_DIP_WIN eWindow);
229 void MDrv_XC_DIP_InterruptAttach(void* pInstance,InterruptCb pIntCb,SCALER_DIP_WIN eWindow);
230 void MDrv_XC_DIP_InterruptDetach(void* pInstance,SCALER_DIP_WIN eWindow);
231 void MDrv_XC_DIP_SetRotation(void* pInstance,MS_BOOL bRotation,EN_XC_DIP_ROTATION eRoDirection,SCALER_DIP_WIN eTmpWindow);
232 void MDrv_XC_DIP_SetPinpon(void* pInstance,MS_BOOL bPinpon,MS_PHY u64PinponAddr,SCALER_DIP_WIN eWindow);
233 MS_BOOL MDrv_XC_DIP_SetHVSP(void* pInstance,MS_BOOL bSelect, SCALER_DIP_WIN eWindow);
234 MS_BOOL MDrv_XC_DIP_Set420TileBlock(void* pInstance,EN_XC_DIP_TILE_BLOCK eTileBlock,SCALER_DIP_WIN eWindow);
235 void MDrv_XC_DIP_SetBdgLevel(EN_XC_DIP_DEBUG_LEVEL level);
236 #ifdef CONFIG_UTOPIA_PROC_DBG_SUPPORT
237 void MDrv_XC_DIP_Mdb_Cmdline(MS_U64* u64ReqHdl,MS_U32 u32CmdSize,char *pcCmdLine);
238 void MDrv_XC_DIP_Mdb_GetInfo(MS_U64* u64ReqHdl);
239 #endif
240 //==============Get===================
241 MS_U16 MDrv_XC_DIP_GetIntrStatus(void* pInstance,SCALER_DIP_WIN eWindow);
242 BUFFER_INFO MDrv_XC_DIP_GetBufferInfo(void* pInstance,SCALER_DIP_WIN eWindow);
243 //==============OP TEE===================
244 MS_U32 MDrv_XC_DIP_ConfigPipe_U2(void* pInstance,MS_U32 u32PipeID, MS_U32 u32SecureDMA, MS_U32 u32OperationMode);
245 #undef INTERFACE
246 #endif /* DRV_SC_SCALING_H */
247 
248