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

📄 isr.c

📁 车载电子影音系统dvd播放系统原程序代码
💻 C
📖 第 1 页 / 共 3 页
字号:
                    {
                        __bAudioOverflow = TRUE;
                        __dwIER &= ~(INT_AO); 
                        W99AV_EnableInterrupt(__dwIER);                        
                        if( !( W99AV_ReadRegW(DVDCTLR) & 0x000D ) ) // not in stop mode
                        {
                            W99AV_WriteRegW(DVDCTLR, 0x108);
                        }                                        
                    }
                }                
            }
	}
#endif

#ifndef NO_DIGEST //LJY1.20, support 4M flash, remove digest
    // current in DIGEST mode
    if ( __btDIGEST )
    {
        // ** TCH0.16; bINTEvent=INT_IFSC;
        // In DIGEST mode, F/W need to write SCAN command for Audio continuity

        // ** TCH0.16; Move this to HAL_DigestCommand ();
        // W99AV_ClearInterrupt ( INT_IFSC );
        // W99AV_EnableInterrupt ( __dwIER );

        // 4 frames/9 frames
        HAL_DigestCommand();
        __dwIFrames++;
    }
    else 
#endif        
    {
        // PBC had extra action that need to be checked
        // VCD 2.0 Auto-Pause
        if ( __btPBC )
        {
            // Check PSR_ETE for EOF/TRIGGER/EOR interrupt
            if ( __wTempPSR & INT_ETE )
            {
                // ** TCH0.16;  bINTEvent=INT_ETE;

                // Check error in Timer and record __dwTimeError
                // when the error is near the PSR_ETE, then the auto-pause is ignored
// ** TCH0.50;                 if ( ((__dwCountSystem-__dwTimeError) < __dwTimeThreshold ) )
                if ( ((__dwCountSystem-__dwTimeError) < TIMETHRESHOLD_TRIGGER ) )
                {
                    _bErrorSet=TRUE;
                }
                else
                // when the error is far from the PSR_ETE
                // take the auto pause is valid
                {
                    _bErrorSet=FALSE;
                }

                if ( ! _bErrorSet )
                {
                // means that has Auto-Pause function
                if ( __wAutoPauseTime )
                {
                    // Auto-Puase is valid only when F/W is in Normal Play
                    if ( __bModeCmd == KEY_PLAY )
                    {
                        if ( HAL_CheckEvent ( HAL_EVENT_TRIGGER ) )
                        {
                            // TCC040, re-use this function to disable servo in ATAPIIF
                            _ISR_CountOneSector();
                            // CountCDIF, one sector about 13.333 msec

                            // Count Video Buffer
// ** TCH0.50;                             dwTemp= COUNT_200_MSEC* 2000;
                            _dwDRAMValue= COUNT_200_MSEC* 2000;
                            //[W9926QF], must control the buffer data
// Micky1.20, 4M flash, reduce common bank lib.
// use while (variabels++/--) will invoke C51 lib (?C?LLDIXDATA), 44 bytes
// ** TCH0.50;                             while ( dwTemp -- )
#ifdef  NO_DIRECT_OPERATION
                            while ( _dwDRAMValue )
                            {
                                _dwDRAMValue --;
#else
                            while ( _dwDRAMValue -- )
                            {
#endif
                                W99AV_ReadInfo(W99AV_INFO_VIDEO_REMAIN, &dwVRemainder);
                                // For test auto pause position
                                // JVC Testing title
// TCC029, test this value is close with jvc test title
#ifdef INPUT_PATH_ATAPIIF
                                if ( dwVRemainder < 0x2000 )
#else
                                if ( dwVRemainder < 1200 )
#endif
                                {
                                    break;
                                }
                            }

                            // [W9926QF] Modify
                            //W99AV_Command1(COMMAND_STEP, 0);
                            // TCC040, should use pause since only pause will issue dsp pause command
                            W99AV_Command1(COMMAND_PAUSE, 0);
                            CHIPS_OpenAudio( FALSE );
                            // TCC040, Must disable servo running or it'll wait no dma done.
                            //SERVO_EnableRunning (FALSE) ;
                            // the starting pause time
                            __dwTimeVCD20= __dwCountSystem;
                            __bVCD20Status = VCD20_AUTOPAUSE;

                            // Enter PAUSE mode
                            __btPlaying= FALSE;
                            __btPause= TRUE;
                        }   // Trigger bit; HAL_CheckEvent ( HAL_EVENT_TRIGEGR )
                    }   // if ( _bModeCmd == KEY_PLAY )
                }   // if ( __wAutoPauseTime )

                }       // if ( _bErrorSet= FALSE )
                // ** TCH0.16; _bErrorSet= FALSE;

                HAL_ClearEvent (HAL_EVENT_ALL);
            }   // ETE
        }   // __btPBC

        if ( __bFirstPlay )
        {
            // wyc1.24, motion and still mode both need to IFD checking, so remove the MODE_PLAYMOTION protection.
            if ( __wTempPSR & INT_IFD )
            {
                /*// ** TCH0.16;
                // it will set 3 when F/W auto recover the hang
                if ( __bFirstPlay == 3 )    // It recover from F/W hang
                {   // error -concealment
                    //SKIP_SEQ, set to zero before NPF command
                    W99AV_WriteDRAMData (W99AV_DRAM_SKIP_SEQ, 0 );
                }
                else
                {
                    // It's normal case when play from a new bitstream
                    // STOP->SCF case
                    if (__bModeCmd==KEY_SCF)
                    {
                        // send Scan command
                        // this will shorten the time to see first picture
                        W99AV_Command1(COMMAND_SCAN, 0);
                    }
                }
                */  // ** TCH0.16;

                // check bitstream size, and do resize if necessary
                if ( HAL_GetStreamInfo () )
                {
                    // wyc1.10, RISC will reset vertical to 0 after H/W or Soft video reset and update when detect picture size. So we can read it to check 
                    // if RISC had detected picture size and decide if can do adjust TV mode now.
                    if ( W99AV_ReadDRAMData (W99AV_DRAM_VHSIZE, &_dwDRAMValue) )
                    {
                        if (HIWORD(_dwDRAMValue) != 0)
                        {
                            HAL_AdjustTVMode();

#ifdef  SUPPORT_UPDATE_SEQ
                            //DVD_043-1SEQUENCE
                            // must wait at lease 1 sequence header is decoded
                            // DVD_155Micky, directly call W99AV_ReadDRAMData.(already protected)
                            W99AV_ReadDRAMData(W99AV_DRAM_UPDATE_SEQ, &_dwDRAMValue);
                            // if the remain buffer for last track contain 3 sequence header,
                            // it will be possible the sequence size is not updated
                            if ((_dwDRAMValue & 0xFFFF0000) <= W99AV_UPDATE_SEQUENCE_LIMIT )
#endif
                            {
                            __bFirstPlay= NULL;           // cancel the check
                            // clear the PSR_IFD interrupt
                            __dwIER&=~INT_IFD;
                            // no interrupt need to be enabled
                            if  ( ! __dwIER )
                                EX1=0;  // disable EX 1 interrupt(From uP)
                            }
                        }
                    }
                }   // if ( HAL_GetStreamInfo () )
            }   // PSR_IFD
        }   // if ( __bFirstPlay )
    }       // non-digest mode
    // wyc1.25, DSP will report AINT when DSP code detected it is abnormal, so need to record it and force to reset it in Monitor.
    // wyc2.31, remove this code because no use it.
    /*if(W99AV_GetPSRDW() & INT_AINT)
    {
        __bNeedResetAudio = TRUE;
        W99AV_WriteRegDW(ISR, LOWORD(INT_AINT), HIWORD(INT_AINT));
    }*/

    W99AV_ClearInterrupt (__dwIER );
    W99AV_EnableInterrupt (__dwIER );

    // ** TCH0.16; remove it as this is Twice DigestCommand? Need to confirm more
    /*
    if ( __btDIGEST )
    {
        // 4 frames/9 frames
        HAL_DigestCommand();
    }
    */
    // wyc2.80, add fish's updated code.
    // LLY2.80, swap the argument buffer of W99AV_CommandN() to normal API usage
    // To avoid content be destroyed while ISR will call any W99AV_CommandN()
    // Notice: Must put this in last statement within this API
    __dwW99AVCmdArg = __dwW99AVCmdBuffer;

    return;
}

//  *********************************************************************
//  Function    :   ISR_INT0; EX0(SFR, bit 0 of IE)
//              :   External H/W interrupt INT 0(through P3.2)
//  Description :   1. It's used for IR interrupt.
//              :   2. call IR Scan
//  Arguments   :
//  Return      :   __bISRKey is the scanned key value
//  Side Effect :
//  *********************************************************************
//DVD_037RECOVER
// Chuan0.83a, 908 SW IR use INT5 (Temporal Solution)
#ifdef  SYSTEM_8051
#if !defined(W99132_IR)
void        ISR_INT0 (void) interrupt 11 using 1
#else
void        ISR_INT0 (void) interrupt 0 using 1
#endif
{
//    BYTE        _bKeyGet; // ** TCH0.50; move to global
    // scan the key pressed
    _bKeyGet = INPUT_RemoteScan();
	if(__bTftLowBatt)
		{
                    _bKeyGet = KEY_NO_KEY;
		}
    if (_bKeyGet != KEY_NO_KEY)
    {
       // key is detected
       if ( _bKeyGet == __bISRKeyPrev )
       {
            // re-push same key within 250 msec
            if ( (__dwCountSystem - __dwTimeISRKeyPrev) < COUNT_250_MSEC )
            {
                // only these keys have continue capability
                if ( (_bKeyGet!=KEY_VOL_UP) &&
                   (_bKeyGet!=KEY_VOL_DOWN) &&
                   (_bKeyGet!=KEY_KEYUP) &&
                   (_bKeyGet!=KEY_KEYDOWN) )
                {
                    _bKeyGet = KEY_NO_KEY;
                }
                else
                {
                    // some key processing longer such as PROGRAM
                    // will cause continue key effect too.
                }
            }
        }
        // reset time
        // to disable the key continue capability
        __dwTimeISRKeyPrev = __dwCountSystem;
        if ( _bKeyGet != KEY_NO_KEY )
        {
            // LLY2.37p, remove __bISRKeyRead, because we will split IR and F/W key to __bISRKey and __bFWKey
            // So, it's un-necessary to reference it to decide input key source                 
            //__bISRKeyRead=TRUE;

            __bISRKeyPrev= _bKeyGet;
       // #ifdef KEY_NEXT_PREV_AS_KEY_UPDOWN_IN_SETUPMODE
        #ifdef KEY_NEXT_PREV_SCB_SCF_AS_KEY_DOWN_UP_LEFT_RIGHT
        {
        	extern BYTE __bSetupMode;
		if(__bSetupMode)
		{
			if(_bKeyGet==KEY_NEXT)
				_bKeyGet=KEY_DOWN;
			else if(_bKeyGet==KEY_PREV)
				_bKeyGet=KEY_UP;
			else if(_bKeyGet==KEY_SCB)
				_bKeyGet=KEY_LEFT;
			else if(_bKeyGet==KEY_SCF)
				_bKeyGet=KEY_RIGHT;
		}
        }
	#endif
            __bISRKey= _bKeyGet;

            // DVD_101Micky, don't need extra double stop action sice provide __bKeySource
        }
    }

    // to clear the interrupt in queue
    IE0 = 0;
    return;
}
#endif

#ifdef SUPPORT_PORTABLE_PROJECT
// Modified for portable, begin, KCHong, 20031117
#ifdef  SYSTEM_8051
BYTE bTimer1Count;

void ISR_INT4 (void) interrupt 10 using 1
{
    bTimer1Count=0;
    TH1=0;
    TL1=0;
    ET1=1;
    TR1=1;
}
#endif

#ifdef  SYSTEM_8051
void ISR_Timer1 (void) interrupt 3 using 1
{
    extern BYTE _bOpen;
    extern BYTE __bSetupMode;

    bTimer1Count++;
    if(bTimer1Count>20)
    {
        ET1=0;
        TR1=0;
        TF1=0;
        if(!SERVO_CheckTrayClosed())
        {
            if(__bSetupMode && _bOpen==TOP_OPENED)
                return;

            __bISRKey=KEY_OPEN_CLOSE;
            __bKeyInputEnable=FALSE;    // Added for portable, KCHong, 20031118
            _bOpen=TOP_UNSTABLE;
        }
    }
}
#endif
// Modified for portable, end, KCHong, 20031117
#endif

⌨️ 快捷键说明

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