diff options
Diffstat (limited to 'deps/sysobj_early/include/util_edid.h')
-rw-r--r-- | deps/sysobj_early/include/util_edid.h | 93 |
1 files changed, 74 insertions, 19 deletions
diff --git a/deps/sysobj_early/include/util_edid.h b/deps/sysobj_early/include/util_edid.h index 3d54fa0d..af9364e0 100644 --- a/deps/sysobj_early/include/util_edid.h +++ b/deps/sysobj_early/include/util_edid.h @@ -23,16 +23,72 @@ #include <stdint.h> /* for *int*_t types */ -#define EDID_MAX_EXT_BLOCKS 254 +struct edid_dtd { + uint8_t *ptr; + int pixel_clock_khz; + int horiz_pixels; + int vert_lines; +}; + +struct edid_cea_header { + uint8_t *ptr; + int type, len; +}; + +struct edid_cea_block { + struct edid_cea_header header; + int reserved[8]; +}; + +struct edid_cea_audio { + struct edid_cea_header header; + int format, channels, freq_bits; + int depth_bits; /* format 1 */ + int max_kbps; /* formats 2-8 */ +}; + +struct edid_cea_video { + struct edid_cea_header header; +}; + +struct edid_cea_vendor_spec { + struct edid_cea_header header; +}; + +struct edid_cea_speaker { + struct edid_cea_header header; + int alloc_bits; +}; + +typedef struct { + union { + void* data; + uint8_t* u8; + uint16_t* u16; + uint32_t* u32; + }; + unsigned int len; + + /* 0 - EDID + * 1 - EIA/CEA-861 + * 2 - DisplayID + */ + int std; -/* just enough edid decoding */ -struct edid { int ver_major, ver_minor; - char ven[4]; + int checksum_ok; /* first 128-byte block only */ + int ext_blocks, ext_blocks_ok, ext_blocks_fail; + uint8_t *ext_ok; + + int dtd_count; + struct edid_dtd *dtds; + int cea_block_count; + struct edid_cea_block *cea_blocks; + + char ven[4]; int d_type[4]; char d_text[4][14]; - /* point into d_text */ char *name; char *serial; @@ -41,28 +97,27 @@ struct edid { int a_or_d; /* 0 = analog, 1 = digital */ int bpc; - uint16_t product; uint32_t n_serial; int week, year; - int horiz_cm, vert_cm; float diag_cm, diag_in; - int size; /* bytes */ - int checksum_ok; /* block 0 */ +} edid; +edid *edid_new(const char *data, unsigned int len); +edid *edid_new_from_hex(const char *hex_string); +void edid_free(edid *e); +char *edid_dump_hex(edid *e, int tabs, int breaks); - int ext_blocks, ext_blocks_ok, ext_blocks_fail; - uint8_t ext[EDID_MAX_EXT_BLOCKS][2]; /* block type, checksum_ok */ -}; - -int edid_fill(struct edid *id_out, const void *edid_bytes, int edid_len); -int edid_fill_xrandr(struct edid *id_out, const char *xrandr_edid_dump); +const char *edid_standard(int type); +const char *edid_descriptor_type(int type); +const char *edid_ext_block_type(int type); +const char *edid_cea_block_type(int type); +const char *edid_cea_audio_type(int type); -int edid_hex_to_bin(void **edid_bytes, int *edid_len, const char *hex_string); -char *edid_bin_to_hex(const void *edid_bytes, int edid_len); +char *edid_dtd_describe(struct edid_dtd *dtd); +char *edid_cea_block_describe(struct edid_cea_block *blk); -const char *edid_descriptor_type(int type); -char *edid_dump(struct edid *id); +char *edid_dump2(edid *e); #endif |