xref: /utopia/UTPA2-700.0.x/mxlib/include/drvSYS.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 ///////////////////////////////////////////////////////////////////////////////////////////////////
96 ///
97 /// @file   drvSYS.h
98 /// @brief  System Control Interface
99 /// @author MStar Semiconductor Inc.
100 ///////////////////////////////////////////////////////////////////////////////////////////////////
101 
102 /*! \defgroup G_SYS SYS interface
103     \ingroup  G_PERIPHERAL
104 
105     \brief
106 
107     This drvSYS.h provide functions like WDT, FlushMemory, and Chip-Related utility.
108 
109     <b>Features</b>
110 
111     - WDT control function
112     - System Memory control function
113     - System Chip-Related function
114 
115     <b> Operation Code Flow: </b> \n
116     -# Prepare SYS setting for each operation
117     -# Set and start SYS in command handle
118     -# Trigger SYS
119 
120      \defgroup G_SYS_INIT Initialization Task relative
121      \ingroup  G_SYS
122      \defgroup G_SYS_COMMON Common Task relative
123      \ingroup  G_SYS
124      \defgroup G_SYS_CONTROL Control relative
125      \ingroup  G_SYS
126      \defgroup G_SYS_OTHER  other relative
127      \ingroup  G_SYS
128 */
129 
130 #ifndef _DRV_SYS_H_
131 #define _DRV_SYS_H_
132 
133 #ifdef __cplusplus
134 extern "C"
135 {
136 #endif
137 
138 #include "MsTypes.h"
139 #include "MsDevice.h"
140 
141 #include "UFO.h"
142 
143 //-------------------------------------------------------------------------------------------------
144 //  Driver Capability
145 //-------------------------------------------------------------------------------------------------
146 #define MDRV_SYS_XC_TIMING_VERSION        0x00000001UL
147 #define MDRV_SYS_XC_BYPART_TIMING_VERSION 0x00000001UL
148 
149 #define SYS_ENCODER_MFE		0x00000001UL
150 #define SYS_ENCODER_VE		0x00000002UL
151 
152 #define SYS_FRONTEND_AVD	0x00000001UL
153 #define SYS_FRONTEND_DEMOD	0x00000002UL
154 #define SYS_FRONTEND_VBI	0x00000004UL
155 #define SYS_FRONTEND_VIF	0x00000008UL
156 
157 #define SYS_SYSTEM_CEC		0x00000001UL
158 #define SYS_SYSTEM_MBX		0x00000002UL
159 #define SYS_SYSTEM_SWI2C	0x00000004UL
160 #define SYS_SYSTEM_BDMA		0x00000008UL
161 #define SYS_SYSTEM_CPU		0x00000010UL
162 #define SYS_SYSTEM_GPIO		0x00000020UL
163 #define SYS_SYSTEM_HWI2C	0x00000040UL
164 #define SYS_SYSTEM_IR		0x00000080UL
165 #define SYS_SYSTEM_MIU		0x00000100UL
166 #define SYS_SYSTEM_MPIF		0x00000200UL
167 #define SYS_SYSTEM_MSPI		0x00000400UL
168 #define SYS_SYSTEM_PM		0x00000800UL
169 #define SYS_SYSTEM_PWM		0x00001000UL
170 #define SYS_SYSTEM_PWS		0x00002000UL
171 #define SYS_SYSTEM_RTC		0x00004000UL
172 #define SYS_SYSTEM_SAR		0x00008000UL
173 #define SYS_SYSTEM_URDMA	0x00010000UL
174 #define SYS_SYSTEM_WDT		0x00020000UL
175 
176 #define SYS_CA_AESDMA		0x00000001UL
177 #define SYS_CA_CA			0x00000002UL
178 #define SYS_CA_PCMCIA		0x00000004UL
179 #define SYS_CA_SC			0x00000008UL
180 
181 #define SYS_CODEC_GPD		0x00000001UL
182 #define SYS_CODEC_JPEG		0x00000002UL
183 #define SYS_CODEC_VDEC		0x00000004UL
184 
185 #define SYS_DISPLAY_ACE		0x00000001UL
186 #define SYS_DISPLAY_DAC		0x00000002UL
187 #define SYS_DISPLAY_DDC2BI	0x00000004UL
188 #define SYS_DISPLAY_DIP		0x00000008UL
189 #define SYS_DISPLAY_DLC		0x00000010UL
190 #define SYS_DISPLAY_GOP		0x00000020UL
191 #define SYS_DISPLAY_HDMITX	0x00000040UL
192 #define SYS_DISPLAY_MHL		0x00000080UL
193 #define SYS_DISPLAY_MVOP	0x00000100UL
194 #define SYS_DISPLAY_PNL		0x00000200UL
195 #define SYS_DISPLAY_XC		0x00000400UL
196 
197 #define SYS_GFX_GFX			0x00000001UL
198 #define SYS_AUDIO_AUDIO		0x00000001UL
199 #define SYS_STORAGE_SERFLASH	0x00000001UL
200 #define SYS_DEMUX_DMX		0x00000001UL
201 
202 //-------------------------------------------------------------------------------------------------
203 //  Macro and Define
204 //-------------------------------------------------------------------------------------------------
205 /// Version string.
206     #define MSIF_SYS_LIB_CODE               {'S','Y','S','_'} //Lib code
207     #define MSIF_SYS_LIBVER                 {'0','1'}      //LIB version
208     #define MSIF_SYS_BUILDNUM               {'0','9' }    //Build Number
209     #define MSIF_SYS_CHANGELIST             {'0','0','6','3','0','6','5','2'} //P4 ChangeList Number
210 
211 #define SYS_DRV_VERSION                 /* Character String for DRV/API version             */  \
212     MSIF_TAG,                           /* 'MSIF'                                           */  \
213     MSIF_CLASS,                         /* '00'                                             */  \
214     MSIF_CUS,                           /* 0x0000                                           */  \
215     MSIF_MOD,                           /* 0x0000                                           */  \
216     MSIF_CHIP,                                                                                  \
217     MSIF_CPU,                                                                                   \
218     MSIF_SYS_LIB_CODE,                  /* IP__                                             */  \
219     MSIF_SYS_LIBVER,                    /* 0.0 ~ Z.Z                                        */  \
220     MSIF_SYS_BUILDNUM,                  /* 00 ~ 99                                          */  \
221     MSIF_SYS_CHANGELIST,                /* CL#                                              */  \
222     MSIF_OS
223 
224 #define SYS_LIB_NAME_MAX            16UL      ///< Maximum length of library name
225 #define SYS_LIB_TIME_MAX            16UL     ///< Maximum length of time
226 #define SYS_LIB_DATE_MAX            16UL      ///< Maximum length of date
227 #define SYS_BOARD_MODEL_MAX         32UL      ///< Maximum length of board name
228 #define SYS_PLATFORM_CHIP_MAX       32UL      ///< Maximum length of playform name
229 #define SYS_EFUSE_DID_LENGTH         4UL      ///< efuse device ID length
230 
231 
232 //-------------------------------------------------------------------------------------------------
233 //  Type and Structure
234 //-------------------------------------------------------------------------------------------------
235 
236 /// System information
237 typedef struct _SYS_Info
238 {
239     struct
240     {
241         MS_U16    DeviceId;                           ///< Device ID
242         MS_U8     Version;                            ///< Version
243         MS_U8     Revision;                           ///< Revision
244         MS_PHY  MIU1Base;                           ///< MIU1Base
245         MS_PHY  MIU1BusBase;                        ///< MIU1Base
246         MS_PHY  MIU2Base;                           ///< MIU2Base
247         MS_PHY  MIU2BusBase;                        ///< MIU3Base
248         MS_PHY  MIU3Base;                           ///< MIU2Base
249         MS_PHY  MIU3BusBase;                        ///< MIU3Base
250     } Chip;                                         ///< Chip information
251 
252     struct
253     {
254         MS_U8   Time[SYS_LIB_TIME_MAX];             ///< Library Built Time
255         MS_U8   Date[SYS_LIB_DATE_MAX];             ///< Library Built Date
256     } SWLib;                                        ///< Software Library Information
257 
258 } SYS_Info;
259 
260 
261 typedef struct _SYS_Status
262 {
263     MS_BOOL     WDT_Active;                         ///< Watchdog Timer
264 
265 } SYS_Status;
266 
267 typedef enum _SYS_DbgLv
268 {
269     E_SYS_DBGLV_NONE           //no debug message
270     ,E_SYS_DBGLV_ERR_ONLY      //show error only
271     ,E_SYS_DBGLV_REG_DUMP      //show error & reg dump
272     ,E_SYS_DBGLV_INFO          //show error & informaiton
273     ,E_SYS_DBGLV_ALL           //show error, information & funciton name
274 }SYS_DbgLv;
275 
276 typedef enum
277 {
278     E_SYS_QUERY_H264_SUPPORTED = 0x00,
279     E_SYS_QUERY_DVBC_SUPPORTED = 0x10,
280     E_SYS_QUERY_MM_SUPPORTED = 0x11,
281     E_SYS_QUERY_TTXNICAM_SUPPORTED = 0x12,
282     E_SYS_QUERY_TCON_SUPPORTED = 0x13,
283     E_SYS_QUERY_DTV_SUPPORTED = 0x14,
284     E_SYS_QUERY_DTVCC_SUPPORTED = 0x15,
285     E_SYS_QUERY_GINGA_NCL_SUPPORTED = 0x16,
286     E_SYS_QUERY_GINGA_JAVA_SUPPORTED = 0x17,
287     E_SYS_QUERT_HD_SUPPORTED = 0x18,
288     E_SYS_QUERY_MHL_SUPPORTED = 0x19,
289     E_SYS_QUERY_DVBT_SUPPORTED = 0x1A,
290     E_SYS_QUERY_ISDBT_SUPPORTED = 0x1B,
291     E_SYS_QUERY_HBBTV_SUPPORTED = 0x1C,
292     E_SYS_QUERY_TTS_SUPPORTED = 0x1D,
293 
294     E_SYS_QUERY_DOLBY_HDR_SUPPORTED = 0x1E,
295     E_SYS_QUERY_EVDHD_SUPPORTED = 0x1F,
296     E_SYS_QUERY_VIDAC1_SUPPORTED = 0x20,
297     E_SYS_QUERY_ETHTX_SUPPORTED = 0x21,
298     E_SYS_QUERY_ETHRX_SUPPORTED = 0x22,
299     E_SYS_QUERY_ETHTXOUTSWING_SUPPORTED = 0x23,
300     E_SYS_QUERY_DVBT2_SUPPORTED = 0x24,
301     E_SYS_QUERY_4K_SUPPORTED = 0x25,
302     E_SYS_QUERY_TSIN_SUPPORTED = 0x26,
303     E_SYS_QUERY_VP8_SUPPORTED = 0x27,
304     E_SYS_QUERY_VP9_SUPPORTED = 0x28,
305     E_SYS_QUERY_DVBS2_SUPPORTED = 0x29,
306     E_SYS_QUERY_GINGA_SOLUTION_CONTROL1_SUPPORTED = 0x100,
307     E_SYS_QUERY_GINGA_SOLUTION_CONTROL2_SUPPORTED = 0x101,
308     E_SYS_QUERY_GINGA_SOLUTION_CONTROL3_SUPPORTED = 0x102,
309     E_SYS_QUERY_SECURED_IC_SUPPORTED = 0x200,
310 } E_SYS_QUERY;
311 
312 typedef enum
313 {
314     E_SYS_ATV_AGC_PAD_SET,
315     E_SYS_DTV_AGC_PAD_SET,
316     E_SYS_DTV_AGC_PAD_SET_ALL_OFF,
317 }SYS_AGC_PAD_SET;
318 
319 typedef enum
320 {
321     E_TS0_PAD_SET,
322     E_TS1_PAD_SET,
323     E_TS2_PAD_SET,
324     E_TS3_PAD_SET,
325     E_CA_CI_PAD_SET,
326     E_SC_PAD_SET,
327     E_MSPI_PAD_SET,
328     E_TS4_PAD_SET,
329     E_TS5_PAD_SET,
330     E_TSO_PAD_SET,
331     E_PAD_SET_MAX
332 }SYS_PAD_MUX_SET;
333 
334 typedef enum
335 {
336     E_PARALLEL_IN,
337     E_SERIAL_IN,
338     E_PARALLEL_IN_2nd_PORT,
339     E_PARALLEL_OUT,
340     E_CA_CI_PAD_CA,
341     E_CA_CI_PAD_CI,
342     E_CA_CI_PAD_NONE,
343     E_TRI_STATE_ON,
344     E_TRI_STATE_OFF,
345     E_SC_PAD_PCM,
346     E_SC_PAD_TS1,
347     E_MSPI_PAD_ON,
348     E_MSPI_PAD_GPIO,
349     E_SERIAL_IN_3_WIRE,
350     E_PARALLEL_OUT_SER2PAR,
351     E_PARALLEL_OUT_INTDMD,
352     E_PARALLEL_OUT_TSO,
353     E_PARALLEL_OUT_SER2PAR1,
354     E_MSPI_PAD_ON_2nd_PORT,
355     E_PAD_DRIVING_4MA = 0x00001000,
356     E_PAD_DRIVING_8MA = 0x00001001,
357     E_PAD_SEL_MAX
358 }SYS_PAD_SEL;
359 
360 typedef struct _SYS_XC_TIMING
361 {
362     MS_U32 u32TimingVersion;      //init it with MDRV_SYS_XC_TIMING_VERSION
363     MS_U32 u32StructLength;       //init it with the size of this stuct
364     MS_U32 u32Width;
365     MS_U32 u32Height;
366     MS_U16 u16Framerate;
367 } SYS_XC_TIMING_t;
368 
369 typedef struct _SYS_XC_BYPART_TIMING
370 {
371     MS_U32 u32TimingVersion;      //init it with MDRV_SYS_XC_BYPART_TIMING_VERSION
372     MS_U32 u32StructLength;       //init it with the size of this stuct
373     SYS_XC_TIMING_t stInput;
374     SYS_XC_TIMING_t stOutput;
375 } SYS_XC_BYPART_TIMING_t;
376 
377 typedef enum
378 {
379     E_PCM_CD_SINGLE,
380     E_PCM_CD_OR,
381     E_PCM_CD_MAX
382 }SYS_PCM_CD_MODE;
383 
384 typedef enum
385 {
386     E_SYS_DOLBY_VERSION = 0x00,
387     E_SYS_DOLBY_CONTROL_BIT = 0x01,
388     E_SYS_DOLBY_REVERSE_BIT = 0x02,
389 
390 } E_SYS_DOLBY_HASH_INFO;
391 
392 typedef enum
393 {
394     E_SYS_CHIP_TV,
395     E_SYS_CHIP_STB,
396     E_SYS_CHIP_MAX,
397 } E_SYS_CHIP_TYPE;
398 
399 typedef enum
400 {
401 	E_SYS_IP_ENCODER,
402 	E_SYS_IP_FRONTEND,
403 	E_SYS_IP_DEMUX,
404 	E_SYS_IP_SYSTEM,
405 	E_SYS_IP_CA,
406 	E_SYS_IP_CODEC,
407 	E_SYS_IP_DISPLAY,
408 	E_SYS_IP_AUDIO,
409 	E_SYS_IP_GFX,
410 	E_SYS_IP_STORAGE,
411 } E_SYS_IP_TYPE;
412 
413 typedef enum
414 {
415 	E_SYS_IO_SWI2C_READ     = 0x00,
416 	E_SYS_IO_SWI2C_WRITE    = 0x01,
417 	E_SYS_IO_MAX            = 0xFF,
418 } E_SYS_IO_PROC;
419 
420 typedef enum
421 {
422     E_SYS_OK = 0x0,
423     E_SYS_FAIL,
424     E_SYS_ERROR_PARAMETER,
425     E_SYS_NOT_SUPPORT,
426 } E_SYS_ReturnValue;
427 
428 typedef enum
429 {
430     E_SYS_QOS_QUERY_XC_BYPART_EN = 0x00,  //Info: SYS_XC_BYPART_TIMING_t
431     E_SYS_QOS_QUERY_MEMC_EN,              //Info: SYS_XC_TIMING_t
432     E_SYS_QOS_MAX,
433 } E_SYS_QOS_QUERY_TYPE;
434 
435 #define SYS_TEEINFO_OSTYPE_NOTEE                 0
436 #define SYS_TEEINFO_OSTYPE_NUTTX                 1
437 #define SYS_TEEINFO_OSTYPE_OPTEE                 2
438 
439 
440 typedef struct _SYS_TEEInfo
441 {
442     MS_U32 OsType;
443 }SYS_TEEINFO;
444 
445 //-------------------------------------------------------------------------------------------------
446 //  Function and Variable
447 //-------------------------------------------------------------------------------------------------
448 //-------------------------------------------------------------------------------------------------
449 /// MOBF Encrypt
450 /// @ingroup G_SYS_INIT
451 /// @param u32Key \b IN: Key
452 /// @param bEnable \b IN: TRUE/FLASE
453 /// @return DRVAESDMA_OK : Success
454 /// @return Others : Fail
455 //-------------------------------------------------------------------------------------------------
456 MS_BOOL         MDrv_SYS_Init(void);
457 //-------------------------------------------------------------------------------------------------
458 /// MOBF Encrypt
459 /// @ingroup G_SYS_INIT
460 /// @param u32Key \b IN: Key
461 /// @param bEnable \b IN: TRUE/FLASE
462 /// @return DRVAESDMA_OK : Success
463 /// @return Others : Fail
464 //-------------------------------------------------------------------------------------------------
465 MS_BOOL         MDrv_SYS_GlobalInit(void);
466 //-------------------------------------------------------------------------------------------------
467 /// MOBF Encrypt
468 /// @ingroup G_SYS_COMMON
469 /// @param u32Key \b IN: Key
470 /// @param bEnable \b IN: TRUE/FLASE
471 /// @return DRVAESDMA_OK : Success
472 /// @return Others : Fail
473 //-------------------------------------------------------------------------------------------------
474 const SYS_Info* MDrv_SYS_GetInfo(void);
475 //-------------------------------------------------------------------------------------------------
476 /// MOBF Encrypt
477 /// @ingroup G_SYS_COMMON
478 /// @param u32Key \b IN: Key
479 /// @param bEnable \b IN: TRUE/FLASE
480 /// @return DRVAESDMA_OK : Success
481 /// @return Others : Fail
482 //-------------------------------------------------------------------------------------------------
483 MS_U8           MDrv_SYS_GetChipRev(void);
484 //-------------------------------------------------------------------------------------------------
485 /// MOBF Encrypt
486 /// @ingroup G_SYS_COMMON
487 /// @param u32Key \b IN: Key
488 /// @param bEnable \b IN: TRUE/FLASE
489 /// @return DRVAESDMA_OK : Success
490 /// @return Others : Fail
491 //-------------------------------------------------------------------------------------------------
492 MS_U16          MDrv_SYS_GetChipID(void);
493 //-------------------------------------------------------------------------------------------------
494 /// MOBF Encrypt
495 /// @ingroup G_SYS_COMMON
496 /// @param u32Key \b IN: Key
497 /// @param bEnable \b IN: TRUE/FLASE
498 /// @return DRVAESDMA_OK : Success
499 /// @return Others : Fail
500 //-------------------------------------------------------------------------------------------------
501 void            MDrv_SYS_WDTEnable(MS_BOOL bEnable);
502 //-------------------------------------------------------------------------------------------------
503 /// MOBF Encrypt
504 /// @ingroup G_SYS_COMMON
505 /// @param u32Key \b IN: Key
506 /// @param bEnable \b IN: TRUE/FLASE
507 /// @return DRVAESDMA_OK : Success
508 /// @return Others : Fail
509 //-------------------------------------------------------------------------------------------------
510 void            MDrv_SYS_WDTClear(void);
511 //-------------------------------------------------------------------------------------------------
512 /// MOBF Encrypt
513 /// @ingroup G_SYS_COMMON
514 /// @param u32Key \b IN: Key
515 /// @param bEnable \b IN: TRUE/FLASE
516 /// @return DRVAESDMA_OK : Success
517 /// @return Others : Fail
518 //-------------------------------------------------------------------------------------------------
519 MS_BOOL         MDrv_SYS_WDTLastStatus(void);
520 //-------------------------------------------------------------------------------------------------
521 /// MOBF Encrypt
522 /// @ingroup G_SYS_COMMON
523 /// @param u32Key \b IN: Key
524 /// @param bEnable \b IN: TRUE/FLASE
525 /// @return DRVAESDMA_OK : Success
526 /// @return Others : Fail
527 //-------------------------------------------------------------------------------------------------
528 void            MDrv_SYS_WDTSetTime(MS_U32 u32Ms);
529 //-------------------------------------------------------------------------------------------------
530 /// MOBF Encrypt
531 /// @ingroup G_SYS_COMMON
532 /// @param u32Key \b IN: Key
533 /// @param bEnable \b IN: TRUE/FLASE
534 /// @return DRVAESDMA_OK : Success
535 /// @return Others : Fail
536 //-------------------------------------------------------------------------------------------------
537 void            MDrv_SYS_ResetChip(void);
538 //-------------------------------------------------------------------------------------------------
539 /// MOBF Encrypt
540 /// @ingroup G_SYS_COMMON
541 /// @param u32Key \b IN: Key
542 /// @param bEnable \b IN: TRUE/FLASE
543 /// @return DRVAESDMA_OK : Success
544 /// @return Others : Fail
545 //-------------------------------------------------------------------------------------------------
546 void            MDrv_SYS_ResetCPU(void);
547 //-------------------------------------------------------------------------------------------------
548 /// MOBF Encrypt
549 /// @ingroup G_SYS_COMMON
550 /// @param u32Key \b IN: Key
551 /// @param bEnable \b IN: TRUE/FLASE
552 /// @return DRVAESDMA_OK : Success
553 /// @return Others : Fail
554 //-------------------------------------------------------------------------------------------------
555 void            MDrv_SYS_SetDbgLevel(SYS_DbgLv eLevel);
556 //-------------------------------------------------------------------------------------------------
557 /// MOBF Encrypt
558 /// @ingroup G_SYS_COMMON
559 /// @param u32Key \b IN: Key
560 /// @param bEnable \b IN: TRUE/FLASE
561 /// @return DRVAESDMA_OK : Success
562 /// @return Others : Fail
563 //-------------------------------------------------------------------------------------------------
564 void            MDrv_SYS_FlushMemory(void);
565 //-------------------------------------------------------------------------------------------------
566 /// MOBF Encrypt
567 /// @ingroup G_SYS_COMMON
568 /// @param u32Key \b IN: Key
569 /// @param bEnable \b IN: TRUE/FLASE
570 /// @return DRVAESDMA_OK : Success
571 /// @return Others : Fail
572 //-------------------------------------------------------------------------------------------------
573 void            MDrv_SYS_ReadMemory(void);
574 //-------------------------------------------------------------------------------------------------
575 /// MOBF Encrypt
576 /// @ingroup G_SYS_COMMON
577 /// @param u32Key \b IN: Key
578 /// @param bEnable \b IN: TRUE/FLASE
579 /// @return DRVAESDMA_OK : Success
580 /// @return Others : Fail
581 //-------------------------------------------------------------------------------------------------
582 void            MDrv_SYS_VIFWriteByteByVDMbox(MS_U32 u32Reg, MS_U8 u8Val);
583 //-------------------------------------------------------------------------------------------------
584 /// MOBF Encrypt
585 /// @ingroup G_SYS_COMMON
586 /// @param u32Key \b IN: Key
587 /// @param bEnable \b IN: TRUE/FLASE
588 /// @return DRVAESDMA_OK : Success
589 /// @return Others : Fail
590 //-------------------------------------------------------------------------------------------------
591 void            MDrv_SYS_VIFWriteByteMaskByVDMbox(MS_U32 u32Reg, MS_U8 u8Val, MS_U8 u8Mask);
592 //-------------------------------------------------------------------------------------------------
593 /// MOBF Encrypt
594 /// @ingroup G_SYS_COMMON
595 /// @param u32Key \b IN: Key
596 /// @param bEnable \b IN: TRUE/FLASE
597 /// @return DRVAESDMA_OK : Success
598 /// @return Others : Fail
599 //-------------------------------------------------------------------------------------------------
600 void            MDrv_SYS_VIFWriteRegBitByVDMbox(MS_U32 u32Reg, MS_U8 bEnable, MS_U8 u8Mask);
601 //-------------------------------------------------------------------------------------------------
602 /// MOBF Encrypt
603 /// @ingroup G_SYS_COMMON
604 /// @param u32Key \b IN: Key
605 /// @param bEnable \b IN: TRUE/FLASE
606 /// @return DRVAESDMA_OK : Success
607 /// @return Others : Fail
608 //-------------------------------------------------------------------------------------------------
609 MS_U8           MDrv_SYS_VIFReadByteByVDMbox(MS_U32 u32Reg);
610 //-------------------------------------------------------------------------------------------------
611 /// MOBF Encrypt
612 /// @ingroup G_SYS_COMMON
613 /// @param u32Key \b IN: Key
614 /// @param bEnable \b IN: TRUE/FLASE
615 /// @return DRVAESDMA_OK : Success
616 /// @return Others : Fail
617 //-------------------------------------------------------------------------------------------------
618 MS_U16          MDrv_SYS_VIFRead2ByteByVDMbox(MS_U32 u32Reg);
619 //-------------------------------------------------------------------------------------------------
620 /// MOBF Encrypt
621 /// @ingroup G_SYS_COMMON
622 /// @param u32Key \b IN: Key
623 /// @param bEnable \b IN: TRUE/FLASE
624 /// @return DRVAESDMA_OK : Success
625 /// @return Others : Fail
626 //-------------------------------------------------------------------------------------------------
627 MS_BOOL         MDrv_SYS_Query(E_SYS_QUERY id);
628 
629 #ifdef _SYS_DAC_GAIN_CTRL_
630 //-------------------------------------------------------------------------------------------------
631 /// MOBF Encrypt
632 /// @ingroup G_SYS_COMMON
633 /// @param u32Key \b IN: Key
634 /// @param bEnable \b IN: TRUE/FLASE
635 /// @return DRVAESDMA_OK : Success
636 /// @return Others : Fail
637 //-------------------------------------------------------------------------------------------------
638 void MDrv_SYS_EnhanceDACGain(MS_U8 u8DAC_ID, MS_BOOL bEnable);
639 #endif
640 //-------------------------------------------------------------------------------------------------
641 /// MOBF Encrypt
642 /// @ingroup G_SYS_COMMON
643 /// @param u32Key \b IN: Key
644 /// @param bEnable \b IN: TRUE/FLASE
645 /// @return DRVAESDMA_OK : Success
646 /// @return Others : Fail
647 //-------------------------------------------------------------------------------------------------
648 void            MDrv_SYS_GetSoftwareVersion(MS_SW_VERSION_INFO *pSoftwareVersionInfo);
649 //-------------------------------------------------------------------------------------------------
650 /// MOBF Encrypt
651 /// @ingroup G_SYS_COMMON
652 /// @param u32Key \b IN: Key
653 /// @param bEnable \b IN: TRUE/FLASE
654 /// @return DRVAESDMA_OK : Success
655 /// @return Others : Fail
656 //-------------------------------------------------------------------------------------------------
657 void            MDrv_SYS_SetAGCPadMux(SYS_AGC_PAD_SET eAgcPadMux);
658 //-------------------------------------------------------------------------------------------------
659 /// MOBF Encrypt
660 /// @ingroup G_SYS_CONTROL
661 /// @param u32Key \b IN: Key
662 /// @param bEnable \b IN: TRUE/FLASE
663 /// @return DRVAESDMA_OK : Success
664 /// @return Others : Fail
665 //-------------------------------------------------------------------------------------------------
666 MS_BOOL         MDrv_SYS_SetPadMux(SYS_PAD_MUX_SET ePadMuxType,SYS_PAD_SEL ePadSel);
667 //-------------------------------------------------------------------------------------------------
668 /// Get Utopia Pack Mode
669 /// @ingroup G_SYS_CONTROL
670 /// @return TRUE : Pack Mode
671 /// @return FALSE : Non-Pack Mode
672 //-------------------------------------------------------------------------------------------------
673 MS_BOOL         MDrv_SYS_PackMode(void);
674 //-------------------------------------------------------------------------------------------------
675 /// MOBF Encrypt
676 /// @ingroup G_SYS_CONTROL
677 /// @param u32Key \b IN: Key
678 /// @param bEnable \b IN: TRUE/FLASE
679 /// @return DRVAESDMA_OK : Success
680 /// @return Others : Fail
681 //-------------------------------------------------------------------------------------------------
682 MS_BOOL         MDrv_SYS_SetPCMCardDetectMode(SYS_PCM_CD_MODE ePCMCDMode);
683 //-------------------------------------------------------------------------------------------------
684 /// MOBF Encrypt
685 /// @ingroup G_SYS_CONTROL
686 /// @param u32Key \b IN: Key
687 /// @param bEnable \b IN: TRUE/FLASE
688 /// @return DRVAESDMA_OK : Success
689 /// @return Others : Fail
690 //-------------------------------------------------------------------------------------------------
691 MS_BOOL         MDrv_SYS_DisableDebugPort(void);
692 //-------------------------------------------------------------------------------------------------
693 /// MOBF Encrypt
694 /// @ingroup G_SYS_CONTROL
695 /// @param u32Key \b IN: Key
696 /// @param bEnable \b IN: TRUE/FLASE
697 /// @return DRVAESDMA_OK : Success
698 /// @return Others : Fail
699 //-------------------------------------------------------------------------------------------------
700 MS_BOOL         MDrv_SYS_EnableDebugPort(void);
701 //-------------------------------------------------------------------------------------------------
702 /// MOBF Encrypt
703 /// @ingroup G_SYS_CONTROL
704 /// @param u32Key \b IN: Key
705 /// @param bEnable \b IN: TRUE/FLASE
706 /// @return DRVAESDMA_OK : Success
707 /// @return Others : Fail
708 //-------------------------------------------------------------------------------------------------
709 MS_BOOL         MDrv_SYS_SetTSOutClockPhase(MS_U16 u16Val);
710 //-------------------------------------------------------------------------------------------------
711 /// MOBF Encrypt
712 /// @ingroup G_SYS_CONTROL
713 /// @param u32Key \b IN: Key
714 /// @param bEnable \b IN: TRUE/FLASE
715 /// @return DRVAESDMA_OK : Success
716 /// @return Others : Fail
717 //-------------------------------------------------------------------------------------------------
718 MS_BOOL         MDrv_SYS_SetTSClockPhase(SYS_PAD_MUX_SET ePadMuxType, MS_U16 u16Val);
719 //-------------------------------------------------------------------------------------------------
720 /// MOBF Encrypt
721 /// @ingroup G_SYS_CONTROL
722 /// @param u32Key \b IN: Key
723 /// @param bEnable \b IN: TRUE/FLASE
724 /// @return DRVAESDMA_OK : Success
725 /// @return Others : Fail
726 //-------------------------------------------------------------------------------------------------
727 MS_BOOL         MDrv_SYS_PadMuxTableSuspend(void);
728 //-------------------------------------------------------------------------------------------------
729 /// MOBF Encrypt
730 /// @ingroup G_SYS_CONTROL
731 /// @param u32Key \b IN: Key
732 /// @param bEnable \b IN: TRUE/FLASE
733 /// @return DRVAESDMA_OK : Success
734 /// @return Others : Fail
735 //-------------------------------------------------------------------------------------------------
736 MS_BOOL         MDrv_SYS_PadMuxTableResume(void);
737 //-------------------------------------------------------------------------------------------------
738 /// MOBF Encrypt
739 /// @ingroup G_SYS_COMMON
740 /// @param u32Key \b IN: Key
741 /// @param bEnable \b IN: TRUE/FLASE
742 /// @return DRVAESDMA_OK : Success
743 /// @return Others : Fail
744 //-------------------------------------------------------------------------------------------------
745 MS_U32          MDrv_SYS_SetPowerState(EN_POWER_MODE u16PowerState);
746 //-------------------------------------------------------------------------------------------------
747 /// MOBF Encrypt
748 /// @ingroup G_SYS_OTHER
749 /// @param u32Key \b IN: Key
750 /// @param bEnable \b IN: TRUE/FLASE
751 /// @return DRVAESDMA_OK : Success
752 /// @return Others : Fail
753 //-------------------------------------------------------------------------------------------------
754 MS_U32          MDrv_SYS_QueryDolbyHashInfo(E_SYS_DOLBY_HASH_INFO index);
755 //-------------------------------------------------------------------------------------------------
756 /// MOBF Encrypt
757 /// @ingroup G_SYS_COMMON
758 /// @param u32Key \b IN: Key
759 /// @param bEnable \b IN: TRUE/FLASE
760 /// @return DRVAESDMA_OK : Success
761 /// @return Others : Fail
762 //-------------------------------------------------------------------------------------------------
763 E_SYS_CHIP_TYPE MDrv_SYS_GetChipType(void);
764 //-------------------------------------------------------------------------------------------------
765 /// MOBF Encrypt
766 /// @ingroup G_SYS_COMMON
767 /// @param u32Key \b IN: Key
768 /// @param bEnable \b IN: TRUE/FLASE
769 /// @return DRVAESDMA_OK : Success
770 /// @return Others : Fail
771 //-------------------------------------------------------------------------------------------------
772 void MDrv_SYS_SetChipType(E_SYS_CHIP_TYPE Type);
773 //-------------------------------------------------------------------------------------------------
774 /// MOBF Encrypt
775 /// @ingroup G_SYS_OTHER
776 /// @param u32Key \b IN: Key
777 /// @param bEnable \b IN: TRUE/FLASE
778 /// @return DRVAESDMA_OK : Success
779 /// @return Others : Fail
780 //-------------------------------------------------------------------------------------------------
781 void MDrv_SYS_GetDolbyKeyCustomer(MS_U8 * u8pkey);
782 //-------------------------------------------------------------------------------------------------
783 /// MOBF Encrypt
784 /// @ingroup G_SYS_OTHER
785 /// @param u32Key \b IN: Key
786 /// @param bEnable \b IN: TRUE/FLASE
787 /// @return DRVAESDMA_OK : Success
788 /// @return Others : Fail
789 //-------------------------------------------------------------------------------------------------
790 MS_U16          MDrv_SYS_ReadBrickTerminatorStatus(void);
791 //-------------------------------------------------------------------------------------------------
792 /// MOBF Encrypt
793 /// @ingroup G_SYS_OTHER
794 /// @param u32Key \b IN: Key
795 /// @param bEnable \b IN: TRUE/FLASE
796 /// @return DRVAESDMA_OK : Success
797 /// @return Others : Fail
798 //-------------------------------------------------------------------------------------------------
799 void            MDrv_SYS_WriteBrickTerminatorStatus(MS_U16 u16Status);
800 //-------------------------------------------------------------------------------------------------
801 /// MOBF Encrypt
802 /// @ingroup G_SYS_OTHER
803 /// @param u32Key \b IN: Key
804 /// @param bEnable \b IN: TRUE/FLASE
805 /// @return DRVAESDMA_OK : Success
806 /// @return Others : Fail
807 //-------------------------------------------------------------------------------------------------
808 MS_BOOL         MDrv_SYS_GetEfuseDid(MS_U16 *u16efuse_did);
809 //-------------------------------------------------------------------------------------------------
810 /// MOBF Encrypt
811 /// @ingroup G_SYS_OTHER
812 /// @param u32Key \b IN: Key
813 /// @param bEnable \b IN: TRUE/FLASE
814 /// @return DRVAESDMA_OK : Success
815 /// @return Others : Fail
816 //-------------------------------------------------------------------------------------------------
817 MS_BOOL         MDrv_SYS_ReadEfuseHDCPKey(MS_U16 u16ReadAddr, MS_U32 *u32HDCPKey);
818 //-------------------------------------------------------------------------------------------------
819 /// MOBF Encrypt
820 /// @ingroup G_SYS_COMMON
821 /// @param u32Key \b IN: Key
822 /// @param bEnable \b IN: TRUE/FLASE
823 /// @return DRVAESDMA_OK : Success
824 /// @return Others : Fail
825 //-------------------------------------------------------------------------------------------------
826 MS_U32          MDrv_SYS_GetIpList(E_SYS_IP_TYPE TYPE);
827 //-------------------------------------------------------------------------------------------------
828 /// Query MEMC Config
829 /// @ingroup G_SYS_COMMON
830 /// @param u32SourceType \b IN: Source Type, Ref: INPUT_SOURCE_TYPE_t
831 /// @param stXCTiming \b IN: Input Timing, Ref: SYS_XC_TIMING_t
832 /// @param retEnMemc \b OUT: Query result of enabling EMMC
833 /// @return @ref E_SYS_ReturnValue
834 //-------------------------------------------------------------------------------------------------
835 E_SYS_ReturnValue __attribute__((weak)) MDrv_SYS_GetMemcConfg(MS_U32 u32SourceType, SYS_XC_TIMING_t *stXCTiming, MS_BOOL *retEnMemc);
836 //-------------------------------------------------------------------------------------------------
837 /// Query QoS Config
838 /// @ingroup G_SYS_COMMON
839 /// @param eQueryType \b IN: Query Type, Ref: E_SYS_QOS_QUERY_TYPE
840 /// @param u32SourceType \b IN: Source Type, Ref: INPUT_SOURCE_TYPE_t
841 /// @param stXCTiming \b IN: Input Info Structure, each E_SYS_QOS_QUERY_TYPE maps to a specified struct
842 /// @param retEn \b OUT: Query result of enabling status
843 /// @return @ref E_SYS_ReturnValue
844 //-------------------------------------------------------------------------------------------------
845 E_SYS_ReturnValue __attribute__((weak)) MDrv_SYS_GetQoSConfig(E_SYS_QOS_QUERY_TYPE eQueryType, MS_U32 u32SourceType, void *stInfo, MS_BOOL *retEn);
846 
847 //FOR INTERNAL USE ONLY
848 MS_U32          MDrv_SYS_RegisterIoProc(E_SYS_IO_PROC dwIoType, void *pdwIoFunction);
849 void MDrv_SYS_ReadKernelCmdLine(void);
850 MS_U32 MDrv_SYS_SetTEEInfo(MS_U32 osType);
851 MS_U32 MDrv_SYS_GetTEEInfo(SYS_TEEINFO* TeeInfo);
852 
853 #ifdef UFO_SYS_PADMUX
854 //-------------------------------------------------------------------------------------------------
855 /// SYS Pad Mux Control
856 /// @param u32RegAddr \b IN: Register Address
857 /// @param u8RegVal \b IN: Register Value
858 /// @param u8Mask \b IN: Mask Value
859 /// @return MS_BOOL :
860 /// - TRUE: Success
861 /// - FALSE: Fail
862 //-------------------------------------------------------------------------------------------------
863 MS_BOOL MDrv_SYS_PadMuxCtrl(MS_U32 u32RegAddr, MS_U8  u8RegVal, MS_U8  u8Mask);
864 #endif
865 
866 char* MDrv_SYS_GetUtopiaReleaseLabel(void);
867 
868 #ifdef CONFIG_MSTAR_DVFS_KERNEL_SUPPORT
869 MS_S16 MDrv_SYS_GetCurrentTemperature(void);
870 MS_U16 MDrv_SYS_GetLowerLevelTemperature(void);
871 MS_U16 MDrv_SYS_GetUpperLevelTemperature(void);
872 MS_U16 MDrv_SYS_GetMaxLevelTemperature(void);
873 #endif
874 
875 //note:
876 //Fix Me. [C2P] Mdrv_SYS_VR360_Restore_BW_Setting, Mdrv_SYS_VR360_Set_BW_Setting are temporary solutions for VR360.
877 //Request by PM - Treasure
878 //It will be remove when sn/mi adds flow for recognizating vr360 mode.
879 void            Mdrv_SYS_VR360_Restore_BW_Setting(void);
880 void            Mdrv_SYS_VR360_Set_BW_Setting(void);
881 
882 #ifdef __cplusplus
883 }
884 #endif
885 
886 
887 #endif // _DRV_SYS_H_
888 
889