xref: /utopia/UTPA2-700.0.x/modules/wdt/drv/wdt/drvWDT_private.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 #ifndef _DRVWDT_PRIV_H_
95 #define _DRVWDT_PRIV_H_
96 
97 ////////////////////////////////////////////////////////////////////////////////
98 /// @file drvBDMA.h
99 /// @author MStar Semiconductor Inc.
100 /// @brief Byte DMA control driver
101 ////////////////////////////////////////////////////////////////////////////////
102 
103 ////////////////////////////////////////////////////////////////////////////////
104 // Header Files
105 ////////////////////////////////////////////////////////////////////////////////
106 #ifdef __cplusplus
107 extern "C"
108 {
109 #endif
110 
111 #include "MsTypes.h"
112 #include "drvWDT.h"
113 
114 typedef enum {
115     MDrv_CMD_WDT_Init,
116     MDrv_CMD_WDT_Stop,
117     MDrv_CMD_WDT_Clear,
118     MDrv_CMD_WDT_ClearRstFlag,
119     MDrv_CMD_WDT_IsReset,
120     MDrv_CMD_WDT_IsEnable,
121     MDrv_CMD_WDT_SetTimer,
122     MDrv_CMD_WDT_SetTimer_ms,
123     MDrv_CMD_WDT_SetTimer_us,
124     MDrv_CMD_WDT_SetIntTimer,
125     MDrv_CMD_TIMER_Init,
126     MDrv_CMD_TIMER_Count,
127     MDrv_CMD_TIMER_Rst,
128     MDrv_CMD_TIMER_SetMaxMatch,
129     MDrv_CMD_TIMER_HitMaxMatch,
130     MDrv_CMD_TIMER_GetMaxMatch,
131     MDrv_CMD_TIMER_GetCounter,
132     MDrv_CMD_TIMER_GetSecond,
133     MDrv_CMD_TIMER_GetMs,
134     MDrv_CMD_TIMER_GetUs,
135     MDrv_CMD_TIMER_Delay,
136     MDrv_CMD_TIMER_DelayMs,
137     MDrv_CMD_TIMER_DelayUs,
138     MDrv_CMD_TIMER_Initial,
139     MDrv_CMD_TIMER_Exit,
140     MDrv_CMD_WDT_GetConfig,
141 } eWdtIoctlOpt;
142 
143 
144 typedef struct _WDT_RESOURCE_PRIVATE
145 {
146    WDT_DbgLv eLevel;
147 }WDT_RESOURCE_PRIVATE;
148 
149 typedef struct _WDT_INIT_PARAM
150 {
151     WDT_DbgLv eLevel;
152 }WDT_INIT_PARAM, *PWDT_INIT_PARAM;
153 
154 typedef struct _WDT_IS_RST_PARAM
155 {
156     WDT_Result status;
157 }WDT_IS_RST_PARAM, *PWDT_IS_RST_PARAM;
158 
159 typedef struct _WDT_IS_EN_PARAM
160 {
161     WDT_Result status;
162 }WDT_IS_EN_PARAM, *PWDT_IS_EN_PARAM;
163 
164 typedef struct _WDT_STOP_PARAM
165 {
166     WDT_DbgLv eLevel;
167 }WDT_STOP_PARAM, *PWDT_STOP_PARAM;
168 
169 typedef struct _WDT_SET_S_PARAM
170 {
171     WDT_DbgLv eLevel;
172     MS_U16 sec;
173 }WDT_SET_S_PARAM, *PWDT_SET_S_PARAM;
174 
175 typedef struct _WDT_SET_MS_PARAM
176 {
177     WDT_DbgLv eLevel;
178     MS_U16 msec;
179 }WDT_SET_MS_PARAM, *PWDT_SET_MS_PARAM;
180 
181 typedef struct _WDT_SET_US_PARAM
182 {
183     WDT_DbgLv eLevel;
184     MS_U16 usec;
185 }WDT_SET_US_PARAM, *PWDT_SET_US_PARAM;
186 
187 typedef struct _WDT_SETTIMER_PARAM
188 {
189     WDT_DbgLv eLevel;
190     MS_U16 sec;
191 }WDT_SETTIMER_PARAM, *PWDT_SETTIMER_PARAM;
192 
193 typedef struct _TIMER_COUNT_PARAM
194 {
195 	E_PIU_Timer eTimer;
196 	MS_BOOL bEnable;
197 }TIMER_COUNT_PARAM, *PTIMER_COUNT_PARAM;
198 
199 typedef struct _TIMER_INT_PARAM
200 {
201 	E_PIU_Timer eTimer;
202 	MS_BOOL bEnable;
203 }TIMER_INT_PARAM, *PTIMER_INT_PARAM;
204 
205 typedef struct _TIMER_HIT_MAX_MATCH_PARAM
206 {
207 	E_PIU_Timer eTimer;
208 }TIMER_HIT_MAX_MATCH_PARAM, *PTIMER_HIT_MAX_MATCH_PARAM;
209 
210 typedef struct _TIMER_RST_PARAM
211 {
212 	E_PIU_Timer eTimer;
213 }TIMER_RST_PARAM, *PTIMER_RST_PARAM;
214 
215 typedef struct _TIMER_SET_MAX_MATCH_PARAM
216 {
217 	E_PIU_Timer eTimer;
218 	MS_U32 u32MaxTimer;
219 }TIMER_SET_MAX_MATCH_PARAM, *PTIMER_SET_MAX_MATCH_PARAM;
220 
221 typedef struct _TIMER_GET_MAX_MATCH_PARAM
222 {
223 	E_PIU_Timer eTimer;
224 	MS_U32 u32MaxMatchVal;
225 }TIMER_GET_MAX_MATCH_PARAM, *PTIMER_GET_MAX_MATCH_PARAM;
226 
227 typedef struct _TIMER_GET_COUNTER_PARAM
228 {
229 	E_PIU_Timer eTimer;
230 	MS_U32 u32Cnt;
231 }TIMER_GET_COUNTER_PARAM, *PTIMER_GET_COUNTER_PARAM;
232 
233 typedef struct _TIMER_GET_SEC_PARAM
234 {
235 	E_PIU_Timer eTimer;
236 	MS_U32 u32Sec;
237 }TIMER_GET_SEC_PARAM, *PTIMER_GET_SEC_PARAM;
238 
239 typedef struct _TIMER_GET_MS_PARAM
240 {
241 	E_PIU_Timer eTimer;
242 	MS_U32 u32Msec;
243 }TIMER_GET_MS_PARAM, *PTIMER_GET_MS_PARAM;
244 
245 typedef struct _TIMER_GET_US_PARAM
246 {
247 	E_PIU_Timer eTimer;
248 	MS_U32 u32Usec;
249 }TIMER_GET_US_PARAM, *PTIMER_GET_US_PARAM;
250 
251 typedef struct _TIMER_DELAY_PARAM
252 {
253 	E_PIU_Timer eTimer;
254 	MS_U32 u32Second;
255 }TIMER_DELAY_PARAM, *PTIMER_DELAY_PARAM;
256 
257 typedef struct _TIMER_DELAY_MS_PARAM
258 {
259 	E_PIU_Timer eTimer;
260 	MS_U32 u32ms;
261 }TIMER_DELAY_MS_PARAM, *PTIMER_DELAY_MS_PARAM;
262 
263 typedef struct _TIMER_DELAY_US_PARAM
264 {
265 	E_PIU_Timer eTimer;
266 	MS_U32 u32us;
267 }TIMER_DELAY_US_PARAM, *PTIMER_DELAY_US_PARAM;
268 
269 typedef union _WDT_PRIVATE_PARAM
270 {
271 	 WDT_INIT_PARAM					privateWdtInit;
272 	 WDT_IS_RST_PARAM				privateWdtIsRst;
273 	 WDT_IS_EN_PARAM				privateWdtIsEn;
274 	 WDT_STOP_PARAM				privateWdtStop;
275 	 WDT_SET_S_PARAM				privateWdtSetSec;
276 	 WDT_SET_MS_PARAM				privateWdtSetMSec;
277 	 WDT_SET_US_PARAM				privateWdtSetUSec;
278 	 WDT_SETTIMER_PARAM			privateWdtSetTimer;
279 	 TIMER_COUNT_PARAM				privateTimerCnt;
280 	 TIMER_INT_PARAM				privateTimerInit;
281 	 TIMER_HIT_MAX_MATCH_PARAM		privateTimerHitMaxMatch;
282 	 TIMER_RST_PARAM				privateTimerRst;
283 	 TIMER_SET_MAX_MATCH_PARAM		privateTimerSetMaxMatch;
284 	 TIMER_GET_MAX_MATCH_PARAM		privateTimerGetMaxMatch;
285 	 TIMER_GET_COUNTER_PARAM		privateTimerGetCunter;
286 	 TIMER_GET_SEC_PARAM			privateTimerGetSec;
287 	 TIMER_GET_MS_PARAM			privateTimerGetMs;
288 	 TIMER_GET_US_PARAM				privateTimerGetUs;
289 	 TIMER_DELAY_PARAM				privateTimerDelay;
290 	 TIMER_DELAY_MS_PARAM			privateTimerDelayMs;
291 	 TIMER_DELAY_US_PARAM			privateTimerDelayUs;
292 } WDT_PRIVATE_PARAM;
293 
294 typedef WDT_Result (*IOCTL_WDT_IS_ENABLE)(void);
295 typedef WDT_Result (*IOCTL_WDT_INIT)(WDT_DbgLv);
296 typedef WDT_Result (*IOCTL_WDT_STOP)(WDT_DbgLv);
297 typedef WDT_Result (*IOCTL_WDT_CLEAR)(void);
298 typedef WDT_Result (*IOCTL_WDT_CLEAR_RST_FLAG)(void);
299 typedef WDT_Result (*IOCTL_WDT_IS_RST)(void);
300 typedef WDT_Result (*IOCTL_WDT_SET_TIMER)(WDT_DbgLv , MS_U16);
301 typedef WDT_Result (*IOCTL_WDT_SET_MS)(WDT_DbgLv , MS_U16);
302 typedef WDT_Result (*IOCTL_WDT_SET_US)(WDT_DbgLv , MS_U16);
303 typedef WDT_Result (*IOCTL_WDT_SET_INT_TIMER)(WDT_DbgLv , MS_U16);
304 typedef void (*IOCTL_TIMER_COUNT)(E_PIU_Timer , MS_BOOL);
305 typedef void (*IOCTL_TIMER_INT)(E_PIU_Timer , MS_BOOL);
306 typedef MS_BOOL (*IOCTL_TIMER_MAX_MATCH)(E_PIU_Timer);
307 typedef void (*IOCTL_TIMER_RST)(E_PIU_Timer);
308 typedef void (*IOCTL_TIMER_SET_MAX_MATCH)(E_PIU_Timer , MS_U32 );
309 typedef MS_U32 (*IOCTL_TIMER_GET_MAX_MATCH) (E_PIU_Timer);
310 typedef MS_U32 (*IOCTL_TIMER_GET_COUNT) (E_PIU_Timer);
311 typedef MS_U32 (*IOCTL_TIMER_GET_SEC) (E_PIU_Timer);
312 typedef MS_U32 (*IOCTL_TIMER_GET_MS) (E_PIU_Timer);
313 typedef MS_U32 (*IOCTL_TIMER_GET_US) (E_PIU_Timer);
314 typedef void (*IOCTL_TIMER_DELAY) (E_PIU_Timer,MS_U32);
315 typedef void (*IOCTL_TIMER_DELAY_MS) (E_PIU_Timer,MS_U32);
316 typedef void (*IOCTL_TIMER_DELAY_US) (E_PIU_Timer,MS_U32);
317 typedef void (*IOCTL_TIMER_INITIAL) (void);
318 typedef void (*IOCTL_TIMER_EXIT) (void);
319 
320 typedef struct _WDT_INSTANT_PRIVATE
321 {
322 	IOCTL_WDT_IS_ENABLE 		fpWdtIsEn;
323 	IOCTL_WDT_INIT  				fpWdtInit;
324 	IOCTL_WDT_STOP				fpWdtStop;
325 	IOCTL_WDT_CLEAR			fpWdtClear;
326 	IOCTL_WDT_CLEAR_RST_FLAG	fpWdtClrRstFlg;
327 	IOCTL_WDT_IS_RST			fpWdtIsRst;
328 	IOCTL_WDT_SET_TIMER		fpWdtSetTimer;
329 	IOCTL_WDT_SET_MS			fpWdtSetMs;
330 	IOCTL_WDT_SET_US			fpWdtSetUs;
331 	IOCTL_WDT_SET_INT_TIMER		fpWdtSetIntTimer;
332 	IOCTL_TIMER_COUNT			fpTimerCount;
333 	IOCTL_TIMER_INT				fpTimerInt;
334 	IOCTL_TIMER_MAX_MATCH		fpTimerMaxMatch;
335 	IOCTL_TIMER_RST				fpTimerRST;
336 	IOCTL_TIMER_SET_MAX_MATCH	fpTimerSetMaxMatch;
337 	IOCTL_TIMER_GET_MAX_MATCH	fpTimerGetMaxMatch;
338 	IOCTL_TIMER_GET_COUNT		fpTimerGetCount;
339 	IOCTL_TIMER_GET_SEC			fpTimerGetSec;
340 	IOCTL_TIMER_GET_MS			fpTimerGetMs;
341 	IOCTL_TIMER_GET_US			fpTimerGetUs;
342 	IOCTL_TIMER_DELAY			fpTimerDelay;
343 	IOCTL_TIMER_DELAY_MS		fpTimerDelayMs;
344 	IOCTL_TIMER_DELAY_US		fpTimerDelayUs;
345 	IOCTL_TIMER_INITIAL			fpTimerInitial;
346 	IOCTL_TIMER_EXIT				fpTimerExit;
347 }WDT_INSTANT_PRIVATE;
348 
349 void WDTRegisterToUtopia(FUtopiaOpen ModuleType);
350 MS_U32 WDTOpen(void** ppInstance, MS_U32 u32ModuleVersion, void* pAttribute);
351 MS_U32 WDTClose(void* pInstance);
352 MS_U32 WDTIoctl(void* pInstance, MS_U32 u32Cmd, void* pArgs);
353 MS_U32 WDTStr(MS_U32 u32PowerState, void* pModule);
354 
355 WDT_Result MDrv_WDT_Init_U2K(WDT_DbgLv eLevel);
356 WDT_Result MDrv_WDT_Stop_U2K(WDT_DbgLv eLevel);
357 WDT_Result MDrv_WDT_Clear_U2K(void);
358 WDT_Result MDrv_WDT_ClearRstFlag_U2K(void);
359 WDT_Result MDrv_WDT_IsReset_U2K(void);
360 WDT_Result MDrv_WDT_IsEnable_U2K(void);
361 WDT_Result MDrv_WDT_SetTimer_U2K(WDT_DbgLv eLevel, MS_U16 sec);
362 WDT_Result MDrv_WDT_SetTimer_ms_U2K(WDT_DbgLv eLevel, MS_U16 msec);
363 WDT_Result MDrv_WDT_SetTimer_us_U2K(WDT_DbgLv eLevel, MS_U16 usec);
364 WDT_Result MDrv_WDT_SetIntTimer_U2K(WDT_DbgLv eLevel, MS_U16 sec);
365 void MDrv_TIMER_Init_U2K(void);
366 void MDrv_TIMER_Count_U2K(E_PIU_Timer eTimer, MS_BOOL bEnable);
367 void MDrv_TIMER_INT_U2K(E_PIU_Timer eTimer, MS_BOOL bEnable);
368 void MDrv_TIMER_Rst_U2K(E_PIU_Timer eTimer);
369 void MDrv_TIMER_SetMaxMatch_U2K(E_PIU_Timer eTimer, MS_U32 u32MaxTimer);
370 MS_BOOL MDrv_TIMER_HitMaxMatch_U2K(E_PIU_Timer eTimer);
371 MS_U32 MDrv_TIMER_GetMaxMatch_U2K(E_PIU_Timer eTimer);
372 MS_U32 MDrv_TIMER_GetCounter_U2K(E_PIU_Timer eTimer);
373 MS_U32 MDrv_TIMER_GetSecond_U2K(E_PIU_Timer eTimer);
374 MS_U32 MDrv_TIMER_GetMs_U2K(E_PIU_Timer eTimer);
375 MS_U32 MDrv_TIMER_GetUs_U2K(E_PIU_Timer eTimer);
376 void MDrv_TIMER_Delay_U2K(E_PIU_Timer eTimer, MS_U32 u32Second);
377 void MDrv_TIMER_DelayMs_U2K(E_PIU_Timer eTimer, MS_U32 u32MS);
378 void MDrv_TIMER_DelayUs_U2K(E_PIU_Timer eTimer, MS_U32 u32US);
379 void MDrv_TIMER_Exit_U2K(void);
380 
381 
382 #ifdef __cplusplus
383 }
384 #endif
385 #endif // _DRVWDT_PRIV_H_
386