⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 digest.c

📁 车载电子影音系统dvd播放系统原程序代码
💻 C
📖 第 1 页 / 共 5 页
字号:
        HAL_DigestPosition(__iXDigest, __iYDigest);

        // the entry point is a CD-DA track
        // need do the following action to open VBI
#ifndef NO_CDDADIGEST
        if (__btCDDADigest)
        {
            HAL_DigestEnableVBI(); // the API is only for CDDA digest SWOSD display
            __btCDDADigest=FALSE;
            // must set mode for CD-DA track play
            __bModePlay=MODE_PLAYUNKNOW;
        }
#endif //#ifndef NO_CDDADIGEST
        // wyc.051 for avoid the hang of No DMA Done
        HAL_Reset(HAL_RESET_PARSER); //the critical code for hang ver65000
        HAL_ControlParser(HAL_PARSER_VIDEO_ID, 0);//the critical code for hang ver65000
        HAL_ControlParser(HAL_PARSER_AUDIO_ID, __bASTID );//the critical code for hang ver65000
        HAL_ControlParser(HAL_PARSER_ENABLE, NULL );//the critical code for hang ver65000

        // indicate not to perform the reset action in Digest mode
        // since the DIGEST setting are already done
        __btDigestSetMode=TRUE;
                   
        UTL_SetPlayMode ( __bDigestModePlay );

        // must clear here!!! UTL_SetPlayMode might return when same type
        __btDigestSetMode=FALSE;

        // get play range
        // wyc.100
        if (!__bDVDDigest)
            UTL_GetPlayRange ( bTrackNO );

        // ckear screen here if press KEY_PREV or KEY_NEXT, reason is because 
        // only place here can clear the previous page frame image
        // wyc.172r, reduce SRAM
#ifndef NO_DVDDIGEST
        if (__bCmdKeyPress)
        {
            W99AV_ReadInfo(W99AV_INFO_DIGEST_HSIZE, &_dwTemp);
            W99AV_ReadInfo(W99AV_INFO_DIGEST_VSIZE, &__dwTemp);
//LJY0.86, for new HAL_ClearScreen()
            HAL_ClearScreen(HAL_COLOR_DIGEST);
            __bCmdKeyPress = FALSE;
        }
#endif // NO_DVDDIGEST
        // LLY.045-1, porting for new define depending on 22QF055.DOC
        // following action is same between emulator and system
        //MICKY, 05.18.99
        // in Emulator RANDOM mode, found the Reset A/V buffer action will cause
        // input FIFO always keep at > 32
        // after testing, found it must wait audio empty then can reset A/V buffer
        // As WCH said, it's possible has problem that to reset buffer while DBI still action

        //wyc.051
        //__dwCheckTime=__dwCountSystem;
        __dwCheckTime=UTL_GetSysTimer();
        // it's about 1.3 seconds that the audio buffer will be empty(Keep at 24)
        while ((UTL_GetSysTimer() - __dwCheckTime) < (COUNT_1_SEC + COUNT_500_MSEC))
        {
            W99AV_ReadInfo(W99AV_INFO_AUDIO_REMAIN, &__dwTemp);
#ifndef NO_DVDDIGEST
            //wyc.100
            if (__bDVDDigest)
            {
                if (__dwTemp < 300)
                    break;
            }
            else
#endif // NO_DVDDIGEST
            {
                if (__dwTemp < 32)
                    break;
            }
        }
        // LLY.045-1 end ...
        ///////////////////////////////////////////////////////////////
        ////// Added by LLY on 1999.02.04 for "previous data showing
        ////// on next position" problem
        ////// Set video A/V buffer size  when change track
        // DVD022, because set A/V buffer size command has been modified
/*
        __dwW99AVCmdArg[0]=3;  // the number of ARG0~ARG15
        __dwW99AVCmdArg[1]=0xFFFF; // command_arg don't care
        __dwW99AVCmdArg[2]=W99AV_ADDR_VBUFF;  // video:end>>8, start>>8
        __dwW99AVCmdArg[3]=W99AV_ADDR_ABUFF;  // audio
        W99AV_CommandN(COMMAND_SAVBS);
*/
/////////////////////////////////////
        ///// Following actions is added to solve the problem :
        ///// CDDA -> MPEG will hang while in digest mode
        // wyc.155, remove this code becuase has added HAL_Reset at below
        //W99AV_Reset(W99AV_RESET_AUDIO);
        // DVD.039, must do audio command play after resetting DSP
        // it can fix "Wait no DMA_Done" bug while enter digest mode
        //W99AV_WriteRegDW (ADCMR, 0x1, 0x0000) ; //LJY.280p, marked.
        ///////////////////////////////////////////////////////////////

        // using absolute time
        //LJY2.81, for DVCD discview in dtop mode
        if (((__bStyle & 0x0F)==DIGEST_STYLE_DISCVIEW) || (__bStyle & DIGEST_DVCD_DISCVIEW))
            __dwTimeBegin=NULL;
        // __dwTimeBegin is to record track start point

        //  WYC.050a , for digest audio noise error, we reset the audio buffer
        //  before enter playing the next track
        HAL_Reset(HAL_RESET_AUDIO);
//        W99AV_WriteRegDW (ADCMR, 0x1, 0x0000) ; //LJY.280p, marked.
        // !!! Let data in first, then send SCAN command ???
        // send scan command, then open data

        // __btTrackPoint is TRUE means this is the initial DisplayFrame
        // this special routine is to send the track data from the beginning
        // do not update the frame to the DIGEST grid
        // later after the IFSC is detected,
        // then will actually go to the entry point for playing
        // wyc.100 for adding read DVD bitstream

#ifndef NO_DVDDIGEST
        //__bNoDoDigest = FALSE;
        if (__bDVDDigest)
        {
            if ((__bStyle & 0x0F) == DIGEST_STYLE_TITLE)
            {
                __btDigestSetMode = TRUE;
                NV_TitlePlay(__bTitle,__wChapter);
                NV_Trigger();
                __btDigestSetMode = FALSE;
                SERVO_EnableRunning(TRUE);
                //gbServoRunning = TRUE;
                __btPlaying= TRUE;
            }
            else if ((__bStyle & 0x0F) == DIGEST_STYLE_CHAP)
            {
                __btDigestSetMode = TRUE;
                NV_TitlePlay(__bTitle,__wChapter);
                NV_Trigger();
                __btDigestSetMode = FALSE;
                SERVO_EnableRunning(TRUE);
                //gbServoRunning = TRUE;
                __btPlaying= TRUE;

            }
            else if ((__bStyle & 0x0F) == DIGEST_STYLE_CHAPXX)
            {
                if (__bCHAPXXFromCurr)
                {
                    __btDigestSetMode = TRUE;
                    __bCHAPXXFromCurr = FALSE;
                    __wTotChapTime = __wTimeChapterBegin;
                    __wTemp = __wTimeCellBegin + (WORD)CELL_QueryTime();
                    __bTemp = (BYTE)(__wTemp / 3600);
                    __bMin = (BYTE)((__wTemp % 3600) / 60);
                    __bSec = (BYTE)((__wTemp % 3600) % 60);
                    if ((__bTemp == 0) && (__bMin == 0) && (__bSec < 2)) __bSec = 2;
                    __dwGoToTime=MAKE_TMSF(__bTemp,__bMin,__bSec, 0x0);
                    NV_TimePlay(__bTitle,__dwGoToTime);
                    __btPlaying= TRUE;                    
                }
                else
                {
                    if (__bRepeat != REPEAT_CHAPTER)
                        __wTotChapTime  = __wTotChapTime + __wTimeChapter + 1;
                    if (__bRepeat == REPEAT_CHAPTER)
                        __wTotChapTime ++;

                    __dwGoToTime=MAKE_TMSF(__wTotChapTime/(WORD)3600,(__wTotChapTime%(WORD)3600)/60,(__wTotChapTime%(WORD)3600)%60, 0x0);
                    NV_TimePlay(__bTitle,__dwGoToTime);
                    if (__bRepeat == REPEAT_CHAPTER)
                        __wTotChapTime --;
                    __btPlaying= TRUE;                    
                }
            }
            if (((__bStyle & 0x0F) == DIGEST_STYLE_TITLE) || ((__bStyle & 0x0F) == DIGEST_STYLE_CHAP))
            {
                __bFrames = 9;
                __wTemp = MASK_SOURCE_RESOLUTION(__wV_ATR);
                if ((__wTemp == 2) || (__wTemp == 3))
                {
                    W99AV_WriteDRAMData (W99AV_DRAM_DIG_HVSTART,MAKELONG(0,0));
                    // set DIGESET_HVSIZE
                    // logic horizontal and vertical size for chip
                    W99AV_WriteDRAMData (W99AV_DRAM_DIG_HVSIZE, MAKELONG(0x00EF,0x0160));
                    __bFrames = 4;
                }
                else
                {
                    W99AV_WriteDRAMData (W99AV_DRAM_DIG_HVSTART,MAKELONG(0x0,0x2));
                    W99AV_WriteDRAMData (W99AV_DRAM_DIG_HVSIZE, MAKELONG(0x1DF,0xB0));
                }
            }
            //__wW99AVNVSUBIDRLow = 0xff; // JYLiu 2002/4/12
            //W99AV_WriteRegDW(NVSUBIDR, __wW99AVNVSUBIDRLow, __wW99AVNVSUBIDRHigh);  // JYLiu 2002/4/12
        }
        //
        else //(__bDVDDigest)
#endif // NO_DVDDIGEST
        {
            if (((__bStyle & 0x0F)== DIGEST_STYLE_TRACK) && __btTrackPoint)
            {
                if (__bDigestModePlay & MODE_PLAYMOTION)
                {
                    // not move the decoded picture to digest frame position
                    HAL_DigestEnableFrame(FALSE);
                    // go to track begin for one sequence header
                    SERVO_ReadSectors ( __dwTimeBegin - __dwTimeTorelence, __dwTimeEnd);
                }
                else //(__bDigestModePlay
                {
                    // CD-DA, directly go to the entry point
                    // wyc.172r, reduce SRAM
                    SERVO_ReadSectors ( /*__dwDigestKeep*/__dwTimeDigestBegin - __dwTimeTorelence, __dwTimeEnd);
                    __btTrackPoint=FALSE;
                } //(__bDigestModePlay
            }
            else //((__bStyle== DIGEST_STYLE_TRACK)
            {
                // wyc.173-1, keep this code for fixing some VCD titles digest frame error.
                SERVO_ReadSectors ( __dwTimeBegin+ __dwTimeShow - __dwTimeTorelence, __dwTimeEnd );
            } //((__bStyle == DIGEST_STYLE_TRACK)
        //LJY276, added
            HAL_ControlCDIF(HAL_CDIF_OPEN);           
        }// if (__bDVDDigest)

        // wyc.173-1, keep this code for fixing some VCD titles digest frame error.
        if(!(__bStyle & DIGEST_DVCD_DISCVIEW)) //LJY2.81, for DVCD discview in stop mdoe
        if (( (__bStyle & 0x0F) != DIGEST_STYLE_DISCVIEW ) && (!__bDVDDigest))
            __dwTimeShow= VIEWTIME;             // 3 seconds

        // shoud wait the CD loader to be stable then open CD-IF???
        // Open the CD-IF
//LJY276, marked
//       HAL_ControlCDIF(HAL_CDIF_OPEN);

        if ( __bDigestModePlay & MODE_PLAYMOTION )
        {
//            HAL_DigestCommand(); //jyliu.lumin, it can be removed
            // ISR bit set 1 ==> clear the corresponding bit in PSR
            // Let chip know host already get the status, prevent from
            // receiving previous status forever
            // IER set 1 ==> ask for chip status
            // IER, NULL ==> IRQ is asserted if both IER and PSR is set
            // ISR,IER==> write only
            // PSR ==> read only
            W99AV_ClearInterrupt(INT_IFSC);
            // For accelerating the SCAN first frame
            // second SCAN command before IFSC will have no effect
            // except that let first scan command faster
            HAL_DigestCommand(); //jyliu.digest, why need to set twice???
        }
       
        i=FALSE; 
        // check the IFSC interrupt
        if ( __bDigestModePlay & MODE_PLAYMOTION )
        {
            if (!__bDVDDigest) // for VCD digest
            {
                EX1 = 0;
                __dwCheckTime= UTL_GetSysTimer();
                while ( (UTL_GetSysTimer()- __dwCheckTime ) < COUNT_4_SEC )
                {
                //LJY276
#ifdef SUPPORT_CDIF
                if(__bServoAutoCtrl)
                    SERVO_Monitor();  
                else
                                        MONITOR_CheckBuffer();//LJY277.3rd
#else
                                        SERVO_Monitor();
#endif //#ifdef SUPPORT_CDIF
                    if (HAL_CheckInterrupt(INT_IFSC))
                    {
                        __dwIFrames++;
                        i=TRUE;
//LJY276, marked
/*                        if (__btTrackPoint)
                        {
                            // must close the data input
                            HAL_ControlCDIF(HAL_CDIF_CLOSE);
                        }
*/                        
//                       if ( __btDigestEnableAudio )  //LJY1.24-3, no need.
//                            CHIPS_OpenAudio( TRUE ); //LJY1.24-3, no need.
                        // this scan will clear video buffer
                        HAL_DigestCommand(); // cannot be removed, 2002/12/6

                        // ignore too black frame at the beginning of the track
                        // Check the Luminace
                        // If read fail, give up
                        // If Luminance is larger than 200(experience), Accept
                        //      NOT, look for next I-Frame
                        // DIGEST_Y is the luminance address
                        if ( ! W99AV_ReadInfo ( W99AV_INFO_DIGEST_LUMINACE, & __dwTemp) )
                            __dwTemp=0x200;
                        else __dwTemp >>= 16; //LJY2.28b-2, luminace was stored at HIWORD
                        if (__dwTemp > 0x200)
                            break;
                    } //if (HAL_CheckInterrupt(INT_IFSC))
                } //while ( (UTL_GetSysTimer()
                EX1 = 1;                
            } //if (__bDVDDigest)
            //LJY276, added for stop mode noise            
            if(!__bServoAutoCtrl)
            //LJY278, remove HAL_CDIF_FREEZE_TIME                
                HAL_CheckCDIF ( HAL_CDIF_FREEZE_TIME, (BYTE)NULL );//for stop mode noise
            //    HAL_ControlCDIF(HAL_CDIF_CLOSE);
            // wyc.099
            if ((__bStyle & 0x0F) == DIGEST_STYLE_TRACK)
                if (__btTrackPoint)
                {
                    //LJY277a, clear decoded frame to fix first frame error(show the picture of track begin)
                    W99AV_ReadInfo(W99AV_INFO_DIGEST_HSIZE, &_dwTemp);
                    W99AV_ReadInfo(W99AV_INFO_DIGEST_VSIZE, &__dwTemp);
                    //LJY0.86, for new HAL_ClearScreen()
                    HAL_ClearScreen(HAL_COLOR_DIGEST);
                
                    // set 1 will move the decoded picture to digest frame position
//                    HAL_DigestEnableFrame(TRUE);
                    __btTrackPoint=FALSE;                    
                    // entry point for this track
                    // wyc.172r, reduce SRAM
//LJY277.3rd, marked                    
//                  SERVO_ReadSectors ( /*__dwDigestKeep*/__dwTimeDigestBegin, __dwTimeEnd);
                    // must wait the CD loader to be stable
                    // then open CD-IF                  
//                    HAL_ControlCDIF(HAL_CDIF_OPEN);                             
//LJY277.3rd, added for noise problem of first time entered
                    HAL_Reset(HAL_RESET_AUDIO);                    
                    UTL_PlayFromTime (__dwTimeDigestBegin);
                }
            // Enable Interrupt
            // to let IFSC processed by interrupt
            W99AV_EnableInterrupt(__dwIER);
            // add(should if I-frame not detected in 2 sec.
            // open audio again
            if ( __btDigestEnableAudio )
                CHIPS_OpenAudio( TRUE );
            // Open VBI now        
            HAL_Display(HAL_DISPLAY_VIDEO, TRUE);
        }
#ifndef NO_CDDADIGEST
        else        // No-MPEG mode
        {
            W99AV_EnableInterrupt(__dwIER);

            if ( __btDigestEnableAudio )
                CHIPS_OpenAudio( TRUE );
        }
#endif // NO_CDDADIGEST
    }
    else  // repeat!=0
    {
//LJY277a, issue digest command here to fix the problem of SWOSD shown prior to picture.
         HAL_DigestPosition(__iXDigest, __iYDigest);
//LJY277a.4th
//jyliu.lumin.test         HAL_DigestCommand();  
         W99AV_ClearInterrupt(INT_IFSC);
         HAL_DigestCommand(); //jyliu.digest, why need to set twice???

        // avoid for playing cross the track
        // for short track
        // wyc.100
        if (!__bDVDDigest)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -