xref: /utopia/UTPA2-700.0.x/modules/njpd/hal/maxim/njpd_ex/halNJPD.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-2011 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 ///////////////////////////////////////////////////////////////////////////////////////////////////
96 ///
97 /// @file   halNJPD.h
98 /// @brief  NJPD hal interface
99 /// @author MStar Semiconductor Inc.
100 ///////////////////////////////////////////////////////////////////////////////////////////////////
101 
102 #ifndef _HAL_NJPD_H_
103 #define _HAL_NJPD_H_
104 
105 //#include "njpeg_def.h"
106 
107 //-------------------------------------------------------------------------------------------------
108 //  Driver Capability
109 //-------------------------------------------------------------------------------------------------
110 
111 
112 //-------------------------------------------------------------------------------------------------
113 //  Macro and Define
114 //-------------------------------------------------------------------------------------------------
115 //Version
116 #define NJPD_HAL_VERSION     "NJPD.HAL.00117630"
117 
118 // VPU MailBox
119 #define VPU_HI_MBOX0        0
120 #define VPU_HI_MBOX1        1
121 #define VPU_RISC_MBOX0      2
122 #define VPU_RISC_MBOX1      3
123 
124 //#ifndef HAL_MIU1_BASE
125 //#define HAL_MIU1_BASE       0x10000000 // 256M
126 //#endif
127 #define NJPD_MIU_ADDR_MASK   (HAL_MIU1_BASE - 1)
128 
129 
130 //-------------------------------------------------------------------------------------------------
131 //  Type and Structure
132 //-------------------------------------------------------------------------------------------------
133 // NJPD debug level enum
134 typedef enum
135 {
136     E_NJPD_DEBUG_HAL_NONE = 0x0
137   , E_NJPD_DEBUG_HAL_MSG  = 0x04
138   , E_NJPD_DEBUG_HAL_ERR  = 0x08
139 } NJPD_HalDbgLevel;
140 
141 
142 typedef enum
143 {
144     E_NJPD_OUTPUT_ORIGINAL  = 0x0
145   , E_NJPD_OUTPUT_YC_SWAP   = 0x01
146   , E_NJPD_OUTPUT_UV_SWAP   = 0x02
147   , E_NJPD_OUTPUT_UV_7BIT   = 0x03
148   , E_NJPD_OUTPUT_UV_MSB    = 0x04
149 } NJPD_OutputFormat;
150 
151 // Dual Decode
152 typedef enum
153 {
154     E_HAL_MJPEG_MAIN_STREAM,
155     E_HAL_MJPEG_SUB_STREAM
156 } HAL_MJPEG_StreamType;
157 
158 typedef enum
159 {
160     E_HAL_MJPEG_STREAM_NONE = 0x0,
161 
162     E_HAL_MJPEG_MAIN_STREAM_BASE = 0x10,
163     E_HAL_MJPEG_MAIN_STREAM0 = E_HAL_MJPEG_MAIN_STREAM_BASE,
164     E_HAL_MJPEG_MAIN_STREAM_MAX,
165 
166     E_HAL_MJPEG_SUB_STREAM_BASE = 0x20,
167     E_HAL_MJPEG_SUB_STREAM0 = E_HAL_MJPEG_SUB_STREAM_BASE,
168     E_HAL_MJPEG_SUB_STREAM_MAX,
169 
170 } HAL_MJPEG_StreamId;
171 
172 
173 typedef struct
174 {
175     MS_U8* pu8HalVer;
176     MS_U8* pu8FwVer;
177 }NJPD_HAL_Version;
178 
179 // Dual Decode
180 typedef struct
181 {
182     HAL_MJPEG_StreamId eStreamId;
183     MS_BOOL bUsed;
184 } HAL_MJPEG_Stream;
185 
186 //-------------------------------------------------------------------------------------------------
187 //  Function and Variable
188 //-------------------------------------------------------------------------------------------------
189 
190 void HAL_NJPD_SetMIU(MS_U8 u8Idx);
191 void HAL_NJPD_JPDSelect(MS_BOOL bNJPD);
192 void HAL_NJPD_Set_GlobalSetting00(MS_U16 u16Value);
193 MS_U16 HAL_NJPD_Get_GlobalSetting00(void);
194 void HAL_NJPD_Set_GlobalSetting01(MS_U16 u16Value);
195 MS_U16 HAL_NJPD_Get_GlobalSetting01(void);
196 void HAL_NJPD_Set_GlobalSetting02(MS_U16 u16Value);
197 MS_U16 HAL_NJPD_Get_GlobalSetting02(void);
198 
199 void HAL_NJPD_SetMRCBuf0_StartLow(MS_U16 u16Value);
200 void HAL_NJPD_SetMRCBuf0_StartHigh(MS_U16 u16Value);
201 void HAL_NJPD_SetMRCBuf0_EndLow(MS_U16 u16Value);
202 void HAL_NJPD_SetMRCBuf0_EndHigh(MS_U16 u16Value);
203 void HAL_NJPD_SetMRCBuf1_StartLow(MS_U16 u16Value);
204 void HAL_NJPD_SetMRCBuf1_StartHigh(MS_U16 u16Value);
205 void HAL_NJPD_SetMRCBuf1_EndLow(MS_U16 u16Value);
206 void HAL_NJPD_SetMRCBuf1_EndHigh(MS_U16 u16Value);
207 
208 void HAL_NJPD_SetMRCStart_Low(MS_U16 u16Value);
209 void HAL_NJPD_SetMRCStart_High(MS_U16 u16Value);
210 MS_U16 HAL_NJPD_GetMWCBuf_StartLow(void);
211 MS_U16 HAL_NJPD_GetMWCBuf_StartHigh(void);
212 MS_U16 HAL_NJPD_GetMWCBuf_WritePtrLow(void);
213 MS_U16 HAL_NJPD_GetMWCBuf_WritePtrHigh(void);
214 
215 
216 void HAL_NJPD_SetMWCBuf_StartLow(MS_U16 u16Value);
217 void HAL_NJPD_SetMWCBuf_StartHigh(MS_U16 u16Value);
218 void HAL_NJPD_SetPic_H(MS_U16 u16Value);
219 void HAL_NJPD_SetPic_V(MS_U16 u16Value);
220 
221 void HAL_NJPD_ClearEventFlag(MS_U16 u16Value);
222 void HAL_NJPD_ForceEventFlag(MS_U16 u16Value);
223 void HAL_NJPD_MaskEventFlag(MS_U16 u16Value);
224 MS_U16 HAL_NJPD_GetEventFlag(void);
225 
226 void HAL_NJPD_SetROI_H(MS_U16 u16Value);
227 void HAL_NJPD_SetROI_V(MS_U16 u16Value);
228 void HAL_NJPD_SetROIWidth(MS_U16 u16Value);
229 void HAL_NJPD_SetROIHeight(MS_U16 u16Value);
230 void HAL_NJPD_SetClock(MS_U16 u16Value);
231 MS_U16 HAL_NJPD_GetClock(void);
232 void HAL_NJPD_SetClockGate(MS_U16 u16Value);
233 void HAL_NJPD_PowerOn(void);
234 void HAL_NJPD_PowerOff(void);
235 void HAL_NJPD_InitRegBase(void);
236 void HAL_NJPD_CreateMutex(void);
237 void HAL_NJPD_DeleteMutex(void);
238 void HAL_NJPD_SetRSTIntv(MS_U16 u16Value);
239 void HAL_NJPD_SetDbgLevel(MS_U8 u8DbgLevel);
240 void HAL_NJPD_GetLibVer(NJPD_HAL_Version *pHalVer);
241 void HAL_NJPD_Rst(void);
242 void HAL_NJPD_SetMWBuffLineNum(MS_U16 u16Value);
243 MS_U32 HAL_NJPD_GetCurMRCAddr(void);
244 MS_U16 HAL_NJPD_GetCurRow(void);
245 MS_U16 HAL_NJPD_GetCurCol(void);
246 void HAL_NJPD_SetWriteProtect(MS_BOOL enable);
247 void HAL_NJPD_SetAutoProtect(MS_BOOL enable);
248 
249 void HAL_NJPD_SetMRBurstThd(MS_U16 u16Value);
250 void HAL_NJPD_Set_MARB06(MS_U16 u16Value);
251 MS_U16 HAL_NJPD_Get_MARB06(void);
252 void HAL_NJPD_Set_MARB07(MS_U16 u16Value);
253 MS_U16 HAL_NJPD_Get_MARB07(void);
254 
255 void HAL_NJPD_SetWPENUBound_0_L(MS_U16 u16Value);
256 void HAL_NJPD_SetWPENUBound_0_H(MS_U16 u16Value);
257 void HAL_NJPD_SetWPENLBound_0_L(MS_U16 u16Value);
258 void HAL_NJPD_SetWPENLBound_0_H(MS_U16 u16Value);
259 
260 void HAL_NJPD_SetSpare00(MS_U16 u16Value);
261 MS_U16 HAL_NJPD_GetSpare00(void);
262 void HAL_NJPD_SetSpare01(MS_U16 u16Value);
263 MS_U16 HAL_NJPD_GetSpare01(void);
264 void HAL_NJPD_SetSpare02(MS_U16 u16Value);
265 MS_U16 HAL_NJPD_GetSpare02(void);
266 void HAL_NJPD_SetSpare03(MS_U16 u16Value);
267 MS_U16 HAL_NJPD_GetSpare03(void);
268 void HAL_NJPD_SetSpare04(MS_U16 u16Value);
269 MS_U16 HAL_NJPD_GetSpare04(void);
270 void HAL_NJPD_SetSpare05(MS_U16 u16Value);
271 MS_U16 HAL_NJPD_GetSpare05(void);
272 void HAL_NJPD_SetSpare06(MS_U16 u16Value);
273 MS_U16 HAL_NJPD_GetSpare06(void);
274 void HAL_NJPD_SetSpare07(MS_U16 u16Value);
275 MS_U16 HAL_NJPD_GetSpare07(void);
276 void HAL_NJPD_SetWriteOneClearReg(MS_U16 u16Value);
277 void HAL_NJPD_SetWriteOneClearReg_2(MS_U16 u16Value);
278 MS_U16 HAL_NJPD_GetWriteOneClearReg(void);
279 void HAL_NJPD_SetHTableStart_Low(MS_U16 u16Value);
280 void HAL_NJPD_SetHTableStart_High(MS_U16 u16Value);
281 void HAL_NJPD_SetQTableStart_Low(MS_U16 u16Value);
282 void HAL_NJPD_SetQTableStart_High(MS_U16 u16Value);
283 void HAL_NJPD_SetGTableStart_Low(MS_U16 u16Value);
284 void HAL_NJPD_SetGTableStart_High(MS_U16 u16Value);
285 void HAL_NJPD_SetHTableSize(MS_U16 u16Value);
286 MS_U16 HAL_NJPD_GetHTableSize(void);
287 void HAL_NJPD_SetRIUInterface(MS_U16 u16Value);
288 MS_U16 HAL_NJPD_GetRIUInterface(void);
289 MS_U16 HAL_NJPD_TBCReadData_L(void);
290 MS_U16 HAL_NJPD_TBCReadData_H(void);
291 void HAL_NJPD_SetIBufReadLength(MS_U8 u8Min, MS_U8 u8Max);
292 void HAL_NJPD_SetCRCReadMode(void);
293 void HAL_NJPD_SetCRCWriteMode(void);
294 MS_U8 HAL_NJPD_GetHandshakeCnt(void);
295 void HAL_NJPD_Handshake_SWRowCountMode(MS_U8 u8Cnt);
296 void HAL_NJPD_Handshake_HWRowCountMode(void);
297 void HAL_NJPD_SetOutputFormat(MS_BOOL bRst, NJPD_OutputFormat eOutputFormat);
298 void HAL_NJPD_SetMTLBMode(MS_U8 u8MTLB);
299 void HAL_NJPD_SetVerificationMode(NJPD_VerificationMode VerificationMode);
300 NJPD_VerificationMode HAL_NJPD_GetVerificationMode(void);
301 void HAL_NJPD_Debug(void);
302 void HAL_NJPD_SetNJPDInstance(JPD_Number JPDNum);
303 MS_BOOL HAL_NJPD_IsNeedToPatch(NJPD_PATCH_INDEX eIndex);
304 MS_U8 HAL_NJPD_JPDCount(void);
305 
306 #endif // _HAL_NJPD_H_
307 
308