xref: /utopia/UTPA2-700.0.x/modules/dmx/drv/tsio/drvTSIO.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) 2011-2013 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    drvTSO.h
98 /// @brief  TS I/O Driver Interface
99 /// @author MStar Semiconductor,Inc.
100 /// @attention
101 /// All TSO DDI are not allowed to use in any interrupt context other than TSO ISR and Callback
102 ///////////////////////////////////////////////////////////////////////////////////////////////////
103 
104 #ifndef _DRV_TSIO_H_
105 #define _DRV_TSIO_H_
106 
107 
108 
109 #ifdef __cplusplus
110 extern "C"
111 {
112 #endif
113 
114 
115 //-------------------------------------------------------------------------------------------------
116 //  Driver Capability
117 //-------------------------------------------------------------------------------------------------
118 
119 
120 //-------------------------------------------------------------------------------------------------
121 //  Macro and Define
122 //-------------------------------------------------------------------------------------------------
123 /// Transport stream null PID
124 #define MSIF_TSIO_LIB_CODE           {'T','S','I','O'}                                           // Lib code
125 #define MSIF_TSIO_LIBVER             {'0','1'}                                                   // LIB version
126 #define MSIF_TSIO_BUILDNUM           {'0','1'}                                                   // Build Number
127 #define MSIF_TSIO_CHANGELIST         {'0','0','0','0','0','0','0','0'}                           // P4 ChangeList Number
128 
129 #define TSIO_DRV_VERSION             /* Character String for DRV/API version             */  \
130     MSIF_TAG,                       /* 'MSIF'                                           */  \
131     MSIF_CLASS,                     /* '00'                                             */  \
132     MSIF_CUS,                       /* 0x0000                                           */  \
133     MSIF_MOD,                       /* 0x0000                                           */  \
134     MSIF_CHIP,                                                                              \
135     MSIF_CPU,                                                                               \
136     MSIF_TSIO_LIB_CODE,              /* IP__                                             */  \
137     MSIF_TSIO_LIBVER,                /* 0.0 ~ Z.Z                                        */  \
138     MSIF_TSIO_BUILDNUM,              /* 00 ~ 99                                          */  \
139     MSIF_TSIO_CHANGELIST,            /* CL#                                              */  \
140     MSIF_OS
141 
142 
143 #define TSIO_CC_CMD_MIN_LEN                             2
144 #define TSIO_CC_CMD_MAX_LEN                             258
145 #define TSIO_CC_CMD_TIMEOUT                             200 //200 ms
146 #define TSIO_CC_CMD_ERR_STATUS_MASK                     0x0770
147 
148 //-------------------------------------------------------------------------------------------------
149 //  Type and Structure
150 //-------------------------------------------------------------------------------------------------
151 typedef enum
152 {
153     DRVTSIO_FAIL                      = 0,
154     DRVTSIO_OK                        = 1,
155     DRVTSIO_INVALID_PARAM             = 2,
156     DRVTSIO_FUNC_ERROR                = 3,
157 }TSIO_Result;
158 
159 typedef enum
160 {
161     E_DRVTSIO_DBG_Release = 0,
162     E_DRVTSIO_DBG_ERR,
163     E_DRVTSIO_DBG_INFO,
164     E_DRVTSIO_DBG_TRACE,
165 }DRVTSIO_DBGLEVEL;
166 
167 typedef enum
168 {
169     E_DRVTSIO_SERVICEDEST_LIVE = 0,
170     E_DRVTSIO_SERVICEDEST_DMA,
171 }DRVTSIO_SERVICEDEST;
172 
173 typedef enum
174 {
175     DRVTSIO_INFO_LOSELOCKCNT = 0,
176     DRVTSIO_INFO_USEBUFLEN = 1,
177     DRVTSIO_INFO_MAX = 0xFFFF,
178 }DRVTSIO_INFO;
179 
180 typedef enum
181 {
182     DRVTSIO_CLK_200M = 0,
183     DRVTSIO_CLK_100M = 1,
184     DRVTSIO_CLK_50M = 2,
185     DRVTSIO_CLK_25M = 3,
186 }DRVTSIO_CLK;
187 
188 typedef enum
189 {
190     DRVTSIO_CAP_RESOURCE_SIZE          = 0,                     // Get the data structure size of private resource (share resource)
191     DRVTSIO_CAP_CAP_NULL,
192 } DRVTSIO_CAP;
193 
194 typedef struct
195 {
196     MS_PHY phyBufAddr;
197     MS_U32 u32BufSize;
198     MS_BOOL bTSmode;
199     MS_BOOL bMidPriority;
200     MS_BOOL bLastNodeFlush;
201     MS_BOOL bNewPkt;
202 }DRVTSIO_DMAIN_SET;
203 
204 typedef struct
205 {
206     MS_PHY phyBufAddr;
207     MS_U32 u32BufSize;
208     MS_BOOL bSecurity;
209 }DRVTSIO_DMAOUT_SET;
210 
211 typedef struct
212 {
213     MS_U32 u32Endnodeflag; //[0]: last node, [1]: node int
214     MS_U32 u32Buffersize;
215     MS_U32 u32Bufferaddr;
216     MS_U32 u32Nextnodeaddr;
217 }DRVTSIO_SGDMA_NODE;
218 
219 typedef enum
220 {
221     E_TSIO_INT_NONE = 0,
222     E_TSIO_SGDMAOUT_LASTNODE = 1,
223     E_TSIO_SGDMAOUT_NODEINT = 2,
224     E_TSIO_SGDMAOUT_DROP = 3,
225     E_TSIO_SGDMAOUT_DMAEND = 4,
226     E_TSIO_SGDMAIN_DONE,
227     E_TSIO_CC_TX_DONE,
228     E_TSIO_CC_RX_DONE,
229     E_TSIO_LIVE_TSO_OVERFLOW,
230     E_TSIO_OPERATION_START,
231 }E_TSIO_INT_TYPE;
232 
233 typedef struct
234 {
235     MS_U32 u32Event;
236     MS_U64 u64DmainInt;
237     MS_U64 u64DmaoutInt[4];
238 }DRVTSIO_IOSIGNAL;
239 
240 
241 typedef void(*TSIOIntCB)(E_TSIO_INT_TYPE eType, MS_U32 u32Info, void *ext1, void *ext2);
242 
243 //-------------------------------------------------------------------------------------------------
244 /// Get TSIO IO signal
245 /// @param stIosig                                   \b OUT: TSIO IO signal
246 /// @return TSIO_Result
247 /// @note
248 //-------------------------------------------------------------------------------------------------
249 TSIO_Result MDrv_TSIO_Wait_IoSignal(DRVTSIO_IOSIGNAL *stIosig);
250 
251 //-------------------------------------------------------------------------------------------------
252 /// Register interrupt callback function
253 /// @param TSIOIntCB                                  \b IN: Callback function pointer
254 /// @return TSIO_Result
255 /// @note
256 //-------------------------------------------------------------------------------------------------
257 TSIO_Result MDrv_TSIO_RegisterIntCb(TSIOIntCB efn);
258 
259 //-------------------------------------------------------------------------------------------------
260 /// Initialize lib resource API
261 /// @param pResMemAddr                \b IN: Pointer to store resource memory address
262 /// @return TSIO_Result
263 /// @note
264 //-------------------------------------------------------------------------------------------------
265 TSIO_Result MDrv_TSIO_InitLibResource(void* pResMemAddr);
266 
267 //-------------------------------------------------------------------------------------------------
268 /// Get TSIO Hardware capability
269 /// @param  eCap                                 \b IN: Capability item to get
270 /// @param  pOutput                             \b IN: Pointer to store getting result
271 /// @return TSIO_Result
272 /// @note
273 //-------------------------------------------------------------------------------------------------
274 TSIO_Result MDrv_TSIO_GetCap(DRVTSIO_CAP eCap, void* pOutput);
275 
276 //-------------------------------------------------------------------------------------------------
277 /// Initialize TSIO driver
278 /// @return TSIO_Result
279 /// @note
280 /// It should be called before calling any other TSIO functions.
281 //-------------------------------------------------------------------------------------------------
282 TSIO_Result MDrv_TSIO_Init(void);
283 
284 //-------------------------------------------------------------------------------------------------
285 /// Open TSIO
286 /// @param eClk                         \b IN: clk speed
287 /// @return TSIO_Result
288 /// @note
289 //-------------------------------------------------------------------------------------------------
290 TSIO_Result MDrv_TSIO_Open(DRVTSIO_CLK eClk);
291 
292 //-------------------------------------------------------------------------------------------------
293 /// Exit TSIO driver
294 /// @return TSIO_Result
295 /// @note
296 //-------------------------------------------------------------------------------------------------
297 TSIO_Result MDrv_TSIO_Exit(void);
298 
299 //-------------------------------------------------------------------------------------------------
300 /// Close TSIO
301 /// @return TSIO_Result
302 /// @note
303 //-------------------------------------------------------------------------------------------------
304 TSIO_Result MDrv_TSIO_Close(void);
305 
306 //-------------------------------------------------------------------------------------------------
307 /// Search and setting Analog phase
308 /// @param u8offset                         \b IN: shift phase
309 /// @return TSIO_Result
310 /// @note
311 //-------------------------------------------------------------------------------------------------
312 TSIO_Result MDrv_TSIO_Analogphase_adj_bittraining(MS_U8 u8offset);
313 
314 //-------------------------------------------------------------------------------------------------
315 /// Search and setting Analog phase
316 /// @return TSIO_Result
317 /// @note
318 //-------------------------------------------------------------------------------------------------
319 TSIO_Result MDrv_TSIO_Analogphase_adj(void);
320 
321 //-------------------------------------------------------------------------------------------------
322 /// Set debug level of TSIO
323 /// @param  DbgLevel                \b IN: Debug Level Value
324 /// @return TSIO_Result
325 /// @note
326 //-------------------------------------------------------------------------------------------------
327 TSIO_Result MDrv_TSIO_SetDbgLevel(DRVTSIO_DBGLEVEL DbgLevel);
328 
329 //-------------------------------------------------------------------------------------------------
330 /// Reset TSIO driver
331 /// @return TSIO_Result
332 /// @note
333 //-------------------------------------------------------------------------------------------------
334 TSIO_Result MDrv_TSIO_Reset(void);
335 
336 //-------------------------------------------------------------------------------------------------
337 /// Enable bypass SMC setting on TSIO module
338 /// @param u8Mode                  \b IN: 0: disable, 1: direct8, 2: direct 16, 3: loopback , bypass SMC setting
339 /// @return TSIO_Result
340 /// @note
341 //-------------------------------------------------------------------------------------------------
342 TSIO_Result MDrv_TSIO_BypassSMC_Set(MS_U8 u8Mode);
343 
344 //-------------------------------------------------------------------------------------------------
345 /// Set Stuffing ServiceID to TSIO module
346 /// @param u32StuffingSID           \b IN: stuffing service ID
347 /// @return TSIO_Result
348 /// @note
349 //-------------------------------------------------------------------------------------------------
350 TSIO_Result MDrv_TSIO_StuffingSID_Set(MS_U32 u32StuffingSID);
351 
352 //-------------------------------------------------------------------------------------------------
353 /// Enable Loc decrypt engine on TSIO module
354 /// @param bEnable           \b IN: enable/disable loc decrypt engine
355 /// @return TSIO_Result
356 /// @note
357 //-------------------------------------------------------------------------------------------------
358 TSIO_Result MDrv_TSIO_LocDecrypt_Set(MS_BOOL bEnable);
359 
360 //-------------------------------------------------------------------------------------------------
361 /// Set Sync threshold value to TSIO module
362 /// @param u8Value           \b IN: threshold value
363 /// @return TSIO_Result
364 /// @note
365 //-------------------------------------------------------------------------------------------------
366 TSIO_Result MDrv_TSIO_Syncthreshold_Set(MS_U8 u8Value);
367 
368 //-------------------------------------------------------------------------------------------------
369 /// Enable Bypass packet merge on TSIO module
370 /// @param bEnable           \b IN: enable/disable bypass packet merge
371 /// @return TSIO_Result
372 /// @note
373 //-------------------------------------------------------------------------------------------------
374 TSIO_Result MDrv_TSIO_BypassMerge_Set(MS_BOOL bEnable);
375 
376 //-------------------------------------------------------------------------------------------------
377 /// Reset SGDMAIN
378 /// @return TSIO_Result
379 /// @note
380 //-------------------------------------------------------------------------------------------------
381 TSIO_Result MDrv_TSIO_SGDMAIN_Reset(void);
382 
383 //-------------------------------------------------------------------------------------------------
384 /// Allocate TSIO SGDMA_in PID filter
385 /// @param  pu16PidFltId                         \b OUT: pointer of PID filter ID for return
386 /// @return TSIO_Result
387 /// @note
388 //-------------------------------------------------------------------------------------------------
389 TSIO_Result MDrv_TSIO_SGDMAIN_PidFlt_Alloc(MS_U16 *pu16PidFltId);
390 
391 //-------------------------------------------------------------------------------------------------
392 /// Free TSIO SGDMA_in PID filter
393 /// @param u16PidFltId                           \b IN: PID filter ID
394 /// @return TSIO_Result
395 /// @note
396 //-------------------------------------------------------------------------------------------------
397 TSIO_Result MDrv_TSIO_SGDMAIN_PidFlt_Free(MS_U16 u16PidFltId);
398 
399 //-------------------------------------------------------------------------------------------------
400 /// Set PID to SGDMA_in PID filter
401 /// @param  u16PidFltId                       \b IN: PID filter ID
402 /// @param  u16Pid                             \b IN: PID
403 /// @return TSIO_Result
404 /// @note
405 //-------------------------------------------------------------------------------------------------
406 TSIO_Result MDrv_TSIO_SGDMAIN_PidFlt_SetPid(MS_U16 u16PidFltId, MS_U16 u16Pid);
407 
408 //-------------------------------------------------------------------------------------------------
409 /// Set Service ID to PID filter
410 /// @param  u16PidFltId                         \b IN: PID filter ID
411 /// @param  u8Sid                                \b IN: Service ID
412 /// @return TSIO_Result
413 /// @note
414 //-------------------------------------------------------------------------------------------------
415 TSIO_Result MDrv_TSIO_SGDMAIN_PidFlt_SetSid(MS_U16 u16PidFltId, MS_U8 u8Sid);
416 
417 //=======================================================
418 // C&C setting API
419 //=======================================================
420 
421 //-------------------------------------------------------------------------------------------------
422 /// Send C&C cmd
423 /// @param pu8Cmd                                        \b IN: Pointer to store C&C cmd address
424 /// @param u16CmdLen                                   \b IN: C&C cmd length
425 /// @return TSIO_Result
426 /// @note
427 //-------------------------------------------------------------------------------------------------
428 TSIO_Result MDrv_TSIO_CC_SendCmd(MS_U8 *pu8Cmd, MS_U16 u16CmdLen);
429 
430 //-------------------------------------------------------------------------------------------------
431 /// Send C&C cmd in speed-up mode
432 /// @param pu8Cmd                                        \b IN: Pointer to store C&C cmd address
433 /// @param u16CmdLen                                   \b IN: C&C cmd length
434 /// @return TSIO_Result
435 /// @note
436 //-------------------------------------------------------------------------------------------------
437 TSIO_Result MDrv_TSIO_CC_SendCmd_Fast(MS_U8 *pu8Cmd, MS_U16 u16CmdLen);
438 
439 //-------------------------------------------------------------------------------------------------
440 /// Receive C&C cmd
441 /// @param pu8Cmd                                        \b OUT: Pointer to store C&C cmd address
442 /// @param pu16CmdLen                                  \b OUT: Pointer to store C&C cmd length
443 /// @return TSIO_Result
444 /// @note
445 //-------------------------------------------------------------------------------------------------
446 TSIO_Result MDrv_TSIO_CC_ReceiveCmd(MS_U8 *pu8Cmd, MS_U16 *pu16CmdLen);
447 
448 //-------------------------------------------------------------------------------------------------
449 /// Receive C&C cmd in speed-up mode
450 /// @param pu8Cmd                                        \b OUT: Pointer to store C&C cmd address
451 /// @param pu16CmdLen                                  \b OUT: Pointer to store C&C cmd length
452 /// @return TSIO_Result
453 /// @note
454 //-------------------------------------------------------------------------------------------------
455 TSIO_Result MDrv_TSIO_CC_ReceiveCmd_Fast(MS_U8 *pu8Cmd, MS_U16 *pu16CmdLen);
456 
457 //-------------------------------------------------------------------------------------------------
458 /// Receive interupt status
459 /// @param u32Timeout                                  \b IN: Timeout value
460 /// @param pu16Status                                  \b OUT: Pointer to store C&C receiver status address
461 /// @return TSIO_Result
462 /// @note
463 //-------------------------------------------------------------------------------------------------
464 TSIO_Result MDrv_TSIO_CC_ReceiveIntStatus(MS_U32 u32Timeout, MS_U16 *pu16Status);
465 
466 //=======================================================
467 // Physic buffer setting API
468 //=======================================================
469 
470 //-------------------------------------------------------------------------------------------------
471 /// Set SGDMAIN Last packet buffer
472 /// @param u32LastpktBufAddr                          \b IN: Last packet buffer physic address
473 /// @param u32LastpktBufSize                           \b IN: Last packet buffer size
474 /// @return TSIO_Result
475 /// @note
476 //-------------------------------------------------------------------------------------------------
477 TSIO_Result MDrv_TSIO_SGDMAIN_LastPktBuf_Set(MS_U32 u32LastpktBufAddr, MS_U32 u32LastpktBufSize);
478 
479 //-------------------------------------------------------------------------------------------------
480 /// Set SGDMAIN VQ buffer
481 /// @param u32VQBufAddr                          \b IN: SGDMAIN VQ buffer physic address
482 /// @param u32VQBufSize                           \b IN: SGDMAIN VQ buffer size
483 /// @return TSIO_Result
484 /// @note
485 //-------------------------------------------------------------------------------------------------
486 TSIO_Result MDrv_TSIO_SGDMAIN_SGVQBuf_Set(MS_U32 u32VQBufAddr, MS_U32 u32VQBufSize);
487 
488 //-------------------------------------------------------------------------------------------------
489 /// Set SGDMAIN Node buffer
490 /// @param u32NodeAddr                          \b IN: SGDMAIN Node buffer physic address
491 /// @param u32NodeSize                           \b IN: SGDMAIN Node buffer size
492 /// @return TSIO_Result
493 /// @note
494 //-------------------------------------------------------------------------------------------------
495 TSIO_Result MDrv_TSIO_SGDMAIN_NodeBuf_Set(MS_U32 u32NodeAddr, MS_U32 u32NodeSize);
496 
497 //-------------------------------------------------------------------------------------------------
498 /// Set SGDMAOUT Node buffer
499 /// @param u32NodeAddr                          \b IN: SGDMAOUT Node buffer physic address
500 /// @param u32NodeSize                           \b IN: SGDMAOUT Node buffer size
501 /// @return TSIO_Result
502 /// @note
503 //-------------------------------------------------------------------------------------------------
504 TSIO_Result MDrv_TSIO_SGDMAOUT_NodeBuf_Set(MS_U32 u32NodeAddr, MS_U32 u32NodeSize);
505 
506 //=======================================================
507 // Service relative setting API
508 //=======================================================
509 
510 //-------------------------------------------------------------------------------------------------
511 /// Allocate TSIO service
512 /// @param  pu16Servicehandle                         \b OUT: pointer of service handle for return
513 /// @return TSIO_Result
514 /// @note
515 //-------------------------------------------------------------------------------------------------
516 TSIO_Result MDrv_TSIO_Service_Alloc(MS_U16 *pu16Servicehandle);
517 
518 //-------------------------------------------------------------------------------------------------
519 /// Free TSIO service
520 /// @param u16Servicehandle                           \b IN: Service handle ID
521 /// @return TSIO_Result
522 /// @note
523 //-------------------------------------------------------------------------------------------------
524 TSIO_Result MDrv_TSIO_Service_Free(MS_U16 u16Servicehandle);
525 
526 //-------------------------------------------------------------------------------------------------
527 /// Set Service ID to TSIO service
528 /// @param u16Servicehandle                           \b IN: Service handle ID
529 /// @param u8Sid                                            \b IN: Service ID
530 /// @return TSIO_Result
531 /// @note
532 //-------------------------------------------------------------------------------------------------
533 TSIO_Result MDrv_TSIO_Service_SetSid(MS_U16 u16Servicehandle, MS_U8 u8Sid);
534 
535 //-------------------------------------------------------------------------------------------------
536 /// Get Service ID with target Service handle
537 /// @param u16Servicehandle                           \b IN: Service handle ID
538 /// @param u8Sid                                            \b OUT: Service ID
539 /// @return TSIO_Result
540 /// @note
541 //-------------------------------------------------------------------------------------------------
542 TSIO_Result MDrv_TSIO_Service_GetSid(MS_U16 u16Servicehandle, MS_U8 *u8Sid);
543 
544 //-------------------------------------------------------------------------------------------------
545 /// Set DMAIN Virture channel to TSIO service
546 /// @param u16Servicehandle                           \b IN: Service handle ID
547 /// @param eSet                                             \b IN: Sgdma in param setting
548 /// @return TSIO_Result
549 /// @note
550 //-------------------------------------------------------------------------------------------------
551 TSIO_Result MDrv_TSIO_Service_SetDMAinVC(MS_U16 u16Servicehandle, DRVTSIO_DMAIN_SET *peSet);
552 
553 //-------------------------------------------------------------------------------------------------
554 /// start DMAIN Virture channel
555 /// @param u16Servicehandle                           \b IN: Service handle ID
556 /// @param u32Pacing                                     \b IN: Sgdma in pacing rate, unit: bps
557 /// @return TSIO_Result
558 /// @note
559 //-------------------------------------------------------------------------------------------------
560 TSIO_Result MDrv_TSIO_Service_DMAinVC_Start(MS_U16 u16Servicehandle, MS_U32 u32Pacing);
561 
562 //-------------------------------------------------------------------------------------------------
563 /// Set DMAOUT VC to TSIO service
564 /// @param u16Servicehandle                           \b IN: Service handle ID
565 /// @param eSet                                            \b IN: Sgdma out param setting
566 /// @return TSIO_Result
567 /// @note
568 //-------------------------------------------------------------------------------------------------
569 TSIO_Result MDrv_TSIO_Service_SetDMAoutVC(MS_U16 u16Servicehandle, DRVTSIO_DMAOUT_SET* peSet);
570 
571 //-------------------------------------------------------------------------------------------------
572 /// Get DMAOUT VC  write address
573 /// @param u16Servicehandle                          \b IN: Service handle ID
574 /// @param pphyWrite                                    \b OUT: dma out write address
575 /// @return TSIO_Result
576 /// @note
577 //-------------------------------------------------------------------------------------------------
578 TSIO_Result MDrv_TSIO_Service_DMAout_WriteGet(MS_U16 u16Servicehandle, MS_PHY* pphyWrite);
579 
580 //-------------------------------------------------------------------------------------------------
581 /// Set destination to TSIO service
582 /// @param u16Servicehandle                           \b IN: Service handle ID
583 /// @param eSet                                            \b IN: Sgdma out param setting
584 /// @return TSIO_Result
585 /// @note
586 //-------------------------------------------------------------------------------------------------
587 TSIO_Result MDrv_TSIO_Service_SetDestination(MS_U16 u16Servicehandle, DRVTSIO_SERVICEDEST eDest);
588 
589 //-------------------------------------------------------------------------------------------------
590 /// Enable bypass SMC merge setting to TSIO service
591 /// @param u16Servicehandle                           \b IN: Service handle ID
592 /// @param bEnable                  \b IN: enable/disable bypass SMC setting
593 /// @return TSIO_Result
594 /// @note
595 //-------------------------------------------------------------------------------------------------
596 TSIO_Result MDrv_TSIO_Service_BypassSMCMergeEnable(MS_U16 u16Servicehandle, MS_BOOL bEnable);
597 
598 //-------------------------------------------------------------------------------------------------
599 /// Set Locdecrypt key to TSIO service
600 /// @param u16Servicehandle                           \b IN: Service handle ID
601 /// @param pKey                                            \b IN: Pointer to store loc decrypt key address
602 /// @param u16KeySize                                   \b IN: Decrypt key size
603 /// @param bOddKey                                       \b IN: 1: odd key, 0: even key
604 /// @return TSIO_Result
605 /// @note
606 //-------------------------------------------------------------------------------------------------
607 TSIO_Result MDrv_TSIO_Service_SetLocdecKey(MS_U16 u16Servicehandle, MS_U8 *pKey, MS_U16 u16KeySize, MS_BOOL bOddKey);
608 
609 //-------------------------------------------------------------------------------------------------
610 /// Enable/disable locdec key
611 /// @param u16Servicehandle                           \b IN: Service handle ID
612 /// @param bEnable                                        \b IN: Enable locdec key
613 /// @return TSIO_Result
614 /// @note
615 //-------------------------------------------------------------------------------------------------
616 TSIO_Result MDrv_TSIO_Service_LocdecKeyEnable(MS_U16 u16Servicehandle, MS_BOOL bEnable);
617 
618 //-------------------------------------------------------------------------------------------------
619 /// Enable secure keyslot on Locdecrypt
620 /// @param u16Servicehandle                           \b IN: Service handle ID
621 /// @param bEnable                                        \b IN: Enable / disable secure keyslot
622 /// @return TSIO_Result
623 /// @note
624 //-------------------------------------------------------------------------------------------------
625 TSIO_Result MDrv_TSIO_Service_SetLocdecSecureKeyslot(MS_U16 u16Servicehandle, MS_BOOL bEnable);
626 
627 //-------------------------------------------------------------------------------------------------
628 /// Enable privilege keyslot on Locdecrypt
629 /// @param u16Servicehandle                           \b IN: Service handle ID
630 /// @param bEnable                                        \b IN: Enable / disable secure flag
631 /// @return TSIO_Result
632 /// @note
633 //-------------------------------------------------------------------------------------------------
634 TSIO_Result MDrv_TSIO_Service_SetLocdecPrivilegeKeyslot(MS_U16 u16Servicehandle, MS_BOOL bEnable);
635 
636 //-------------------------------------------------------------------------------------------------
637 /// Enable SGDMAIN PidFlt
638 /// @param u16Servicehandle                           \b IN: Service handle ID
639 /// @param bEnable                                        \b IN: Enable
640 /// @return TSIO_Result
641 /// @note
642 //-------------------------------------------------------------------------------------------------
643 TSIO_Result MDrv_TSIO_Service_SgdmaInPidFltEnable(MS_U16 u16Servicehandle, MS_BOOL bEnable);
644 
645 //-------------------------------------------------------------------------------------------------
646 /// Get TSIO informaiton
647 /// @param eInfo                                        \b IN: Info type
648 /// @param u32Arg                                      \b IN: detail value
649 /// @param u32Retinfo                                 \b OUT: Pointer to store Info address
650 /// @return DMX_FILTER_STATUS
651 /// @note
652 //-------------------------------------------------------------------------------------------------
653 TSIO_Result MDrv_TSIO_GetInfo(DRVTSIO_INFO eInfo, MS_U32 u32Arg, MS_U32 *u32Retinfo);
654 
655 #ifdef __cplusplus
656 } // closing brace for extern "C"
657 #endif
658 
659 #endif // _DRV_TSIO_H_
660 
661 
662