xref: /utopia/UTPA2-700.0.x/projects/tmplib/include/drvTVEncoder.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    drvTVEncoder.h
98 /// @brief  TVEncoder interface
99 /// @author MStar Semiconductor Inc.
100 ///////////////////////////////////////////////////////////////////////////////////////////////////
101 
102 /* !\defgroup VE VE interface (drvTVEncoder.h)
103     \ingroup CVBS_OUT
104 
105     VE is used to covernt input video into standard definition resolution(pal/nstc)
106     and pass through the DAC to scart out.
107 
108     <b> VE Block Diagram: </b> \n
109     \image html drvVE_pic01.png
110 
111  *! \defgroup VE_INFO VE Information pool
112  *  \ingroup VE
113 
114  *! \defgroup VE_INIT VE init control
115  *  \ingroup VE
116 
117  *! \defgroup VE_FEATURE VE feature operation
118  *  \ingroup VE
119 
120  *! \defgroup VE_ToBeModified VE api to be modified
121  *  \ingroup VE
122 
123  *! \defgroup VE_ToBeRemove VE api to be removed
124  *  \ingroup VE
125 */
126 #ifndef _DRVTVENCODER_H
127 #define _DRVTVENCODER_H
128 
129 #include "MsDevice.h"
130 
131 #ifdef __cplusplus
132 extern "C"
133 {
134 #endif
135 
136 //-------------------------------------------------------------------------------------------------
137 //  Macro and Define
138 //-------------------------------------------------------------------------------------------------
139 #define MSIF_VE_TAG                 {'M','S','I','F'}    //Version ID header
140 #define MSIF_VE_CLASS               {'0','0'}            //info Class code
141 #define MSIF_VE_CUS                 0x6666               //Customer ID
142 #define MSIF_VE_MOD                 0x6666               //Module ID
143 #define MSIF_VE_CHIP                0Xffff               //CHIP ID
144 #define MSIF_VE_CPU                 '1'                  //CPU
145 #define MSIF_VE_LIB_CODE            {'V','E','_','_'}    //Lib code
146 #define MSIF_VE_LIBVER              {'0','1'}            //LIB version
147 #define MSIF_VE_BUILDNUM            {'1','4'}            //Build Number
148 #define MSIF_VE_CHANGELIST          {'0','0','6','8','8','5','4','7'} //P4 ChangeList Number
149 //#define MSIF_OS                     '0'                  //OS
150 
151 #define VE_DRV_VERSION                  /* Character String for DRV/API version             */  \
152     MSIF_VE_TAG,                        /* 'MSIF'                                           */  \
153     MSIF_VE_CLASS,                      /* '00'                                             */  \
154     MSIF_VE_CUS,                        /* 0x0000                                           */  \
155     MSIF_VE_MOD,                        /* 0x0000                                           */  \
156     MSIF_VE_CHIP,                                                                               \
157     MSIF_VE_CPU,                                                                                \
158     MSIF_VE_LIB_CODE,                   /* IP__                                             */  \
159     MSIF_VE_LIBVER,                     /* 0.0 ~ Z.Z                                        */  \
160     MSIF_VE_BUILDNUM,                   /* 00 ~ 99                                          */  \
161     MSIF_VE_CHANGELIST,                 /* CL#                                              */  \
162     MSIF_OS
163 
164 /// version of structure 'MS_VE_VECAPTURESTATE' of current VE lib
165 #define VE_VECAPTURESTATE_VERSION                          0 //Version number for compatibility with AP and VE driver
166 #define VE_INPUTSRC_INFO_VERSION                           0
167 
168 //-------------------------------------------------------------------------------------------------
169 //  Type and Structure
170 //-------------------------------------------------------------------------------------------------
171 /// Result of VE function
172 typedef enum _VE_Result
173 {
174     E_VE_NOT_SUPPORT = -1,
175     E_VE_FAIL = 0,
176     E_VE_OK = 1,
177     E_VE_TIMEOUT,
178     E_VE_QUEUE_FULL,
179     E_VE_BUSY
180 } VE_Result;
181 
182 /// definition of video system
183 typedef enum
184 {
185     MS_VE_NTSC,     ///< NTSC
186     MS_VE_NTSC_443, ///< NTSC443
187     MS_VE_NTSC_J,   ///< NTSC_J
188     MS_VE_PAL_M,    ///< PAL_M
189     MS_VE_PAL_N,    ///< PAL_N
190     MS_VE_PAL_NC,   ///< PAL_Nc
191     MS_VE_PAL,      ///< PAL_B
192     MS_VE_SECAM,    ///< SECAM
193     MS_VE_VIDEOSYS_NUM,
194 } MS_VE_VIDEOSYS;
195 
196 typedef enum
197 {
198     MS_VE_LAYER_NONE = 0,                   ///<0: VE LAYER NONE
199     MS_VE_LAYER_FRAME_VIDEO_MUX1_MUX2,      ///<1: FrameColor->Video->osd  ->osd1
200     MS_VE_LAYER_FRAME_VIDEO_MUX2_MUX1,      ///<2: FrameColor->Video->osd1 ->osd
201     MS_VE_LAYER_FRAME_MUX1_VIDEO_MUX2,      ///<3: FrameColor->osd ->Video->osd1
202     MS_VE_LAYER_FRAME_MUX1_MUX2_VIDEO,      ///<4: FrameColor->osd ->osd1 ->Video
203     MS_VE_LAYER_FRAME_MUX2_VIDEO_MUX1,      ///<5: FrameColor>osd1 ->Video->osd
204     MS_VE_LAYER_FRAME_MUX2_MUX1_VIDEO,      ///<6: FrameColor->osd1 ->osd->Video
205     MS_VE_LAYER_RESERVED,
206 } MS_VE_OSD_LAYER_SEL;
207 
208 /// VE cap's capability
209 typedef struct
210 {
211     MS_BOOL bNTSC;
212     MS_BOOL bPAL;
213     MS_BOOL bVESupported;        ///< supported VE or not
214 } VE_Caps;
215 
216 /// VE extented capability: for STB chips, not all chips support up-scaling or
217 /// crop
218 typedef struct
219 {
220     MS_BOOL bSupport_UpScale;
221     MS_BOOL bSupport_CropMode;
222 } MS_VE_Ext_Cap;
223 
224 /// VE driver info.
225 typedef struct
226 {
227     VE_Caps stCaps;
228 } VE_DrvInfo;
229 
230 /// VE DRV status
231 typedef struct
232 {
233     MS_VE_VIDEOSYS         VideoSystem;         // video std of output signal
234     MS_U16  u16H_CapStart;
235     MS_U16  u16H_CapSize;
236     MS_U16  u16V_CapStart;
237     MS_U16  u16V_CapSize;
238 
239 } VE_DrvStatus;
240 
241 typedef struct
242 {
243     MS_U8*     pVE_TBL;
244     MS_U8*     pVE_Coef_TBL;
245     MS_U8*     pVBI_TBL;
246     MS_BOOL    bvtotal_525;
247     MS_BOOL    bPALSwitch;
248     MS_BOOL    bPALout;
249 }MS_VE_Out_VideoSYS, *PMS_VE_Out_VideoSYS;
250 
251 /// type of output destination for TV encoder
252 typedef enum
253 {
254     MS_VE_DEST_NONE = 0,
255     MS_VE_DEST_SCART,     ///< output destination is SCART
256     MS_VE_DEST_CVBS,      ///< output destination is CVBS
257     MS_VE_DEST_SVIDEO,    ///< output destination is S-Video
258     MS_VE_DEST_YPBPR,     ///< output destination is YPbPr
259     MS_VE_DEST_NUM,
260 } MS_VE_OUTPUT_DEST_TYPE;
261 
262 /// type of input source for TV encoder
263 typedef enum
264 {
265     MS_VE_SRC_DTV       = 0x00, ///< input source is DTV
266     MS_VE_SRC_ATV       = 0x01, ///< input source is ATV
267     MS_VE_SRC_CVBS0     = 0x02, ///< input source is CVBS0
268     MS_VE_SRC_CVBS1     = 0x03, ///< input source is CVBS1
269     MS_VE_SRC_CVBS2     = 0x04, ///< input source is CVBS2
270     MS_VE_SRC_CVBS3     = 0x05, ///< input source is CVBS3
271     MS_VE_SRC_SVIDEO    = 0x06, ///< input source is SVIDEO
272     MS_VE_SRC_DSUB      = 0x07, ///< input source is DSUB
273     MS_VE_SRC_COMP      = 0x08, ///< input source is COMP
274     MS_VE_SRC_HDMI_A    = 0x09, ///< input source is COMP
275     MS_VE_SRC_HDMI_B    = 0x0A, ///< input source is COMP
276     MS_VE_SRC_HDMI_C    = 0x0B, ///< input source is COMP
277     MS_VE_SRC_MAIN      = 0x0C, ///< input source is from main window
278     MS_VE_SRC_SUB       = 0x0D, ///< input source is from sub window
279     MS_VE_SRC_SCALER    = 0x0E, ///< input source is scaler op2
280     MS_VE_SRC_DI        = 0x0F, ///< input source is DI
281     MS_VE_SRC_BT656     = 0x10, ///< input source is BT656
282     MS_VE_SRC_DTV_FROM_MVOP = 0x11,  ///< input source is DTV but from MVOP
283     MS_VE_SRC_DNR       = 0x12,  ///< input source is DNR
284     MS_VE_SRC_NONE      = 0xFF,
285 }MS_VE_INPUT_SRC_TYPE;
286 
287 typedef struct
288 {
289     MS_U32 PreHScalingRatio;
290     MS_U32 PreVScalingRatio;
291     MS_U32 PostHScalingRatio;
292     MS_U32 PostVScalingRatio;
293 }MS_VE_Backup_Reg, *PMS_VE_Backup_Reg;
294 
295 /// status of switchinging output destination
296 typedef enum
297 {
298     MS_VE_SWITCH_DST_SUCCESS,               ///< success
299     MS_VE_SWITCH_DST_INVALID_COMBINATION,   ///< invalid combination
300     MS_VE_SWITCH_DST_INVALID_PARAM,         ///< invalid parameter
301     MS_VE_SWITCH_DST_FAIL,                  ///< fail
302 }MS_SWITCH_VE_DST_STATUS;
303 
304 
305 /// VE output Type
306 typedef enum
307 {
308     MS_VE_OUT_CCIR656,  ///< output signal is CCIR656
309     MS_VE_OUT_TVENCODER,///< output signal from TVEncoder
310     MS_VE_OUT_CAPTURE,///<   output signal from VE Capture
311 }MS_VE_OUT_TYPE;
312 
313 typedef struct
314 {
315     MS_U16  u16Width;
316     MS_U16  u16height;
317     MS_PHY  u32MiuBaseAddr;
318     MS_U32  u32MemSize;
319     MS_BOOL bVECapture; ///< TRUE/FALSE, enable/disable VE capture
320 }MS_VE_Output_CAPTURE, *PMS_VE_Output_CAPTURE;
321 
322 /// the information of switching ouput destination for TV encoder
323 typedef struct
324 {
325     MS_VE_OUTPUT_DEST_TYPE OutputDstType; ///< type of output destination
326     MS_SWITCH_VE_DST_STATUS Status;     ///< the returning status of switching output destination
327 }MS_Switch_VE_Dest_Info, *PMS_Switch_VE_Dest_Info;
328 
329 
330 /// status of switchinging input source
331 typedef enum
332 {
333     MS_VE_SWITCH_SRC_SUCCESS,           ///< success
334     MS_VE_SWITCH_SRC_INVALID_PARAM,     ///< invalid parameter
335     MS_VE_SWITCH_SRC_FAIL,              ///< fail
336 }MS_SWITCH_VE_SRC_STATUS;
337 
338 /// the information of switching output destination for TV encoder
339 typedef struct
340 {
341     MS_VE_INPUT_SRC_TYPE InputSrcType; ///< type of input source
342     MS_SWITCH_VE_SRC_STATUS Status; ///< the returning status of switching input source
343 }MS_Switch_VE_Src_Info, *PMS_Switch_VE_Src_Info;
344 
345 typedef struct
346 {
347     MS_U16  u16Version;   //< Version number for this structure
348     MS_VE_INPUT_SRC_TYPE eInputSrcType; ///< type of input source for Video encoder
349     MS_VE_INPUT_SRC_TYPE eInputSrcOfMixedSrc;  // The real input source for mixed "InputSrcType" of VE,
350                                               // eg. Real InputSrc of "MS_VE_SRC_MAIN", "MS_VE_SRC_SUB", "MS_VE_SRC_SCALER" etc.
351 }MS_VE_InputSrc_Info, *PMS_VE_InputSrc_Info;
352 
353 /// output control for VE
354 typedef struct
355 {
356     MS_BOOL bEnable; ///< TRUE/FALSE, enable/disable VE
357     MS_VE_OUT_TYPE OutputType; ///< VE output type
358 }MS_VE_Output_Ctrl, *PMS_VE_Output_Ctrl;
359 
360 /// VE set mode type
361 typedef struct
362 {
363     MS_U16 u16H_CapStart;
364     MS_U16 u16H_CapSize;
365     MS_U16 u16V_CapStart;
366     MS_U16 u16V_CapSize;
367     MS_U16 u16H_SC_CapStart;
368     MS_U16 u16H_SC_CapSize;
369     MS_U16 u16V_SC_CapStart;
370     MS_U16 u16V_SC_CapSize;
371     MS_U16 u16InputVFreq;
372     MS_BOOL bHDuplicate;
373     MS_BOOL bSrcInterlace;
374 }MS_VE_Set_Mode_Type;
375 
376 //VE_ApiStatus
377 typedef struct
378 {
379     PMS_VE_Output_Ctrl      output_ctrl;
380     MS_Switch_VE_Src_Info   src_info;
381     MS_Switch_VE_Dest_Info  dst_info;
382 }MS_VE_ApiStatus;
383 
384 /// Define Window position and size attribute
385 typedef struct
386 {
387     MS_U16 x;    ///<start x of the window
388     MS_U16 y;    ///<start y of the window
389     MS_U16 width;    ///<width of the window
390     MS_U16 height;    ///<height of the window
391 } MS_VE_WINDOW_TYPE;
392 
393 //Display information
394 typedef struct
395 {
396     MS_U32 VDTOT; //Output vertical total
397     MS_U32 DEVST; //Output DE vertical start
398     MS_U32 DEVEND;//Output DE Vertical end
399     MS_U32 HDTOT;// Output horizontal total
400     MS_U32 DEHST; //Output DE horizontal start
401     MS_U32 DEHEND;// Output DE horizontal end
402     MS_BOOL bInterlaceMode;
403 } MS_VE_DST_DispInfo;
404 
405 //VE register bank
406 typedef enum
407 {
408     MS_VE_REG_BANK_3B,
409     MS_VE_REG_BANK_3E,
410     MS_VE_REG_BANK_3F,
411 } MS_VE_REG_BANK;
412 
413 //External Info
414 typedef struct
415 {
416     //op to ve timing
417     MS_U16 u16VttIn;
418     MS_U16 u16HttIn;
419     MS_U16 u16HdeIn;
420     MS_U16 u16VdeIn;
421 
422     MS_U16 u16Vde_St;
423     MS_U16 u16Hde_St;
424 
425 }MS_VE_PLL_InCfg;
426 
427 //VE customer scaling setting
428 typedef struct
429 {
430     MS_U16   u16HScalingsrc; ///< H Source size for VE scaling
431     MS_U16   u16HScalingdst;///< H Dest size for VE scaling
432     MS_U16   u16VScalingsrc;///< V Source size for VE scaling
433     MS_U16   u16VScalingdst;///< V Dest size for VE scaling
434     MS_BOOL  bHCusScalingEnable; ///< Enable/Disable H customer scaling
435     MS_BOOL  bVCusScalingEnable; ///< Enable/Disable V customer scaling
436 }MS_VE_CusScalingInfo, *PMS_VE_CusScalingInfo;
437 
438 //Structure AP use
439 typedef struct
440 {
441     MS_U16  u16Version;   //< Version number for this structure
442     MS_U16  u16Length;    //< Length of this structure, unit: byte
443     MS_BOOL bEnable;      //< InOut, VE capture enable state
444     MS_U8   u8FrameCount; //< Out, Current captured frame number,value range: 0~3
445     MS_U8   u8Result;     //< Out, Function return status
446 }MS_VE_VECAPTURESTATE, *PMS_VE_VECAPTURESTATE;
447 
448 //-------------------------------------------------------------------------------------------------
449 //  Function and Variable
450 //-------------------------------------------------------------------------------------------------
451 //-------------------------------------------------------------------------------------------------
452 /// Description : Show the VE driver version
453 /// @ingroup VE_INFO
454 /// @param ppVersion \b Out: Library version string
455 /// @return             @ref  VE_Result
456 //-------------------------------------------------------------------------------------------------
457 // VE_Result MDrv_VE_GetLibVer(const MSIF_Version **ppVersion);
458 
459 //-------------------------------------------------------------------------------------------------
460 /// Description : Get VE Information
461 /// @ingroup VE_INFO
462 /// @return @ref VE_DrvInfo return the VE information in this member
463 //-------------------------------------------------------------------------------------------------
464 const VE_DrvInfo * MDrv_VE_GetInfo(void);
465 
466 //-------------------------------------------------------------------------------------------------
467 /// Description : Get VE Status
468 /// @ingroup VE_INFO
469 /// @param  pDrvStatus                  \b OUT: store the status
470 /// @return @ref VE_Result
471 //-------------------------------------------------------------------------------------------------
472 VE_Result MDrv_VE_GetStatus(VE_DrvStatus *pDrvStatus);
473 
474 //-------------------------------------------------------------------------------------------------
475 /// Description : Set VE debug memesage level
476 /// @ingroup VE_INFO
477 /// @param  level \b IN: the debug meseage level
478 /// @return None
479 //-------------------------------------------------------------------------------------------------
480 void MDrv_VE_SetDbgLevel(MS_U16 level);
481 
482 //-------------------------------------------------------------------------------------------------
483 /// Description : Get VE capability that support which standard
484 /// @ingroup VE_INFO
485 /// @param  pCaps \b OUT: the standard that VE support
486 /// @return None
487 //-------------------------------------------------------------------------------------------------
488 // void MDrv_VE_GetCaps(VE_Caps* pCaps);
489 
490 //------------------------------------------------------------------------------
491 /// Description : Set the input source of video encoder
492 /// @ingroup VE_ToBeModified
493 /// @param  -pSwitchInfo \b IN/OUT: the information of switching input destination of TV encodeer
494 /// @return None
495 //------------------------------------------------------------------------------
496 void MDrv_VE_SwitchInputSource(PMS_Switch_VE_Src_Info pSwitchInfo);
497 
498 //------------------------------------------------------------------------------
499 /// Description: Extended API for set the input source of video encoder(To Expand&Replace MDrv_VE_SwitchInputSource)
500 /// @ingroup VE_EEATURE
501 /// @param  -pSwitchInfo \b IN/OUT: the information of switching input destination of TV encodeer
502 /// @return @ref MS_SWITCH_VE_SRC_STATUS
503 //------------------------------------------------------------------------------
504 MS_SWITCH_VE_SRC_STATUS MDrv_VE_SetInputSource(PMS_VE_InputSrc_Info pInputSrcInfo);
505 
506 //------------------------------------------------------------------------------
507 /// Description : Set the output destination of video encoder
508 /// @ingroup VE_FEATURE
509 ///              None SCART CVBS SVIDEO YPbPr
510 ///       None    O     O     O     O     O
511 ///       SCART O      -     X     X     X
512 ///        CVBS  O     X      -     O     O
513 ///     S_VIDE  O     O     X      O     -     X
514 ///       YPbPr   O     X     O      X     -
515 ///
516 /// @param  -pSwitchInfo \b IN/OUT: the information of switching output destination of TV encodeer
517 /// @return None
518 //------------------------------------------------------------------------------
519 void MDrv_VE_SwitchOuputDest(PMS_Switch_VE_Dest_Info pSwitchInfo);
520 
521 //------------------------------------------------------------------------------
522 /// Description : Control the output of video encoder
523 /// @ingroup VE_FEATURE
524 /// @param  -pOutputCtrl \b IN: the control information of VE
525 /// @return none
526 //------------------------------------------------------------------------------
527 void MDrv_VE_SetOutputCtrl(PMS_VE_Output_Ctrl pOutputCtrl);
528 
529 //------------------------------------------------------------------------------
530 /// Description : Set the output video standard of video encoder
531 /// @ingroup VE_FEATURE
532 /// @param  -VideoSystem \b IN: the video standard
533 /// @return TRUE: supported and success,  FALSE: unsupported or unsuccess
534 //------------------------------------------------------------------------------
535 MS_BOOL MDrv_VE_SetOutputVideoStd(MS_VE_VIDEOSYS VideoSystem);
536 
537 //------------------------------------------------------------------------------
538 /// Description : Load customized setting table for VE
539 /// User can load customized table in initialize function, then enable it.
540 /// Driver will apply customized table setting when MDrv_VE_SetOutputVideoStd
541 /// Table using sample:
542 /// MS_U8 pPALTable[12] =
543 ///        {0xAA,0xBB,0xCC,0xDD,  => add one customized setting. format: {bank_H, bank_L, 8-bit address, value,}
544 ///          0xFF,0xFF,0xFF,0xFF} => must set 0xFF,0xFF,0xFF,0xFF for end of table command setting
545 /// Note: Users set value which want to be changed only.
546 /// @ingroup VE_FEATURE
547 /// @param  -VideoSystem \b IN: the video standard
548 /// @param  -pTbl \b IN: pointer to the table
549 /// @return TRUE: supported and success,  FALSE: unsupported or unsuccess
550 //------------------------------------------------------------------------------
551 // MS_BOOL MDrv_VE_SetCusTable(MS_VE_VIDEOSYS VideoSystem, MS_U8* pTbl);
552 
553 //------------------------------------------------------------------------------
554 /// Description : Enable/Disable customized table
555 /// @ingroup VE_FEATURE
556 /// @param  -bEnable \b IN: Enable/Disable customized table
557 //------------------------------------------------------------------------------
558 // void MDrv_VE_EnableCusTable(MS_BOOL bEnable);
559 
560 //------------------------------------------------------------------------------
561 /// Description : Power on VE
562 /// @ingroup VE_ToBeRemove
563 /// @return none
564 //------------------------------------------------------------------------------
565 // void MDrv_VE_PowerOn(void);
566 //------------------------------------------------------------------------------
567 /// Description : Power off VE
568 /// @ingroup VE_ToBeRemove
569 /// @return none
570 //------------------------------------------------------------------------------
571 // void MDrv_VE_PowerOff(void);
572 
573 //------------------------------------------------------------------------------
574 /// Description : Set RIU Base
575 /// @ingroup VE_FEATURE
576 /// @return TRUE: success, FALSE: unsuccess
577 //------------------------------------------------------------------------------
578 MS_BOOL MDrv_VE_SetIOMapBase(void);
579 
580 //------------------------------------------------------------------------------
581 /// Description : Initiate VE
582 /// @ingroup VE_INIT
583 /// @param[in]  u32MIUAddress  \b IN: The address reserved for VE
584 /// @return none
585 //------------------------------------------------------------------------------
586 void MDrv_VE_Init(MS_PHYADDR u32MIUAddress);
587 
588 //------------------------------------------------------------------------------
589 /// Description : Exit VE
590 /// @ingroup VE_FEATURE
591 /// @return TRUE: success, FALSE: unsuccess
592 //------------------------------------------------------------------------------
593 MS_BOOL MDrv_VE_Exit(void);
594 
595 //------------------------------------------------------------------------------
596 /// Description : Set Wild-screen signal
597 /// @ingroup VE_FEATURE
598 /// @param  -bEn \b IN: Enable/Disable WSS
599 /// @param  -u16WSSData \b IN: The WSS data
600 /// @return none
601 //------------------------------------------------------------------------------
602 void MDrv_VE_SetWSSData(MS_BOOL bEn, MS_U16 u16WSSData);
603 
604 //------------------------------------------------------------------------------
605 /// Description : Get Wild-screen signal data
606 /// @ingroup VE_FEATURE
607 /// @return @ref MS_U16 retun the data of WSS
608 //------------------------------------------------------------------------------
609 MS_U16 MDrv_VE_GetWSSData(void);
610 
611 //------------------------------------------------------------------------------
612 /// Description : VE Setmode. Configurate VE for CVBS out.
613 /// @ingroup VE_FEATURE
614 /// @param[in]  pVESetMode  \b IN: The parameter for VE
615 /// @return none
616 //------------------------------------------------------------------------------
617 void MDrv_VE_SetMode(MS_VE_Set_Mode_Type * pVESetMode);
618 
619 //------------------------------------------------------------------------------
620 /// Description : Output black screen from VE. This function is not for disabling VE.
621 /// @ingroup VE_FEATURE
622 /// @param[in]  pVESetMode  \b IN: enable or disable the black screen
623 /// @return none
624 //------------------------------------------------------------------------------
625 void MDrv_VE_SetBlackScreen(MS_BOOL bEn);
626 
627 //------------------------------------------------------------------------------
628 /// Description : Return true if VE output black video right now.
629 /// @ingroup VE_FEATURE
630 /// @return @ref MS_BOOL
631 //------------------------------------------------------------------------------
632 MS_BOOL MDrv_VE_IsBlackScreenEnabled(void);
633 
634 //------------------------------------------------------------------------------
635 /// Description : VE restart TVE to read data from TT buffer
636 /// @ingroup VE_FEATURE
637 /// @param[in]  bEnable  \b IN: enable or disable the TTX
638 /// @return none
639 //------------------------------------------------------------------------------
640 void MDrv_VE_EnableTtx(MS_BOOL bEnable);
641 
642 //------------------------------------------------------------------------------
643 /// Description : VE set TTx buffer address
644 /// @ingroup VE_FEATURE
645 /// @param[in]  u32StartAddr  \b IN: Start of the Memory address that store TTX
646 /// @param[in]  u32Size       \b IN: the size of store the TTX data
647 /// @return none
648 //------------------------------------------------------------------------------
649 void MDrv_VE_SetTtxBuffer(MS_U32 u32StartAddr, MS_U32 u32Size);
650 
651 //------------------------------------------------------------------------------
652 /// Description : VE clear TT buffer read done status
653 /// @ingroup VE_FEATURE
654 /// @return none
655 //------------------------------------------------------------------------------
656 void MDrv_VE_ClearTtxReadDoneStatus(void);
657 
658 //------------------------------------------------------------------------------
659 /// Description : VE TT buffer read done status
660 /// @ingroup VE_FEATURE
661 /// @return TRUE/FALSE
662 //------------------------------------------------------------------------------
663 MS_BOOL MDrv_VE_GetTtxReadDoneStatus(void);
664 
665 //------------------------------------------------------------------------------
666 /// Description : VE Set VBI TT active Lines
667 /// @ingroup VE_FEATURE
668 /// @param[in]  u8LinePerField       \b IN: TTX active line
669 /// @return none
670 //------------------------------------------------------------------------------
671 void MDrv_VE_SetVbiTtxActiveLines(MS_U8 u8LinePerField);
672 
673 //------------------------------------------------------------------------------
674 /// Description : VE Set VBI TT active Lines by the given bitmap
675 /// @ingroup VE_FEATURE
676 /// @param <IN>\b u32Bitmap: a bitmap that defines whick physical lines the teletext lines are to be inserted.
677 /// @return none
678 //------------------------------------------------------------------------------
679 // void MDrv_VE_SetVbiTtxActiveLinesBitmap(MS_U32 u32Bitmap);
680 
681 //------------------------------------------------------------------------------
682 /// Description : VE Set VBI ttx active line
683 /// @ingroup VE_FEATURE
684 /// @param <IN>\b odd_start: odd page start line
685 /// @param <IN>\b odd_end: odd page end line
686 /// @param <IN>\b even_start: even page start line
687 /// @param <IN>\b even_end: even page end line
688 /// @return none
689 //------------------------------------------------------------------------------
690 // void MDrv_VE_SetVbiTtxRange(MS_U16 odd_start, MS_U16 odd_end,
691 //                             MS_U16 even_start, MS_U16 enen_end);
692 //------------------------------------------------------------------------------
693 /// Description : VE Set VBI CC
694 /// @ingroup VE_FEATURE
695 /// @param[in]  bEnable  \b IN: enable or disable the CC
696 /// @return none
697 //------------------------------------------------------------------------------
698 // void MDrv_VE_EnableCcSw(MS_BOOL bEnable);
699 
700 //------------------------------------------------------------------------------
701 /// Description : VE Set VBI CC active line
702 /// @ingroup VE_FEATURE
703 /// @param <IN>\b odd_start: odd page start line
704 /// @param <IN>\b odd_end: odd page end line
705 /// @param <IN>\b even_start: even page start line
706 /// @param <IN>\b even_end: even page end line
707 /// @return none
708 //------------------------------------------------------------------------------
709 // void MDrv_VE_SetCcRange(MS_U16 odd_start, MS_U16 odd_end, MS_U16 even_start, MS_U16 enen_end);
710 
711 //------------------------------------------------------------------------------
712 /// Description : VE Set VBI CC data
713 /// @ingroup VE_FEATURE
714 /// @param <IN>\b bIsOdd: odd field use
715 /// @param <IN>\b data: the CC data
716 /// @return none
717 //------------------------------------------------------------------------------
718 // void MDrv_VE_SendCcData(MS_BOOL bIsOdd, MS_U16 data);
719 
720 //------------------------------------------------------------------------------
721 /// Description : VE Set display windows
722 /// @ingroup VE_FEATURE
723 /// @param <IN>\b stDispWin: the info of the display window
724 /// @return none
725 //------------------------------------------------------------------------------
726 void MDrv_VE_set_display_window(MS_VE_WINDOW_TYPE stDispWin);
727 
728 //------------------------------------------------------------------------------
729 /// Description : VE Set output with Frame Color
730 /// @ingroup VE_FEATURE
731 /// @param <IN>\b u32aRGB: the value of frame color
732 /// @return none
733 //------------------------------------------------------------------------------
734 // VE_Result MDrv_VE_SetFrameColor(MS_U32 u32aRGB);
735 
736 //------------------------------------------------------------------------------
737 /// Description : VE Set output with OSD
738 /// @ingroup VE_FEATURE
739 /// @param <IN>\b bEnable: enable or disable the OSD
740 /// @return none
741 //------------------------------------------------------------------------------
742 void MDrv_VE_SetOSD(MS_BOOL bEnable);
743 
744 //------------------------------------------------------------------------------
745 /// Description : Set VE OSD Layer
746 /// @ingroup VE_FEATURE
747 /// @param <IN>\b eVideoOSDLayer: set the OSD layer
748 /// @return none
749 //------------------------------------------------------------------------------
750 // VE_Result MDrv_VE_Set_OSDLayer(MS_VE_OSD_LAYER_SEL eVideoOSDLayer);
751 
752 //------------------------------------------------------------------------------
753 /// Description: Get VE OSD Layer
754 /// @ingroup VE_FEATURE
755 /// @return @ref MS_VE_OSD_LAYER_SEL
756 //------------------------------------------------------------------------------
757 // MS_VE_OSD_LAYER_SEL MDrv_VE_Get_OSDLayer(void);
758 
759 //------------------------------------------------------------------------------
760 /// Description: Set VE Video Alpha
761 /// @ingroup VE_FEATURE
762 /// @param <IN>\b u8Val: set the video alpha value
763 /// @return @ref VE_Result
764 //------------------------------------------------------------------------------
765 // VE_Result MDrv_VE_Set_VideoAlpha(MS_U8 u8Val);
766 
767 //------------------------------------------------------------------------------
768 /// Description: Get VE Video Alpha
769 /// @ingroup VE_FEATURE
770 /// @param <OUT>\b pu8Val: pointer to the value
771 /// @return @ref VE_Result
772 //------------------------------------------------------------------------------
773 // VE_Result MDrv_VE_Get_VideoAlpha(MS_U8 *pu8Val);
774 
775 //------------------------------------------------------------------------------
776 /// Description: VE Set RGB In
777 /// @ingroup VE_FEATURE
778 /// @param <IN>\b bEnable: set the input is RGB or not
779 /// @return none
780 //------------------------------------------------------------------------------
781 void MDrv_VE_SetRGBIn(MS_BOOL bEnable);
782 
783 //------------------------------------------------------------------------------
784 /// Description: VE Get output video standard
785 /// @ingroup VE_FEATURE
786 /// @return @ref MS_VE_VIDEOSYS
787 //------------------------------------------------------------------------------
788 MS_VE_VIDEOSYS MDrv_VE_Get_Output_Video_Std(void);
789 
790 //------------------------------------------------------------------------------
791 /// Description: VE Set Capture Mode
792 /// @ingroup VE_FEATURE
793 /// @param <IN>\b bEnable: enable or disable the capture mode
794 /// @return none
795 //------------------------------------------------------------------------------
796 void MDrv_VE_SetCaptureMode(MS_BOOL bEnable);
797 
798 //------------------------------------------------------------------------------
799 /// Description: VE Get Destination Information for GOP mixer
800 /// @param <OUT>\b pDstInfo: output DST display info
801 /// @param <IN>\b u32SizeofDstInfo: The size of DST display info
802 /// @return @ref MS_BOOL
803 //------------------------------------------------------------------------------
804 MS_BOOL MApi_VE_GetDstInfo(MS_VE_DST_DispInfo *pDstInfo, MS_U32 u32SizeofDstInfo);
805 
806 //------------------------------------------------------------------------------
807 /// Description: VE Set Test pattern
808 /// @ingroup VE_FEATURE
809 /// @param <IN>\b bEnable: enable or disable the test pattern
810 /// @return none
811 //------------------------------------------------------------------------------
812 // void MDrv_VE_Set_TestPattern(MS_BOOL bEn);
813 
814 //------------------------------------------------------------------------------
815 /// Description: Write the VE register
816 /// @ingroup VE_FEATURE
817 /// @param <IN>\b VE_BK: select the VE bank
818 /// @param <IN>\b u32Reg: the register to be set
819 /// @param <IN>\b u16Val: set value
820 /// @param <IN>\b u16Mask: the mask value
821 /// @return none
822 //------------------------------------------------------------------------------
823 void MApi_VE_W2BYTE_MSK(MS_VE_REG_BANK VE_BK, MS_U32 u32Reg, MS_U16 u16Val, MS_U16 u16Mask);
824 
825 //------------------------------------------------------------------------------
826 /// Description: Write the VE register
827 /// @ingroup VE_FEATURE
828 /// @param <IN>\b VE_BK: select the VE bank
829 /// @param <IN>\b u32Reg: the register to be read
830 /// @param <IN>\b u16Mask: the mask value
831 /// @return @ref MS_U16
832 //------------------------------------------------------------------------------
833 // MS_U16 MApi_VE_R2BYTE_MSK(MS_VE_REG_BANK VE_BK, MS_U32 u32Reg, MS_U16 u16Mask);
834 
835 //------------------------------------------------------------------------------
836 /// Description: VE Dump Table Interface
837 /// @ingroup VE_FEATURE
838 /// @param <IN>\b pVETable: pointer to the table
839 /// @param <IN>\b u8TableType: the type of table
840 /// @return none
841 //------------------------------------------------------------------------------
842 // void MDrv_VE_DumpTable(MS_U8 *pVETable, MS_U8 u8TableType);
843 
844 //------------------------------------------------------------------------------
845 /// Description: This routine set flag to mask register write for special case \n
846 ///            e.g. MBoot to APP with logo display
847 /// @ingroup VE_FEATURE
848 /// @param <IN>\b bFlag: TRUE: Mask register write, FALSE: not Mask
849 /// @return @ref VE_Result
850 //------------------------------------------------------------------------------
851 VE_Result MDrv_VE_DisableRegWrite(MS_BOOL bFlag);
852 
853 //------------------------------------------------------------------------------
854 /// Description: VE show internal color bar (test pattern)
855 /// @ingroup VE_FEATURE
856 /// @param <IN>\b bEnable: TRUE to enable color; false to disable color bar
857 /// @return None
858 //------------------------------------------------------------------------------
859 // void MDrv_VE_ShowColorBar(MS_BOOL bEnable);
860 
861 //------------------------------------------------------------------------------
862 /// Description: This routine set read/write addjustment to centralize VE display window.\n
863 ///        Set the adjustment and it works after MDrv_VE_set_display_window() API is invoked. \n
864 /// @ingroup VE_FEATURE
865 /// @param <IN>\b s32WAddrAdjustment: the pixel units to adjust on write address
866 /// @param <IN>\b s32RAddrAdjustment: the pixel units to adjust on read address
867 /// @return @ref VE_Result
868 //------------------------------------------------------------------------------
869 VE_Result MDrv_VE_AdjustPositionBase(MS_S32 s32WAddrAdjustment, MS_S32 s32RAddrAdjustment);
870 
871 //------------------------------------------------------------------------------
872 /// Description: In STB Chip, VE needs to set vepll to lock frame rate with HD Path.\n
873 /// @ingroup VE_FEATURE
874 /// @param <IN>\b pInCfg: Information of HD path
875 /// @param <IN>\b bEnable: enable/disable frame lock
876 /// @return @ref VE_Result
877 //------------------------------------------------------------------------------
878 // VE_Result MDrv_VE_SetFrameLock(MS_VE_PLL_InCfg *pInCfg, MS_BOOL bEnable);
879 
880 //------------------------------------------------------------------------------
881 /// Description: Provide the capability of Customer scaling for VE.\n
882 /// @ingroup VE_FEATURE
883 /// @param <IN>\b pstVECusScalingInfo : Src and Dest info for customer scaling, @ref MS_VE_CusScalingInfo
884 /// @return @ref VE_Result
885 //------------------------------------------------------------------------------
886 VE_Result  MDrv_VE_Set_Customer_Scaling(MS_VE_CusScalingInfo *pstVECusScalingInfo);
887 //------------------------------------------------------------------------------
888 /// Description: MDrv_VE_set_crop_window, set up crop window (crop video frame in MIU)
889 /// @ingroup VE_FEATURE
890 /// @param <IN>\b stCropWin: crop window
891 /// @return @ref VE_Result
892 //------------------------------------------------------------------------------
893 // VE_Result MDrv_VE_set_crop_window(MS_VE_WINDOW_TYPE stCropWin);
894 //------------------------------------------------------------------------------
895 /// Description: VE be set display window (backend), after MIU
896 /// @ingroup VE_FEATURE
897 /// @param <IN>\b stDispWin: display window
898 /// @return @ref VE_Result
899 //------------------------------------------------------------------------------
900 // VE_Result MDrv_VE_set_be_display_window(MS_VE_WINDOW_TYPE stDispWin);
901 //------------------------------------------------------------------------------
902 /// Description: MDrv_VE_Get_Ext_Caps: get VE extented capability
903 /// @ingroup VE_FEATURE
904 /// @param <OUT>\b cap: Get capbility
905 /// @return @ref VE_Result
906 //------------------------------------------------------------------------------
907 // VE_Result MDrv_VE_Get_Ext_Caps(MS_VE_Ext_Cap *cap);
908 //------------------------------------------------------------------------------
909 /// Description: MDrv_VE_SetWindow, set crop window and display window in one API.
910 /// @ingroup VE_FEATURE
911 /// @argument:
912 /// @param <IN>\b stSrcWin: a pointer to MS_VE_WINDOW_TYPE - source window, depends on input size
913 /// @param <IN>\b stCropWin: a pointer to MS_VE_WINDOW_TYPE - crop window, depends on source window size
914 /// @param <IN>\b stDispWin: a pointer to MS_VE_WINDOW_TYPE - display window, depends on output size
915 /// @return @ref VE_Result
916 //------------------------------------------------------------------------------
917 // VE_Result MDrv_VE_SetWindow(MS_VE_WINDOW_TYPE *stSrcWin, MS_VE_WINDOW_TYPE *stCropWin,
918 //         MS_VE_WINDOW_TYPE *stDispWin);
919 
920 //------------------------------------------------------------------------------
921 /// Description: Init and config the VE capture
922 /// @ingroup VE_FEATURE
923 /// @param pVECapture \b IN : @ref PMS_VE_Output_CAPTURE
924 /// @return none
925 //------------------------------------------------------------------------------
926 void MDrv_VE_InitVECapture(PMS_VE_Output_CAPTURE pVECapture);
927 
928 //------------------------------------------------------------------------------
929 /// Description: Enable VE capture
930 /// @ingroup VE_FEATURE
931 /// @param <IN>\b pstVECapState: a pointer to caputre state
932 /// @return @ref MS_BOOL
933 //------------------------------------------------------------------------------
934 MS_BOOL MDrv_VE_EnaVECapture(PMS_VE_VECAPTURESTATE pstVECapState);
935 
936 //------------------------------------------------------------------------------
937 /// Description: Get VE capture state
938 /// @ingroup VE_FEATURE
939 /// @param <IN>\b pstVECapState: a pointer to get caputre state
940 /// @return @ref MS_BOOL
941 //------------------------------------------------------------------------------
942 // MS_BOOL MDrv_VE_GetVECaptureState(PMS_VE_VECAPTURESTATE pstVECapState);
943 
944 //-------------------------------------------------------------------------------------------------
945 /// Description: Wait on the finish of specified frame: Check if the frame is captured,
946 /// if Yes, return TRUE, otherwise sleep until the next Vsync ISR
947 /// @ingroup VE_FEATURE
948 /// @param <IN>\b pstVECapState: a pointer to caputre state
949 /// @return @ref MS_BOOL
950 //-------------------------------------------------------------------------------------------------
951 MS_BOOL MDrv_VE_VECaptureWaitOnFrame(PMS_VE_VECAPTURESTATE pstVECapState);
952 
953 ////////////////////////////////////////////////////////////////////////////////
954 /// Description : the frame start is used to adjust output video (in pixel)
955 /// @ingroup VE_FEATURE
956 /// @param <IN>        \b stSrcWin :source window, depends on input size
957 /// @param <IN>\b pixel_offset : set pixel offset value
958 /// @return @ref VE_Result
959 ////////////////////////////////////////////////////////////////////////////////
960 VE_Result MDrv_VE_Adjust_FrameStart(MS_VE_WINDOW_TYPE *stSrcWin,MS_S16 pixel_offset);
961 
962 //-------------------------------------------------------------------------------------------------
963 /// Description : Start or Stop to send WSS data on 525i system
964 /// @ingroup VE_FEATURE
965 /// @param <IN>\b  bEn: enable/disable wss525
966 /// @param <IN>\b  u32WSSData: 20-bit wss data includes 14 bits of data and 6 bits of CRC
967 /// @return             @ref  VE_Result
968 //-------------------------------------------------------------------------------------------------
969 VE_Result MDrv_VE_SetWSS525Data(MS_BOOL bEn, MS_U32 u32WSSData);
970 
971 //-------------------------------------------------------------------------------------------------
972 /// Description : Get current wss data
973 /// @ingroup VE_FEATURE
974 /// @return   32-bit wss data, it includes 14 bits of data and 6 bits of CRC in lower 20 bits
975 //-------------------------------------------------------------------------------------------------
976 MS_U32 MDrv_VE_GetWSS525Data(void);
977 
978 //-------------------------------------------------------------------------------------------------
979 /// Description : Set the state for supesend
980 /// @ingroup VE_FEATURE
981 /// @param <IN>\b  u16PowerState: The state for suspend
982 /// @return  @ref MS_U32 , TRUE for success, false for fail
983 //-------------------------------------------------------------------------------------------------
984 MS_U32 MDrv_TVE_SetPowerState(EN_POWER_MODE u16PowerState);
985 
986 #ifdef __cplusplus
987 }
988 #endif
989 
990 #endif  // _DRVTVENCODER_H
991