xref: /utopia/UTPA2-700.0.x/modules/mvop/hal/maldives/mvop/halMVOP.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 _HAL_MVOP_H_
96 #define _HAL_MVOP_H_
97 
98 
99 //-------------------------------------------------------------------------------------------------
100 //  Macro and Define
101 //-------------------------------------------------------------------------------------------------
102 #define STB_DC                  0   //0 for TV series MVOP; 1 for STB DC.
103 
104 #define MVOP_MIU_CLIENT_MAIN    MIU_CLIENT_MVOP_128BIT_R
105 #define MVOP_MIU_CLIENT_SUB     MIU_CLIENT_MVOP1_R
106 
107 #define _MVOP_128BIT_BUS        0//128-bit MIU bus
108 #define _MVOP_64BIT_BUS         1// 64-bit MIU bus
109 #define _MVOP_256BIT_BUS        2//256-bit MIU bus
110 #define MVOP_BUS_WIDTH          _MVOP_128BIT_BUS
111 
112 #define HAL_MVOP_MODULE_CNT     1
113 #if (HAL_MVOP_MODULE_CNT >= 2)
114 #define MVOP_SUPPORT_SUB        1
115 #else
116 #define MVOP_SUPPORT_SUB        0
117 #endif
118 #if (HAL_MVOP_MODULE_CNT >= 3)
119 #define MVOP_SUPPORT_3RD        1
120 #else
121 #define MVOP_SUPPORT_3RD        0
122 #endif
123 
124 #define ENABLE_3D_LR_MODE           1 //Enable 3D L/R feature
125 #define SUPPORT_3DLR_INST_VBLANK    1
126 #define SUPPORT_3DLR_ALT_SBS        1
127 
128 #define SUPPORT_EVD_MODE        1
129 #define SUPPORT_VP9_MODE        1
130 
131 #if (STB_DC == 0)
132 #define MVOP_BASE_ADD_BITS          31  //29 - 1 (MSB is signed bit) + 3 (unit in 8-byte)
133 #endif
134 
135 //-------------------------------------------------------------------------------------------------
136 //  Type and Structure
137 //-------------------------------------------------------------------------------------------------
138 typedef enum
139 {
140     HALMVOP_SYNCMODE,
141     HALMVOP_FREERUNMODE,
142     HALMVOP_160MHZ = 160000000ul,
143     HALMVOP_144MHZ = 144000000ul,
144     HALMVOP_320MHZ = 320000000ul,
145     HALMVOP_288MHZ = 288000000ul
146 }HALMVOPFREQUENCY;
147 
148 typedef struct
149 {
150     MS_U8 u8Gp:4;
151     MS_U8 u8BitPos:4;
152 }HALMVOPMIUCLIENTINFO;
153 
154 typedef enum
155 {
156     E_MVOP_SEL_MIU0         = 0,
157     E_MVOP_SEL_MIU1         = 0x01,
158     E_MVOP_SEL_MIU2         = 0x02,
159     E_MVOP_SEL_MIU3         = 0x03,
160     E_MVOP_SEL_NONE         = 0xFF,
161 
162 } HALMVOPMIUSEL;
163 //-------------------------------------------------------------------------------------------------
164 //  Function and Variable
165 //-------------------------------------------------------------------------------------------------
166 void HAL_MVOP_RegSetBase(MS_U32 u32Base);
167 void HAL_MVOP_Init(void);
168 void HAL_MVOP_SetFieldInverse(MS_BOOL b2MVD, MS_BOOL b2IP);
169 void HAL_MVOP_SetChromaWeighting(MS_BOOL bEnable);
170 void HAL_MVOP_LoadReg(void);
171 void HAL_MVOP_SetMIUReqMask(MS_BOOL bEnable);
172 void HAL_MVOP_Enable(MS_BOOL bEnable);
173 MS_BOOL HAL_MVOP_GetEnableState(void);
174 HALMVOPFREQUENCY HAL_MVOP_GetMaxFreerunClk(void);
175 void HAL_MVOP_SetFrequency(HALMVOPFREQUENCY enFrequency);
176 HALMVOPFREQUENCY HAL_MVOP_GetMaximumClk(void);
177 HALMVOPFREQUENCY HAL_MVOP_GetCurrentClk(void);
178 void HAL_MVOP_Rst(void);
179 void HAL_MVOP_SetBlackBG(void);
180 void HAL_MVOP_SetOutputInterlace(MS_BOOL bEnable);
181 void HAL_MVOP_SetCropWindow(MVOP_InputCfg *pparam);
182 void HAL_MVOP_SetInputMode( VOPINPUTMODE mode, MVOP_InputCfg *pparam, MS_U16 u16ECOVersion );
183 void HAL_MVOP_EnableUVShift(MS_BOOL bEnable);
184 void HAL_MVOP_SetEnable60P(MS_BOOL bEnable);
185 void HAL_MVOP_SetVSyncMode(MS_U8 u8Mode);
186 void HAL_MVOP_SetOutputTiming( MVOP_Timing *ptiming );
187 void HAL_MVOP_SetDCClk(MS_U8 clkNum, MS_BOOL bEnable);
188 void HAL_MVOP_SetSynClk(MVOP_Timing *ptiming);
189 void HAL_MVOP_SetMonoMode(MS_BOOL bEnable);
190 void HAL_MVOP_SetH264HardwireMode(void);
191 void HAL_MVOP_SetRMHardwireMode(void);
192 void HAL_MVOP_SetJpegHardwireMode(void);
193 void HAL_MVOP_SetEVDHardwireMode(void);
194 void HAL_MVOP_SetPattern(MVOP_Pattern enMVOPPattern);
195 MS_BOOL HAL_MVOP_SetTileFormat(MVOP_TileFormat eTileFmt);
196 MS_BOOL HAL_MVOP_SetRgbFormat(MVOP_RgbFormat eRgbFmt);
197 MS_BOOL HAL_MVOP_GetSupportRgbFormat(MVOP_RgbFormat eRgbFmt);
198 MS_BOOL HAL_MVOP_Enable3DLR(MS_BOOL bEnable);
199 MS_BOOL HAL_MVOP_Get3DLRMode(void);
200 MS_BOOL HAL_MVOP_Set3DLRInsVBlank(MS_U16 u16InsLines);
201 MS_BOOL HAL_MVOP_GetTimingInfoFromRegisters(MVOP_TimingInfo_FromRegisters *mvopTimingInfo);
202 void HAL_MVOP_SetHorizontallMirrorMode(MS_BOOL bEnable);
203 void HAL_MVOP_SetVerticalMirrorMode(MS_BOOL bEnable);
204 void HAL_MVOP_SetYUVBaseAdd(MS_U32 u32YOffset, MS_U32 u32UVOffset, MS_BOOL bProgressive, MS_BOOL b422pack);
205 void HAL_MVOP_SetRepeatField(MVOP_RptFldMode eMode);
206 void HAL_MVOP_EnableFreerunMode(MS_BOOL bEnable);
207 MS_U32 HAL_MVOP_GetYBaseAdd(void);
208 MS_U32 HAL_MVOP_GetUVBaseAdd(void);
209 MS_BOOL HAL_MVOP_Set3DLRAltOutput(MS_BOOL bEnable);
210 MS_BOOL HAL_MVOP_Set3DLRAltOutput_VHalfScaling(MS_BOOL bEnable);
211 MS_BOOL HAL_MVOP_Set3DLRAltSBSOutput(MS_BOOL bEnable);
212 MS_BOOL HAL_MVOP_Get3DLRAltOutput(void);
213 MS_BOOL HAL_MVOP_Get3DLRAltSBSOutput(void);
214 EN_MVOP_Output_3D_TYPE HAL_MVOP_GetOutput3DType(void);
215 MS_BOOL HAL_MVOP_Set3DLR2ndCfg(MS_BOOL bEnable);
216 MS_BOOL HAL_MVOP_Get3DLR2ndCfg(void);
217 MVOP_DrvMirror HAL_MVOP_GetMirrorMode(MVOP_DevID eID);
218 MS_BOOL HAL_MVOP_SetVerDup(MS_BOOL bEnable);
219 MS_BOOL HAL_MVOP_GetVerDup(void);
220 MS_BOOL HAL_MVOP_SetVerx4Dup(MS_BOOL bEnable);
221 MS_BOOL HAL_MVOP_GetVerx4Dup(void);
222 MS_BOOL HAL_MVOP_SetHorx4Dup(MS_BOOL bEnable);
223 MS_BOOL HAL_MVOP_GetHorx4Dup(void);
224 MS_BOOL HAL_MVOP_SetYUVBaseAddMultiView(MVOP_BaseAddInput *stBaseAddInfo);
225 MS_U32 HAL_MVOP_GetYBaseAddMultiView(MVOP_3DView eView);
226 MS_U32 HAL_MVOP_GetUVBaseAddMultiView(MVOP_3DView eView);
227 MS_U16 HAL_MVOP_GetTopVStart(MVOP_DevID eID);
228 MS_U16 HAL_MVOP_GetBottomVStart(MVOP_DevID eID);
229 MS_U16 HAL_MVOP_GetVCount(MVOP_DevID eID);
230 void HAL_MVOP_SetStartX(MS_U16 u16Length);
231 void HAL_MVOP_SetStartY(MS_U16 u16Length, MS_BOOL bIs4Align);
232 void HAL_MVOP_SetPicWidthMinus(MS_U16 u16Sizes);
233 void HAL_MVOP_SetPicHeightMinus(MS_U16 u16Sizes);
234 void HAL_MVOP_PowerStateSuspend(void);
235 MVOP_HSMode HAL_MVOP_GetHandShakeMode(MVOP_DevID eID);
236 MS_BOOL HAL_MVOP_CheckSTCCW(void);
237 //MS_BOOL HAL_MVOP_GetIsMiuIPControl(HALMVOPMIUCLIENTINFO stInfo);
238 void HAL_MVOP_SelMIU(MVOP_DevID eDevID, HALMVOPMIUSEL eMiuMSB0, HALMVOPMIUSEL eMiuMSB1, HALMVOPMIUSEL eMiuLSB0, HALMVOPMIUSEL eMiuLSB1);
239 void HAL_MVOP_GetMaxFramerate(MVOP_DevID eDevID, MVOP_GetMaxFps* stStreamInfo);
240 void HAL_MVOP_ResetReg(MVOP_DevID eDevID);
241 void HAL_MVOP_SetVP9HardwireMode(void);
242 MS_BOOL HAL_MVOP_SupportFRCOutputFPS(MVOP_DevID eID);
243 
244 #endif // _HAL_MVOP_H_
245 
246