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

📄 utl.c

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

// ADDto39 begin
// for auto pause re-entry
    __btPause=FALSE;
// ADDto39 end
    // f/w 0.46
    if (dwTime)
        EX1=bEX1;

    }   // NO-CDDA
    else        //play CD-DA
    {   // it's CD-DA
        // wyc1.24, move code from the place after UTL_TransferCommandID to before it because of MPEG will decode the buffer remain data
        // then seek servo and read data. So when servo pick up is far away from current pause position, then we will hear the audio in buffer
        // remain data then pause a while then hear the data from servo. So re-arrange the place to make data ready then issue play command.
        // CD-ROM jump new time
        SERVO_ReadSectors ( __dwTimeNow, __dwTimeEnd );

        HAL_ControlCDIF(HAL_CDIF_OPEN);
        // Micky1.00, must issue DSP play command after DSP pause
        if (__btPause)
            UTL_TransferCommandID(__bModeCmd);
//MICKY041 begin
        // must set status here
        // for play motion auto pause re-entry problem
        __btPlaying=TRUE;
        __btPause=FALSE;
//MICKY041 end

    }
// DVD_103Micky, fix VCD play->pre-stop->play->stop->won't enter pre-stop?
// as resume will complete through several keys conversion.
// Micky2.79, tune the usage of __bCountStop, don't reference DOUBLE_STOP
// set as playing first, as it was meant to be playing after UTL_PlayItem.
//#ifdef  DOUBLE_STOP
//    if (__bCountStop)
    __bCountStop=0;
//#endif
    return TRUE;
}

//  *********************************************************************
//  Function    :   UTL_PlayFromTime    // ** TCH0.27;
//  Description :   CD-ROM goto specified time and open CD-IF for data input.
//  Arguments   :   dwTime      : the specified time to start input
//  Return      :   TRUE is Successful
//  Side Effect :   CD-IF still close if finding MSF is failed
//  *********************************************************************
BIT  UTL_PlayFromTime ( DWORD dwTime )
{
//DVD_046-1DVDIF
#ifdef  SUPPORT_CDIF
if (__bCurrentIF == BITSTREAM_CDIF)
{
//jyliu.scan, fix SCB/SCF time incorrect issue
#ifdef SUPPORT_ANTISHOCK
{
extern BYTE __bScanTime;
	if(((__bModeCmd == KEY_SCB) || (__bModeCmd == KEY_SCF))&&!(__wDiscType&BOOK_CDDA))
	{
		if(__bScanTime)
		{
			__bScanTime = FALSE;
		}
	}
}
#endif
    // TCC278, add protect for the range
    if (dwTime > __dwTimeEnd)
        //return FALSE ;
        return TRUE ;   // TCC278-2, if return FALSE, f/w will open CDIF and let data come-in and makes blocks.
    HAL_ControlCDIF(HAL_CDIF_CLOSE);

    HAL_WriteCDHeader(dwTime);
    // the CD-ROM jump time will be earlier than the specified time by SERVO_LEADING sectors
    // TCC278-3, move to below or finding header sometimes fail if W99132_IR is not defined. 
    //SERVO_ReadSectors ( dwTime- __dwTimeTorelence, __dwTimeEnd );
    // ** TCH0.25; end...

    // find header, open all
    // Chuan 277-3 2002/09/19: When PBC ON, we will send the sectors exactly. Therefore, it just need check
    // __dwTimeNow == __dwTimeEnd at _VCD20_Check_PlayEnd().
    // Fix mustek test report(9109004): Title: MINI DVD
    // Chuan 278 2002/10/22: Let all case do the same control.
    __dwTemp = __dwTimeEnd - dwTime + 1; // The remainder sectors 
    if (__dwTemp<250L)
        HAL_CDIFCountSectors ( 1, (BYTE)__dwTemp );
    else
        HAL_CDIFCountSectors ( 1, 250 );
    // TCC278-3, move to here or finding header sometimes fail if W99132_IR is not defined. In fact, it's right 
    // that let data came in after necessary registers are set. So that it won't be effected by Interrupt.
    SERVO_ReadSectors ( dwTime- __dwTimeTorelence, __dwTimeEnd );
    /// DVD_172Micky, use _dwTimeStart. as __dwTemp can't be cross function.
    _dwTimeStart= UTL_GetSysTimer();
    __btTemp= FALSE;

    // time out for finding MSF
    while ( (UTL_GetSysTimer()- _dwTimeStart ) < COUNT_HALF_SEC )
    {
        if (HAL_CheckCDIF(HAL_CDIF_HEADER_START, NULL))
        {
            __btTemp= TRUE;
//            HAL_ControlCDIF(HAL_CDIF_OPEN);
//LJY1.23, LJY1.11b-2, keep target value for error recovery.
#ifdef SUPPORT_ANTISHOCK
            {
                extern DWORD __dwPrevTime;
                __dwPrevTime = dwTime;
            }
#endif
            break;
        }

        SERVO_Monitor ();
    }   // while (.)

#ifdef _DEBUG_INFO
    if (__btTemp==FALSE)
        OSD_Output (MSG_VERSION, 5500, 3) ;
//      OSD_Output (MSG_VERSION, (WORD) dwTime, 1) ;
#endif
    // Chuan 277-3 2002/09/19: When PBC ON and __dwTimeEnd > dwTime +250, issue "STOP Sector'
    // Chuan 278 2002/10/22: __dwTimeEnd > dwTime + 250, count down 251 sectors.
    /*
    if (__btPBC&&__bSec)
    {
        HAL_WriteCDHeader(__dwTimeEnd);
        W99AV_WriteRegW(DVDCTLR, 0x4);
    }
    */
    return __btTemp;
}
#endif
//#ifndef  INPUT_PATH_CDIF
//if (__bCurrentIF != BITSTREAM_CDIF)
{
    // ** TCH0.25; begin...
    HAL_ControlCDIF(HAL_CDIF_CLOSE);
    HAL_WriteCDHeader(dwTime);

    {
// TCC278, let DVD call SERVO directly.
#if 1 //#ifdef    SIMP_DVD
       // the CD-ROM jump time will be earlier than the specified time by SERVO_LEADING sectors
        SERVO_ReadSectors ( dwTime- __dwTimeTorelence, __dwTimeEnd );
        HAL_ControlCDIF(HAL_CDIF_OPEN);
#else
        // Do nothing as CELL Module will do it
        if ( ! ( __wDiscType & BOOK_DVD ) )     // ** TCH0.27; If NV+CELL, Don't enable Servo
        {
            // ** TCH0.47; Need use SetSectors only. Problem when Pause-> Play in VCD title.
            // Video is 4xxxx, Audio is 8xxxx (Almost full). SERVO_ReadSectors() will cause the NO_DMA DONE (65000).
///            SERVO_ReadSectors ( dwTime- __dwTimeTorelence, __dwTimeEnd );
            SERVO_SetSectors ( dwTime- __dwTimeTorelence, __dwTimeEnd );       // ** TCH0.48P;
            HAL_ControlCDIF(HAL_CDIF_OPEN);
        }
        else
        {
///            SERVO_SetSectors ( dwTime- __dwTimeTorelence, __dwTimeEnd );
///            HAL_ControlCDIF(HAL_CDIF_OPEN);
            // ** TCH0.27; begin...
            HAL_ControlCDIF(HAL_CDIF_OPEN);
        }
#endif    // SIMP_DVD
    }
    // ** TCH0.25; end...

    return TRUE;
}
}


// LLY.274p, re-modify the procedure base on new spec.
// [1] Must give desired new playing mode attribute into __bAttrPlayNew, first
// [2] Then, call UTL_SetPlayMode() and new playing mode as it's parameter
//  *********************************************************************
//  Function    :   UTL_SetPlayMode
//  Description :   Set relative register for MPEG chip for desired playing mode
//                  the desired playing mode will keep in __bModePlay
//                  the desired playing mode attribute in __bAttrPlay
//  Arguments   :   bType, the desired playing mode -- MODE_PLAYXXXX
//  Return      :   TRUE
//  Side Effect :   it'll reset MPEG chip
//                  when switch CDDA and MPEG, __wVolAudio will be changed
//
//  *********************************************************************
BYTE UTL_SetPlayMode ( BYTE bType )
{
    // Micky2.34, remove unused variables
    //WORD        wTemp, wTemp1;
    BIT         btPseudoReset= FALSE;

// f/w 0.45
// Micky1.20, 4M flash
#ifndef NO_DIGEST
    extern BIT  __btDigestSetMode;
#endif

    // LLY.274p, only MODE_PLAYAUDIO & MODE_PLAYVIDEO has attribute
    // Others, assign the attribute to NONE
    //if( (bType&MODE_PLAYAUDIO) || (bType&MODE_PLAYVIDEO) )
        //LJY1.26, MODE_PLAYMOTION for CDROM has attribute
    // wyc2.31, use reserve statement to replace this one to reduce code size. 
    // wyc2.34, add __wDiscType & CDROM_M1 to avoid CDROM disc error.
    if (((bType & MODE_PLAYMOTION) || (bType & MODE_STILL)) && !(__wDiscType & CDROM_M1))
        __bAttrPlayNew=ATTR_NONE;
    /*if( (bType&MODE_PLAYAUDIO) || (bType&MODE_PLAYVIDEO) || (__wDiscType & CDROM_M1))
    {
    }
    else
    {
        __bAttrPlayNew=ATTR_NONE;
    }*/

// f/w 0.33
    if ( !(bType & MODE_STILL) )
        __btCheckVideoType=FALSE;
    if (__btCheckVideoType)
    {
        MONITOR_VideoStream();
    }

    // LLY.274p-3, Must check playing mode and attribute together
    //if ( bType == __bModePlay )         // same play-mode
    if( (bType==__bModePlay) && (__bAttrPlayNew==__bAttrPlay) )
    {
        // Micky1.21, CodeReview --- remove
        // wyc1.21, remove this switch case.
        /*
        // The thing that always need be done while same play
        switch(bType)
        {
        default:
            break;
        }
        */
        return FALSE;
    }

    // wyc2.32, the priority of __bNextHWReset is higher than btPseudoReset. So move this code
    // before __bNextHWReset control
    // Don't do reset and initialize if the previous playing mode before CDROM
    // decoding is same as the desired playing mode after CDROM decoding
    if( (bType==__bModePlayPreCDROM) && (__bModePlay&MODE_PLAYCDROM) )
        btPseudoReset= TRUE;

    // wyc1.11, when play from LOGO or still picture, then do H/W reset to avoid video mosaic problem.
    if ( HAL_QueryStream (HAL_QUERY_STILL) )
        __bNextHWReset = TRUE;
    // wyc1.25-2, VCD add checking code to avoid video black when acrossing tracks.
    if (__wDiscType & BOOK_VCD)
    {
        __bNextHWReset = TRUE;
//        if ((__bLastModePlay == MODE_PLAYMOTION) && (bType == MODE_PLAYMOTION))
        if ((__bLastModePlay == MODE_PLAYMOTION) && (bType == MODE_PLAYMOTION) 
//LJY1.26, Don't perform soft reset for digest.
#ifndef NO_DIGEST
        && (!__btDIGEST)
#endif        
        )
            __bNextHWReset = FALSE;
    }
    // wyc2.32, make __bNextHWReset priority higher than btPseudoReset, so when __bNextHWReset == TRUE need to set btPseudoReset tp FALSE to
    // aviod __bNextHWReset not executed.
    if (__bNextHWReset)
        btPseudoReset = FALSE;

    // ** TCH0.25; begin...
    {   // reset the range and suppose DRAM Don't content any CDROM data...
        __dwSectorCDROMBegin= NULL;
        __dwSectorCDROMEnd= NULL;
    }
    // ** TCH0.25; end...

    // LLY.274p, re-modify the checking procedure
    if( (bType&MODE_PLAYAUDIO) && (__bAttrPlayNew==ATTR_CDDA) ) // playing CDDA
    {
        // flag indicate do not do MPEG reset
        btPseudoReset= TRUE;
    }
    else
    {
// Micky1.20, 4M flash
#ifndef NO_DIGEST
        if (__btDigestSetMode)
        {
            __btDigestSetMode=FALSE;
            btPseudoReset=TRUE;
        }
#endif

// LLY.051 open this option that MP3 playing w/ LOGO
// no reset for MP3 play
#ifndef NO_MP3
#ifdef  SUPPORT_MP3_WITH_LOGO   // LLY.099
        if (__wDiscType & CDROM_M1)
        {
            // wyc1.10, when play these files that need to do RISC H/W reset to avoid bitstream not continuous and video block problem..
            //__bTemp = FM_GetFileType(__wPlayItem);
            // wyc1.24, use bType to replace reading DRAM for not read DRAM too many times, also H/W reset RISC when play from VOB/DAT/MPG -> other mode
            // to avoid motion still play background
            if (bType == MODE_PLAYMOTION)
            //if (( __bTemp== EXTNAME_DAT) || (__bTemp == EXTNAME_VOB) || (__bTemp == EXTNAME_MPG))
            {
                btPseudoReset=FALSE;
                __bNextHWReset = TRUE;
            }
            
            else
               btPseudoReset=TRUE;
        }
#endif  // #ifdef SUPPORT_MP3_WITH_LOGO
#endif  // #ifndef NO_MP3
    }

    // wyc1.21, move out from switch case because all case will do it.
    EA= 0;
    if (bType != MODE_PLAYUNKNOW)
    {
        HAL_ControlCDIF(HAL_CDIF_CLOSE);
        W99AV_Reset(W99AV_RESET_CDIF);
    }
    if (bType == MODE_PLAYCDROM)
    {
        HAL_SetSectorFormat(HAL_SECTOR_FORMAT_CDXAM2F1|HAL_WITH_SYNC);
        HAL_SetPlayMode(HAL_PLAYMODE_CDROM);
    }
    EA= 1;

    // wyc1.21, because the switch strcuture all do close CDIF and reser CDIF, so we can move it out. About the set sector format and set play mode 
    // can move to out by if (bType == MODE_PLAYCDROM) just adding it above part.
#if 0    
    // program register according to play mode
    switch( bType )
    {
        case    MODE_PLAYCDROM: // for CD-ROM decoding
            {
            EA= 0;
            HAL_ControlCDIF(HAL_CDIF_CLOSE);
            W99AV_Reset(W99AV_RESET_CDIF);
            HAL_SetSectorFormat(HAL_SECTOR_FORMAT_CDXAM2F1|HAL_WITH_SYNC);
            HAL_SetPlayMode(HAL_PLAYMODE_CDROM);
            EA= 1;
            }

            SERVO_SetDSPMode ( SERVO_MODE_CDROM );       // ** SVCD-TCH;
            break;

 

⌨️ 快捷键说明

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