Exemple #1
0
__s32 ParseEDID(void)
{
	//collect the EDID ucdata of segment 0
	__u8 BlockCount ;
	__u32 i,offset ;

	__inf("ParseEDID\n");

	memset(Device_Support_VIC,0,sizeof(Device_Support_VIC));
	memset(EDID_Buf,0,sizeof(EDID_Buf));
	is_hdmi = 0;
	is_yuv = 0;
	is_exp = 0;
	DDC_Init();

	GetEDIDData(0, EDID_Buf);

	if( EDID_CheckSum(0, EDID_Buf) != 0)
		return 0;

	if( EDID_Header_Check(EDID_Buf)!= 0)
		return 0;

	if( EDID_Version_Check(EDID_Buf)!= 0)
		return 0;

	Parse_DTD_Block(EDID_Buf + 0x36);

	Parse_DTD_Block(EDID_Buf + 0x48);

	BlockCount = EDID_Buf[0x7E];

	if((Check_EDID(EDID_Buf,exp0) == 0)||
		(Check_EDID(EDID_Buf,exp1) == 0))
	{
		printk("*****************is_exp*****************\n");
		is_exp = 1;
	}

	if( BlockCount > 0 ) {
		if ( BlockCount > 4 )
			BlockCount = 4 ;

		for( i = 1 ; i <= BlockCount ; i++ ) {
			GetEDIDData(i, EDID_Buf) ;
			if( EDID_CheckSum(i, EDID_Buf)!= 0)
				return 0;

			if((EDID_Buf[0x80*i+0]==2)/*&&(EDID_Buf[0x80*i+1]==1)*/)
			{
				if( (EDID_Buf[0x80*i+1]>=1)) {
					if(EDID_Buf[0x80*i+3]&0x20)
					{
						is_yuv = 1;
						__inf("device support YCbCr44 output\n");
						if(rgb_only == 1) {
							__inf("rgb only test!\n");
							is_yuv = 0;
						}
					}
				}

				offset = EDID_Buf[0x80*i+2];
				/* deal with reserved data block */
				if(offset > 4) {
					__u8 bsum = 4;
					while(bsum < offset)
					{
						__u8 tag = EDID_Buf[0x80*i+bsum]>>5;
						__u8 len = EDID_Buf[0x80*i+bsum]&0x1f;
						if( (len >0) && ((bsum + len + 1) > offset) ) {
							__inf("len or bsum size error\n");
							return 0;
						} else {
							if( tag == 1) {
								/* ADB */
								Parse_AudioData_Block(EDID_Buf+0x80*i+bsum+1,len);
							}	else if( tag == 2) {
								/* VDB */
								Parse_VideoData_Block(EDID_Buf+0x80*i+bsum+1,len);
							}	else if( tag == 3) {
								/* vendor specific */
								Parse_HDMI_VSDB(EDID_Buf+0x80*i+bsum+1,len);
							}
						}

						bsum += (len +1);
					}
				} else {
					__inf("no data in reserved block%d\n",i);
				}

				/* deal with 18-byte timing block */
				if(offset >= 4)	{
					while(offset < (0x80-18)) {
						Parse_DTD_Block(EDID_Buf + 0x80*i + offset);
						offset += 18;
					}
				} else {
					__inf("no datail timing in block%d\n",i);
				}
			}
		}
Exemple #2
0
__s32 ParseEDID(void)
{
    //collect the EDID ucdata of segment 0
    __u8 BlockCount ;
    __u32 i,offset ;

    __inf("ParseEDID\n");

    memset(Device_Support_VIC,0,sizeof(Device_Support_VIC));
    memset(EDID_Buf,0,sizeof(EDID_Buf));

	DDC_Init();

    GetEDIDData(0, EDID_Buf);

	if( EDID_CheckSum(0, EDID_Buf) != 0)
	{
		return 0;
	}

	if( EDID_Header_Check(EDID_Buf)!= 0)
	{
		return 0;
	}

	if( EDID_Version_Check(EDID_Buf)!= 0)
	{
		return 0;
	}
	Parse_DTD_Block(EDID_Buf + 0x36);

	Parse_DTD_Block(EDID_Buf + 0x48);

    BlockCount = EDID_Buf[0x7E];

    if( BlockCount > 0 )
    {
	    if ( BlockCount > 4 )
	    {
	        BlockCount = 4 ;
	    }
	    for( i = 1 ; i <= BlockCount ; i++ )
	    {
	        GetEDIDData(i, EDID_Buf) ;
	        if( EDID_CheckSum(i, EDID_Buf)!= 0)
	        {
	        	return 0;
	        }

			if((EDID_Buf[0x80*i+0]==2)/*&&(EDID_Buf[0x80*i+1]==1)*/)
			{

				offset = EDID_Buf[0x80*i+2];
				if(offset > 4)		//deal with reserved data block
				{
					__u8 bsum = 4;
					while(bsum < offset)
					{
						__u8 tag = EDID_Buf[0x80*i+bsum]>>5;
						__u8 len = EDID_Buf[0x80*i+bsum]&0x1f;
						if( (len >0) && ((bsum + len + 1) > offset) )
						{
						    __inf("len or bsum size error\n");
							return 0;
						}else
						{
							if( tag == 1)		//ADB
							{
								Parse_AudioData_Block(EDID_Buf+0x80*i+bsum+1,len);
							}
							else if( tag == 2)	//VDB
							{
								Parse_VideoData_Block(EDID_Buf+0x80*i+bsum+1,len);
							}
							else if( tag == 3)	//vendor specific
							{
								Parse_HDMI_VSDB(EDID_Buf+0x80*i+bsum+1,len);
							}
						}

						bsum += (len +1);
					}

				}else
				{
					__inf("no data in reserved block%d\n",i);
				}

				if(offset >= 4)		//deal with 18-byte timing block
				{
					while(offset < (0x80-18))
					{
						Parse_DTD_Block(EDID_Buf + 0x80*i + offset);
						offset += 18;
					}
				}else
				{
					__inf("no datail timing in block%d\n",i);
				}
			}