xref: /utopia/UTPA2-700.0.x/mxlib/include/drvVBI.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!�L) 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   drvVBI.h
98 /// @brief  MStar VBI Driver Interface
99 /// @author MStar Semiconductor Inc.
100 /// @version 1.0
101 ///////////////////////////////////////////////////////////////////////////////////////////////////
102 
103 //-------------------------------------------------
104 /*! \defgroup VBI VBI interface
105     \ingroup  VBI
106 
107     <b> Operation Code Flow: </b> \n
108     \image html vbi1.png
109     \image html vbi2.png
110 
111   *! \defgroup VBI_General VBI general functions
112   *   \ingroup   VBI
113 
114   *! \defgroup VBI_Task VBI process functions.
115   *   \ingroup   VBI
116 
117   *! \defgroup VBI_TTX VBI TTX related functions
118   *   \ingroup   VBI
119 
120   *! \defgroup VBI_CC VBI CC related functions
121   *   \ingroup   VBI
122 
123   *! \defgroup VBI_STR VBI STR functions
124   *   \ingroup   VBI
125 
126   *! \defgroup VBI_ToBeModified VBI api to be modified
127   *   \ingroup   VBI
128 
129   *! \defgroup VBI_TTX_ToBeModified VBI TTX api to be modified
130   *   \ingroup   VBI_ToBeModified
131 
132   *! \defgroup VBI_ToBeRemove VBI api to be removed
133   *   \ingroup   VBI
134   */
135 //-------------------------------------------------
136 
137 #ifndef _DRV_VBI_H
138 #define _DRV_VBI_H
139 
140 #include "MsTypes.h"
141 #include "MsDevice.h"
142 
143 #include "ULog.h"
144 #include "UFO.h"
145 #ifdef __cplusplus
146 extern "C"
147 {
148 #endif
149 
150 #define VBI_UTOPIA20 (1)
151 
152 //-------------------------------------------------------------------------------------------------
153 //  Driver Capability
154 //-------------------------------------------------------------------------------------------------
155 
156 
157 //-------------------------------------------------------------------------------------------------
158 //  Macro and Define
159 //-------------------------------------------------------------------------------------------------
160 #define VBI_TTX_DATA_LENGTH 48
161 
162 #define MSIF_VBI_LIB_CODE                   {'V','B','I','_'} //Lib code
163 #define MSIF_VBI_LIBVER                        {'0','0'}      //LIB version
164 #define MSIF_VBI_BUILDNUM                 {'0','2' }    //Build Number
165 #define MSIF_VBI_CHANGELIST             {'0','0','5','6','5','9','8','0'} //P4 ChangeList Number
166 #define VBI_VER                  /* Character String for DRV/API version             */  \
167     MSIF_TAG,                           /* 'MSIF'                                           */  \
168     MSIF_CLASS,                         /* '00'                                             */  \
169     MSIF_CUS,                           /* 0x0000                                           */  \
170     MSIF_MOD,                           /* 0x0000                                           */  \
171     MSIF_CHIP,                                                                                  \
172     MSIF_CPU,                                                                                   \
173     MSIF_VBI_LIB_CODE,                  /* IP__                                             */  \
174     MSIF_VBI_LIBVER,                       /* 0.0 ~ Z.Z                                        */  \
175     MSIF_VBI_BUILDNUM,                 /* 00 ~ 99                                          */  \
176     MSIF_VBI_CHANGELIST,             /* CL#                                              */  \
177     MSIF_OS
178 
179 
180 //-------------------------------------------------------------------------------------------------
181 //  Type and Structure
182 //-------------------------------------------------------------------------------------------------
183 typedef enum
184 {
185     VBI_VIDEO_SECAM,
186     VBI_VIDEO_PAL_NC,
187     VBI_VIDEO_PAL_M,
188     VBI_VIDEO_NTSC,
189     VBI_VIDEO_NTSC443_PAL60,
190     VBI_VIDEO_PAL,
191     VBI_VIDEO_OTHERS
192 } VBI_VIDEO_STANDARD;
193 
194 typedef enum
195 {
196     E_VBI_TELETEXT,
197     E_VBI_CC,
198     E_VBI_WSS
199 } VBI_INIT_TYPE;
200 
201 typedef struct
202 {
203     MS_U8   u8NoInfo;
204 } VBI_DrvInfo;
205 
206 typedef struct DLL_PACKED
207 {
208     VBI_INIT_TYPE   eInitType;
209 } VBI_DrvStatus;
210 
211 typedef struct DLL_PACKED
212 {
213     MS_U8 ptable[7];
214 } VBI_CC_TABLE;
215 
216 typedef struct DLL_PACKED
217 {
218     MS_BOOL _bSuspend;
219     VBI_INIT_TYPE eInitType;
220     MS_VIRT _ptrVBIRiuBaseAddr;
221 
222     // TTX buffer address & buffer size
223     MS_PHY  _TTXBufAddr;
224     MS_U16  _TTXBufLen;
225 
226     // CC buffer address & buffer size
227     MS_PHY  _CCBufAddr;
228     MS_U16  _CCBufLen;
229 
230     // callback info
231     MS_PHY  _cbBufferAddr;
232     MS_U32  _cbBufferLength;
233     MS_U8  *_pCbVABuff;
234 
235     MS_BOOL  _bTTXSupported;
236     MS_BOOL  _bVBIInit;
237     MS_U16  _u16VBIDbgSwitch;
238 } VBI_StoreInfo;
239 
240 /*
241  * ClosedCaption
242  */
243 typedef enum
244 {
245     VBI_CC_PACKET_COUNT,
246     VBI_CC_BYTE_FOUND_INDICATION,
247     VBI_CC_DATA_GET
248 
249 } EN_VBI_INFO;
250 
251 /* Error code */
252 typedef enum
253 {
254     VBI_ERRORCODE_SUCCESS            = 0x0000,
255     VBI_ERRORCODE_FAIL               = 0x0001
256 
257 } EN_VBI_ERRORCODE;
258 
259 typedef enum
260 {
261     EN_TTX_DMA_HEADER,
262     EN_TTX_DMA_PACKET1_TO_25,
263     EN_TTX_DMA_PACKET26_28_29,
264     EN_TTX_DMA_PACKET27,
265     EN_TTX_DMA_BTT,
266     EN_TTX_DMA_AIT,
267 } EN_TTX_DMA_TYPE;
268 
269 typedef enum
270 {
271     VBI_INIT,
272     VBI_EXIT,
273     VBI_SUSPEND,
274     VBI_RESUME,
275 } EN_VBI_CMD;
276 
277 typedef MS_U32(*VBI_CB_FN)(MS_U8 *pVBILine, MS_U32 length);
278 //-------------------------------------------------------------------------------------------------
279 //  Function and Variable
280 //-------------------------------------------------------------------------------------------------
281 
282 // must have functions
283 //-------------------------------------------------------------------------------------------------
284 /// Get VBI lib version.
285 /// @ingroup VBI_General
286 /// @param  pFN             \b OUT: return vbi lib version.
287 /// @return TRUE  : Succeed
288 /// @return FALSE : Fail
289 //-------------------------------------------------------------------------------------------------
290 MS_BOOL MDrv_VBI_GetLibVer(const MSIF_Version **ppVersion);                  ///< Get version (without Mutex protect)
291 //-------------------------------------------------------------------------------------------------
292 /// Get VBI module info.
293 /// @ingroup VBI_General
294 /// @return VBI_DrvInfo
295 //-------------------------------------------------------------------------------------------------
296 const VBI_DrvInfo * MDrv_VBI_GetInfo(void);              ///< Get info from driver (without Mutex protect)
297 //-------------------------------------------------------------------------------------------------
298 /// Get VBI Driver Status.
299 /// @ingroup VBI_General
300 /// @param  pDrvStatus    \b OUT: driver status.
301 /// @return TRUE  : Succeed
302 /// @return FALSE : Fail
303 //-------------------------------------------------------------------------------------------------
304 MS_BOOL MDrv_VBI_GetStatus(VBI_DrvStatus *pDrvStatus);   ///< Get VBI current status
305 //-------------------------------------------------------------------------------------------------
306 /// Set VBI Debug Level.
307 /// @ingroup VBI_General
308 /// @param  u16DbgSwitch    \b IN: debug level.
309 /// @return TRUE  : Succeed
310 /// @return FALSE : Fail
311 //-------------------------------------------------------------------------------------------------
312 MS_BOOL MDrv_VBI_SetDbgLevel(MS_U16 u16DbgSwitch);       ///< Set debug level (without Mutex protect)
313 
314 //-----------------
315 // VBI_General
316 //-----------------
317 //-------------------------------------------------------------------------------------------------
318 /// Initialize VBI module
319 /// @ingroup VBI_General
320 /// @param  type      \b IN: VBI type (Teletext/CC)
321 /// @return TRUE  : Succeed
322 /// @return FALSE : Fail
323 //-------------------------------------------------------------------------------------------------
324 MS_BOOL MDrv_VBI_Init(VBI_INIT_TYPE type);
325 //-------------------------------------------------------------------------------------------------
326 /// Finalize VBI module
327 /// @ingroup VBI_General
328 /// @return TRUE  : Succeed
329 /// @return FALSE : Fail
330 //-------------------------------------------------------------------------------------------------
331 MS_BOOL MDrv_VBI_Exit(void);
332 
333 //-------------------------------------------------------------------------------------------------
334 /// Set Callback to VBI driver, the CB will be called if VBI interrupt is catched
335 /// @ingroup VBI_Task
336 /// @param  pFN              \b IN: call back function pointer.
337 /// @param  bufferAddr    \b IN: the physical address of buffer which will store VBI data and pass pointer to CB
338 /// @param  length           \b IN: the data lebgth of th input buffer. Note: it should be the multiple of VBI_TTX_DATA_LENGTH
339 /// @return None
340 //-------------------------------------------------------------------------------------------------
341 #if defined(UFO_PUBLIC_HEADER_300)
342 void MDrv_VBI_RegisterCB(VBI_CB_FN pFN, MS_PHYADDR bufferAddr, MS_U32 length);
343 #else
344 void MDrv_VBI_RegisterCB(VBI_CB_FN pFN, MS_PHY bufferAddr, MS_U32 length);
345 #endif
346 //-------------------------------------------------------------------------------------------------
347 /// Reset TTX Ring Buffer
348 /// @ingroup VBI_Task
349 /// @return None
350 //-------------------------------------------------------------------------------------------------
351 void MDrv_VBI_RingBuffer_Reset(void);
352 
353 //-------------------------------------------------------------------------------------------------
354 /// Initialize TTX Slicer.
355 /// @ingroup VBI_TTX
356 /// @param  bufferAddr     \b IN: TTX buffer address.
357 /// @param  packetCount  \b IN: TTX packet count.
358 /// @return None
359 //-------------------------------------------------------------------------------------------------
360 #if defined(UFO_PUBLIC_HEADER_300)
361 void MDrv_VBI_InitializeTTXSlicer(MS_PHYADDR bufferAddr, MS_U16 packetCount);
362 #else
363 void MDrv_VBI_InitializeTTXSlicer(MS_PHY bufferAddr, MS_U16 packetCount);
364 #endif
365 //-------------------------------------------------------------------------------------------------
366 /// Enable TTX Slicer.
367 /// @ingroup VBI_TTX
368 /// @param bEnable     \b IN: enable or disable TTX slicer.
369 /// @return None
370 //-------------------------------------------------------------------------------------------------
371 void MDrv_VBI_EnableTTXSlicer(MS_BOOL bEnable);
372 
373 //-------------------------------------------------------------------------------------------------
374 /// VPS Is Ready or Not. (Refine function name: MDrv_VBI_TTX_IsVPS_Ready)
375 /// @ingroup VBI_TTX_ToBeModified
376 /// @return TRUE  : VPS is ready.
377 /// @return FALSE : VPS is not ready.
378 //-------------------------------------------------------------------------------------------------
379 MS_BOOL MDrv_VBI_IsVPS_Ready(void);
380 
381 //-------------------------------------------------------------------------------------------------
382 /// TTX Is Ready or Not.
383 /// @ingroup VBI_TTX
384 /// @return TRUE  : TTX is ready.
385 /// @return FALSE : TTX is not ready.
386 //-------------------------------------------------------------------------------------------------
387 MS_BOOL MDrv_VBI_IsTTX_Ready(void);
388 
389 //-------------------------------------------------------------------------------------------------
390 /// WSS Is Ready or Not. (Refine function name: MDrv_VBI_TTX_IsWSS_Ready)
391 /// @ingroup VBI_TTX_ToBeModified
392 /// @return TRUE  : WSS is ready.
393 /// @return FALSE : WSS is not ready.
394 //-------------------------------------------------------------------------------------------------
395 MS_BOOL MDrv_VBI_IsWSS_Ready(void);
396 
397 //-------------------------------------------------------------------------------------------------
398 /// Get WSS Data. (Refine function name: MDrv_VBI_TTX_GetWSS_Data)
399 /// @ingroup VBI_TTX_ToBeModified
400 /// @return : WSS data
401 //-------------------------------------------------------------------------------------------------
402 MS_U16 MDrv_VBI_GetWSS_Data(void);
403 
404 //-------------------------------------------------------------------------------------------------
405 /// Get VPS Data. (Refine function name: MDrv_VBI_TTX_GetVPS_Data)
406 /// @ingroup VBI_TTX_ToBeModified
407 /// @param  lowerWord    \b OUT: VPS lower data.
408 /// @param  higherWord   \b OUT: VPS higher data.
409 /// @return None
410 //-------------------------------------------------------------------------------------------------
411 void MDrv_VBI_GetVPS_Data(MS_U8 *lowerWord, MS_U8 *higherWord);
412 
413 //-------------------------------------------------------------------------------------------------
414 /// Get Complete VPS Data.
415 /// @ingroup VBI_TTX_ToBeModified
416 /// @param  pBuffer    \b IN/OUT: VPS buffer.
417 /// @param  dataLen   \b IN: buffer size.
418 /// @return None
419 //-------------------------------------------------------------------------------------------------
420 MS_BOOL MDrv_VBI_GetCompleteVPS_Data(MS_U8** pBuffer, MS_U32* dataLen);
421 
422 //-------------------------------------------------------------------------------------------------
423 /// Set Video Standard. (Refine function name: MDrv_VBI_TTX_SetVideoStandard)
424 /// @ingroup VBI_TTX_ToBeModified
425 /// @param  lowerWord    \b IN: type (NTSC/PAL/SECAM). See VBI_VIDEO_STANDARD.
426 /// @return None
427 //-------------------------------------------------------------------------------------------------
428 void MDrv_VBI_SetVideoStandard(VBI_VIDEO_STANDARD eStandard);
429 
430 //-------------------------------------------------------------------------------------------------
431 /// Check TTX circuit ready.
432 /// @ingroup VBI_TTX
433 /// @return TRUE  : TTX circuit is ready.
434 /// @return FALSE : TTX circuit is not ready.
435 //-------------------------------------------------------------------------------------------------
436 MS_BOOL MDrv_VBI_TTX_CheckCircuitReady(void);
437 
438 //-------------------------------------------------------------------------------------------------
439 /// Get TTX Packet Count.
440 /// @ingroup VBI_TTX
441 /// @return : TTX packet count
442 //-------------------------------------------------------------------------------------------------
443 MS_U16 MDrv_VBI_TTX_GetPacketCount(void);
444 
445 //-------------------------------------------------------------------------------------------------
446 /// Check if the TTX packet in VBI buffer is empty.
447 /// @ingroup VBI_TTX
448 /// @return TRUE  : TTX buffer is empty.
449 /// @return FALSE : TTX buffer is not empty.
450 //-------------------------------------------------------------------------------------------------
451 MS_BOOL MDrv_VBI_TTX_PacketBufferIsEmpty(void);
452 
453 // Get all of the packets in the VBI buffer (if the input buffer is big enough)
454 //-------------------------------------------------------------------------------------------------
455 /// Get TTX Packets. (Get all of the packets in the VBI buffer (if the input buffer is big enough))
456 /// @ingroup VBI_TTX
457 /// @param  dataAddr   \b IN:   Data address.
458 /// @param  length       \b OUT: Packet length.
459 /// @return TRUE  : Succeed
460 /// @return FALSE : Fail
461 //-------------------------------------------------------------------------------------------------
462 #if defined(UFO_PUBLIC_HEADER_300)
463 MS_BOOL MDrv_VBI_TTX_GetPackets(MS_PHYADDR dataAddr, MS_U32 *length);
464 #else
465 MS_BOOL MDrv_VBI_TTX_GetPackets(MS_PHY dataAddr, MS_U32 *length);
466 #endif
467 // Get 1 of the packets in the VBI buffer
468 //-------------------------------------------------------------------------------------------------
469 /// Get TTX Packets. (Get 1 of the packets in the VBI buffer)
470 /// @ingroup VBI_TTX
471 /// @param  packetAddress   \b OUT: Packet address
472 /// @return TRUE  : Get TTX packet successfully.
473 /// @return FALSE : Get TTX packet unsuccessfully.
474 //-------------------------------------------------------------------------------------------------
475 #if defined(UFO_PUBLIC_HEADER_300)
476 MS_BOOL MDrv_VBI_TTX_GetPacket(MS_PHYADDR *packetAddress);
477 #else
478 MS_BOOL MDrv_VBI_TTX_GetPacket(MS_PHY *packetAddress);
479 #endif
480 //-------------------------------------------------------------------------------------------------
481 /// Check if there is a packet buffer overflow. If there is an overflow,
482 /// the the packet buffer should be cleared from the reading task.
483 /// @ingroup VBI_TTX
484 /// @return TRUE  : TTX buffer is overflow.
485 /// @return FALSE : Otherwise.
486 //-------------------------------------------------------------------------------------------------
487 MS_BOOL MDrv_VBI_TTX_PacketBufferIsOverflow( void );
488 
489 //-------------------------------------------------------------------------------------------------
490 /// Resuren the nomber of packet buffer overflows since the last reset or creation.
491 /// @ingroup VBI_TTX
492 /// @return : The number of packet buffer overflows.
493 //-------------------------------------------------------------------------------------------------
494 MS_U16 MDrv_VBI_TTX_PacketBufferGetNoOfOverflows( void );
495 
496 //-------------------------------------------------------------------------------------------------
497 /// Set TTX Enable Line
498 /// @ingroup VBI_TTX
499 /// @param  StartLine   \b IN: TTX start line
500 /// @param  EndLine    \b IN: TTX end line
501 /// @return None
502 //-------------------------------------------------------------------------------------------------
503 void MDrv_VBI_TTX_EnableLine(MS_U16 StartLine, MS_U16 EndLine);
504 
505 
506 //-------------------------------------------------------------------------------------------------
507 /// Restrict vbi memory buffer range.
508 /// @ingroup VBI_Task
509 /// @param  bEnable    \b IN: set enable protect.
510 /// @param  phyAddr   \b IN: start address of the range.
511 /// @param  u32Size    \b IN: size of the range.
512 /// @return TRUE  : Succeed
513 /// @return FALSE : Fail
514 //-------------------------------------------------------------------------------------------------
515 #if defined(UFO_PUBLIC_HEADER_300)
516 MS_BOOL MDrv_VBI_ProtectMemory(MS_BOOL bEnable, MS_PHYADDR phyAddr, MS_U32 u32Size);
517 #else
518 MS_BOOL MDrv_VBI_ProtectMemory(MS_BOOL bEnable, MS_PHY phyAddr, MS_U32 u32Size);
519 #endif
520 /*
521  *  ClosedCaption
522  */
523 //-------------------------------------------------------------------------------------------------
524 /// Initialize CC Slicer.
525 /// @ingroup VBI_CC
526 /// @param  u32RiuAddr     \b IN: VBI CC RIU address.
527 /// @param  bufferAddr      \b IN: VBI CC buffer address.
528 /// @param  packetCount   \b IN: VBI CC packet count.
529 /// @return None
530 //-------------------------------------------------------------------------------------------------
531 #if defined(UFO_PUBLIC_HEADER_300)
532 void MDrv_VBI_CC_InitSlicer(MS_U32 u32RiuAddr, MS_PHYADDR bufferAddr, MS_U16 packetCount);
533 #else
534 void MDrv_VBI_CC_InitSlicer(MS_VIRT u32RiuAddr, MS_PHY bufferAddr, MS_U16 packetCount);
535 #endif
536 //-------------------------------------------------------------------------------------------------
537 /// Initialize CC CVBS number.
538 /// @ingroup VBI_CC
539 /// @param  cvbs_no     \b IN: CVBS number.
540 /// @return None
541 //-------------------------------------------------------------------------------------------------
542 void MDrv_VBI_CC_InitYPbYr(MS_U8 cvbs_no);
543 //-------------------------------------------------------------------------------------------------
544 /// Enable CC Slicer.
545 /// @ingroup VBI_CC
546 /// @param  bEnable     \b IN: enable or disable CC slicer.
547 /// @return None
548 //-------------------------------------------------------------------------------------------------
549 void MDrv_VBI_CC_EnableSlicer(MS_BOOL bEnable);
550 //-------------------------------------------------------------------------------------------------
551 /// Set CC Data Rate.
552 /// @ingroup VBI_CC
553 /// @param  ptable    \b OUT: data rate table.
554 /// @return : Data rate or 0 when failed
555 //-------------------------------------------------------------------------------------------------
556 MS_U8 MDrv_VBI_CC_SetDataRate(MS_U8 *ptable);
557 //-------------------------------------------------------------------------------------------------
558 /// Set CC Frame Count.
559 /// @ingroup VBI_CC
560 /// @param  cnt     \b IN: frame count.
561 /// @return None
562 //-------------------------------------------------------------------------------------------------
563 void MDrv_VBI_CC_SetFrameCnt(MS_U8 cnt);
564 //-------------------------------------------------------------------------------------------------
565 /// Get CC Information.
566 /// @ingroup VBI_CC
567 /// @param  selector  \b IN: CC function select.
568 /// @return : packet count or indication
569 //-------------------------------------------------------------------------------------------------
570 MS_U32 MDrv_VBI_CC_GetInfo(MS_U32 selector);
571 //-------------------------------------------------------------------------------------------------
572 /// Enable CC Line.
573 /// @ingroup VBI_CC
574 /// @param  StartLine    \b IN: start line.
575 /// @param  EndLine     \b IN: end line.
576 /// @param  mode        \b IN: NTSC/PAL/SECAM mode.
577 /// @return None
578 //-------------------------------------------------------------------------------------------------
579 void MDrv_VBI_CC_EnableLine(MS_U16 StartLine, MS_U16 EndLine, MS_U8 mode);
580 //-------------------------------------------------------------------------------------------------
581 /// Fresh memory to avoid cache coherence issue. (Use MsOS function)
582 /// @ingroup VBI_ToBeRemove
583 /// @param  u32Start    \b IN: start address (must be 16-B aligned and in cacheable area).
584 /// @param  u32Size     \b IN: size (must be 16-B aligned).
585 /// @return TRUE  : Succeed
586 /// @return FALSE : Fail due to invalide parameter
587 //-------------------------------------------------------------------------------------------------
588 MS_BOOL MDrv_VBI_SyncMemory( MS_U32 u32Start, MS_U32 u32Size );
589 //-------------------------------------------------------------------------------------------------
590 /// Set CC SC window length.
591 /// @ingroup VBI_CC
592 /// @param  u8Len  \b IN: windows length.
593 /// @return TRUE  : Succeed
594 /// @return FALSE : Fail
595 //-------------------------------------------------------------------------------------------------
596 MS_BOOL MDrv_VBI_CC_SetSCWindowLen(MS_U8 u8Len);
597 //-------------------------------------------------------------------------------------------------
598 /// Set CC standard.
599 /// @ingroup VBI_CC
600 /// @param  eStandard  \b IN: video standard.
601 /// @return TRUE  : Succeed
602 /// @return FALSE : Fail
603 //-------------------------------------------------------------------------------------------------
604 MS_BOOL MDrv_VBI_CC_SetVideoStandard(VBI_VIDEO_STANDARD eStandard);
605 
606 /*
607  *  Others
608  */
609 //-------------------------------------------------------------------------------------------------
610 /// Set WSS/VPS Byte Number. (Refine function name: MDrv_VBI_TTX_WSS_SetVpsByteNum)
611 /// @ingroup VBI_TTX_ToBeModified
612 /// @param  cnt    \b IN: byte number.
613 /// @return None
614 //-------------------------------------------------------------------------------------------------
615 void MDrv_VBI_WSS_SetVpsByteNum(MS_U8 cnt);
616 
617 //-------------------------------------------------------------------------------------------------
618 /// Save VBI driver states to DRAM.
619 /// @ingroup VBI_STR
620 /// @return TRUE  : Succeed
621 /// @return FALSE : Fail
622 //-------------------------------------------------------------------------------------------------
623 MS_BOOL MDrv_VBI_Suspend(void);
624 //-------------------------------------------------------------------------------------------------
625 /// Restore VBI driver states from DRAM
626 /// @ingroup VBI_STR
627 /// @return TRUE  : Succeed
628 /// @return FALSE : Fail
629 //-------------------------------------------------------------------------------------------------
630 MS_BOOL MDrv_VBI_Resume(void);
631 //-------------------------------------------------------------------------------------------------
632 /// Control VBI STR functions.
633 /// @ingroup VBI_STR
634 /// @param  u16PowerState  \b IN: STR power mode. (to control STR suspend & resume case.)
635 /// @return : Utopia status - UTOPIA_STATUS_SUCCESS (Succeed) or UTOPIA_STATUS_FAIL (Fail)
636 //-------------------------------------------------------------------------------------------------
637 MS_U32  MDrv_VBI_SetPowerState(EN_POWER_MODE u16PowerState);
638 
639 #ifdef __cplusplus
640 }
641 #endif
642 
643 #endif
644 
645