#include<sys/types.h>
#include<sys/socket.h>
#include<netinet/in.h>
#include<arpa/inet.h>
#include<unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include<sys/wait.h>
#include <string.h>
#define u16 unsigned short
#define u8 unsigned char
typedef struct {
u16 pixel_clock;
u8 h_active_low;
u8 h_blank_low;
u8 h_blank_high : 4;
u8 h_active_high : 4;
u8 v_active_low;
u8 v_blank_low;
u8 v_blank_high : 4;
u8 v_active_high : 4;
u8 h_front_low;
u8 h_sync_low;
u8 v_sync_low : 4;
u8 v_front_low : 4;
u8 v_sync_high : 2;
u8 v_front_high : 2;
u8 h_sync_high : 2;
u8 h_front_high : 2;
u8 physical_size[5];
u8 unused0 : 1;
u8 hpol : 1;
u8 vpol : 1;
u8 seperate_sync : 1;
u8 digital_sync : 1;
u8 unused5 : 1;
u8 unused6 : 1;
u8 interlaced : 1;
} __attribute__((packed)) edid_native_timing_t;
int main(int argc, char **argv)
{
//char buf[]={0x01,0x1d,0x20,0x78,0x71,0xb0,0xb5,0x30,0xa6,0x2c,0x85,0x00,0xA0,0x5A,0x00,0x00,0x00,0x1E};
unsigned char buf[]={0x01,0x1d,0x20,0x78,0x71,0xb0,0xb5,0x30,0xa6,0x2c,0x85,0x00,0xA0,0x5A,0x00,0x00,0x00,0x1E};
edid_native_timing_t * edid_time;
edid_time = (edid_native_timing_t *)buf;
int i;
printf("\n");
for(i=0;i<18;i++){
printf("0x%x,", buf[i]);
}
printf("\n");
printf("edid_time->pixel_clock:%d \n", edid_time->pixel_clock);
printf("edid_time->h_active:%d \n",(edid_time->h_active_high<<8) | (edid_time->h_active_low));
printf("edid_time->h_blank:%d \n", (edid_time->h_blank_high<<8) | (edid_time->h_blank_low));
printf("edid_time->h_front:%d \n", (edid_time->h_front_high<<8) | (edid_time->h_front_low));
printf("edid_time->h_sync:%d \n", (edid_time->h_sync_high<<8) | (edid_time->h_sync_low));
printf("edid_time->v_active:%d \n",(edid_time->v_active_high<<8) | (edid_time->v_active_low));
printf("edid_time->v_blank:%d \n", (edid_time->v_blank_high<<8) | (edid_time->v_blank_low));
printf("edid_time->v_front:%d \n", (edid_time->v_front_high<<4) | (edid_time->v_front_low));
printf("edid_time->v_sync:%d \n", (edid_time->v_sync_high<<4) | (edid_time->v_sync_low));
printf("edid_time->hpol:%d \n", (edid_time->hpol));
printf("edid_time->vpol:%d \n", (edid_time->vpol));
///
u16 h_active = 1824;
u16 h_blank = 376;
u16 h_front = 192;
u16 h_sync = 88;
u16 v_active = 1888;
u16 v_blank = 362;
u16 v_front = 72;
u16 v_sync = 10;
u16 pixel_clock = 14850;
edid_time->pixel_clock = pixel_clock;
edid_time->h_active_high = h_active>>8;
edid_time->h_active_low = h_active&0x00ff;
edid_time->h_blank_high = h_blank>>8;
edid_time->h_blank_low = h_blank&0x00ff;
edid_time->h_front_high = h_front>>8;
edid_time->h_front_low = h_front&0x00ff;
edid_time->h_sync_high = h_sync>>8;
edid_time->h_sync_low = h_sync&0x00ff;
edid_time->v_active_high = v_active>>8;
edid_time->v_active_low = v_active&0x00ff;
edid_time->v_blank_high = v_blank>>8;
edid_time->v_blank_low = v_blank&0x00ff;
edid_time->v_front_high = v_front>>4;
edid_time->v_front_low = v_front&0x000f;
edid_time->v_sync_high = v_sync>>4;
edid_time->v_sync_low = v_sync&0x000f;
unsigned char * buf2 = (unsigned char *)edid_time;
printf("\n");
for(i=0;i<18;i++){
printf("0x%x,", buf2[i]);
}
printf("\n");
printf("edid_time->pixel_clock:%d \n", edid_time->pixel_clock);
printf("edid_time->h_active:%d \n",(edid_time->h_active_high<<8) | (edid_time->h_active_low));
printf("edid_time->h_blank:%d \n", (edid_time->h_blank_high<<8) | (edid_time->h_blank_low));
printf("edid_time->h_front:%d \n", (edid_time->h_front_high<<8) | (edid_time->h_front_low));
printf("edid_time->h_sync:%d \n", (edid_time->h_sync_high<<8) | (edid_time->h_sync_low));
printf("edid_time->v_active:%d \n",(edid_time->v_active_high<<8) | (edid_time->v_active_low));
printf("edid_time->v_blank:%d \n", (edid_time->v_blank_high<<8) | (edid_time->v_blank_low));
printf("edid_time->v_front:%d \n", (edid_time->v_front_high<<4) | (edid_time->v_front_low));
printf("edid_time->v_sync:%d \n", (edid_time->v_sync_high<<4) | (edid_time->v_sync_low));
printf("edid_time->hpol:%d \n", (edid_time->hpol));
printf("edid_time->vpol:%d \n", (edid_time->vpol));
return 0;
}
EDID 分辨率
最新推荐文章于 2024-03-05 14:12:26 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)