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 drvRVD.c
98 /// @brief RVD Driver Interface
99 /// @author MStar Semiconductor Inc.
100 ///////////////////////////////////////////////////////////////////////////////////////////////////
101
102 //-------------------------------------------------------------------------------------------------
103 // Include Files
104 //-------------------------------------------------------------------------------------------------
105 // Common Definition
106 #include "MsCommon.h"
107 #include "MsVersion.h"
108 #include "regRVD.h"
109 //load H/w Setting
110 ////////////////
111 #include "osalRVD.h"
112 #include "halRVD.h"
113 #include "drvRVD.h"
114 // Internal Definition
115 #include "drvMMIO.h"
116
117 #include "drvBDMA.h"
118 #define dmacpy( DESTADDR, SRCADDR , LEN) MDrv_BDMA_CopyHnd((MS_PHYADDR)(SRCADDR), (MS_PHYADDR)(DESTADDR), (LEN), E_BDMA_SDRAM2SDRAM1, BDMA_OPCFG_DEF)
119 #define BDMAcpy(DESTADDR, SRCADDR, LEN , Flag) MDrv_BDMA_CopyHnd((MS_PHYADDR)(SRCADDR), (MS_PHYADDR)(DESTADDR), (LEN), (Flag), BDMA_OPCFG_DEF)
120
121 //-------------------------------------------------------------------------------------------------
122 // Driver Compiler Options
123 //-------------------------------------------------------------------------------------------------
124 //#define __TESTCODE__
125
126 //-------------------------------------------------------------------------------------------------
127 // Local Defines
128 //-------------------------------------------------------------------------------------------------
129 #if RVD_ENABLE_EMBEDDED_FW_BINARY
130 static MS_U8 VLC_TAB[] =
131 {
132 #include "fwRVDvlcmem.dat"
133 };
134 #endif
135
136 #define USING_ID_LINK 1
137 #define QMEM_BBU_TABLE_SIZE 0x4000
138 #define RVD_BBU_DEPTH 1600
139 #define BYTECOUNT_LIMIT 16777216 // 2^24
140 #define RVD_ISR_ENABLE 0 //Maybe used at Build broken index problem
141
142 //-------------------------------------------------------------------------------------------------
143 // Local Structurs
144 //-------------------------------------------------------------------------------------------------
145 //Version
146 //#define RVD_DRV_VERSION "xx.xxx.xxxx"
147 #define RVD_FW_CMD_TIMEOUT_DEFAULT 100 ///<Check FW cmd timeout threshold unit: ms
148 //extern MS_U32 eRvdDynCfgByChip; ///<Dynamic scaling config bit (Got from hal layer)
149 #define RVD_CTRL_INIT_FINISHED BIT(0) ///<RVD init status :Finish
150 #define RVD_CTRL_PROCESSING BIT(1) ///<RVD init status :processing
151 #define RVD_CTRL_DATA_END BIT(2) ///< RVD init status : data end
152 #define RVD_CTRL_DISPLAY_CTRL BIT(3) ///< RVD init status :Set Disp ctrl mode
153 #define RVD_CTRL_DISP_INFO_RDY BIT(4) ///< RVD init status Get Disp Info Rdy
154 #define RVD_CTRL_CODE_MIU_1 BIT(5) ///< RVD init status :Open Bin Addr in MIU1
155 #define RVD_CTRL_ES_MIU_1 BIT(6) ///< RVD init status :ES buffer in MIU1
156
157 //-------------------------------------------------------------------------------------------------
158 // Global Variables
159 //-------------------------------------------------------------------------------------------------
160 /// Version string
161 static MSIF_Version _drv_rvd_version = {
162 .DDI = { RVD_DRV_VERSION, },
163 };
164 // Used for F/W Qmem exchange
165 static MS_U32 gu32QmemExchangeInfoAddr;
166 static MS_U32 gu32QmemBbuAddr = 0;
167 static RVD_DrvInfo DrvRVDInfo;
168 static MS_U8 u8RVD_DbgLevel = E_RVD_DEBUG_NONE;
169 static MS_U32 u32RVDCtrlMode = 0;
170 static MS_U32 u32StepPlayCnt = 0; // check if step play done
171 static MS_U32 u32StepDecodeCnt = 0; // check if step play done
172 static MS_U32 u32BytePos = 0;
173 static MS_U16 u16QmemBbuWptr = 0;
174 MS_U32 u32FWBinAddr = 0;
175 static MS_BOOL bRVDIsInit = FALSE;
176 static RVD_ISR_Ctrl gRVDISRCtrl = { FALSE , 0 , NULL };
177 RVD_MEMCfg *MEMCfgRst;
178 RVD_FileInfo *FileInfoRst;
179 RVD_MiuInfo gRVDInfo;
180 extern MS_U32 u32SVDRegOSBase;
181 extern MS_U32 MsOS_GetSystemTime(void);
182
183 static MS_BOOL gbEnableRVTurboFWMode = FALSE;
184
185 #define RVD_ENABLE_TIME_MEASURE 0
186 #if RVD_ENABLE_TIME_MEASURE
187 #define RVD_GetSysTime_ms() MsOS_GetSystemTime()
188 MS_U32 u32RvdInitSysTimeBase = 0;
189 #endif
190
191 #define MW_RVD_BROKEN_BY_US 0x00800000
192 #define RVD_FW_IDLE_THRESHOLD 100
193 #define RVD_GetSystemTime MsOS_GetSystemTime
194 #define RVD_VLC_TABLE_SIZE 0x20000
195
196 /************* RVD debug define *************/
197 #define RVD_MSG_INF(format, args...) do{if(MDrv_RVD_IsDbgEnable(E_RVD_DEBUG_INF)) printf(format, ##args);}while(0) ///< output general message
198 #define RVD_MSG_DRV(format, args...) do{if(MDrv_RVD_IsDbgEnable(E_RVD_DEBUG_DRV)) printf(format, ##args);}while(0)///< output drv layer message
199 #define RVD_MSG_HAL(format, args...) do{if(MDrv_RVD_IsDbgEnable(E_RVD_DEBUG_HAL)) printf(format, ##args);}while(0)///< output hal layer message
200 #define RVD_MSG_ERR(format, args...) do{if(MDrv_RVD_IsDbgEnable(E_RVD_DEBUG_ERR)) printf(format, ##args);}while(0)///< Only output error message
201
202 #define _DRV_RVD_Entry() { u32RVDCtrlMode |= RVD_CTRL_PROCESSING; }
203 #define _DRV_RVD_Return(_ret) { u32RVDCtrlMode &= (~RVD_CTRL_PROCESSING); return _ret; }
204
205 //-------------------------------------------------------------------------------------------------
206 // Local Variables
207 //-------------------------------------------------------------------------------------------------
208
209 //-------------------------------------------------------------------------------------------------
210 // Debug Functions
211 //-------------------------------------------------------------------------------------------------
212
213 //-------------------------------------------------------------------------------------------------
214 // Local Functions
215 //-------------------------------------------------------------------------------------------------
216 //-----------------------------------------------------------------------------
217 /// @brief \b Function \b Name: MDrv_RVD_SetBBU_ID()
218 /// @brief \b Function \b Description: Push the BBU Table ID in F/W remapping area
219 /// @param -u32Address \b IN F/W RISC AREA
220 /// @param -u32Byte_Pos \b IN BBU Byte Position
221 /// @param -u32ID_High \b IN BBU ID High Address
222 /// @param -u32ID_Low \b IN BBU ID Low Address
223 //-----------------------------------------------------------------------------
MDrv_RVD_SetBBU_ID(MS_U32 u32Address,MS_U32 u32Byte_Pos,MS_U32 u32ID_High,MS_U32 u32ID_Low)224 void MDrv_RVD_SetBBU_ID(MS_U32 u32Address,MS_U32 u32Byte_Pos, MS_U32 u32ID_High, MS_U32 u32ID_Low)
225 {
226 HAL_RVD_MemWrite( u32Address,u32Byte_Pos);
227 HAL_RVD_MemWrite( (u32Address+4),u32ID_Low);
228 HAL_RVD_MemWrite( (u32Address+8),u32ID_High);
229 }
230
231 //-----------------------------------------------------------------------------
232 /// @brief \b Function \b Name: MDrv_RVD_SetBBU_OffsetLength()
233 /// @brief \b Function \b Description: Push the offset and length in F/W remapping area
234 /// @param -u32Address \b IN F/W RISC AREA
235 /// @param -u32offset \b IN BBU offet
236 /// @param -u32length \b IN BBU length
237 //-----------------------------------------------------------------------------
MDrv_RVD_SetBBU_OffsetLength(MS_U32 u32Address,MS_U32 u32offset,MS_U32 u32length)238 void MDrv_RVD_SetBBU_OffsetLength(MS_U32 u32Address,MS_U32 u32offset, MS_U32 u32length)
239 {
240 HAL_RVD_MemWrite( u32Address,u32offset);
241 HAL_RVD_MemWrite( (u32Address+4),u32length);
242 }
243
244 //-----------------------------------------------------------------------------
245 /// @brief \b Function \b Name: MDrv_RVD_GetBBUStartAddr()
246 /// @brief \b Function \b Description: Get BBU Statr address
247 /// @return - BBU Statr address
248 //-----------------------------------------------------------------------------
MDrv_RVD_GetBBUStartAddr(void)249 MS_U32 MDrv_RVD_GetBBUStartAddr(void)
250 {
251 return HAL_RVD_QMemRead(gu32QmemExchangeInfoAddr+RVD_QMEM_INFO_OFFSET_BBU_ADDR);
252 }
253
254 //-----------------------------------------------------------------------------
255 /// @brief \b Function \b Name: MDrv_RVD_GetDecErrCnt()
256 /// @brief \b Function \b Description: Get BBU Statr address
257 /// @return - BBU Statr address
258 //-----------------------------------------------------------------------------
MDrv_RVD_GetDecErrCnt(void)259 MS_U32 MDrv_RVD_GetDecErrCnt(void)
260 {
261 return HAL_RVD_QMemRead(gu32QmemExchangeInfoAddr+RVD_QMEM_INFO_DECERRCNT);
262 }
263
264 //-----------------------------------------------------------------------------
265 /// @brief \b Function \b Name: MDrv_RVD_GetDataErrCnt()
266 /// @brief \b Function \b Description: Get Data Error Count
267 /// @return - Data Error count
268 //-----------------------------------------------------------------------------
MDrv_RVD_GetDataErrCnt(void)269 MS_U32 MDrv_RVD_GetDataErrCnt(void)
270 {
271 return HAL_RVD_QMemRead(gu32QmemExchangeInfoAddr+RVD_QMEM_INFO_DATAERRCNT);
272 }
273
274 //-----------------------------------------------------------------------------
275 /// @brief \b Function \b Name: MDrv_RVD_GetSkipCnt()
276 /// @brief \b Function \b Description: Get Frame Skip Count
277 /// @return - Skip frame number
278 //-----------------------------------------------------------------------------
MDrv_RVD_GetSkipCnt(void)279 MS_U32 MDrv_RVD_GetSkipCnt(void)
280 {
281 return HAL_RVD_QMemRead(gu32QmemExchangeInfoAddr+RVD_QMEM_INFO_SKIP_CNT);
282 }
283
284 //-----------------------------------------------------------------------------
285 /// @brief \b Function \b Name: MDrv_RVD_GetDropCnt()
286 /// @brief \b Function \b Description: Get Frame drop Count
287 /// @return - Drop frame number
288 //-----------------------------------------------------------------------------
MDrv_RVD_GetDropCnt(void)289 MS_U32 MDrv_RVD_GetDropCnt(void)
290 {
291 return HAL_RVD_QMemRead(gu32QmemExchangeInfoAddr+RVD_QMEM_INFO_DROP_CNT);
292 }
293
294 //-----------------------------------------------------------------------------
295 /// @brief \b Function \b Name: MDrv_RVD_GetDispQueNum()
296 /// @brief \b Function \b Description: Get Display queue number
297 /// @return - Display queue number
298 //-----------------------------------------------------------------------------
MDrv_RVD_GetDispQueNum(void)299 MS_U32 MDrv_RVD_GetDispQueNum(void)
300 {
301 return HAL_RVD_QMemRead(gu32QmemExchangeInfoAddr+RVD_QMEM_INFO_DISP_QUE_NUM);
302 }
303
304 //-----------------------------------------------------------------------------
305 /// @brief \b Function \b Name: MDrv_RVD_SetBBUDepth()
306 /// @brief \b Function \b Description: Set vaild BBU Queue depth.
307 /// @param -u32Rptr \b IN from MDrv_RVD_GetQMEM_Info
308 //-----------------------------------------------------------------------------
MDrv_RVD_SetBBUDepth(MS_U32 u32Rptr)309 void MDrv_RVD_SetBBUDepth(MS_U32 u32Rptr)
310 {
311 HAL_RVD_QMemWrite((gu32QmemExchangeInfoAddr + RVD_QMEM_INFO_OFFSET_BBU_DEPTH), u32Rptr);
312 }
313
314 //-----------------------------------------------------------------------------
315 /// @brief \b Function \b Name: MDrv_RVD_SetBBUDepth()
316 /// @brief \b Function \b Description: Set vaild BBU Queue depth.
317 /// @param -u32Rptr \b IN from MDrv_RVD_GetQMEM_Info
318 //-----------------------------------------------------------------------------
MDrv_RVD_SetPBInfo(MS_PHYADDR u32Addr,MS_U32 u32Size)319 void MDrv_RVD_SetPBInfo(MS_PHYADDR u32Addr , MS_U32 u32Size)
320 {
321 if(u32Size)
322 {
323 HAL_RVD_QMemWrite((gu32QmemExchangeInfoAddr + RVD_QMEM_INFO_DUMMY_OFFSET), u32Addr &(HAL_MIU1_BASE -1));
324 HAL_RVD_QMemWrite((gu32QmemExchangeInfoAddr + RVD_QMEM_INFO_DUMMY_LENGTH), u32Size);
325 }
326 else
327 {
328 RVD_MSG_ERR("<Warning>PB Size 0x%lx !!!\n",u32Size);
329 }
330
331 }
332 //-------------------------------------------------------------------------------------------------
333 // Global Functions
334 //-------------------------------------------------------------------------------------------------
335 //------------------------------------------------------------------
336 /// @brief \b Function \b Name: MDrv_RVD_SetCfg()
337 /// @brief \b Function \b Description: Set RVD Memory map and FW info
338 /// @param -memCfg \b IN RVD_MEMCfg
339 /// @return - Display Count
340 /// @retval - E_RVD_RET_SUCCESS, Success
341 /// @retval - E_RVD_RET_INVALID_PARAM, the config setting invalid
342 //------------------------------------------------------------------
MDrv_RVD_SetCfg(RVD_MEMCfg * memCfg)343 RVD_Result MDrv_RVD_SetCfg( RVD_MEMCfg* memCfg)
344 {
345 if (!memCfg)
346 return E_RVD_RET_INVALID_PARAM;
347
348 //config memory
349
350 HAL_RVD_MemSetMap(E_RVD_MMAP_FW, memCfg->u32FWAddr, memCfg->u32FWSize);
351 HAL_RVD_MemSetMap(E_RVD_MMAP_FB, memCfg->u32FBAddr, memCfg->u32FBSize);
352 HAL_RVD_MemSetMap(E_RVD_MMAP_BS, memCfg->u32BSAddr, memCfg->u32BSSize);
353 HAL_RVD_MemSetMap(E_RVD_MMAP_PB, memCfg->u32PBAddr, memCfg->u32PBSize);
354 HAL_RVD_MemSetMap(E_RVD_MMAP_FW_BIN, memCfg->u32FWBinAddr, memCfg->u32FWBinSize);
355 HAL_RVD_MemSetMap(E_RVD_MMAP_VLC_BIN, memCfg->u32VLCBinAddr, memCfg->u32VLCBinSize);
356 return E_RVD_RET_SUCCESS;
357 }
358
359 //-----------------------------------------------------------------------------
360 /// @brief \b Function \b Name: MDrv_RVD_SetOSRegBase()
361 /// @brief \b Function \b Description: Set system register base
362 /// @param -u32RegBaseAddr \b IN : system register base
363 //-----------------------------------------------------------------------------
MDrv_RVD_SetOSRegBase(MS_U32 u32RegBaseAddr)364 void MDrv_RVD_SetOSRegBase(MS_U32 u32RegBaseAddr )
365 {
366 HAL_RVD_InitRegBase(u32RegBaseAddr);
367 }
368
369 //-----------------------------------------------------------------------------
370 /// @brief \b Function \b Name: MDrv_RVD_GetQmemSwBbuVacancy()
371 /// @brief \b Function \b Description: get the vacancy of BBU queue.
372 /// @return - TRUE / FALSE
373 /// @retval -0: queue is full.
374 /// @retval -not zero: queue is not full.
375 //-----------------------------------------------------------------------------
MDrv_RVD_GetQmemSwBbuVacancy(void)376 MS_S16 MDrv_RVD_GetQmemSwBbuVacancy(void)
377 {
378 MS_S16 s16Vac;
379 MS_S16 s16Rptr;
380 MS_S16 s16Wptr;
381 MS_S16 s16BBUDepth;
382
383 #if USING_ID_LINK
384 s16Rptr = (MS_S16)MDrv_RVD_GetIDReadPtr();
385 //s16Wptr = (MS_S16)MDrv_RVD_GetIDWritePtr();
386 #else
387 s16Rptr = (MS_S16)MDrv_RVD_GetBBUReadPtr();
388 //s16Wptr = (MS_S16)MDrv_RVD_GetBBUWritePtr();
389 #endif
390 s16Wptr =(MS_S16)u16QmemBbuWptr;
391 s16BBUDepth = (MS_S16)MDrv_RVD_GetBBUDepth();
392
393 if(s16Wptr < s16Rptr)
394 {
395 s16Vac = s16Rptr - s16Wptr - 1;
396 }
397 else if(s16Wptr >= s16Rptr)
398 {
399 s16Vac = (s16BBUDepth-1) - s16Wptr + s16Rptr;
400 }
401
402 return s16Vac;
403 }
404
405 #if RVD_ENABLE_BDMA_FW_FLASH_2_SDRAM
406 #if 0
407 BDMA_CpyType MDrv_RVD_BDMAFlag(MS_BOOL bDirect)
408 {
409 if(bDirect)
410 return E_BDMA_FLASH2SDRAM1;
411 else
412 return E_BDMA_FLASH2SDRAM;
413 }
414 #endif
415 #endif
416
MDrv_RVD_BDMAFlag(MS_BOOL bDst,MS_BOOL bSrc,RVD_FWSourceType eType)417 BDMA_CpyType MDrv_RVD_BDMAFlag(MS_BOOL bDst ,MS_BOOL bSrc, RVD_FWSourceType eType)
418 {
419 RVD_MSG_HAL("Dst : %d Src :%d\n SourceType: %d",bDst,bSrc,eType);
420 switch(eType)
421 {
422 case E_RVD_FW_SOURCE_DRAM:
423 if(bDst < bSrc)
424 {
425 return E_BDMA_SDRAM12SDRAM;
426 }
427 else if(bDst > bSrc )
428 {
429 return E_BDMA_SDRAM2SDRAM1;
430 }
431 else
432 {
433 if(bSrc)
434 return E_BDMA_SDRAM12SDRAM1;
435 else
436 return E_BDMA_SDRAM2SDRAM;
437 }
438 case E_RVD_FW_SOURCE_FLASH:
439 if(bDst)
440 return E_BDMA_FLASH2SDRAM1;
441 else
442 return E_BDMA_FLASH2SDRAM;
443 default:
444 return (BDMA_CpyType)0;
445 }
446 }
447
MDrv_RVD_BDMA_SDFlag(MS_BOOL bDst,MS_BOOL bSrc)448 BDMA_CpyType MDrv_RVD_BDMA_SDFlag(MS_BOOL bDst ,MS_BOOL bSrc)
449 {
450 RVD_MSG_HAL("Dst : %d Src :%d\n",bDst,bSrc);
451 if(bDst < bSrc)
452 {
453 return E_BDMA_SDRAM12SDRAM;
454 }
455 else if(bDst > bSrc )
456 {
457 return E_BDMA_SDRAM2SDRAM1;
458 }
459 else
460 {
461 if(bSrc)
462 return E_BDMA_SDRAM12SDRAM1;
463 else
464 return E_BDMA_SDRAM2SDRAM;
465 }
466 }
467
468 //-----------------------------------------------------------------------------
469 /// @brief \b Function \b Name: MDrv_RVD_GetFrameSize()
470 /// @brief \b Function \b Description: get the frame size from Qmem used for RPR
471 /// @param -u16Width \b IN Frame Size Width
472 /// @param -u16Height \b IN Frame Size Height
473 /// @return status
474 //-----------------------------------------------------------------------------
MDrv_RVD_GetFrameSize(MS_U16 * u16Width,MS_U16 * u16Height)475 void MDrv_RVD_GetFrameSize(MS_U16* u16Width,MS_U16* u16Height)
476 {
477 *u16Width = HAL_RVD_QMemRead( gu32QmemExchangeInfoAddr + RVD_QMEM_INFO_FRAME0_WIDTH);
478 *u16Height = HAL_RVD_QMemRead( gu32QmemExchangeInfoAddr + RVD_QMEM_INFO_FRAME0_HEIGHT);
479 }
480
481 //-----------------------------------------------------------------------------
482 /// @brief \b Function \b Name: MDrv_RVD_GetLibVer()
483 /// @brief \b Function \b Description: get the RVD Drv and FW Version
484 /// @return none
485 //-----------------------------------------------------------------------------
MDrv_RVD_GetLibVer(const MSIF_Version ** ppVersion)486 RVD_Result MDrv_RVD_GetLibVer(const MSIF_Version **ppVersion)
487 {
488 if (!ppVersion)
489 return E_RVD_RET_FAIL;
490
491 *ppVersion = &_drv_rvd_version;
492 return E_RVD_RET_SUCCESS;
493 }
494
495 //-----------------------------------------------------------------------------
496 /// @brief \b Function \b Name: MDrv_RVD_SetDispRepeatCnt()
497 /// @brief \b Function \b Description: Set Disp repeat cnt to f/w
498 /// @param -u32Num \b IN Repeat cnt
499 /// @return status
500 //-----------------------------------------------------------------------------
MDrv_RVD_SetDispRepeatCnt(MS_U32 u32Num)501 RVD_Result MDrv_RVD_SetDispRepeatCnt(MS_U32 u32Num)
502 {
503 return MDrv_RVD_SetCmd(E_RVD_CMD_DISP_REPEAT_MAX, u32Num);
504 }
505
506 //-----------------------------------------------------------------------------
507 /// @brief \b Function \b Name: MDrv_RVD_GetInfo()
508 /// @brief \b Function \b Description: Get information of RVD driver.
509 /// @return - driver information
510 //-----------------------------------------------------------------------------
MDrv_RVD_GetInfo(void)511 const RVD_DrvInfo* MDrv_RVD_GetInfo( void )
512 {
513 if(!bRVDIsInit)
514 return 0;
515 DrvRVDInfo.bRVD=MDrv_RVD_CheckCaps();
516 return (&DrvRVDInfo);
517 }
518
519 //-----------------------------------------------------------------------------
520 /// @brief \b Function \b Name: MDrv_RVD_GetTimeStamp()
521 /// @brief \b Function \b Description: get the pts of current displayed video frame
522 /// @return - PTS
523 //-----------------------------------------------------------------------------
MDrv_RVD_GetTimeStamp(void)524 MS_U32 MDrv_RVD_GetTimeStamp(void)
525 {
526 MS_U32 u32FrameInfoAddr;
527
528 u32FrameInfoAddr = HAL_RVD_QMemRead( gu32QmemExchangeInfoAddr + RVD_QMEM_INFO_DISP_FRAME_INFO_ADDR);
529 return HAL_RVD_MemRead(u32FrameInfoAddr + E_RVD_FRAMEBUFF_INFO_TIMESTAMP );
530 }
531
532 //-----------------------------------------------------------------------------
533 /// @brief \b Function \b Name: MDrv_RVD_GetDecodeCnt()
534 /// @brief \b Function \b Description: get accumulated decoded frame Count
535 /// @return - decoded frame Count
536 //-----------------------------------------------------------------------------
MDrv_RVD_GetDecodeCnt(void)537 MS_U32 MDrv_RVD_GetDecodeCnt(void)
538 {
539 return HAL_RVD_QMemRead( (gu32QmemExchangeInfoAddr + RVD_QMEM_INFO_DECODECNT) );
540 }
541
542 //-----------------------------------------------------------------------------
543 /// @brief \b Function \b Name: MDrv_RVD_GetFrameCnt()
544 /// @brief \b Function \b Description: get accumulated display Count
545 /// @return - Display Count
546 //-----------------------------------------------------------------------------
MDrv_RVD_GetFrameCnt(void)547 MS_U32 MDrv_RVD_GetFrameCnt(void)
548 {
549 return HAL_RVD_QMemRead( (gu32QmemExchangeInfoAddr + RVD_QMEM_INFO_DISPLAYCNT) );
550 }
551
552 //-----------------------------------------------------------------------------
553 /// @brief \b Function \b Name: MDrv_RVD_SetBBUReadPtr()
554 /// @brief \b Function \b Description: Set BBU Read point to f/w
555 /// @param -u32Rptr \b IN BBU Read Pointer
556 //-----------------------------------------------------------------------------
MDrv_RVD_SetBBUReadPtr(MS_U32 u32Rptr)557 void MDrv_RVD_SetBBUReadPtr(MS_U32 u32Rptr)
558 {
559 HAL_RVD_QMemWrite((gu32QmemExchangeInfoAddr + RVD_QMEM_INFO_OFFSET_BBU_RPTR), u32Rptr);
560 }
561
562 //-----------------------------------------------------------------------------
563 /// @brief \b Function \b Name: MDrv_RVD_SetBBUWritePtr()
564 /// @brief \b Function \b Description: Set BBU write point to f/w
565 /// @param -u32Wptr \b IN BBU Read Pointer
566 //-----------------------------------------------------------------------------
MDrv_RVD_SetBBUWritePtr(MS_U32 u32Wptr)567 void MDrv_RVD_SetBBUWritePtr(MS_U32 u32Wptr)
568 {
569 HAL_RVD_QMemWrite((gu32QmemExchangeInfoAddr + RVD_QMEM_INFO_OFFSET_BBU_WPTR), u32Wptr);
570 }
571
572 //-----------------------------------------------------------------------------
573 /// @brief \b Function \b Name: MDrv_RVD_SetIDReadPtr()
574 /// @brief \b Function \b Description: Set BBU read point to f/w (Flush only)
575 /// @param -u32Wptr \b IN BBU Read Pointer
576 //-----------------------------------------------------------------------------
MDrv_RVD_SetIDReadPtr(MS_U32 u32Wptr)577 void MDrv_RVD_SetIDReadPtr(MS_U32 u32Wptr)
578 {
579 HAL_RVD_QMemWrite((gu32QmemExchangeInfoAddr + RVD_QMEM_INFO_ID_RPTR), u32Wptr);
580 }
581
582 //-----------------------------------------------------------------------------
583 /// @brief \b Function \b Name: MDrv_RVD_SetIDWritePtr()
584 /// @brief \b Function \b Description: Set BBU write point to f/w
585 /// @param -u32Wptr \b IN BBU Read Pointer
586 //-----------------------------------------------------------------------------
MDrv_RVD_SetIDWritePtr(MS_U32 u32Wptr)587 void MDrv_RVD_SetIDWritePtr(MS_U32 u32Wptr)
588 {
589 HAL_RVD_QMemWrite((gu32QmemExchangeInfoAddr + RVD_QMEM_INFO_ID_WPTR), u32Wptr);
590 }
591
592 //-----------------------------------------------------------------------------
593 /// @brief \b Function \b Name: MDrv_RVD_GetBBUReadPtr()
594 /// @brief \b Function \b Description: Get BBU Read point from f/w
595 /// @return - bbu read pointer
596 //-----------------------------------------------------------------------------
MDrv_RVD_GetBBUReadPtr(void)597 MS_U32 MDrv_RVD_GetBBUReadPtr(void)
598 {
599 return HAL_RVD_QMemRead( gu32QmemExchangeInfoAddr + RVD_QMEM_INFO_OFFSET_BBU_RPTR);
600 }
601
602 //-----------------------------------------------------------------------------
603 /// @brief \b Function \b Name: MDrv_RVD_GetFrameInfo()
604 /// @brief \b Function \b Description: Get Frame Info
605 /// @return - bbu read pointer
606 //-----------------------------------------------------------------------------
MDrv_RVD_GetFrameInfo(RVD_FrameBuff_Info * framebuffinfo,MS_BOOL bGETDISP)607 RVD_Result MDrv_RVD_GetFrameInfo(RVD_FrameBuff_Info *framebuffinfo ,MS_BOOL bGETDISP)
608 {
609 MS_U32 u32FrameInfoAddr = 0;
610 MS_U32 u32MIUBaseAddr = 0;
611
612 if (bGETDISP)
613 u32FrameInfoAddr = HAL_RVD_QMemRead( gu32QmemExchangeInfoAddr + RVD_QMEM_INFO_DISP_FRAME_INFO_ADDR);
614 else
615 u32FrameInfoAddr = HAL_RVD_QMemRead( gu32QmemExchangeInfoAddr + RVD_QMEM_INFO_DEC_FRAME_INFO_ADDR);
616
617 RVD_MSG_HAL("u32FrameInfoAddr = 0x%lx",u32FrameInfoAddr);
618 if (u32FrameInfoAddr)
619 {
620 if (gRVDInfo.bRVD_HWinMIU1)
621 u32MIUBaseAddr = HAL_MIU1_BASE;
622
623 framebuffinfo->u32LumaAddr = HAL_RVD_MemRead(u32FrameInfoAddr + E_RVD_FRAMEBUFF_INFO_LUMAADDR ) |u32MIUBaseAddr;
624 framebuffinfo->u32ChromaAddr = HAL_RVD_MemRead(u32FrameInfoAddr + E_RVD_FRAMEBUFF_INFO_CHROMADDR )|u32MIUBaseAddr;
625 framebuffinfo->u32TimeStamp = HAL_RVD_MemRead(u32FrameInfoAddr + E_RVD_FRAMEBUFF_INFO_TIMESTAMP );
626 framebuffinfo->u32ID_L = HAL_RVD_MemRead(u32FrameInfoAddr + E_RVD_FRAMEBUFF_INFO_ID_L );
627 framebuffinfo->u32ID_H = HAL_RVD_MemRead(u32FrameInfoAddr + E_RVD_FRAMEBUFF_INFO_ID_H );
628 framebuffinfo->u16FrmType = (MS_U16)(HAL_RVD_MemRead(u32FrameInfoAddr + E_RVD_FRAMEBUFF_INFO_FRAME_TYPE )&0x0000ffff);
629 framebuffinfo->u16Pitch = (MS_U16)((HAL_RVD_MemRead(u32FrameInfoAddr + E_RVD_FRAMEBUFF_INFO_PITCH)&0xffff0000)>>16);
630 framebuffinfo->u16Width = (MS_U16) (HAL_RVD_MemRead(u32FrameInfoAddr + E_RVD_FRAMEBUFF_INFO_WIDTH)&0x0000ffff);
631 framebuffinfo->u16Height = (MS_U16)((HAL_RVD_MemRead(u32FrameInfoAddr + E_RVD_FRAMEBUFF_INFO_HEIGHT)&0xffff0000)>>16);
632 RVD_MSG_HAL("Luma = 0x%lx Chroma = 0x%lx Width =0x%x Height =0x%x Pitch = 0x%x",framebuffinfo->u32LumaAddr, framebuffinfo->u32ChromaAddr,
633 framebuffinfo->u16Width, framebuffinfo->u16Height, framebuffinfo->u16Pitch );
634 return E_RVD_RET_SUCCESS;
635 }
636 else
637 {
638 return E_RVD_RET_FAIL;
639 }
640 }
641
642 //-----------------------------------------------------------------------------
643 /// @brief \b Function \b Name: MDrv_RVD_GetIDReadPtr()
644 /// @brief \b Function \b Description: Get BBU Read point from f/w
645 /// @return - bbu read pointer
646 //-----------------------------------------------------------------------------
MDrv_RVD_GetIDReadPtr(void)647 MS_U32 MDrv_RVD_GetIDReadPtr(void)
648 {
649 return HAL_RVD_QMemRead( gu32QmemExchangeInfoAddr + RVD_QMEM_INFO_ID_RPTR);
650 }
651
652 //-----------------------------------------------------------------------------
653 /// @brief \b Function \b Name: MDrv_RVD_GetIDWritePtr()
654 /// @brief \b Function \b Description: Get ID write point from f/w
655 /// @return - bbu write pointer
656 //-----------------------------------------------------------------------------
MDrv_RVD_GetIDWritePtr(void)657 MS_U32 MDrv_RVD_GetIDWritePtr(void)
658 {
659 return HAL_RVD_QMemRead( gu32QmemExchangeInfoAddr + RVD_QMEM_INFO_ID_WPTR);
660 }
661
662 //-----------------------------------------------------------------------------
663 /// @brief \b Function \b Name: MDrv_RVD_GetBBUWritePtr()
664 /// @brief \b Function \b Description: Get BBU write point from f/w
665 /// @return - bbu write pointer
666 //-----------------------------------------------------------------------------
MDrv_RVD_GetBBUWritePtr(void)667 MS_U32 MDrv_RVD_GetBBUWritePtr(void)
668 {
669 return HAL_RVD_QMemRead( gu32QmemExchangeInfoAddr + RVD_QMEM_INFO_OFFSET_BBU_WPTR);
670 }
671
672 //-----------------------------------------------------------------------------
673 /// @brief \b Function \b Name: MDrv_RVD_GetBBUDepth()
674 /// @brief \b Function \b Description: Get BBU Depth
675 /// @return - BBU Depth
676 //-----------------------------------------------------------------------------
MDrv_RVD_GetBBUDepth(void)677 MS_U16 MDrv_RVD_GetBBUDepth(void)
678 {
679 return HAL_RVD_QMemRead( gu32QmemExchangeInfoAddr + RVD_QMEM_INFO_OFFSET_BBU_DEPTH);
680 }
681
682 //-----------------------------------------------------------------------------
683 /// @brief \b Function \b Name: MDrv_RVD_SetPictureSize()
684 /// @brief \b Function \b Description: Set Picture width and Height to F/W
685 /// @param -u16Width \b IN The frame Width
686 /// @param -u16Height \b IN The frame Height
687 //-----------------------------------------------------------------------------
MDrv_RVD_SetPictureSize(MS_U16 u16Width,MS_U16 u16Height)688 void MDrv_RVD_SetPictureSize(MS_U16 u16Width, MS_U16 u16Height)
689 {
690 HAL_RVD_QMemWrite( (gu32QmemExchangeInfoAddr + RVD_QMEM_INFO_OFFSET_PIC_WIDTH) , u16Width);
691 HAL_RVD_QMemWrite( (gu32QmemExchangeInfoAddr + RVD_QMEM_INFO_OFFSET_PIC_HEIGHT) , u16Height);
692 }
693
694 //-----------------------------------------------------------------------------
695 /// @brief \b Function \b Name: MDrv_RVD_GetPictureSize()
696 /// @brief \b Function \b Description: Set Picture width and Height to F/W
697 /// @param -u32Width \b IN The frame Width
698 /// @param -u32Height \b IN The frame Height
699 //-----------------------------------------------------------------------------
MDrv_RVD_GetPictureSize(MS_U16 * u16Width,MS_U16 * u16Height)700 void MDrv_RVD_GetPictureSize(MS_U16* u16Width, MS_U16* u16Height)
701 {
702 *u16Width = HAL_RVD_QMemRead( gu32QmemExchangeInfoAddr + RVD_QMEM_INFO_OFFSET_PIC_WIDTH);
703 *u16Height = HAL_RVD_QMemRead( gu32QmemExchangeInfoAddr + RVD_QMEM_INFO_OFFSET_PIC_HEIGHT);
704 }
705
706 //-----------------------------------------------------------------------------
707 /// @brief \b Function \b Name: MDrv_RVD_SetPlayMode()
708 /// @brief \b Function \b Description: HK Command ()
709 /// @param -u32PlayMode \b IN RVD_PlayMode
710 //-----------------------------------------------------------------------------
MDrv_RVD_SetDisplay(RVD_DisplayMode u32PlayMode)711 void MDrv_RVD_SetDisplay(RVD_DisplayMode u32PlayMode)
712 {
713 HAL_RVD_QMemWrite( gu32QmemExchangeInfoAddr+RVD_QMEM_INFO_PLAY_MODE, u32PlayMode);
714 }
715
716 //-----------------------------------------------------------------------------
717 /// @brief \b Function \b Name: MDrv_RVD_PushBBU()
718 /// @brief \b Function \b Description: push one entry into the decoding table(BBU table).
719 /// @param -u32offset \b IN : the start physical address of the entry.(unit:byte)
720 /// @param -u32length \b IN : the data size of the entry. (unit:byte)
721 /// @param -rvdPackerInfo \b IN : the ID of the entry. (unit:byte)
722 //-----------------------------------------------------------------------------
MDrv_RVD_PushBBU(MS_U32 u32offset,MS_U32 u32length,RVD_Packet_ID * rvdPackerInfo)723 void MDrv_RVD_PushBBU (MS_U32 u32offset, MS_U32 u32length ,RVD_Packet_ID *rvdPackerInfo)
724 {
725 MS_U32 u32Addr;
726 //MS_U16 u16QmemIDWptr = 0;
727
728 if(u32offset&MW_RVD_BROKEN_BY_US)
729 {
730 u32offset = (u32offset & (~MW_RVD_BROKEN_BY_US)) | BROKEN_BY_US;
731 RVD_MSG_DRV("Broken by us is True\n");
732 }
733 RVD_MSG_INF("OFFSET LENGTH<%lx , %lx>\n",u32offset,u32length);
734 #if 0
735 #if USING_ID_LINK
736 u16QmemBbuWptr = (MS_U16)MDrv_RVD_GetIDWritePtr();
737 #else
738 u16QmemBbuWptr = (MS_U16)MDrv_RVD_GetBBUWritePtr();
739 #endif
740 #endif
741
742 u32Addr = gu32QmemBbuAddr + ( ((MS_U32)u16QmemBbuWptr) << 3); //offset + length : 8 byte
743 MDrv_RVD_SetBBU_OffsetLength(u32Addr,u32offset,u32length);
744
745 u32Addr = gu32QmemBbuAddr + QMEM_BBU_TABLE_SIZE + ( ((MS_U32)u16QmemBbuWptr) * 12); // byte_pos, ID_L, ID_H
746 MDrv_RVD_SetBBU_ID(u32Addr,u32BytePos,rvdPackerInfo->u32PacketID_HI,rvdPackerInfo->u32PacketID_LO);
747
748 u32BytePos += u32length;
749 u32BytePos %=BYTECOUNT_LIMIT;
750
751 if ( u16QmemBbuWptr == (RVD_BBU_DEPTH - 1) )
752 {
753 u16QmemBbuWptr = 0;
754 }
755 else
756 {
757 u16QmemBbuWptr++;
758 }
759
760 #if 0
761 MDrv_RVD_SetIDWritePtr((MS_U32)(u16QmemBbuWptr));
762 MDrv_RVD_SetBBUWritePtr((MS_U32)(u16QmemBbuWptr));
763 #endif
764 }
765
766 //------------------------------------------------------------------------------
767 /// @brief \b Function \b Name: MDrv_RVD_FireDecCmd()
768 /// @brief \b Function \b Description: Fire the decode command which be pushed since last fired
769 /// @return Status
770 /// @retval - E_RVD_RET_SUCCESS, Success
771 /// @retval - E_RVD_RET_FAIL, Failed
772 //------------------------------------------------------------------------------
MDrv_RVD_FireDecCmd(void)773 RVD_Result MDrv_RVD_FireDecCmd(void)
774 {
775 MDrv_RVD_SetBBUWritePtr(u16QmemBbuWptr);
776 MDrv_RVD_SetIDWritePtr(u16QmemBbuWptr);
777 return E_RVD_RET_SUCCESS;
778 }
779
780 //-----------------------------------------------------------------------------
781 /// @brief \b Function \b Name: MDrv_RVD_SetFileInfo()
782 /// @brief \b Function \b Description: Set RM File information for F/W INFO Table.
783 /// @param -pFileInfo \b IN : the file information of RM file
784 //-----------------------------------------------------------------------------
MDrv_RVD_SetFileInfo(RVD_FileInfo * pFileInfo)785 void MDrv_RVD_SetFileInfo( RVD_FileInfo *pFileInfo)
786 {
787 MS_U8 i = 0;
788 MS_U32 u32Addr = 0;
789
790 if( NULL == pFileInfo )
791 {
792 return ;
793 }
794
795 // file info addr = bin addr + bin size
796 u32Addr = OPENRISC_BIN_SIZE;
797
798 if ( pFileInfo->RV_Version == 0 ) // RV8
799 {
800 HAL_RVD_SetRVInfo(pFileInfo->RV_Version);
801
802 // write RV_Version = 0
803 HAL_RVD_MemWrite(u32Addr, pFileInfo->RV_Version);
804 u32Addr+=4;
805
806 // write ulNumSizes
807 HAL_RVD_MemWrite(u32Addr, pFileInfo->ulNumSizes);
808 u32Addr+=4;
809
810 // write ulPicSizes_w[8]
811 for( i = 0; i<8; i++ )
812 {
813 HAL_RVD_MemWrite(u32Addr, pFileInfo->ulPicSizes_w[i]);
814 u32Addr+=4;
815 }
816
817 // write ulPicSizes_h[8]
818 for( i = 0; i<8; i++ )
819 {
820 HAL_RVD_MemWrite(u32Addr, pFileInfo->ulPicSizes_h[i]);
821 u32Addr+=4;
822 }
823 }
824 else
825 {
826 HAL_RVD_SetRVInfo(pFileInfo->RV_Version );
827
828 // write RV_Version = 1
829 HAL_RVD_MemWrite(u32Addr, 1);
830 u32Addr+=4;
831
832 // write ulNumSizes = 0
833 HAL_RVD_MemWrite(u32Addr, 0);
834 u32Addr+=4;
835
836 // jump ulPicSizes_w[8], ulPicSizes_h[8]
837 u32Addr += (4 * 8 * 2); // 4 bytes * 8 * 2
838 }
839
840 // write buffer mode
841 HAL_RVD_MemWrite(u32Addr, pFileInfo->ulBufMode);
842 u32Addr+=4;
843
844 // write frame buffer start addr
845 HAL_RVD_MemWrite(u32Addr, pFileInfo->ulFBAddr);
846 u32Addr+=4;
847
848 // write frame buffer size (total frame buffer size + IAP size)
849 HAL_RVD_MemWrite(u32Addr, pFileInfo->ulFBSize);
850 u32Addr+=4;
851
852 // write VLC addr = FB addr + FB size
853 HAL_RVD_MemWrite(u32Addr, pFileInfo->ulVLCAddr );
854 u32Addr+=4;
855 #if 0
856 // write DS setting
857 HAL_RVD_MemWrite(u32Addr, pFileInfo->RV_DynScaling.u32DynAddr);
858 u32Addr+=4;
859
860 HAL_RVD_MemWrite(u32Addr, pFileInfo->RV_DynScaling.u32Depth);
861 u32Addr+=4;
862
863 if (pFileInfo->RV_DynScaling.bEnable)
864 HAL_RVD_MemWrite(u32Addr, eRvdDynCfgByChip);
865 else
866 HAL_RVD_MemWrite(u32Addr, 0);
867 #endif
868 u32Addr+=4;
869 }
870
871 //-----------------------------------------------------------------------------
872 /// @brief \b Function \b Name: MDrv_RVD_GetQMEM_Info()
873 /// @brief \b Function \b Description: Get QmemExchangeInfoAddr From F/W
874 //-----------------------------------------------------------------------------
MDrv_RVD_GetQMEM_Info(void)875 void MDrv_RVD_GetQMEM_Info(void)
876 {
877 gu32QmemExchangeInfoAddr = HAL_RVD_GetExchangeInfoAddr();
878 RVD_MSG_INF("QmemExchangeInfoAddr = 0x%lx\n", gu32QmemExchangeInfoAddr);
879
880 gu32QmemBbuAddr = MDrv_RVD_GetBBUStartAddr();
881 RVD_MSG_INF("QmemBbuAddr = 0x%lx\n", gu32QmemBbuAddr);
882
883 MDrv_RVD_SetBBUDepth(RVD_BBU_DEPTH);
884 RVD_MSG_INF("<gdbg>RVD_BBU_DEPTH = %d\n", RVD_BBU_DEPTH);
885 }
886
887 //-----------------------------------------------------------------------------
888 /// @brief \b Function \b Name: MDrv_RVD_SetTrickRefInfo()
889 /// @brief \b Function \b Description: Mark the dummy data for flush BBU
890 //-----------------------------------------------------------------------------
MDrv_RVD_SetTrickRefInfo(MS_PHYADDR u32DstAddr,MS_PHYADDR u32ScrAddr)891 void MDrv_RVD_SetTrickRefInfo(MS_PHYADDR u32DstAddr ,MS_PHYADDR u32ScrAddr)
892 {
893 MS_U32 tmpAdr ,tmpLen,tmpTotal;
894 RVD_FWSourceType eType = E_RVD_FW_SOURCE_DRAM;
895
896 HAL_RVD_MemGetMap(E_RVD_MMAP_FW, &tmpAdr, &tmpLen,1);
897 tmpTotal = tmpAdr + tmpLen - 8;
898 WRITE_LONG((MS_U32)tmpTotal,(MS_U32)0xffffffff);
899 WRITE_LONG((MS_U32)((tmpTotal)+4),(MS_U32)0xffffffff);
900 tmpTotal = u32ScrAddr + tmpLen - 8;
901 gRVDInfo.u32BDMAFlag = MDrv_RVD_BDMAFlag(gRVDInfo.bRVD_HWinMIU1,gRVDInfo.bRVD_FWinMIU1,eType);//E_RVD_FW_SOURCE_DRAM);
902 if (E_BDMA_OK != BDMAcpy( u32DstAddr,
903 tmpTotal,
904 16,
905 (BDMA_CpyType)gRVDInfo.u32BDMAFlag) )
906 {
907 RVD_MSG_ERR("RVD ERR: BDMAcpy Flash 2 DRAM failed: dest:0x%lx src:0x%lx flag:%lu\n" ,u32DstAddr, tmpTotal, (MS_U32)gRVDInfo.u32BDMAFlag) ;
908 }
909
910 RVD_MSG_INF("DummyDataAddr: 0x%lx\n", u32DstAddr);
911 }
912
913 //-----------------------------------------------------------------------------
914 /// @brief \b Function \b Name: MDrv_RVD_GetFWInfo()
915 /// @brief \b Function \b Description: Get RVD FW and HW version(reported from f/w)
916 //-----------------------------------------------------------------------------
MDrv_RVD_GetFWInfo(void)917 void MDrv_RVD_GetFWInfo(void)
918 {
919 #define FWVerAddr 0 //base : Open bin addr
920 #define HWVerAddr 4 //base : Open bin addr
921
922 DrvRVDInfo.FWversion = HAL_RVD_MemRead(FWVerAddr);
923 DrvRVDInfo.HWversion = HAL_RVD_MemRead(HWVerAddr);
924 RVD_MSG_INF("FW INFO>>RVD.FWversion:0x%lx\t RVD.HWversion: 0x%lx\n", DrvRVDInfo.FWversion, DrvRVDInfo.HWversion);
925 }
926
927 //-----------------------------------------------------------------------------
928 /// @brief \b Function \b Name: MDrv_RVD_LoadVLCTable()
929 /// @brief \b Function \b Description: Load VLC table to Dram
930 //-----------------------------------------------------------------------------
MDrv_RVD_LoadVLCTable(MS_U32 u32Addr,RVD_FWSourceType eType)931 void MDrv_RVD_LoadVLCTable(MS_U32 u32Addr ,RVD_FWSourceType eType)
932 {
933 RVD_MSG_INF("vlc_addr = 0x%lx\n",u32Addr);
934 #if (!RVD_ENABLE_BDMA_FW_FLASH_2_SDRAM)
935 MS_U32 tmpAdr , tmpLen;
936 //RVD_FWSourceType eTypetmp = E_RVD_FW_SOURCE_DRAM;
937
938 eType = E_RVD_FW_SOURCE_DRAM;
939 gRVDInfo.u32BDMAFlag = MDrv_RVD_BDMAFlag(gRVDInfo.bRVD_HWinMIU1,gRVDInfo.bRVD_FWinMIU1,eType);
940 gRVDInfo.u32VLC_ScrAddr = gRVDInfo.u32FW_PhyAddr;
941 HAL_RVD_MemGetMap(E_RVD_MMAP_FW, &tmpAdr, &tmpLen, 1);
942 gRVDInfo.u32VLC_ScrSize = sizeof(VLC_TAB);
943 RVD_memcpy((void*)tmpAdr,(void*)VLC_TAB, gRVDInfo.u32VLC_ScrSize);
944 RVD_MSG_INF("RVD Check: BDMAcpy DRAM 2 DRAM: dest:0x%lx src:0x%lx size:0x%lx flag:%lx\n" ,u32Addr, gRVDInfo.u32VLC_ScrAddr , gRVDInfo.u32VLC_ScrSize , (MS_U32)gRVDInfo.u32BDMAFlag) ;
945 if (E_BDMA_OK != BDMAcpy( u32Addr,
946 gRVDInfo.u32VLC_ScrAddr,
947 gRVDInfo.u32VLC_ScrSize,
948 (BDMA_CpyType)gRVDInfo.u32BDMAFlag) )
949 {
950 RVD_MSG_ERR("RVD ERR: BDMAcpy Flash 2 DRAM failed: dest:0x%lx src:0x%lx size:0x%lx flag:%lu\n" ,u32Addr, gRVDInfo.u32VLC_ScrAddr , gRVDInfo.u32VLC_ScrSize , (MS_U32)gRVDInfo.u32BDMAFlag) ;
951 }
952 #else
953 gRVDInfo.u32BDMAFlag = MDrv_RVD_BDMAFlag(gRVDInfo.bRVD_HWinMIU1, gRVDInfo.bRVD_VLCBinInMIU1,eType);
954 if(E_BDMA_OK != BDMAcpy(u32Addr, gRVDInfo.u32VLC_ScrAddr, gRVDInfo.u32VLC_ScrSize, (BDMA_CpyType)gRVDInfo.u32BDMAFlag) )
955 {
956 RVD_MSG_ERR("RVD ERR: BDMAcpy Flash 2 DRAM failed: dest:0x%lx src:0x%lx size:0x%lx flag:%lu\n" ,u32Addr , gRVDInfo.u32VLC_ScrAddr , gRVDInfo.u32VLC_ScrSize , (MS_U32)gRVDInfo.u32BDMAFlag) ;
957 }
958 #endif
959 }
960
961 //-----------------------------------------------------------------------------
962 /// @brief \b Function \b Name: MDrv_RVD_ResetVariable()
963 /// @brief \b Function \b Description: Reset Variable
964 //-----------------------------------------------------------------------------
MDrv_RVD_ResetVariable(void)965 void MDrv_RVD_ResetVariable(void)
966 {
967 u32StepPlayCnt= 0 ; // check if step play done
968 u32StepDecodeCnt= 0 ; // check if step play done
969 u32BytePos= 0 ;
970 u16QmemBbuWptr = 0;
971 RVD_memset((void*)&gRVDInfo, 0, sizeof(RVD_MiuInfo));
972 }
973
974 //-----------------------------------------------------------------------------
975 /// @brief \b Function \b Name: MDrv_RVD_Init()
976 /// @brief \b Function \b Description: RVD Initial
977 /// @param -pFileInfo \b IN : the file information of RM file
978 /// @param -memCfg \b IN : the RVD memmap config
979 /// @return -The result of RVD Init
980 //-----------------------------------------------------------------------------
MDrv_RVD_Init(RVD_FileInfo * pFileInfo,RVD_MEMCfg * memCfg)981 RVD_Result MDrv_RVD_Init(RVD_FileInfo *pFileInfo, RVD_MEMCfg* memCfg)
982 {
983 MS_U32 tmpAdr, tmpLen;
984 MS_U8 u8Ret = E_RVD_RET_FAIL;
985 MS_U32 u32TmpAddr;
986 MS_BOOL bNeedReloadFW = TRUE;
987
988 #if RVD_ENABLE_TIME_MEASURE
989 u32RvdInitSysTimeBase = RVD_GetSysTime_ms();
990 #endif
991 if (NULL == pFileInfo)
992 {
993 RVD_MSG_ERR("Hal_RVD_Init Err : don't have file_info!!\n");
994 return E_RVD_RET_FAIL;
995 }
996
997 MDrv_RVD_ResetVariable();
998 if (MDrv_RVD_SetCfg(memCfg) != E_RVD_RET_SUCCESS)
999 return E_RVD_RET_INVALID_PARAM;
1000
1001 //the very first step: Get register base addr
1002 //notice: must do this first before accessing any register.
1003 #if 0
1004 MS_U32 u32NonPMBankSize;
1005 MS_U32 u32NonPMBankAddr;
1006 if( !MDrv_MMIO_GetBASE( &u32NonPMBankAddr, &u32NonPMBankSize, MS_MODULE_RVD))
1007 {
1008 RVD_MSG_INF("_MDrv_RVD_Init: IOMap failure\n");
1009 return E_RVD_RET_FAIL;
1010 }
1011 else
1012 {
1013 MDrv_RVD_SetOSRegBase(u32NonPMBankAddr);
1014 RVD_MSG_INF("_MDrv_RVD_Init: u32RiuBaseAdd = %lx\n", u32NonPMBankAddr);
1015 }
1016 #endif
1017
1018 if (bRVDIsInit == TRUE)
1019 {
1020 return E_RVD_RET_RE_INIT;
1021 }
1022
1023 RVD_MSG_INF("GO RVD INIT\n");
1024 #if RVD_ENABLE_TIME_MEASURE
1025 RVD_MSG_DRV( "RVD Time Measure:%ld (%s %d) \n" , RVD_GetSysTime_ms() - u32RvdInitSysTimeBase , __FUNCTION__, __LINE__ );
1026 #endif
1027
1028 #if RVD_ISR_ENABLE
1029 //Release RVD ISR
1030 HAL_RVD_Enable_ISR(FALSE);
1031 #endif
1032
1033 HAL_RVD_Reset_RVD_SVD();
1034 #if RVD_ENABLE_TIME_MEASURE
1035 RVD_MSG_DRV( "RVD Time Measure:%ld (%s %d) \n" , RVD_GetSysTime_ms() - u32RvdInitSysTimeBase , __FUNCTION__, __LINE__ );
1036 #endif
1037
1038 // Using FWAddr as tmp buffer to mark flush pattern
1039 //MDrv_RVD_SetTrickRefInfo(memCfg->u32BSAddr, memCfg->u32FWAddr);
1040 MDrv_RVD_SetTrickRefInfo(memCfg->u32PBAddr, memCfg->u32FWAddr);
1041 #if RVD_ENABLE_TIME_MEASURE
1042 RVD_MSG_DRV( "RVD Time Measure:%ld (%s %d) \n" , RVD_GetSysTime_ms() - u32RvdInitSysTimeBase , __FUNCTION__, __LINE__ );
1043 #endif
1044
1045 //Check whether need to reload fw or not
1046 if((TRUE == gbEnableRVTurboFWMode)
1047 && (FALSE == HAL_RVD_IsNeedReload()))
1048 {
1049 bNeedReloadFW = FALSE;
1050 }
1051
1052 if(TRUE == bNeedReloadFW)
1053 {
1054 //If we need to reload fw, need to reset fw decoder type first.
1055 HAL_RVD_SetFWDecoder(FALSE);
1056
1057 u32TmpAddr = memCfg->u32FBAddr + memCfg->u32FBSize -RVD_VLC_TABLE_SIZE;
1058 MDrv_RVD_LoadVLCTable(u32TmpAddr ,memCfg->eFWSourceType);
1059 #if RVD_ENABLE_TIME_MEASURE
1060 RVD_MSG_DRV( "RVD Time Measure:%ld (%s %d) \n" , RVD_GetSysTime_ms() - u32RvdInitSysTimeBase , __FUNCTION__, __LINE__ );
1061 #endif
1062
1063 #if (!RVD_ENABLE_BDMA_FW_FLASH_2_SDRAM)
1064 HAL_RVD_LoadCode();
1065 #else
1066 gRVDInfo.u32BDMAFlag = MDrv_RVD_BDMAFlag(gRVDInfo.bRVD_FWinMIU1,
1067 gRVDInfo.bRVD_FWBinInMIU1,memCfg->eFWSourceType);
1068 if (E_BDMA_OK != BDMAcpy( gRVDInfo.u32FW_DstAddr,
1069 gRVDInfo.u32FW_ScrAddr,
1070 gRVDInfo.u32FW_ScrSize,
1071 (BDMA_CpyType)gRVDInfo.u32BDMAFlag) )
1072 {
1073 RVD_MSG_ERR("RVD ERR: BDMAcpy Flash 2 DRAM failed: dest:0x%lx src:0x%lx size:0x%lx flag:%lu\n" ,gRVDInfo.u32FW_DstAddr, gRVDInfo.u32FW_ScrAddr , gRVDInfo.u32FW_ScrSize , (MS_U32)gRVDInfo.u32BDMAFlag) ;
1074 }
1075 #endif
1076
1077 //When load successfully, set FW decoder to RVD
1078 HAL_RVD_SetFWDecoder(TRUE);
1079 }
1080
1081 #if RVD_ENABLE_TIME_MEASURE
1082 RVD_MSG_DRV( "RVD Time Measure:%ld (%s %d) \n" , RVD_GetSysTime_ms() - u32RvdInitSysTimeBase , __FUNCTION__, __LINE__ );
1083 #endif
1084
1085 // get virtual bin addr
1086 HAL_RVD_MemGetMap(E_RVD_MMAP_FW, &tmpAdr, &tmpLen, 1);
1087 u32FWBinAddr = tmpAdr;
1088 RVD_MSG_INF("u32FWBinAddr =0x%lx\n", u32FWBinAddr);
1089 #if RVD_ENABLE_TIME_MEASURE
1090 RVD_MSG_DRV( "RVD Time Measure:%ld (%s %d) \n" , RVD_GetSysTime_ms() - u32RvdInitSysTimeBase , __FUNCTION__, __LINE__ );
1091 #endif
1092
1093 HAL_RVD_VerChiptop_Init();
1094 #if RVD_ENABLE_TIME_MEASURE
1095 RVD_MSG_DRV( "RVD Time Measure:%ld (%s %d) \n" , RVD_GetSysTime_ms() - u32RvdInitSysTimeBase , __FUNCTION__, __LINE__ );
1096 #endif
1097
1098 HAL_RVD_Release_RVD_SVD();
1099 #if RVD_ENABLE_TIME_MEASURE
1100 RVD_MSG_DRV( "RVD Time Measure:%ld (%s %d) \n" , RVD_GetSysTime_ms() - u32RvdInitSysTimeBase , __FUNCTION__, __LINE__ );
1101 #endif
1102
1103 u8Ret = E_RVD_RET_FAIL;
1104 while (!u8Ret)
1105 {
1106 u8Ret = HAL_RVD_CheckSWRSTDone();
1107 }
1108 #if RVD_ENABLE_TIME_MEASURE
1109 RVD_MSG_DRV( "RVD Time Measure:%ld (%s %d) \n" , RVD_GetSysTime_ms() - u32RvdInitSysTimeBase , __FUNCTION__, __LINE__ );
1110 #endif
1111
1112 u8Ret = E_RVD_RET_FAIL;
1113 while (!u8Ret)
1114 {
1115 u8Ret = HAL_RVD_CheckHKSWRSTDone();
1116 }
1117 #if RVD_ENABLE_TIME_MEASURE
1118 RVD_MSG_DRV( "RVD Time Measure:%ld (%s %d) \n" , RVD_GetSysTime_ms() - u32RvdInitSysTimeBase , __FUNCTION__, __LINE__ );
1119 #endif
1120
1121 HAL_RVD_BBU_SET_CPU();
1122 HAL_RVD_CPUSetting(1);
1123 HAL_RVD_MemoryProtect(0);
1124 #if RVD_ENABLE_TIME_MEASURE
1125 RVD_MSG_DRV( "RVD Time Measure:%ld (%s %d) \n" , RVD_GetSysTime_ms() - u32RvdInitSysTimeBase , __FUNCTION__, __LINE__ );
1126 #endif
1127
1128 // get physical addr
1129 HAL_RVD_MemGetMap(E_RVD_MMAP_FB, &tmpAdr, &tmpLen, 0);
1130 pFileInfo->ulFBAddr = tmpAdr;
1131 pFileInfo->ulFBSize = tmpLen - RVD_VLC_TABLE_SIZE;
1132 pFileInfo->ulVLCAddr = tmpAdr + tmpLen - RVD_VLC_TABLE_SIZE;
1133 #if RVD_ENABLE_TIME_MEASURE
1134 RVD_MSG_DRV( "RVD Time Measure:%ld (%s %d) \n" , RVD_GetSysTime_ms() - u32RvdInitSysTimeBase , __FUNCTION__, __LINE__ );
1135 #endif
1136
1137 MDrv_RVD_SetFileInfo( pFileInfo ); // write file info to DRAM
1138 HAL_RVD_SetBufferAddr();
1139 #if RVD_ENABLE_TIME_MEASURE
1140 RVD_MSG_DRV( "RVD Time Measure:%ld (%s %d) \n" , RVD_GetSysTime_ms() - u32RvdInitSysTimeBase , __FUNCTION__, __LINE__ );
1141 #endif
1142
1143 while (1)
1144 {
1145 RVD_MSG_INF("Wait RM_HI_MBOX1 \n");
1146 if (HAL_RVD_MBoxReady(RVD_HI_MBOX1))
1147 {
1148 break;
1149 }
1150 }
1151 #if RVD_ENABLE_TIME_MEASURE
1152 RVD_MSG_DRV( "RVD Time Measure:%ld (%s %d) \n" , RVD_GetSysTime_ms() - u32RvdInitSysTimeBase , __FUNCTION__, __LINE__ );
1153 #endif
1154 RVD_MSG_INF("11 \n");
1155
1156 // set physical bin addr
1157 HAL_RVD_MemGetMap(E_RVD_MMAP_FW, &tmpAdr, &tmpLen, 0);
1158 HAL_RVD_MBoxSet(RVD_HI_MBOX1, tmpAdr);//A0000000
1159 RVD_MSG_INF("12 \n");
1160
1161 while (1)
1162 {
1163 RVD_MSG_INF("Wait RM_HI_MBOX0 \n");
1164 if (HAL_RVD_MBoxReady(RVD_HI_MBOX0))
1165 {
1166 break;
1167 }
1168 }
1169 #if RVD_ENABLE_TIME_MEASURE
1170 RVD_MSG_DRV( "RVD Time Measure:%ld (%s %d) \n" , RVD_GetSysTime_ms() - u32RvdInitSysTimeBase , __FUNCTION__, __LINE__ );
1171 #endif
1172 RVD_MSG_INF("21 \n");
1173
1174 HAL_RVD_WriteDimInfo2RVD();
1175 RVD_MSG_INF("22 \n");
1176 #if RVD_ENABLE_TIME_MEASURE
1177 RVD_MSG_DRV( "RVD Time Measure:%ld (%s %d) \n" , RVD_GetSysTime_ms() - u32RvdInitSysTimeBase , __FUNCTION__, __LINE__ );
1178 #endif
1179
1180 HAL_RVD_CPURstRelse();
1181 RVD_MSG_INF("23 \n");
1182 #if RVD_ENABLE_TIME_MEASURE
1183 RVD_MSG_DRV( "RVD Time Measure:%ld (%s %d) \n" , RVD_GetSysTime_ms() - u32RvdInitSysTimeBase , __FUNCTION__, __LINE__ );
1184 #endif
1185
1186 if ( HAL_RVD_Check_INIT_QMEM_SUCCEED1() == FALSE )
1187 return E_RVD_RET_FAIL;
1188 RVD_MSG_INF("3 \n");
1189 #if RVD_ENABLE_TIME_MEASURE
1190 RVD_MSG_DRV( "RVD Time Measure:%ld (%s %d) \n" , RVD_GetSysTime_ms() - u32RvdInitSysTimeBase , __FUNCTION__, __LINE__ );
1191 #endif
1192
1193 MDrv_RVD_GetQMEM_Info();
1194 RVD_MSG_INF("4 \n");
1195 #if RVD_ENABLE_TIME_MEASURE
1196 RVD_MSG_DRV( "RVD Time Measure:%ld (%s %d) \n" , RVD_GetSysTime_ms() - u32RvdInitSysTimeBase , __FUNCTION__, __LINE__ );
1197 #endif
1198
1199 //Set Picture info in Qmem
1200 RVD_MSG_INF("SetPicInfo W=%d H=%d\n", pFileInfo->ulPicSizes_w[0], pFileInfo->ulPicSizes_h[0]);
1201 MDrv_RVD_SetPictureSize(pFileInfo->ulPicSizes_w[0], pFileInfo->ulPicSizes_h[0]);
1202 MDrv_RVD_GetFWInfo();
1203 MDrv_RVD_SetPBInfo((memCfg->u32PBAddr - memCfg->u32BSAddr), memCfg->u32PBSize);
1204 u32RVDCtrlMode |= RVD_CTRL_INIT_FINISHED;
1205 bRVDIsInit = TRUE;
1206 #if RVD_ENABLE_TIME_MEASURE
1207 RVD_MSG_DRV( "RVD Time Measure(Init finish):%ld (%s %d) \n" , RVD_GetSysTime_ms() - u32RvdInitSysTimeBase , __FUNCTION__, __LINE__ );
1208 #endif
1209 return E_RVD_RET_SUCCESS;
1210 }
1211
1212 //-----------------------------------------------------------------------------
1213 /// @brief \b Function \b Name: MDrv_RVD_EnableDynamicScaling()
1214 /// @brief \b Function \b Description: Enable Dynamic Scaling
1215 /// @param -bEnable \b IN : Enable Bit
1216 /// @retval -E_RVD_RET_FAIL:Command Timeout
1217 /// @retval -E_RVD_RET_SUCCESS:Ready
1218 //-----------------------------------------------------------------------------
MDrv_RVD_EnableDynamicScaling(MS_BOOL bEnable)1219 RVD_Result MDrv_RVD_EnableDynamicScaling(MS_BOOL bEnable)
1220 {
1221 if (bEnable)
1222 return MDrv_RVD_SetCmd(E_RVD_CMD_DYNAMIC_SCALE, RVD_DS_MIU_BIT);
1223 else
1224 return MDrv_RVD_SetCmd(E_RVD_CMD_DYNAMIC_SCALE, 0); // disable
1225 }
1226
1227 //-----------------------------------------------------------------------------
1228 /// @brief \b Function \b Name: MDrv_RVD_SetVirtualBox()
1229 /// @brief \b Function \b Description: Set DS width and Height to F/W
1230 /// @param -u16Width \b IN : frame width
1231 /// @param -u16Height \b IN : frame height
1232 //-----------------------------------------------------------------------------
MDrv_RVD_SetVirtualBox(MS_U16 u16Width,MS_U16 u16Height)1233 void MDrv_RVD_SetVirtualBox(MS_U16 u16Width, MS_U16 u16Height)
1234 {
1235 HAL_RVD_QMemWrite( (gu32QmemExchangeInfoAddr + RVD_QMEM_INFO_DS_VIRTUAL_BOX_W), u16Width);
1236 HAL_RVD_QMemWrite( (gu32QmemExchangeInfoAddr + RVD_QMEM_INFO_DS_VIRTUAL_BOX_H), u16Height);
1237 }
1238
1239 //-----------------------------------------------------------------------------
1240 /// @brief Pass scalar parameters to f/w
1241 /// @return -The result of command.
1242 //-----------------------------------------------------------------------------
MDrv_RVD_SetDynScalingParam(MS_U32 u32StAddr,MS_U32 u32Size)1243 RVD_Result MDrv_RVD_SetDynScalingParam(MS_U32 u32StAddr, MS_U32 u32Size)
1244 {
1245 MS_U32 tmpAdr, tmpLen;
1246 MS_U32 u32ScalerInfoAddr;
1247
1248 if ((u32StAddr==NULL) || (u32Size==0))
1249 {
1250 RVD_MSG_ERR("%s invalid para u32StAddr=0x%lx, u32Size=0x%lx\n", __FUNCTION__, u32StAddr, u32Size);
1251 return E_RVD_RET_INVALID_PARAM;
1252 }
1253
1254 HAL_RVD_MemGetMap(E_RVD_MMAP_FW, &tmpAdr, &tmpLen, 1); // get virtual bin addr
1255 u32ScalerInfoAddr = tmpAdr + HAL_RVD_QMemRead(gu32QmemExchangeInfoAddr + RVD_QMEM_INFO_SCALER_INFO_ADDR);
1256
1257 //copy data
1258 u32Size = ((u32Size + 3) >> 2) << 2;
1259 RVD_MSG_INF("u32Size= 0x%lx, u32SrcAdd= 0x%lx\n", u32Size, u32StAddr);
1260 RVD_memcpy((void*)u32ScalerInfoAddr, (void*) u32StAddr, u32Size);
1261
1262 //notify f/w
1263 return MDrv_RVD_SetCmd(E_RVD_CMD_SCALER_INFO, NULL);
1264 }
1265
1266 //-----------------------------------------------------------------------------
1267 /// @brief \b Function \b Name: MDrv_RVD_FlushQueue()
1268 /// @brief \b Function \b Description: Flush Queue and Reset Read/Write pointer
1269 /// @return - Flush Queue is done or not
1270 /// @retval -E_RVD_RET_NOTREADY: f/w not ready for handle the pre cmd
1271 /// @retval -E_RVD_RET_FAIL:Command Timeout
1272 /// @retval -E_RVD_RET_SUCCESS:Ready
1273 //-----------------------------------------------------------------------------
MDrv_RVD_FlushQueue(void)1274 RVD_Result MDrv_RVD_FlushQueue(void)
1275 {
1276 MS_U32 u32Timeout = 0;
1277
1278 #if RVD_ENABLE_TIME_MEASURE
1279 u32RvdInitSysTimeBase = RVD_GetSysTime_ms();
1280 #endif
1281 if(MDrv_RVD_Pause() == E_RVD_RET_FAIL)
1282 {
1283 RVD_MSG_ERR("[RM]THe Pause Command not be deal !!\n");
1284 }
1285 RVD_MSG_INF("<gdbg>BBU Flush \n");
1286 //MDrv_RVD_SetTrickRefInfo();
1287 MDrv_RVD_SetCmd(E_RVD_CMD_FLUSH, NULL);
1288
1289 u32Timeout = RVD_GetSystemTime() + 1000;
1290 while(1)
1291 {
1292 RVD_MSG_HAL("<gdbg PC: 0x%lx>\n", HAL_RVD_ReadSVDProgramCounter());
1293 if (MDrv_RVD_ChkCmdRdy()==E_RVD_RET_SUCCESS)
1294 {
1295 RVD_MSG_INF("<gdbg>Flush done now...\n");
1296 break;
1297 }
1298 if (RVD_GetSystemTime() > u32Timeout)
1299 {
1300 RVD_MSG_ERR("[RM] Hal_RVD_FlushBuf timeout\n");
1301 return E_RVD_RET_TIMEOUT;
1302 }
1303 }
1304 u32BytePos = HAL_RVD_QMemRead(gu32QmemExchangeInfoAddr + RVD_QMEM_INFO_BYTE_POS);
1305 RVD_MSG_INF("u32BytePos =%ld\n", u32BytePos);
1306 RVD_MSG_INF("<gdbg>hold here!!!\n");
1307 HAL_RVD_ReadSVDProgramCounter();
1308 u16QmemBbuWptr = 0;
1309 MDrv_RVD_SetBBUReadPtr(0);
1310 MDrv_RVD_SetBBUWritePtr(0);
1311 MDrv_RVD_SetIDReadPtr(0);
1312 MDrv_RVD_SetIDWritePtr(0);
1313 #if RVD_ENABLE_TIME_MEASURE
1314 RVD_MSG_DRV( "RVD Time Measure(Init finish):%ld (%s %d)\n", RVD_GetSysTime_ms() - u32RvdInitSysTimeBase , __FUNCTION__, __LINE__ );
1315 #endif
1316 return E_RVD_RET_SUCCESS;
1317 }
1318
1319 //-----------------------------------------------------------------------------
1320 /// @brief \b Function \b Name: MDrv_RVD_GetESReadPtr()
1321 /// @brief \b Function \b Description: Get BBU Read Adderess
1322 /// @return - The BBU Read address
1323 //-----------------------------------------------------------------------------
MDrv_RVD_GetESReadPtr(void)1324 MS_U32 MDrv_RVD_GetESReadPtr(void)
1325 {
1326 return HAL_RVD_GetESBufferRptr();
1327 }
1328
1329 //-----------------------------------------------------------------------------
1330 /// @brief \b Function \b Name: MDrv_RVD_ReadSVDProgramCounter()
1331 /// @brief \b Function \b Description: Read Program coUnter
1332 /// @return - Program counter
1333 //-----------------------------------------------------------------------------
MDrv_RVD_ReadSVDProgramCounter(void)1334 MS_U32 MDrv_RVD_ReadSVDProgramCounter(void)
1335 {
1336 return HAL_RVD_ReadSVDProgramCounter();
1337 }
1338
1339 //-----------------------------------------------------------------------------
1340 /// @brief \b Function \b Name: MDrv_RVD_GetESWritePtr()
1341 /// @brief \b Function \b Description: Get Elementary Stream buffer write point
1342 /// @return - ES buffer write point offset from bitstream buffer base
1343 //-----------------------------------------------------------------------------
MDrv_RVD_GetESWritePtr(void)1344 MS_U32 MDrv_RVD_GetESWritePtr(void)
1345 {
1346 MS_U32 u32Wptr = 0;
1347 MS_U32 u32Offset =0;
1348 MS_U32 u32Length =0;
1349
1350 //u32Wptr = MDrv_RVD_GetBBUWritePtr();
1351 u32Wptr = (MS_U32)u16QmemBbuWptr;
1352 if (u32Wptr)
1353 u32Wptr = u32Wptr - 1;
1354 else
1355 u32Wptr = RVD_BBU_DEPTH - 1;
1356
1357 u32Wptr = gu32QmemBbuAddr + (u32Wptr << 3);
1358 u32Offset = HAL_RVD_MemRead(u32Wptr) & (~BROKEN_BY_US);
1359 u32Length = HAL_RVD_MemRead(u32Wptr + 4);
1360 RVD_MSG_INF("ES Write address = %ld\n",(u32Offset+u32Length));
1361 return (u32Offset+u32Length);
1362 }
1363
1364 //-----------------------------------------------------------------------------
1365 /// @brief \b Function \b Name: MDrv_RVD_IsFrameShowed()
1366 /// @brief \b Function \b Description: Is RVD Frame showed after TriggerDisp(TRUE) or first frame showed
1367 /// @return - Is frame showed or not
1368 /// @retval -FALSE(0): New Framed showed
1369 /// @retval -TRUE(1): Not showed
1370 //-----------------------------------------------------------------------------
MDrv_RVD_IsFrameShowed(void)1371 MS_BOOL MDrv_RVD_IsFrameShowed(void)
1372 {
1373 MS_U32 u32DisplayCnt = 0;
1374
1375 u32DisplayCnt = HAL_RVD_QMemRead( gu32QmemExchangeInfoAddr + RVD_QMEM_INFO_DISPLAYCNT);
1376 RVD_MSG_INF("[RVD]Display Count = %ld \n",u32DisplayCnt);
1377 if(u32DisplayCnt)
1378 return TRUE;
1379 else
1380 return FALSE;
1381 }
1382
1383 //-----------------------------------------------------------------------------
1384 /// @brief \b Function \b Name: MDrv_RVD_CheckDispInfoRdy()
1385 /// @brief \b Function \b Description: check display info ready and correct or not
1386 /// @return -The result of command check display infor ready or not
1387 //-----------------------------------------------------------------------------
MDrv_RVD_CheckDispInfoRdy(void)1388 MS_BOOL MDrv_RVD_CheckDispInfoRdy(void)
1389 {
1390 if (HAL_RVD_QMemRead(gu32QmemExchangeInfoAddr + RVD_QMEM_INFO_DECODECNT))
1391 {
1392 return TRUE;
1393 }
1394 else
1395 {
1396 return FALSE;
1397 }
1398 }
1399
1400 //-----------------------------------------------------------------------------
1401 /// @brief \b Function \b Name: MDrv_RVD_CheckDispInfoRdy()
1402 /// @brief \b Function \b Description: check display info ready and correct or not
1403 /// @return -The result of command check display infor ready or not
1404 //-----------------------------------------------------------------------------
MDrv_RVD_DispSetupDone(void)1405 MS_BOOL MDrv_RVD_DispSetupDone(void)
1406 {
1407 if (HAL_RVD_QMemRead(gu32QmemExchangeInfoAddr + RVD_QMEM_INFO_DECODECNT))
1408 return TRUE;
1409 else
1410 return FALSE;
1411 }
1412
1413 //-----------------------------------------------------------------------------
1414 /// @brief \b Function \b Name: MDrv_RVD_CheckCaps()
1415 /// @brief \b Function \b Description: check if HW support this format
1416 /// @return - TRUE/ FALSE
1417 /// @retval -FALSE(0): not supported by HW
1418 /// @retval -TRUE(1): supported by HW
1419 //-----------------------------------------------------------------------------
MDrv_RVD_CheckCaps(void)1420 MS_BOOL MDrv_RVD_CheckCaps(void)
1421 {
1422 return TRUE;
1423 }
1424
1425 //-----------------------------------------------------------------------------
1426 /// @brief \b Function \b Name: MDrv_RVD_IsTSPlaying()
1427 /// @brief \b Function \b Description: Is Playing
1428 /// @return - TRUE/ FALSE
1429 /// @retval -FALSE(0): Stop
1430 /// @retval -TRUE(1): Playing
1431 //-----------------------------------------------------------------------------
MDrv_RVD_IsTSPlaying(void)1432 MS_BOOL MDrv_RVD_IsTSPlaying(void)
1433 {
1434 return TRUE;
1435 }
1436
1437 //-----------------------------------------------------------------------------
1438 /// @brief \b Function \b Name: MDrv_RVD_ChkCmdRdy()
1439 /// @brief \b Function \b Description: Is pre Command had be process by F/W
1440 /// @return - Done or Not
1441 /// @retval -E_RVD_RET_FAIL: Not yet
1442 /// @retval -E_RVD_RET_SUCCESS: Could handle new command
1443 //-----------------------------------------------------------------------------
MDrv_RVD_ChkCmdRdy(void)1444 RVD_Result MDrv_RVD_ChkCmdRdy(void)
1445 {
1446 if (HAL_RVD_QMemRead(gu32QmemExchangeInfoAddr + RVD_QMEM_INFO_COMMAND_ID) == E_RVD_CMD_NULL)
1447 return E_RVD_RET_SUCCESS;
1448 else
1449 return E_RVD_RET_FAIL;
1450 }
1451
1452 //-----------------------------------------------------------------------------
1453 /// @brief \b Function \b Name: MDrv_RVD_SetCmd()
1454 /// @brief \b Function \b Description: Set Command and Argument to F/w
1455 /// @param u32Command \b RVD Command ID
1456 /// @param u32Argument \b The RVD Argument
1457 /// @return Status
1458 /// @retval - E_RVD_RET_SUCCESS, Success
1459 /// @retval - E_RVD_RET_FAIL, Failed
1460 //-----------------------------------------------------------------------------
MDrv_RVD_SetCmd(RVD_User_Cmd u32Command,MS_U32 u32Argument)1461 RVD_Result MDrv_RVD_SetCmd(RVD_User_Cmd u32Command, MS_U32 u32Argument)
1462 {
1463 RVD_Result eRet;
1464 MS_U32 u32Timeout = 0;
1465
1466 _DRV_RVD_Entry();
1467
1468 if (MDrv_RVD_ChkCmdRdy()==E_RVD_RET_FAIL)
1469 {
1470 RVD_MSG_INF("<gdbg>Warning: previous command will be overwritten!");
1471 }
1472
1473 HAL_RVD_QMemWrite( gu32QmemExchangeInfoAddr+RVD_QMEM_INFO_ARGUMENT, u32Argument);
1474 HAL_RVD_QMemWrite( gu32QmemExchangeInfoAddr+RVD_QMEM_INFO_COMMAND_ID, u32Command);
1475
1476 u32Timeout = RVD_GetSystemTime() + 33;
1477 while (1)
1478 {
1479 if (MDrv_RVD_ChkCmdRdy())
1480 {
1481 RVD_MSG_INF("Cmd status :<ID> 0x%lx <Arg>0x%lx\n", (MS_U32)u32Command, u32Argument);
1482 eRet = E_RVD_RET_SUCCESS;
1483 break;
1484 }
1485 if (RVD_GetSystemTime() > u32Timeout)
1486 {
1487 RVD_MSG_ERR("<gdbg>Error: MDrv_RVD_SetCmd(0x%lx, 0x%lx) timeout!\n", (MS_U32)u32Command, u32Argument);
1488 eRet = E_RVD_RET_TIMEOUT;
1489 break;
1490 }
1491 }
1492 _DRV_RVD_Return(eRet);
1493 }
1494
1495 //-----------------------------------------------------------------------------
1496 /// @brief \b Function \b Name: MDrv_RVD_SetSpeed()
1497 /// @brief \b Function \b Description: specify the display speed type.
1498 /// @param -u32DispSpeed \b IN : display speed type
1499 /// @return Status
1500 /// @retval - E_RVD_RET_SUCCESS, Success
1501 /// @retval - E_RVD_RET_FAIL, Failed
1502 //-----------------------------------------------------------------------------
MDrv_RVD_SetSpeed(RVD_Disp_Speed u32DispSpeed)1503 RVD_Result MDrv_RVD_SetSpeed(RVD_Disp_Speed u32DispSpeed)
1504 {
1505 return MDrv_RVD_SetCmd(E_RVD_CMD_DISP_SPEED, u32DispSpeed);
1506 }
1507
1508 //-----------------------------------------------------------------------------
1509 /// @brief \b Function \b Name: MDrv_RVD_JumpToPTS()
1510 /// @brief \b Function \b Description: Jump to PTS
1511 /// @param -u32time_ms \b IN : Jump to PTS position
1512 /// @return Status
1513 /// @retval - E_RVD_RET_SUCCESS, Success
1514 /// @retval - E_RVD_RET_FAIL, Failed
1515 //-----------------------------------------------------------------------------
MDrv_RVD_JumpToPTS(MS_U32 u32time_ms)1516 RVD_Result MDrv_RVD_JumpToPTS(MS_U32 u32time_ms)
1517 {
1518 return MDrv_RVD_SetCmd(E_RVD_CMD_JUMP_TO_PTS, u32time_ms);
1519 }
1520
1521 //-----------------------------------------------------------------------------
1522 /// @brief \b Function \b Name: MDrv_RVD_SkipToPTS()
1523 /// @brief \b Function \b Description: Skip to PTS
1524 /// @param -u32time_ms \b IN : Skip to PTS position
1525 /// @return Status
1526 /// @retval - E_RVD_RET_SUCCESS, Success
1527 /// @retval - E_RVD_RET_FAIL, Failed
1528 //-----------------------------------------------------------------------------
MDrv_RVD_SkipToPTS(MS_U32 u32time_ms)1529 RVD_Result MDrv_RVD_SkipToPTS(MS_U32 u32time_ms)
1530 {
1531 return MDrv_RVD_SetCmd(E_RVD_CMD_SKIP_TO_PTS, u32time_ms);
1532 }
1533
1534 //-----------------------------------------------------------------------------
1535 /// @brief \b Function \b Name: MDrv_RVD_SetTrickMode()
1536 /// @brief \b Function \b Description: specify the trick mode
1537 /// @param -u32TrickMode \b IN : trick mode speed type
1538 //-----------------------------------------------------------------------------
MDrv_RVD_SetTrickMode(RVD_TrickMode u32TrickMode)1539 void MDrv_RVD_SetTrickMode(RVD_TrickMode u32TrickMode)
1540 {
1541 HAL_RVD_QMemWrite(gu32QmemExchangeInfoAddr+RVD_QMEM_INFO_TRICK_MODE, u32TrickMode);
1542 }
1543
1544 //-----------------------------------------------------------------------------
1545 /// @brief \b Function \b Name: MDrv_RVD_GetAction()
1546 /// @brief \b Function \b Description: get F/W action status
1547 /// @return - error count
1548 //-----------------------------------------------------------------------------
MDrv_RVD_GetAction(void)1549 static MS_U32 MDrv_RVD_GetAction(void)
1550 {
1551 return HAL_RVD_QMemRead(gu32QmemExchangeInfoAddr + RVD_QMEM_INFO_ACTION);
1552 }
1553
1554 //-----------------------------------------------------------------------------
1555 /// @brief \b Function \b Name: MDrv_RVD_Play()
1556 /// @brief \b Function \b Description: Play RVD
1557 /// @return -The result of command play
1558 //-----------------------------------------------------------------------------
MDrv_RVD_Play(void)1559 RVD_Result MDrv_RVD_Play(void)
1560 {
1561 MDrv_RVD_SetDisplay(E_RVD_DISPLAYMODE_NULL);
1562
1563 if (MDrv_RVD_GetAction()==E_RVD_ACTIONMODE_PLAY)
1564 return E_RVD_RET_SUCCESS;
1565
1566 return MDrv_RVD_SetCmd(E_RVD_CMD_PLAY, NULL);
1567 }
1568
1569 //-----------------------------------------------------------------------------
1570 /// @brief \b Function \b Name: MDrv_RVD_StepDecode()
1571 /// @brief \b Function \b Description: Step decode
1572 /// @return -The result of Step Decode
1573 //-----------------------------------------------------------------------------
MDrv_RVD_StepDecode(void)1574 RVD_Result MDrv_RVD_StepDecode(void)
1575 {
1576 u32StepDecodeCnt = MDrv_RVD_GetDecodeCnt();
1577 return MDrv_RVD_SetCmd(E_RVD_CMD_STEP_DECODE, NULL);
1578 }
1579
1580 //-----------------------------------------------------------------------------
1581 /// @brief \b Function \b Name: MDrv_RVD_Rst()
1582 /// @brief \b Function \b Description: Reset RVD decoder
1583 /// @return -The result of Step Decode
1584 //-----------------------------------------------------------------------------
MDrv_RVD_Rst(void)1585 RVD_Result MDrv_RVD_Rst(void)
1586 {
1587 return MDrv_RVD_Exit();
1588 }
1589
1590 //-----------------------------------------------------------------------------
1591 /// @brief \b Function \b Name: MDrv_RVD_IsStepDecodeDone()
1592 /// @brief \b Function \b Description: IS Step decode done
1593 /// @return -The result of Step Decode
1594 //-----------------------------------------------------------------------------
MDrv_RVD_IsStepDecodeDone(void)1595 MS_BOOL MDrv_RVD_IsStepDecodeDone(void)
1596 {
1597 if (MDrv_RVD_GetDecodeCnt() > u32StepDecodeCnt)
1598 {
1599 u32StepDecodeCnt = 0;
1600 return TRUE;
1601 }
1602 else
1603 {
1604 return FALSE;
1605 }
1606 }
1607
1608 //-----------------------------------------------------------------------------
1609 /// @brief \b Function \b Name: MDrv_RVD_AVSyncOn()
1610 /// @brief \b Function \b Description: Enable or Disbale AVSync mode
1611 /// @param -bEnable \b IN : enable or not
1612 /// @param -u16SyncDelay \b IN : Sync Delay time (unit ms)
1613 /// @param -u16SyncTolerance \b IN : Tolerance(unit ms)
1614 /// @return -The result of AVSync
1615 //-----------------------------------------------------------------------------
MDrv_RVD_AVSyncOn(MS_BOOL bEnable,MS_U16 u16SyncDelay,MS_U16 u16SyncTolerance)1616 RVD_Result MDrv_RVD_AVSyncOn(MS_BOOL bEnable,MS_U16 u16SyncDelay, MS_U16 u16SyncTolerance)
1617 {
1618 RVD_Result eRet;
1619
1620 if (bEnable)
1621 {
1622 MDrv_RVD_SetCmd(E_RVD_CMD_SYNC_TOLERANCE, u16SyncTolerance);
1623 MDrv_RVD_SetCmd(E_RVD_CMD_SYNC_VIDEO_DELAY, u16SyncDelay);
1624 eRet = MDrv_RVD_SetCmd(E_RVD_CMD_SYNC_ACTIVE, 1);
1625 }
1626 else
1627 {
1628 eRet = MDrv_RVD_SetCmd(E_RVD_CMD_SYNC_ACTIVE, 0);
1629 }
1630 return eRet;
1631 }
1632
MDrv_RVD_IsFwStatusOn(RVD_StatusType type)1633 static MS_BOOL MDrv_RVD_IsFwStatusOn(RVD_StatusType type)
1634 {
1635 if (HAL_RVD_QMemRead(gu32QmemExchangeInfoAddr + RVD_QMEM_INFO_STATUS) & type)
1636 return TRUE;
1637 else
1638 return FALSE;
1639 }
1640
1641 //-----------------------------------------------------------------------------
1642 /// @brief \b Function \b Name: MDrv_RVD_IsAVSyncOn()
1643 /// @brief \b Function \b Description: AV Sync mode had enable or not
1644 /// @return -The mode state of AVSync
1645 //-----------------------------------------------------------------------------
MDrv_RVD_IsAVSyncOn(void)1646 MS_BOOL MDrv_RVD_IsAVSyncOn(void)
1647 {
1648 return MDrv_RVD_IsFwStatusOn(E_RVD_STATUSTYPE_AVSYNCON);
1649 }
1650
1651 //-----------------------------------------------------------------------------
1652 /// @brief \b Function \b Name: MDrv_RVD_Pause()
1653 /// @brief \b Function \b Description: Pause RVD
1654 /// @return -The result of command pause
1655 //-----------------------------------------------------------------------------
MDrv_RVD_Pause(void)1656 RVD_Result MDrv_RVD_Pause(void)
1657 {
1658 if (MDrv_RVD_GetAction()==E_RVD_ACTIONMODE_PAUSE)
1659 return E_RVD_RET_SUCCESS;
1660
1661 return MDrv_RVD_SetCmd(E_RVD_CMD_PAUSE, NULL);
1662 }
1663
1664 //-----------------------------------------------------------------------------
1665 /// @brief \b Function \b Name: MDrv_RVD_Exit()
1666 /// @brief \b Function \b Description: Stop RVD and release resource.
1667 /// @return -The result of command stop
1668 //-----------------------------------------------------------------------------
MDrv_RVD_Exit(void)1669 RVD_Result MDrv_RVD_Exit(void)
1670 {
1671 _DRV_RVD_Entry();
1672
1673 if (bRVDIsInit != TRUE)
1674 {
1675 RVD_MSG_ERR("MDrv_RVD_Exit: not-init yet\n");
1676 _DRV_RVD_Return(E_RVD_RET_FAIL);
1677 }
1678
1679 bRVDIsInit = FALSE;
1680
1681 #if RVD_ISR_ENABLE
1682 HAL_RVD_Enable_ISR(FALSE);
1683 OSAL_RVD_ISR_Disable();
1684 if( gRVDISRCtrl.bRegISR )
1685 {
1686 OSAL_RVD_ISR_Detach();
1687 }
1688 #endif
1689 MDrv_RVD_ResetVariable();
1690
1691 MDrv_RVD_SetCmd(E_RVD_CMD_STOP, NULL);
1692 RVD_MSG_INF("[RM] RVD Decoder is Stop, then exit!!\n");
1693 HAL_RVD_DeInit();
1694 RVD_memset( (void*)&DrvRVDInfo , 0 , sizeof(RVD_DrvInfo) );
1695 _DRV_RVD_Return(E_RVD_RET_SUCCESS);
1696 }
1697
1698 //-----------------------------------------------------------------------------
1699 /// @brief \b Function \b Name: MDrv_RVD_Resume()
1700 /// @brief \b Function \b Description: RVD Resume
1701 /// @return -The result of command resume
1702 //-----------------------------------------------------------------------------
MDrv_RVD_Resume(void)1703 RVD_Result MDrv_RVD_Resume(void)
1704 {
1705 return MDrv_RVD_Play();
1706 }
1707
1708 //-----------------------------------------------------------------------------
1709 /// @brief \b Function \b Name: MDrv_RVD_EnableLastFrameShowed()
1710 /// @brief \b Function \b Description: MDrv_RVD_EnableLastFrameShowed
1711 /// @return -The result of command resume
1712 //-----------------------------------------------------------------------------
MDrv_RVD_EnableLastFrameShowed(MS_BOOL bEnabled)1713 RVD_Result MDrv_RVD_EnableLastFrameShowed(MS_BOOL bEnabled)
1714 {
1715 return MDrv_RVD_SetCmd(E_RVD_CMD_ENABLE_LAST_FRAME_SHOW, bEnabled);
1716 }
1717
1718 //-----------------------------------------------------------------------------
1719 /// @brief \b Function \b Name: MDrv_RVD_GetTrickMode()
1720 /// @brief \b Function \b Description: Get current play mode status.
1721 /// @return - mode status
1722 //-----------------------------------------------------------------------------
MDrv_RVD_GetTrickMode(void)1723 MS_U32 MDrv_RVD_GetTrickMode(void)
1724 {
1725 return HAL_RVD_QMemRead(gu32QmemExchangeInfoAddr + RVD_QMEM_INFO_TRICK_MODE);
1726 }
1727
1728 //-----------------------------------------------------------------------------
1729 /// @brief \b Function \b Name: MDrv_RVD_StepPlay()
1730 /// @brief \b Function \b Description: Step display one frame
1731 /// @return - E_RVD_RET_SUCCESS :command ready
1732 //-----------------------------------------------------------------------------
MDrv_RVD_StepPlay(void)1733 RVD_Result MDrv_RVD_StepPlay(void)
1734 {
1735 u32StepPlayCnt = MDrv_RVD_GetFrameCnt();
1736
1737 MDrv_RVD_SetDisplay(E_RVD_DISPLAYMODE_SHOW);
1738
1739 if (MDrv_RVD_GetAction()==E_RVD_ACTIONMODE_PLAY)
1740 return E_RVD_RET_SUCCESS;
1741
1742 return MDrv_RVD_SetCmd(E_RVD_CMD_PLAY, NULL);
1743 }
1744
1745 //-----------------------------------------------------------------------------
1746 /// @brief \b Function \b Name: MDrv_RVD_StepFreezeImg()
1747 /// @brief \b Function \b Description: Step Disp in Freeze mode
1748 /// @param -bEnabled \b IN : enable or not
1749 /// @return -E_RVD_RET_SUCCESS :command ready
1750 //-----------------------------------------------------------------------------
MDrv_RVD_SetFreezeImg(MS_BOOL bEnabled)1751 RVD_Result MDrv_RVD_SetFreezeImg(MS_BOOL bEnabled)
1752 {
1753 return MDrv_RVD_SetCmd(E_RVD_CMD_FREEZE_IMG, bEnabled);
1754 }
1755
1756 //-----------------------------------------------------------------------------
1757 /// @brief \b Function \b Name: MDrv_RVD_SetBlueScreen()
1758 /// @brief \b Function \b Description: Set Blue screen
1759 /// @param -bEnabled \b IN : enable or not
1760 /// @return -E_RVD_RET_SUCCESS :command ready
1761 //-----------------------------------------------------------------------------
MDrv_RVD_SetBlueScreen(MS_BOOL bEnabled)1762 RVD_Result MDrv_RVD_SetBlueScreen(MS_BOOL bEnabled)
1763 {
1764 return MDrv_RVD_SetCmd(E_RVD_CMD_BLUE_SCREEN, bEnabled);
1765 }
1766
1767 //-----------------------------------------------------------------------------
1768 /// @brief \b Function \b Name: MDrv_RVD_IsStepPlayDone()
1769 /// @brief \b Function \b Description: The frame had be showed(Only work after Step Play)
1770 /// @return - TRUE/ FALSE
1771 /// @retval -FALSE(0): Not yet
1772 /// @retval -TRUE(1): Showed
1773 //-----------------------------------------------------------------------------
MDrv_RVD_IsStepPlayDone(void)1774 MS_BOOL MDrv_RVD_IsStepPlayDone(void)
1775 {
1776 if (MDrv_RVD_GetFrameCnt() > u32StepPlayCnt)
1777 return TRUE;
1778 else
1779 return FALSE;
1780 }
1781
1782 //-----------------------------------------------------------------------------
1783 /// @brief \b Function \b Name: MDrv_RVD_IsIdle()
1784 /// @brief \b Function \b Description: check decoder is idle or not
1785 /// @return - TRUE / FALSE
1786 /// @retval -FALSE(0): decoder is not idle
1787 /// @retval -TRUE(1): decoder is idle
1788 //-----------------------------------------------------------------------------
MDrv_RVD_IsIdle(void)1789 MS_BOOL MDrv_RVD_IsIdle(void)
1790 {
1791 if (HAL_RVD_QMemRead(gu32QmemExchangeInfoAddr + RVD_QMEM_INFO_IDLECNT) >= RVD_FW_IDLE_THRESHOLD )
1792 return TRUE;
1793 else
1794 return FALSE;
1795 }
1796
1797 //-----------------------------------------------------------------------------
1798 /// @brief \b Function \b Name: MDrv_RVD_IsDispFinish()
1799 /// @brief \b Function \b Description: Check this file mode display is finish or not.
1800 /// @return - Is finish or not
1801 /// @retval -FALSE(0): Not finish or Not in file mode playback
1802 /// @retval -TRUE(1): Display Finished.
1803 //-----------------------------------------------------------------------------
MDrv_RVD_IsDispFinish(void)1804 MS_BOOL MDrv_RVD_IsDispFinish(void)
1805 {
1806 return MDrv_RVD_IsFwStatusOn(E_RVD_STATUSTYPE_PLAYBACK_FINISH);
1807 }
1808
1809 //-----------------------------------------------------------------------------
1810 /// @brief \b Function \b Name: MDrv_RVD_1stFrameRdy()
1811 /// @brief \b Function \b Description: check if I frame found after Init() or flush().
1812 /// @return - TRUE / FALSE
1813 /// @retval -FALSE(0): I frame is not found.
1814 /// @retval -TRUE(1): I frame has been found.
1815 //-----------------------------------------------------------------------------
MDrv_RVD_Is1stFrameRdy(void)1816 MS_BOOL MDrv_RVD_Is1stFrameRdy(void)
1817 {
1818 return MDrv_RVD_IsFwStatusOn(E_RVD_STATUSTYPE_1ST_FRAMERDY);
1819 }
1820
1821 //-----------------------------------------------------------------------------
1822 /// @brief \b Function \b Name: MDrv_RVD_IsIFrameFound()
1823 /// @brief \b Function \b Description: check if I frame found after Init() or flush().
1824 /// @return - TRUE / FALSE
1825 /// @retval -FALSE(0): I frame is not found.
1826 /// @retval -TRUE(1): I frame has been found.
1827 //-----------------------------------------------------------------------------
MDrv_RVD_IsIFrameFound(void)1828 MS_BOOL MDrv_RVD_IsIFrameFound(void)
1829 {
1830 return MDrv_RVD_IsFwStatusOn(E_RVD_STATUSTYPE_IFRAMEFOUND);
1831 }
1832
1833 //-----------------------------------------------------------------------------
1834 /// @brief \b Function \b Name: MDrv_RVD_GetErrCode()
1835 /// @brief \b Function \b Description: get error code
1836 /// @return - error code number
1837 //-----------------------------------------------------------------------------
MDrv_RVD_GetErrCode(void)1838 MS_U32 MDrv_RVD_GetErrCode(void)
1839 {
1840 MS_U32 errCode;
1841
1842 errCode = HAL_RVD_QMemRead(gu32QmemExchangeInfoAddr + RVD_QMEM_INFO_ERROR_CODE);
1843
1844 if (errCode == E_ERROR_OUT_OF_MEMORY)
1845 return errCode;
1846 else
1847 return E_ERROR_NONE;
1848 }
1849
1850 //-----------------------------------------------------------------------------
1851 /// @brief \b Function \b Name: MDrv_RVD_SetDbgLevel()
1852 /// @brief \b Function \b Description: Set Dbg level
1853 /// @param -u8DbgLevel \b IN : enable level
1854 //-----------------------------------------------------------------------------
MDrv_RVD_SetDbgLevel(MS_U8 u8DbgLevel)1855 void MDrv_RVD_SetDbgLevel(MS_U8 u8DbgLevel)
1856 {
1857 u8RVD_DbgLevel = u8DbgLevel;
1858 }
1859
1860 //-----------------------------------------------------------------------------
1861 /// @brief \b Function \b Name: MDrv_RVD_GetDbgLevel()
1862 /// @brief \b Function \b Description: Get Dbg level
1863 /// @return - u8RVD_DbgLevel
1864 //-----------------------------------------------------------------------------
MDrv_RVD_GetDbgLevel(VOID)1865 MS_U8 MDrv_RVD_GetDbgLevel(VOID)
1866 {
1867 return u8RVD_DbgLevel;
1868 }
1869
1870 //-----------------------------------------------------------------------------
1871 /// @brief \b Function \b Name: MDrv_RVD_IsDbgEnable()
1872 /// @brief \b Function \b Description: Check the Dbg mode enable or not
1873 /// @return - TRUE / FALSE
1874 /// @retval -FALSE(0): Disable
1875 /// @retval -TRUE(1): Enable
1876 //-----------------------------------------------------------------------------
MDrv_RVD_IsDbgEnable(MS_U8 u8DbgLevel)1877 MS_BOOL MDrv_RVD_IsDbgEnable(MS_U8 u8DbgLevel)
1878 {
1879 if (u8RVD_DbgLevel & u8DbgLevel)
1880 return TRUE;
1881 else
1882 return FALSE;
1883 }
1884
1885 //-----------------------------------------------------------------------------
1886 /// @brief \b Function \b Name: MDrv_RVD_GetStatus()
1887 /// @brief \b Function \b Description: Get status of RVD driver
1888 /// @param -pstatus \b OUT : driver status
1889 //-----------------------------------------------------------------------------
MDrv_RVD_GetStatus(RVD_DrvStatus * pstatus)1890 MS_BOOL MDrv_RVD_GetStatus(RVD_DrvStatus *pstatus)
1891 {
1892 pstatus->bInit = u32RVDCtrlMode & RVD_CTRL_INIT_FINISHED;
1893 pstatus->bBusy = u32RVDCtrlMode & RVD_CTRL_PROCESSING;
1894 return TRUE;
1895 }
1896
1897 //-----------------------------------------------------------------------------
1898 /// @brief \b Function \b Name: MDrv_RVD_GetDispInfo()
1899 /// @brief \b Function \b Description: Set Par and Crop Info to AP
1900 /// @param -pinfo \b IN : Display Infomation
1901 /// @return - E_RVD_RET_SUCCESS / E_RVD_RET_FAIL
1902 /// @retval -E_RVD_RET_FAIL(0): FAIL
1903 /// @retval -E_RVD_RET_SUCCESS(1): SUCCESS
1904 //-----------------------------------------------------------------------------
MDrv_RVD_GetDispInfo(RVD_FrameInfo * pinfo)1905 RVD_Result MDrv_RVD_GetDispInfo(RVD_FrameInfo *pinfo)
1906 {
1907 #define PAR_FACTOR 20
1908 #define SAR_FACTOR 1000
1909
1910 if (HAL_RVD_QMemRead(gu32QmemExchangeInfoAddr + RVD_QMEM_INFO_DECODECNT))
1911 {
1912 MS_U16 u16PicWidth = 0, u16PicHeight = 0;
1913 MS_U16 u16Frame0Width = 0, u16Frame0Height = 0;
1914
1915 MDrv_RVD_GetPictureSize(&u16PicWidth ,&u16PicHeight);
1916 MDrv_RVD_GetFrameSize(&u16Frame0Width ,&u16Frame0Height);
1917 RVD_MSG_INF("Picture Width = %d Height =%d\n",u16PicWidth,u16PicHeight);
1918 RVD_MSG_INF("Frame Width = %d Height =%d\n",u16Frame0Width,u16Frame0Height);
1919
1920 // reset picture size as frame size
1921 MDrv_RVD_SetPictureSize(u16Frame0Width ,u16Frame0Height);
1922
1923 pinfo->u16FrameRate = 60000;
1924 pinfo->u16HorSize = u16Frame0Width; //u16PicWidth;
1925 pinfo->u16VerSize = u16Frame0Height; //u16PicHeight;
1926 pinfo->u8par_width = u16PicWidth * PAR_FACTOR / u16Frame0Width;
1927 pinfo->u8par_height = u16PicHeight* PAR_FACTOR / u16Frame0Height;
1928 pinfo->u16Sar_width = u16PicWidth * SAR_FACTOR / u16Frame0Width;
1929 pinfo->u16Sar_height = u16PicHeight* SAR_FACTOR / u16Frame0Height;
1930 pinfo->u32AspectWidth = (MS_U32) u16PicWidth;
1931 pinfo->u32AspectHeight = (MS_U32) u16PicHeight;
1932 pinfo->u16CropBottom = 0;
1933 pinfo->u16CropTop = 0;
1934 pinfo->u16CropLeft = 0;
1935 pinfo->bEnableMIUSel = gRVDInfo.bRVD_FWinMIU1;//(eRvdDynCfgByChip ==128)?TRUE:FALSE;
1936 pinfo->u32DynScalingAddr = gRVDInfo.u32FW_PhyAddr | HAL_RVD_QMemRead(gu32QmemExchangeInfoAddr + RVD_QMEM_INFO_DS_ADDR);
1937 pinfo->u8DynScalingDepth = (MS_U8)HAL_RVD_QMemRead(gu32QmemExchangeInfoAddr + RVD_QMEM_INFO_DS_DEPTH);
1938 RVD_MSG_INF("DynScalingAddr = 0x%lx DynScalingDepth =%x\n",pinfo->u32DynScalingAddr,pinfo->u8DynScalingDepth);
1939 if (pinfo->u16HorSize & 0x07)
1940 {
1941 pinfo->u16CropRight = 8 - (pinfo->u16HorSize & 0x0007);
1942 pinfo->u16HorSize = ((pinfo->u16HorSize >> 3) + 1) << 3;
1943 }
1944 else
1945 {
1946 pinfo->u16CropRight = 0;
1947 }
1948 return E_RVD_RET_SUCCESS;
1949 }
1950 else
1951 {
1952 RVD_MSG_ERR("GetDispInfo fail!!!\n");
1953 return E_RVD_RET_FAIL;
1954 }
1955 }
1956
1957 // Fixme
MDrv_RVD_DbgSetCmd(RVD_User_Cmd u32Command,MS_U32 u32Argument)1958 RVD_Result MDrv_RVD_DbgSetCmd(RVD_User_Cmd u32Command, MS_U32 u32Argument)
1959 {
1960 return MDrv_RVD_SetCmd(u32Command, u32Argument);
1961 }
1962
MDrv_RVD_DbgSetData(MS_U32 u32Addr,MS_U32 data)1963 void MDrv_RVD_DbgSetData(MS_U32 u32Addr, MS_U32 data)
1964 {
1965 HAL_RVD_QMemWrite(gu32QmemExchangeInfoAddr + u32Addr, data);
1966 }
1967
1968 //------------------------------------------------------------------------------
1969 /// @brief \b Function \b Name: MDrv_RVD_DbgGetData()
1970 /// @brief \b Function \b Description: Get DBG Data from Qmem
1971 /// @param -u32Addr \b IN : address of debug data
1972 /// @param -u32Data \b IN : pointer to the debug data
1973 /// @return -return RVD_Result success/fail to get debug data
1974 //------------------------------------------------------------------------------
MDrv_RVD_DbgGetData(MS_U32 u32Addr,MS_U32 * u32Data)1975 RVD_Result MDrv_RVD_DbgGetData(MS_U32 u32Addr, MS_U32 *u32Data)
1976 {
1977 switch (u32Addr)
1978 {
1979 case RVD_QMEM_INFO_OFFSET_PIC_WIDTH :
1980 case RVD_QMEM_INFO_OFFSET_PIC_HEIGHT :
1981 case RVD_QMEM_INFO_OFFSET_BBU_WPTR :
1982 case RVD_QMEM_INFO_OFFSET_BBU_RPTR :
1983 case RVD_QMEM_INFO_OFFSET_BBU_ADDR :
1984 case RVD_QMEM_INFO_OFFSET_BBU_DEPTH :
1985 case RVD_QMEM_INFO_PLAY_MODE :
1986 case RVD_QMEM_INFO_TRICK_MODE:
1987 case RVD_QMEM_INFO_DISP_FRAME_INFO_ADDR :
1988 case RVD_QMEM_INFO_IDLECNT :
1989 case RVD_QMEM_INFO_DISPLAYCNT :
1990 case RVD_QMEM_INFO_DECODECNT :
1991 case RVD_QMEM_INFO_MAX_BBU_DEPTH :
1992 case RVD_QMEM_INFO_DEC_FRAME_INFO_ADDR :
1993 case RVD_QMEM_INFO_FRAME0_WIDTH :
1994 case RVD_QMEM_INFO_FRAME0_HEIGHT :
1995 case RVD_QMEM_INFO_FRAME_RATE :
1996 case RVD_QMEM_INFO_ERROR_CODE :
1997 case RVD_QMEM_INFO_COMMAND_ID :
1998 case RVD_QMEM_INFO_ARGUMENT :
1999 case RVD_QMEM_INFO_ACTION :
2000 case RVD_QMEM_INFO_STATUS :
2001 *u32Data = HAL_RVD_QMemRead(gu32QmemExchangeInfoAddr+u32Addr);
2002 return E_RVD_RET_SUCCESS;
2003 default:
2004 return E_RVD_RET_FAIL;
2005 }
2006 }
2007
2008 #if defined(REDLION_LINUX_KERNEL_ENVI)
_DRV_RVD_ISRHandler(void)2009 MS_S32 _DRV_RVD_ISRHandler(void)
2010 #else
2011 void _DRV_RVD_ISRHandler(void)
2012 #endif
2013 {
2014 if (gRVDISRCtrl.pfnISRCallBack != NULL )
2015 {
2016 //FIXME LATE
2017 //gRVDISRCtrl.u32ISRInfo = HAL_HVD_GetData( E_HVD_GDATA_HVD_ISR_STATUS );
2018 HAL_RVD_Enable_ISR(FALSE);
2019 gRVDISRCtrl.pfnISRCallBack();
2020 HAL_RVD_Enable_ISR(TRUE);
2021 }
2022 else
2023 {
2024 RVD_MSG_ERR("DRV HRVD Err: ISR callback is NULL.\n");
2025 }
2026 HAL_RVD_SetClearISR();
2027 OSAL_RVD_ISR_Enable();
2028 #if defined(REDLION_LINUX_KERNEL_ENVI)
2029 return 1;
2030 #endif
2031 }
2032
2033 //-----------------------------------------------------------------------------
2034 /// @brief \b Function \b Name: MDrv_RVD_SetISREvent()
2035 /// @brief \b Function \b Description: Set the ISR event type sended by RVD fw.
2036 /// @param -eEvent \b IN : event types
2037 /// @param -fnISRHandler \b IN : function pointer to a interrupt handler.
2038 /// @return -The result of command set ISR event.
2039 //-----------------------------------------------------------------------------
MDrv_RVD_SetISREvent(RVD_ISR_Event eEvent,RVD_InterruptCb fnISRHandler)2040 RVD_Result MDrv_RVD_SetISREvent(RVD_ISR_Event eEvent, RVD_InterruptCb fnISRHandler)
2041 {
2042 RVD_Result eRet = E_RVD_RET_ILLEGAL_ACCESS;
2043
2044 //_DRV_HVD_Inited(eRet);
2045 _DRV_RVD_Entry();
2046 if ( eEvent == E_RVD_ISR_NONE )
2047 {
2048 HAL_RVD_Enable_ISR(FALSE);
2049 OSAL_RVD_ISR_Disable();
2050 OSAL_RVD_ISR_Detach();
2051 gRVDISRCtrl.bRegISR=FALSE;
2052 gRVDISRCtrl.pfnISRCallBack=NULL;
2053 eRet = E_RVD_RET_SUCCESS;
2054 }
2055 else
2056 {
2057 if (fnISRHandler != NULL)
2058 {
2059 HAL_RVD_Enable_ISR(FALSE);
2060 if ( gRVDISRCtrl.bRegISR )
2061 {
2062 OSAL_RVD_ISR_Detach();
2063 gRVDISRCtrl.bRegISR=FALSE;
2064 }
2065 gRVDISRCtrl.pfnISRCallBack = (RVD_ISRCallBack)fnISRHandler;
2066 OSAL_RVD_ISR_Attach( (void*)_DRV_RVD_ISRHandler );
2067 OSAL_RVD_ISR_Enable();
2068 /*
2069 {
2070 MS_U32 i=0;
2071 for (i=0; i<68; i++)
2072 {
2073 MsOS_AttachInterrupt(i, (void*)_DRV_HVD_ISRHandler);//(InterruptCb)fnISRHandler);
2074 MsOS_EnableInterrupt(i);
2075 }
2076 }
2077 */
2078 //FIXME LATE
2079 //RVD_MSG_INF("attach ISR number:%d\n", RVD_ISR_VECTOR);
2080
2081 // TODO: set ISR event and wait ACK
2082 //HAL_RVD_Enable_ISR(TRUE);
2083 gRVDISRCtrl.bRegISR = TRUE;
2084 eRet = E_RVD_RET_SUCCESS;
2085 }
2086 else
2087 {
2088 RVD_MSG_ERR("HVD DrvErr: SetISREvent with NULL pointer. ISR type:%lu\n", (MS_U32)eEvent);
2089 eRet = E_RVD_RET_INVALID_PARAM;
2090 }
2091 }
2092 _DRV_RVD_Return(eRet);
2093 }
2094
2095 //-----------------------------------------------------------------------------
2096 /// @brief \b Function \b Name: MDrv_RVD_SetEnableISR()
2097 /// @brief \b Function \b Description: Enable/Disable RVD interrupt.
2098 /// @param -bEnable \b IN : Enable/Disable
2099 /// -FALSE(0): Disable interrupt.
2100 /// -TRUE(1): Enable interrupt.
2101 /// @return -The result of command set enable ISR.
2102 //-----------------------------------------------------------------------------
MDrv_RVD_SetEnableISR(MS_BOOL bEnable)2103 MS_BOOL MDrv_RVD_SetEnableISR(MS_BOOL bEnable)
2104 {
2105 HAL_RVD_Enable_ISR(bEnable);
2106 return TRUE;
2107 }
2108
2109 //-----------------------------------------------------------------------------
2110 /// @brief \b Function \b Name: MDrv_RVD_SetForceISR()
2111 /// @brief \b Function \b Description: test the HVD interrupt function. Force FW send one interrupt.
2112 /// @param -bEnable \b IN : Enable/Disable
2113 /// -FALSE(0): Clear force interrupt status from HK.
2114 /// -TRUE(1): force one interrupt from HK.
2115 /// @return -The result of command set force ISR.
2116 //-----------------------------------------------------------------------------
MDrv_RVD_SetForceISR(MS_BOOL bEnable)2117 MS_BOOL MDrv_RVD_SetForceISR(MS_BOOL bEnable)
2118 {
2119 HAL_RVD_SetForceISR(bEnable);
2120 return TRUE;
2121 }
2122
2123 //-----------------------------------------------------------------------------
2124 /// @brief \b Function \b Name: MDrv_RVD_GetISRInfo()
2125 /// @brief \b Function \b Description: Get information of HVD driver interrupt
2126 /// @param -eType \b OUT : ISR information
2127 /// @return -the result of get ISR information
2128 //-----------------------------------------------------------------------------
MDrv_RVD_GetISRInfo(RVD_ISR_Event * eType)2129 MS_BOOL MDrv_RVD_GetISRInfo(RVD_ISR_Event* eType)
2130 {
2131 //_DRV_HVD_Inited(FALSE);
2132 *eType = (RVD_ISR_Event)gRVDISRCtrl.u32ISRInfo;
2133 return TRUE;
2134 }
2135
MDrv_RVD_Dump_Status(void)2136 void MDrv_RVD_Dump_Status(void)
2137 {
2138 RVD_MSG_DRV("Queue: DispQueNum:%ld Dec:%ld Disp:%ld ESR:%ld ESW:%ld\n" ,
2139 MDrv_RVD_GetDispQueNum(), MDrv_RVD_GetDecodeCnt(), MDrv_RVD_GetFrameCnt(),
2140 MDrv_RVD_GetESReadPtr(), MDrv_RVD_GetESWritePtr() );
2141
2142 RVD_MSG_DRV("Counter: Dec:%ld Disp:%ld Err_Data:%ld Err_Dec:%ld Skip:%ld Drop:%ld Idle:%ld\n" ,
2143 MDrv_RVD_GetDecodeCnt(), MDrv_RVD_GetFrameCnt(), MDrv_RVD_GetDataErrCnt(),
2144 MDrv_RVD_GetDecErrCnt(), MDrv_RVD_GetSkipCnt(),MDrv_RVD_GetDropCnt(),
2145 HAL_RVD_QMemRead(gu32QmemExchangeInfoAddr + RVD_QMEM_INFO_IDLECNT) );
2146
2147 RVD_MSG_DRV("====================================\n");
2148 }
2149
2150 #if 0
2151 void MDrv_RVD_Dbg_TimeMode(MS_U32 u32Type, MS_U32 u32TimeCnt)
2152 {
2153 if ((MsOS_GetSystemTime() - u32RvdInitSysTimeBase) >= u32TimeCnt)
2154 {
2155 u32RvdInitSysTimeBase = MsOS_GetSystemTime();
2156 MDrv_RVD_Dump_FW_Status();
2157 }
2158 }
2159 #endif
2160
MDrv_RVD_LinkWeakSymbolPatch(void)2161 MS_BOOL MDrv_RVD_LinkWeakSymbolPatch(void)
2162 {
2163 return TRUE;
2164 }
2165
MDrv_RVD_EnableTurboFWMode(MS_BOOL bEnable)2166 void MDrv_RVD_EnableTurboFWMode(MS_BOOL bEnable)
2167 {
2168 gbEnableRVTurboFWMode = bEnable;
2169 }
2170
2171 //-----------------------------------------------------------------------------
2172 /// @brief \b Function \b Name: MDrv_RVD_SetAVSyncFreerunThreshold()
2173 /// @brief \b Function \b Description: Set AV sync free run threshold.
2174 /// @param -u32Th \b IN : The value of threshold.
2175 /// @return -E_RVD_RET_SUCCESS :command ready
2176 //-----------------------------------------------------------------------------
MDrv_RVD_SetAVSyncFreerunThreshold(MS_U32 u32Th)2177 RVD_Result MDrv_RVD_SetAVSyncFreerunThreshold(MS_U32 u32Th)
2178 {
2179 return MDrv_RVD_SetCmd(E_RVD_CMD_FREERUN_THRESHOLD, u32Th);
2180 }
2181
2182
2183