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

📄 int.c

📁 realtek LCD monitor, TV开发源代码
💻 C
📖 第 1 页 / 共 2 页
字号:
//**********************************************************************************************************
//  The  Software  is  proprietary,  confidential,  and  valuable to Realtek Semiconductor
//  Corporation  ("Realtek").  All  rights, including but not limited  to  copyrights,
//  patents,  trademarks, trade secrets, mask work rights, and other similar rights and interests,
//  are reserved to Realtek. Without  prior  written  consent  from  Realtek,  copying, reproduction,
//  modification,  distribution,  or  otherwise  is strictly prohibited. The Software  shall  be
//  kept  strictly  in  confidence,  and  shall  not be  disclosed to or otherwise accessed by
//  any third party. @ <2003> - <2008>   The Software is provided "AS IS" without any warranty of any kind,
//  express, implied, statutory or otherwise.
//**********************************************************************************************************
//----------------------------------------------------------------------------------------------------
// ID Code      : Int.c No.0000
// Update Note  :
//----------------------------------------------------------------------------------------------------

#include "Common\Header\Include.h"

//--------------------------------------------------
// INT0 Interrupt, DP use
//--------------------------------------------------
#if(_DP_SUPPORT == _ON)
void EXINT0(void) interrupt 0
{
//    BYTE xdata qData[4];
    BYTE xdata qData[8];
    BYTE xdata TEST_CRC_Times;

    EA=0;

// Backup Status Start
    qData[2] = MCU_SCA_INF_CTRL_FFF3;
    qData[3] = MCU_SCA_INF_ADDR_FFF4;
    CScalerReadByteInt(_PAGE_SELECT_9F , &qData[1]);

    CScalerSetByteInt(_PAGE_SELECT_9F,_PAGEC);
    CScalerSetByteInt(0xD0, 0xF1);

    CScalerReadByteInt(0xc1 , &qData[4]);
    CScalerReadByteInt(0xc2 , &qData[5]);
    CScalerReadByteInt(0xc3 , &qData[6]);

    CScalerReadByteInt(0xb3 , &qData[7]);
// Backup Status End

    MCU_SCA_INF_CTRL_FFF3 &= 0xDF;

// clear IRQ Flag
    MCU_IRQ_STATUS_FF00 = 0x00;
    CScalerSetByteInt(_PAGE_SELECT_9F,_PAGEC);
    CScalerSetByteInt(0xB3, 0xCC);
    CScalerSetByteInt(0xB4, 0x80);
    CScalerSetByteInt(0xDC, 0xFF);

    CScalerSetByteInt(0xc1,0x00);
    CScalerSetByteInt(0xc2,0x01);
    CScalerSetByteInt(0xc3,0x02);

    CScalerReadByteInt(_PC_DPCD_DATA_PORT_L_C4, &qData[0]);

    switch(qData[0]&0x03)
    {
        case _TRAINING_PATTERN1:

#if (_DP_LT_Proc == _AMD_CARD)
            if( ucDisplayPortLtPreStatus != _TRAINING_PATTERN1_PASS )     // for AMD Card DOS Mode bug
            {
#endif  //  End of #if (_DP_SOURCE == AMD_CARD)


//            #if ((_PCB_TYPE == _RTD2472D_QA_PCB) || (_SCALER_TYPE == _RTD247xRD))
//                bLED3=~bLED3;
//            #endif

                CScalerSetByteInt(0xc1,0x00);
                CScalerSetByteInt(0xc2,0x02);
                CScalerSetByteInt(0xc3,0x02);
                CScalerSetByteInt(0xc4,0x00);
                CScalerSetByteInt(0xc3,0x03);
                CScalerSetByteInt(0xc4,0x00);
                CScalerSetByteInt(0xc3,0x04);
                CScalerSetByteInt(0xc4,0x80);

                Lane01_Status = 0;
                Lane23_Status = 0;

                TP1_times ++;
                TP2_times = 0;

            CScalerSetByteInt(_PAGE_SELECT_9F,_PAGEB);
            CScalerSetByteInt(_PB_DP_PWR_CTL_B4  ,0x00);
                //eagleeyes-20080124
            CScalerSetByteInt(0xB8,0x63); //phy_AUX_SWING
            CScalerSetByteInt(0xB9,0x05); //0xA5, //debug-eagle-20080117
            CScalerSetByteInt(0xe2,0x00);
            CScalerSetByteInt(0xB3,0x80);  // whhsiao + VERB
            CScalerSetByteInt(0xE3,0x01);  //27 Mhz
                //end of eagleeyes-20080124
                //eagleeyes-20080428-for-HDMItoDP-BugFixed
                CScalerSetByteInt(0xA9,0x3B);
                CScalerSetByteInt(0xAA,0x76);
                CScalerSetByteInt(0xAB,0xED);
                CScalerSetByteInt(0xBA,0x80);
                //end of eagleeyes-20080428-HDMItoDP-BugFixed

            CDpTrainPattern1();

                //eagleeyes-20080310-Debug-Message
                CScalerSetByteInt(_PAGE_SELECT_9F,_PAGEC);
                ucDisplayPortStatus &= 0xf8;
                ucDisplayPortStatus |= 0x01;
                CScalerSetByteInt (0xC9, ucDisplayPortStatus);
                //end of eagleeyes-20080310-Debug-Message

                #if ((_PCB_TYPE == _RTD2472D_QA_PCB) || (_PCB_TYPE == _RTD2472RD_QA_PCB))
                      if (ucDisplayPortLtPreStatus == _TRAINING_PATTERN1_PASS)
                      {
                            bLED3=0;
                            bLED4=1;
                            bLED5=1;
                      }
                #endif

//            #if (_DP_DEBUG == _ON)
//                pDataInt[0] = 0x01;
//                CScalerSetByteInt(0x70,pDataInt[0]);
//                pDataInt[1]++;
//                CScalerSetByteInt(0x40,pDataInt[1]);

//            #if ((_PCB_TYPE == _RTD2472D_QA_PCB) || (_SCALER_TYPE == _RTD247xRD))
//                bLED3=~bLED3;
//            #endif

//            #endif // end of #if (_DP_DEBUG == _ON)

#if (_DP_LT_Proc == _AMD_CARD)
            }
#endif  //  End of #if (_DP_SOURCE == AMD_CARD)

            break;

        case _TRAINING_PATTERN2:

#if (_DP_LT_Proc == _AMD_CARD)
            if( ucDisplayPortLtPreStatus != _TRAINING_PATTERN2_PASS )     // for AMD Card DOS Mode bug
            {
#endif  //  End of #if (_DP_SOURCE == AMD_CARD)


//            #if ((_PCB_TYPE == _RTD2472D_QA_PCB) || (_SCALER_TYPE == _RTD247xRD))
//                bLED4=~bLED4;
//            #endif

                TP1_times = 0;
                TP2_times++;

                //eagleeyes-20080309-mark
            CDpTrainPattern2();

                //eagleeyes-20080310-Debug-Message
                CScalerSetByteInt(_PAGE_SELECT_9F,_PAGEC);
                ucDisplayPortStatus |= 0x02;
                CScalerSetByteInt (0xC9, ucDisplayPortStatus);
                //end of eagleeyes-20080310-Debug-Message

            #if ((_PCB_TYPE == _RTD2472D_QA_PCB) || (_PCB_TYPE == _RTD2472RD_QA_PCB))
                  if (ucDisplayPortLtPreStatus == _TRAINING_PATTERN2_PASS)
                  {
                        bLED3=1;
                        bLED4=0;
                        bLED5=1;
                  }
            #endif

//            #if (_DP_DEBUG == _ON)
//                pDataInt[0] |= 0x02;
//                CScalerSetByteInt(0x70,pDataInt[0]);
//                pDataInt[2]++;
//                CScalerSetByteInt(0x41,pDataInt[2]);
//                CScalerSetByteInt(0x7A,TP2_times);

//            #if ((_PCB_TYPE == _RTD2472D_QA_PCB) || (_SCALER_TYPE == _RTD247xRD))
//                bLED4=~bLED4;
//            #endif

//            #endif // end of #if (_DP_DEBUG == _ON)

#if (_DP_LT_Proc == _AMD_CARD)
            }
#endif  //  End of #if (_DP_SOURCE == AMD_CARD)

            break;

        case _TRAINING_PATTERN_END:
            if( ucDisplayPortLtPreStatus == _TRAINING_PATTERN2_PASS )
            {

//        #if ((_PCB_TYPE == _RTD2472D_QA_PCB) || (_SCALER_TYPE == _RTD247xRD))
//                bLED5=~bLED5;
//        #endif

                TP1_times = 0;

                CDpGetDisplayPortControl();
            CDpTrainPatternEnd();

                //eagleeyes-20080310-Debug-Message
                CScalerSetByteInt(_PAGE_SELECT_9F,_PAGEC);
                ucDisplayPortStatus |= 0x04;
                CScalerSetByteInt (0xC9, ucDisplayPortStatus);
                //end of eagleeyes-20080310-Debug-Message

        #if ((_PCB_TYPE == _RTD2472D_QA_PCB) || (_PCB_TYPE == _RTD2472RD_QA_PCB))
                bLED3=1;
                bLED4=1;
                bLED5=0;
        #endif


//        #if (_DP_DEBUG == _ON)
//                pDataInt[0] |= 0x04;
//                CScalerSetByteInt(0x70,pDataInt[0]);
//                pDataInt[3]++;
//                CScalerSetByteInt(0x42,pDataInt[3]);

//        #if ((_PCB_TYPE == _RTD2472D_QA_PCB) || (_SCALER_TYPE == _RTD247xRD))
//                    bLED5=~bLED5;
//        #endif

//        #endif // end of #if (_DP_DEBUG == _ON)

            }
            else            //  Training_Pattern_None
            {
                TP1_times = 0;

        #if ((_PCB_TYPE == _RTD2472D_QA_PCB) || (_PCB_TYPE == _RTD2472RD_QA_PCB))
                bLED3=1;
                bLED4=1;
                bLED5=1;
        #endif

                CScalerSetByteInt(_PAGE_SELECT_9F,_PAGEC);
                CScalerSetByteInt(0xc1,0x00);
                CScalerSetByteInt(0xc2,0x02);
                CScalerSetByteInt(0xc3,0x70);
                CScalerReadByteInt(_PC_DPCD_DATA_PORT_L_C4, &qData[0]);

                if ( (qData[0]&0x01) == 0x01 )
                {
                    TEST_CRC_Times++;

                    CScalerSetByteInt(0xc0,0x00);
                    CScalerSetByteInt(0xc1,0x00);
                    CScalerSetByteInt(0xc2,0x02);

                    CScalerReadByteInt(0xAC, &qData[0]);
                    CScalerSetByteInt(0xc3,0x41);
                    CScalerSetByteInt(0xc4,qData[0]);

                    CScalerReadByteInt(0xAD, &qData[0]);
                    CScalerSetByteInt(0xc3,0x40);
                    CScalerSetByteInt(0xc4,qData[0]);

                    CScalerReadByteInt(0xAE, &qData[0]);
                    CScalerSetByteInt(0xc3,0x43);
                    CScalerSetByteInt(0xc4,qData[0]);

                    CScalerReadByteInt(0xAF, &qData[0]);
                    CScalerSetByteInt(0xc3,0x42);
                    CScalerSetByteInt(0xc4,qData[0]);

                    CScalerReadByteInt(0xB0, &qData[0]);
                    CScalerSetByteInt(0xc3,0x45);
                    CScalerSetByteInt(0xc4,qData[0]);

                    CScalerReadByteInt(0xB1, &qData[0]);
                    CScalerSetByteInt(0xc3,0x44);
                    CScalerSetByteInt(0xc4,qData[0]);

                    CScalerSetByteInt(0xc3,0x46);
                    CScalerSetByteInt(0xc4,0x21);       // Set Test_CRC_Count != 0
                }
                else if (TEST_CRC_Times !=0 )
                {
                    CScalerSetByteInt(0xc0,0x00);
                    CScalerSetByteInt(0xc1,0x00);
                    CScalerSetByteInt(0xc2,0x02);
                    CScalerSetByteInt(0xc3,0x46);
                    CScalerSetByteInt(0xc4,0x20);       // Reset Test_CRC_Count
                }

//                #if (_DP_DEBUG == _ON)
//                            pDataInt[0] |= 0x08;
//                            CScalerSetByteInt(0x70,pDataInt[0]);
//                            pDataInt[4]++;
//                            CScalerSetByteInt(0x43,pDataInt[4]);
//                #endif // end of #if (_DP_DEBUG == _ON)
            }
            break;

        default:
            break;
    }

//*/



//    #if (_DP_DEBUG == _ON)
//        pDataInt[5]++;
//        CScalerSetByteInt(0x71,pDataInt[5]); //total interrupt times
//        CScalerSetByteInt(0x72,ucDisplayPortLtStatus); // now status
//        CScalerSetByteInt(0x73,ucDisplayPortLtPreStatus); // prestatus
//    #endif // end of #if (_DP_DEBUG == _ON)

//clear flag
//        MCU_IRQ_STATUS_FF00 = 0x00;
//        CScalerSetByteInt(_PAGE_SELECT_9F,_PAGEC);
//        CScalerSetByteInt(0xB3, 0xCC);
//        CScalerSetByteInt(0xB4, 0x80);
//        CScalerSetByteInt(0xDC, 0xFF);

    EA=1;

//  Restore Status
         CScalerSetByteInt(_PAGE_SELECT_9F,_PAGEC);
    CScalerSetByteInt(0xc1 , qData[4]);
    CScalerSetByteInt(0xc2 , qData[5]);
    CScalerSetByteInt(0xc3 , qData[6]);

    CScalerSetByteInt(0xb3 , qData[7]);

    CScalerSetByteInt(0xD0, 0xF3);

    CScalerSetByteInt(_PAGE_SELECT_9F,qData[1]);
    MCU_SCA_INF_CTRL_FFF3 = qData[2];
    MCU_SCA_INF_ADDR_FFF4 = qData[3];

}

#endif //End of #if(_DP_SUPPORT == _ON)

//1231 sephinroth start
void CDdcSclLow(void)
{
    BYTE cnt = 0;

    do
    {
        cnt++;
        MCU_PORT50_FF50[6] &= 0x00;//DDCSCL = _LOW;

    }while(cnt <= 250);
}

void CDdcSclHigh(void)
{
    BYTE cnt = 0;

    do
    {
        cnt++;
        MCU_PORT50_FF50[6] |= 0x01;//DDCSCL = _HIGH;

    }while(cnt <= 250);
}

void CDdcSclToggle(void)
{
    ucDdcSdaCnt=0;

    MCU_PIN_SHARE0_FF00         = 0x0C;
    MCU_PORT5_OE_FF03           = 0x6F;

    do
    {
        ucDdcSdaCnt++;
        CDdcSclLow();
        CDdcSclHigh();
    
    }while(ucDdcSdaCnt <= 4);
        
    ucDdcSdaCnt                 = 0;
    MCU_PIN_SHARE0_FF00         = 0x4C;
    MCU_PORT5_OE_FF03           = 0x2F;
    
}
//1231 sephinroth end
//--------------------------------------------------
// Timer0 Interrupt (1ms)
//--------------------------------------------------
void IntProcTimer0(void) interrupt 1
{
    TR0 = _ON;
    TL0 = _TIMER0_COUNT_LBYTE;
    TH0 = _TIMER0_COUNT_HBYTE;

#if(_MCU_TYPE == _REALTEK_EMBEDDED)
    MCU_WATCHDOG_TIMER_FFEA |= 0x40;        //clr wdt. V009_20080822
#else
    MCU_WATCHDOG_TIMER_FF36 |= 0x40;
#endif

    bNotifyTimer0Int = _TRUE;

⌨️ 快捷键说明

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