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

📄 displayport.c

📁 realtek LCD monitor, TV开发源代码
💻 C
📖 第 1 页 / 共 5 页
字号:

            if ( ((Training_Lane_Set&0x04)==0x00) && ((Adjust_Request_L01&0x03)!=0x03) )
                Adjust_Request_L01 = Adjust_Request_L01 + 0x01;

        }


        // Lane_1 D10.2 Check
        if((dpprate&0x0A)== 0x0A)
        {
            CScalerSetByteInt(_PAGE_SELECT_9F,_PAGEC);
            CScalerSetByteInt(0xA4, 0x55);

            CScalerSetByteInt(_PAGE_SELECT_9F,_PAGE2);
            CScalerSetByteInt(0xC9, 0x28);
            CScalerSetByteInt(0xCA, 0x08);
            CScalerSetByteInt(0xC9, 0x29);

            CScalerReadByteInt(0xCA, &Link_clock);

            if ( (Link_clock==0x66)||(Link_clock==0x67) )
                TP1_Error &= 0xFB;
            else
                TP1_Error |= 0x04;
        }

        if ((TP1_Error&0x04)==0x00)
            Lane01_Status |= 0x10;
        else
        {
            Lane01_Status &= 0xEF;

            CScalerSetByteInt(_PAGE_SELECT_9F,_PAGEC);
            CScalerSetByteInt(0xc1, 0x00);
            CScalerSetByteInt(0xc2, 0x01);
            CScalerSetByteInt(0xc3, 0x04);
            CScalerReadByteInt(0xc4, &Training_Lane_Set);

//            Adjust_Request_L01 = (Adjust_Request_L01 & 0xCF) | ((Training_Lane_Set & 0x03)<<4);  // whhsiao-added.20080506
            Adjust_Request_L01 = (Adjust_Request_L01 & 0x0F) | ((Training_Lane_Set & 0x03)<<4) | ((Training_Lane_Set & 0x18)<<3);  // whhsiao-added.20080506

            if ( ((Training_Lane_Set&0x04)==0x00) && ((Adjust_Request_L01&0x30)!=0x30) )
                Adjust_Request_L01 = Adjust_Request_L01 + 0x10;

        }


       // Lane_2 D10.2 Check
        if((dpprate&0x0A)== 0x0A)
        {
            CScalerSetByteInt(_PAGE_SELECT_9F,_PAGEC);
            CScalerSetByteInt(0xA4, 0xAA);

            CScalerSetByteInt(_PAGE_SELECT_9F,_PAGE2);
            CScalerSetByteInt(0xC9, 0x28);
            CScalerSetByteInt(0xCA, 0x08);
            CScalerSetByteInt(0xC9, 0x29);

            CScalerReadByteInt(0xCA, &Link_clock);

            if ( (Link_clock==0x66)||(Link_clock==0x67) )
                TP1_Error &= 0xFD;
            else
                TP1_Error |= 0x02;
        }


        if ((TP1_Error&0x02)==0x00)
            Lane23_Status |= 0x01;
        else
        {
            Lane23_Status &= 0xFE;

            CScalerSetByteInt(_PAGE_SELECT_9F,_PAGEC);
            CScalerSetByteInt(0xc1, 0x00);
            CScalerSetByteInt(0xc2, 0x01);
            CScalerSetByteInt(0xc3, 0x05);
            CScalerReadByteInt(0xc4, &Training_Lane_Set);

//            Adjust_Request_L23 = (Adjust_Request_L23 & 0xFC) | (Training_Lane_Set & 0x03);  // whhsiao-added.20080506
            Adjust_Request_L23 = (Adjust_Request_L23 & 0xF0) | (Training_Lane_Set & 0x03) | ((Training_Lane_Set & 0x18)<<1);  // whhsiao-added.20080506

            if ( ((Training_Lane_Set&0x04)==0x00) && ((Adjust_Request_L23&0x03)!=0x03) )
                Adjust_Request_L23 = Adjust_Request_L23 + 0x01;

        }

        // Lane_3 D10.2 Check
        if((dpprate&0x0A)== 0x0A)
        {
            CScalerSetByteInt(_PAGE_SELECT_9F,_PAGEC);
            CScalerSetByteInt(0xA4, 0xFF);

            CScalerSetByteInt(_PAGE_SELECT_9F,_PAGE2);
            CScalerSetByteInt(0xC9, 0x28);
            CScalerSetByteInt(0xCA, 0x08);
            CScalerSetByteInt(0xC9, 0x29);

            CScalerReadByteInt(0xCA, &Link_clock);

            if ( (Link_clock==0x66)||(Link_clock==0x67) )
                TP1_Error &= 0xFE;
            else
                TP1_Error |= 0x01;
        }

        if ((TP1_Error&0x01)==0x00)
            Lane23_Status |= 0x10;
        else
        {
            Lane23_Status &= 0xEF;

            CScalerSetByteInt(_PAGE_SELECT_9F,_PAGEC);
            CScalerSetByteInt(0xc1, 0x00);
            CScalerSetByteInt(0xc2, 0x01);
            CScalerSetByteInt(0xc3, 0x06);
            CScalerReadByteInt(0xc4, &Training_Lane_Set);

//            Adjust_Request_L23 = (Adjust_Request_L23 & 0xCF) | ((Training_Lane_Set & 0x03)<<4);  // whhsiao-added.20080506
            Adjust_Request_L23 = (Adjust_Request_L23 & 0x0F) | ((Training_Lane_Set & 0x03)<<4) | ((Training_Lane_Set & 0x18)<<3);  // whhsiao-added.20080506

            if ( ((Training_Lane_Set&0x04)==0x00) && ((Adjust_Request_L23&0x30)!=0x30) )
                Adjust_Request_L23 = Adjust_Request_L23 + 0x10;
        }

        if ( ((Lane01_Status&0x11)==0x11) && ((Lane23_Status&0x11)==0x11) )
            ucDisplayPortLtPreStatus = _TRAINING_PATTERN1_PASS;
    }

    CScalerSetByteInt(_PAGE_SELECT_9F,_PAGEC);
    CScalerSetByteInt(0xc1, 0x00);
    CScalerSetByteInt(0xc2, 0x02);
    CScalerSetByteInt(0xc3, 0x06);
    CScalerSetByteInt(0xc4, Adjust_Request_L01);
    CScalerSetByteInt(0xc3, 0x07);
    CScalerSetByteInt(0xc4, Adjust_Request_L23);
    if ( ((dplane&0x03)== 0x01) || ((dplane&0x03)== 0x02) )         //1,2 Lane
    {
        CScalerSetByteInt(0xc3, 0x02);
        CScalerSetByteInt(0xc4, Lane01_Status); //  whhsiao-20080317
        CScalerSetByteInt(0xc3, 0x03);
        CScalerSetByteInt(0xc4, 0x00);
    }
    else                                //4 lane
    {
        CScalerSetByteInt(0xc3, 0x02);
        CScalerSetByteInt(0xc4, Lane01_Status); //  whhsiao-20080317
        CScalerSetByteInt(0xc3, 0x03);
        CScalerSetByteInt(0xc4, Lane23_Status); //  whhsiao-20080317
    }

    CScalerSetByteInt(0xc3, 0x04);
    CScalerSetByteInt(0xc4, 0x80);


    CScalerSetByteInt(_PAGE_SELECT_9F,_PAGEB);
    CScalerSetByteInt(0xe2, 0x00);
    CScalerSetByteInt(0xe3, 0x21);
    CScalerSetByteInt(0xe3, 0x01);

#if (_DP_DEBUG == _ON)

//    CScalerSetByteInt(0x13,TP1_times);
/*
    if(TP1_times == 1)
    {
//        CScalerSetByteInt(_PAGE_SELECT_9F,_PAGEC);
//        CScalerSetByteInt(0xA5,0xff);
//        CScalerReadInt(0xA5, 1, &buf, _NON_AUTOINC);        //Check ANSI 8B/10B Error
//        CScalerSetByteInt(0x13,buf);

        CScalerSetByteInt(0x15,Lane01_Status);
        CScalerSetByteInt(0x70,dpprate);
    }
    else if(TP1_times == 2)
    {
        CScalerSetByteInt(0x16,Lane01_Status);
        CScalerSetByteInt(0x71,dpprate);
    }
    else if(TP1_times == 3)
    {
        CScalerSetByteInt(0x17,Lane01_Status);
        CScalerSetByteInt(0x72,dpprate);
    }
    else if(TP1_times == 4)
    {
        CScalerSetByteInt(0x18,Lane01_Status);
        CScalerSetByteInt(0x73,dpprate);
    }
    else if(TP1_times == 5)
    {
        CScalerSetByteInt(0x19,Lane01_Status);
        CScalerSetByteInt(0x74,dpprate);
    }
    else if(TP1_times == 6)
    {
        CScalerSetByteInt(0x1B,Lane01_Status);
        CScalerSetByteInt(0x75,dpprate);
    }
    else if(TP1_times == 7)
    {
        CScalerSetByteInt(0x1C,Lane01_Status);
        CScalerSetByteInt(0x7A,dpprate);
    }
    else if(TP1_times == 8)
    {
        CScalerSetByteInt(0x1D,Lane01_Status);
        CScalerSetByteInt(0x7B,dpprate);
    }
    else if(TP1_times == 9)
    {
        CScalerSetByteInt(0x1E,Lane01_Status);
        CScalerSetByteInt(0x7C,dpprate);
    }
    else if(TP1_times == 10)
    {
        CScalerSetByteInt(0x1F,Lane01_Status);
        CScalerSetByteInt(0x7D,dpprate);
    }
//*/


#endif

}
//end of eagleeyes-20080305-interrupt
//--------------------------------------------------
// Description  : AUX Link Training Pattern 2 interrupt
// Input Value  :
// Output Value :
//--------------------------------------------------
//eagleeyes-20080305-interrupt
///*
void CDpTrainPattern2(void)
{
    BYTE xdata dplane,buf,Align_Status;
    BYTE xdata Training_Lane_Set;

#if (_DP_DEBUG == _ON)
    BYTE crcvalue;
    BYTE xdata dpprate;
#endif // end of #if (_DP_DEBUG == _ON)

    CScalerSetByteInt(_PAGE_SELECT_9F,_PAGEB);
    CScalerSetByteInt(0xe2,0x80);

    CScalerSetByteInt(_PAGE_SELECT_9F,_PAGEC);  //  Set to
    CScalerSetByteInt(0xA4, 0x1B);

    CScalerSetByteInt(0xc1, 0x00);
    CScalerSetByteInt(0xc2, 0x01);
    CScalerSetByteInt(0xc3, 0x01);
    CScalerReadByteInt(0xc4, &dplane);  //read  source lane

    if ( (dplane&0x01)== 0x01 )         //1 lane
        CScalerSetByteInt(0xA1, 0x08);
    else if ( (dplane&0x02)== 0x02 )    //2 lane
        CScalerSetByteInt(0xA1, 0x10);
    else                                //4 lane
        CScalerSetByteInt(0xA1, 0x18);


        //delay 200us num=70
//     for (buf=0;buf<=50;buf++)
//     _nop_();


    if((dplane&0x01) == 0x01)
    {
        CScalerSetByteInt(0xb3, 0xb3);
        CScalerSetByteInt(0xb4, 0x8F);
        CScalerSetByteInt(0xb3, 0xb3);
        CScalerSetByteInt(0xb4, 0x8F);

//     for (buf=0;buf<=200;buf++)
//     _nop_();

        CScalerSetByteInt(0xb3, 0xb3);
        CScalerReadByteInt(0xb4, &buf);  //read EQ_Down Status

        if ( (buf&0x08)==0x00 )     // Lane0 : EQ_CRC OK
            Lane01_Status |= 0x06;
        else                        // Lane0 : EQ_CRC Not OK
        {
            Lane01_Status &= 0xF9;

            CScalerSetByteInt(0xc1, 0x00);
            CScalerSetByteInt(0xc2, 0x01);
            CScalerSetByteInt(0xc3, 0x03);
            CScalerReadByteInt(0xc4, &Training_Lane_Set);

            Adjust_Request_L01 = (Adjust_Request_L01 & 0xF0) | (Training_Lane_Set & 0x03) | ((Training_Lane_Set & 0x18)<<1);  // whhsiao-added.20080506

            if ( ((Training_Lane_Set&0x20)==0x00) && ((Adjust_Request_L01&0x0C)!=0x0C) )
                Adjust_Request_L01 = Adjust_Request_L01 + 0x04;
            else if ( ((Training_Lane_Set&0x04)==0x00) && ((Adjust_Request_L01&0x03)!=0x03) )
                Adjust_Request_L01 = Adjust_Request_L01 + 0x01;

        }

        if ( (Lane01_Status==0x07) )
            ucDisplayPortLtPreStatus = _TRAINING_PATTERN2_PASS;
        else
            ucDisplayPortLtPreStatus = _TRAINING_PATTERN2_FAIL;

        CScalerSetByteInt(0xc1, 0x00);
        CScalerSetByteInt(0xc2, 0x02);
        CScalerSetByteInt(0xc3, 0x02);
        CScalerSetByteInt(0xc4, Lane01_Status); //  whhsiao-20080317
        CScalerSetByteInt(0xc3, 0x03);
        CScalerSetByteInt(0xc4, 0x00);
        CScalerSetByteInt(0xc3, 0x04);
        CScalerSetByteInt(0xc4, 0x81);      // For Unigraf CTS#11 Bug
        //CScalerSetByteInt(0xc4, 0x80);      // Normal case
    }
    else if((dplane&0x02) == 0x02)
    {
        CScalerSetByteInt(0xb3, 0xb3);
        CScalerSetByteInt(0xb4, 0x8F);
        CScalerSetByteInt(0xb3, 0xb3);
        CScalerSetByteInt(0xb4, 0x8F);

//     for (buf=0;buf<=200;buf++)
//     _nop_();

        CScalerSetByteInt(0xb3, 0xb3);
        CScalerReadByteInt(0xb4, &buf);  //read EQ_Down Status


        if ( (buf&0x08)==0x00 )     // Lane0 : EQ_CRC OK
            Lane01_Status |= 0x06;
        else                        // Lane0 : EQ_CRC Not OK
        {
            Lane01_Status &= 0xF9;

            CScalerSetByteInt(0xc1, 0x00);
            CScalerSetByteInt(0xc2, 0x01);
            CScalerSetByteInt(0xc3, 0x03);
            CScalerReadByteInt(0xc4, &Training_Lane_Set);

⌨️ 快捷键说明

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