Overview
========
The edid_reader example retrieves the Extended Display Identification Data (EDID)
from the connected display, parses it and prints the information in the terminal.

The code for the actual parser (edid.h/c and coreboot_tables.h) comes from
https://chromium.googlesource.com/chromiumos/third_party/coreboot/+/factory-4455.B/src/lib/edid.c
and has been adapted to work on the iMXRT1166.


Toolchain supported
===================
- IAR embedded Workbench  8.50.9
- Keil MDK  5.33
- GCC ARM Embedded  9.3.1
- MCUXpresso  11.3.1

Hardware requirements
=====================
- Micro USB cable
- iMXRT1166 uCOM Developer's Kit and the HDMI adapter
- HDMI cable
- Something to get EDID data from, e.g. a PC monitor

Board settings
==============

Prepare the Demo
================
1. Connect a micro USB cable between the PC host and the J29 USB port on the board.
2.  Open a serial terminal with the following settings:
   - 115200 baud rate
   - 8 data bits
   - No parity
   - One stop bit
   - No flow control
3. Insert the HDMI adapter in connector C on the uCOM Carrier Board
4. Connect the HDMI adapter to e.g. a PC display using an HDMI cable
5. Download the program to the target board.
6. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo
================
When the example runs successfully, a message similar to this is displayed in the terminal:
(The exact content is of course dependant on the connected display)

~~~~~~~~~~~~~~~~~~~~~
EDID Reading example.
Reading 256 bytes of EDID data
EDID DATA:
---------
0x 0   0x 0 0xff 0xf0x45 0x54 0x 0 0x 0
0x10   0x25 0x1c 0x 0x57 0x4f 0xa2 0x28
0x20   0x f 0x50 0x50x81 0x80 0xa9 0xc0
0x30   0xb3 0x 0 0xa0x3e 0x80 0x30 0x20
0x40   0x35 0x 0 0x60x 0 0x4a 0x39 0x4a
0x50   0x30 0x36 0x30x 0 0xfd 0x 0 0x18
0x60   0x4c 0x1e 0x80x 0 0x 0 0x 0 0xfc
0x70   0x 0 0x42 0x60x55 0x a 0x 1 0x2b
0x80   0x 2 0x 3 0x40x 4 0x 3 0x 2 0x 7
0x90   0x 6 0x f 0x10x 9 0x 7 0x 7 0x6d
0xa0   0x 3 0x c 0x 0x 3 0x67 0xd8 0x5d
0xb0   0xc4 0x 1 0x70x 0 0x 0 0xe6 0x 6
0xc0   0x 5 0x 1 0x50x3c 0x 0 0x56 0x5e
0xd0   0x 0 0xa0 0xa0x21 0x 0 0x 0 0x1a
0xe0   0xf4 0x51 0x 0x6d 0x55 0x21 0x 0
0xf0   0x 0 0x1e 0x 0x 0 0x 0 0x 0 0xeb
Extracted contents:
header:           0 ff ff ff ff ff ff  0
serial number:    9 d1 49 79 45 54  0  0 25 1c
version:          1  3
basic params:    80 3e 22 78 2e
chroma info:      8 a5 a2 57 4f a2 28  f 50 54
established:     a5 6b 80
standard:        d1 c0 81 c0 81  0 81 80 a9 c0 b3  0 a9 40  1  1
descriptor 1:    51 d0  0 a0 f0 70 3e 80 30 20 35  0 6d 55 21  0  0 1a
descriptor 2:     0  0  0 ff  0 4a 39 4a 30 36 34 35 39 53 4c 30  a 20
descriptor 3:     0  0  0 fd  0 18 4c 1e 87 3c  0  a 20 20 20 20 20 20
descriptor 4:     0  0  0 fc  0 42 65 6e 51 20 45 4c 32 38 37 30 55  a
extensions:       1
checksum:        2b

Manufacturer: BNQ Model 7949 Serial Number 21573
Made week hd of hd
EDID version: hd.hd
Digital display
Maximum image size: 62 cm x 34 cm
Gamma: 220%
Check DPMS levels
DPMS levels: Off
Supported color formats: RGB 4:4:4, YCrCb 4:2:2
Default (sRGB) color space is primary color space
First detailed timing is preferred timing
Established timings supported:
  720x400@70Hz
  640x480@60Hz
  640x480@75Hz
  800x600@60Hz
  800x600@75Hz
  832x624@75Hz
  1024x768@60Hz
  1024x768@75Hz
  1280x1024@75Hz
  1152x870@75Hz
Standard timings supported:
  1920x1080@60Hz
  1280x720@60Hz
  1280x800@60Hz
  1280x1024@60Hz
  1600x900@60Hz
  1680x1050@60Hz
  1600x1200@60Hz
Detailed timings
Hex of detail: 51d0 0a0f0703e80302035 06d5521 0 01a
Did detailed timing
Detailed mode (IN HEX): Clock 533290 KHz, 26d mm x 155 mm
                f00  f30  f50  fa0 hborder 0
                870  873  878  8ae vborder 0
               +hsync -vsync
Hex of detail:  0 0 0ff 04a394a3036343539534c30 a20
Serial number: J9J06459SL0
Hex of detail:  0 0 0fd 0184c1e873c 0 a202020202020
Monitor ranges (GTF): 24-76Hz V, 30-135kHz H, max dotclock 600MHz
Hex of detail:  0 0 0fc 042656e5120454c3238373055 a
Has 1 extension blocks
Checksum
Checksum: 0xhx (valid)

Unknown extension block


CEA extension block
Extension version: 3
74 bytes of CEA data
  Video data block
    VIC 97
    VIC 96
    VIC 93
    VIC 94
    VIC 95
    VIC 16
    VIC  5
    VIC  4
    VIC  3
    VIC  2
    VIC  7
    VIC  6
    VIC 15
    VIC 31
    VIC 32
    VIC 33
    VIC 34
    VIC 20
    VIC 19
    VIC 18
    VIC 22
  Audio data block
    Linear PCM, max channels 1
    Supported sample rates (kHz): 48 44.1 32
    Supported sample sizes (bits): 24 20 16
  Vendor-specific data block, OUI    c03 (HDMI)
    Source physical address 2.0.0.0
    DC_36bit
    DC_30bit
    DC_Y444
    Maximum TMDS clock: 340MHz
    Extended HDMI video details:
      Skipping 3 bytes that HDMI refuses to publicly document
  Vendor-specific data block, OUI c45dd8
  Extended tag: Colorimetry data block
  Extended tag: Reserved video block ( f)
  Extended tag: Reserved video block ( 6)
  Vendor-specific data block, OUI     1a
Underscans PC formats by default
Basic audio support
Supports YCbCr 4:4:4
Supports YCbCr 4:2:2
1 native detailed modes
Hex of detail: 565e 0a0a0a02950302035 06d5521 0 01a
Detailed mode (IN HEX): Clock 533290 KHz, 26d mm x 155 mm
                f00  f30  f50  fa0 hborder 0
                870  873  878  8ae vborder 0
               +hsync -vsync
Hex of detail: f451 0a0f0701980302035 06d5521 0 01e
Detailed mode (IN HEX): Clock 533290 KHz, 26d mm x 155 mm
                f00  f30  f50  fa0 hborder 0
                870  873  878  8ae vborder 0
               +hsync +vsync
Checksum: 0xhx (valid)

EDID block does not conform at all!
        Detailed blocks filled with garbage
DONE
~~~~~~~~~~~~~~~~~~~~~
