]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
Docs/EDID: Calculate CRC while building the code
authorChristoph Niedermaier <cniedermaier@dh-electronics.de>
Mon, 5 Nov 2018 08:48:35 +0000 (09:48 +0100)
committerJonathan Corbet <corbet@lwn.net>
Tue, 6 Nov 2018 14:36:22 +0000 (07:36 -0700)
The previous version made it necessary to first generate an
EDID data set without correct CRC and then to fix the CRC in
a second step. This patch adds the CRC calculation to the
makefile in such a way that a correct EDID data set is generated
in a single build step. Successfully tested with all existing
and a couple of new data sets.

Signed-off-by: Christoph Niedermaier <cniedermaier@dh-electronics.de>
Reviewed-by: Carsten Emde <C.Emde@osadl.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Documentation/EDID/1024x768.S
Documentation/EDID/1280x1024.S
Documentation/EDID/1600x1200.S
Documentation/EDID/1680x1050.S
Documentation/EDID/1920x1080.S
Documentation/EDID/800x600.S
Documentation/EDID/HOWTO.txt
Documentation/EDID/Makefile

index ff4013e5fa49407db46d4b7cb8b455355ae6c548..4aed3f9ab88aef714feb192af32262aae7ba62c7 100644 (file)
@@ -39,6 +39,5 @@
 #define ESTABLISHED_TIMING2_BITS 0x08 /* Bit 3 -> 1024x768 @60 Hz */
 #define HSYNC_POL 0
 #define VSYNC_POL 0
-#define CRC 0x55
 
 #include "edid.S"
index ce0e85be379ecf1b57e1b0571980be8b084e03d5..b26dd424cad7cc77d6c1cc79af1348409390a382 100644 (file)
@@ -39,6 +39,5 @@
 /* No ESTABLISHED_TIMINGx_BITS */
 #define HSYNC_POL 1
 #define VSYNC_POL 1
-#define CRC 0xa0
 
 #include "edid.S"
index 5eeb751ebe1bcdd4b5f3a20dc3355332f4d66403..0d091b282768f2bd7ac4399dbe3bd4d0814a3cb6 100644 (file)
@@ -39,6 +39,5 @@
 /* No ESTABLISHED_TIMINGx_BITS */
 #define HSYNC_POL 1
 #define VSYNC_POL 1
-#define CRC 0x9d
 
 #include "edid.S"
index ec679507e33b3000c739e6c6e246d92c6b71b78d..7dfed9a33eab6f5f5c858bd34788d63b380ab5a3 100644 (file)
@@ -39,6 +39,5 @@
 /* No ESTABLISHED_TIMINGx_BITS */
 #define HSYNC_POL 1
 #define VSYNC_POL 1
-#define CRC 0x26
 
 #include "edid.S"
index e0657af801ddf15fbff7126ef92855d6d6f54feb..d6ffbba28e95bf1d7829887134d2ae06f0369ba6 100644 (file)
@@ -39,6 +39,5 @@
 /* No ESTABLISHED_TIMINGx_BITS */
 #define HSYNC_POL 1
 #define VSYNC_POL 1
-#define CRC 0x05
 
 #include "edid.S"
index b6853b2db869fd9c3c931d3296d65b5042a968c6..a5616588de086453bb814f3a1322920ac6c42511 100644 (file)
@@ -36,6 +36,5 @@
 #define ESTABLISHED_TIMING1_BITS 0x01 /* Bit 0: 800x600 @ 60Hz */
 #define HSYNC_POL 1
 #define VSYNC_POL 1
-#define CRC 0xc2
 
 #include "edid.S"
index 7d05a7d30a79746f3730f876ea78057a96f538fa..539871c3b785e46bac8534aaaf4cf0840ba5f9a2 100644 (file)
@@ -47,12 +47,3 @@ EDID:
 #define YBLANK vtotal-vdisp
 #define YOFFSET vsyncstart-vdisp
 #define YPULSE vsyncend-vsyncstart
-
-The CRC value in the last line
-  #define CRC 0x55
-also is a bit tricky. After a first version of the binary data set is
-created, it must be checked with the "edid-decode" utility which will
-most probably complain about a wrong CRC. Fortunately, the utility also
-displays the correct CRC which must then be inserted into the source
-file. After the make procedure is repeated, the EDID data set is ready
-to be used.
index 17763ca3f12ba4048bed05e43ee86e21c24835f1..85a927dfab020af6338259241ca1c27e5f57c299 100644 (file)
@@ -15,10 +15,21 @@ clean:
 %.o:   %.S
        @cc -c $^
 
-%.bin: %.o
+%.bin.nocrc:   %.o
        @objcopy -Obinary $^ $@
 
-%.bin.ihex:    %.o
+%.crc: %.bin.nocrc
+       @list=$$(for i in `seq 1 127`; do head -c$$i $^ | tail -c1 \
+               | hexdump -v -e '/1 "%02X+"'; done); \
+               echo "ibase=16;100-($${list%?})%100" | bc >$@
+
+%.p:   %.crc %.S
+       @cc -c -DCRC="$$(cat $*.crc)" -o $@ $*.S
+
+%.bin: %.p
+       @objcopy -Obinary $^ $@
+
+%.bin.ihex:    %.p
        @objcopy -Oihex $^ $@
        @dos2unix $@ 2>/dev/null