Skip to content

Instantly share code, notes, and snippets.

@mrexodia
Created June 5, 2016 01:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrexodia/538e8528aae48fc707352d2444fe3086 to your computer and use it in GitHub Desktop.
Save mrexodia/538e8528aae48fc707352d2444fe3086 to your computer and use it in GitHub Desktop.
EDIDTemplate.bt.lex
Debugging "EDIDTemplate.bt"
tok_typedef
tok_uint16
tok_identifier "EISAId"
<
tok_identifier "read"
=
tok_identifier "EISAIdToString"
,
tok_identifier "write"
=
tok_identifier "StringToEISAId"
>
;
tok_string
tok_identifier "EISAIdToString"
(
tok_identifier "EISAId"
tok_identifier "x"
)
{
tok_uint16
tok_identifier "sw"
=
tok_identifier "SwapBytes"
(
tok_identifier "x"
)
;
tok_string
tok_identifier "s"
;
tok_identifier "SPrintf"
(
tok_identifier "s"
,
tok_stringlit "%c%c%c"
,
'
@
'
+
(
tok_identifier "sw"
>
>
tok_number 10 (0xA)
&
tok_number 31 (0x1F)
)
,
'
@
'
+
(
tok_identifier "sw"
>
>
tok_number 5 (0x5)
&
tok_number 31 (0x1F)
)
,
'
@
'
+
(
tok_identifier "sw"
>
>
tok_number 0 (0x0)
&
tok_number 31 (0x1F)
)
)
;
tok_return
tok_identifier "s"
;
}
tok_void
tok_identifier "StringToEISAId"
(
tok_identifier "EISAId"
&
tok_identifier "x"
,
tok_string
tok_identifier "s"
)
{
tok_char
tok_identifier "c"
[
tok_number 3 (0x3)
]
;
tok_identifier "SScan"
(
tok_identifier "s"
,
tok_stringlit "%c%c%c"
,
tok_identifier "c"
[
tok_number 0 (0x0)
]
,
tok_identifier "c"
[
tok_number 1 (0x1)
]
,
tok_identifier "c2"
[
tok_number 2 (0x2)
]
)
;
tok_identifier "x"
=
(
tok_identifier "c"
[
tok_number 0 (0x0)
]
-
'
@
'
)
<
<
tok_number 10 (0xA)
|
(
tok_identifier "c"
[
tok_number 1 (0x1)
]
-
'
@
'
)
<
<
tok_number 5 (0x5)
|
(
tok_identifier "c"
[
tok_number 2 (0x2)
]
-
'
@
'
)
<
<
tok_number 0 (0x0)
;
tok_identifier "x"
=
tok_identifier "SwapBytes"
(
tok_identifier "x"
)
;
}
tok_typedef
tok_struct
{
tok_ubyte
tok_identifier "x_resolution"
;
tok_ubyte
tok_identifier "vFrequency"
:
tok_number 6 (0x6)
;
tok_ubyte
tok_identifier "pixelRatio"
:
tok_number 2 (0x2)
;
}
tok_identifier "Timing"
<
tok_identifier "read"
=
tok_identifier "TimingToString"
>
;
tok_string
tok_identifier "TimingToString"
(
tok_identifier "Timing"
&
tok_identifier "t"
)
{
tok_if
(
tok_identifier "t"
.
tok_identifier "x_resolution"
=
=
tok_number 1 (0x1)
&
&
tok_identifier "t"
.
tok_identifier "vFrequency"
=
=
tok_number 1 (0x1)
&
&
tok_identifier "t"
.
tok_identifier "pixelRatio"
=
=
tok_number 0 (0x0)
)
tok_return
tok_stringlit "-"
;
tok_int
tok_identifier "x"
=
(
tok_identifier "t"
.
tok_identifier "x_resolution"
+
tok_number 31 (0x1F)
)
*
tok_number 8 (0x8)
;
tok_int
tok_identifier "y"
;
tok_switch
(
tok_identifier "t"
.
tok_identifier "pixelRatio"
)
{
tok_case
tok_number 0 (0x0)
:
tok_identifier "y"
=
tok_identifier "x"
*
tok_number 10 (0xA)
/
tok_number 16 (0x10)
;
tok_break
;
tok_case
tok_number 1 (0x1)
:
tok_identifier "y"
=
tok_identifier "x"
*
tok_number 3 (0x3)
/
tok_number 4 (0x4)
;
tok_break
;
tok_case
tok_number 2 (0x2)
:
tok_identifier "y"
=
tok_identifier "x"
*
tok_number 4 (0x4)
/
tok_number 5 (0x5)
;
tok_break
;
tok_case
tok_number 3 (0x3)
:
tok_identifier "y"
=
tok_identifier "x"
*
tok_number 9 (0x9)
/
tok_number 16 (0x10)
;
tok_break
;
}
tok_string
tok_identifier "s"
;
tok_identifier "SPrintf"
(
tok_identifier "s"
,
tok_stringlit "%ux%u, %uHz"
,
tok_identifier "x"
,
tok_identifier "y"
,
tok_identifier "t"
.
tok_identifier "vFrequency"
+
tok_number 60 (0x3C)
)
;
tok_return
tok_identifier "s"
;
}
tok_enum
<
tok_ubyte
>
tok_identifier "DescriptorType"
{
tok_identifier "TIMINGS"
=
tok_number 250 (0xFA)
,
tok_identifier "WHITE_POINT"
=
tok_number 251 (0xFB)
,
tok_identifier "MONITOR_NAME"
=
tok_number 252 (0xFC)
,
tok_identifier "RANGE_LIMITS"
=
tok_number 253 (0xFD)
,
tok_identifier "UNSPECIFIED_TEXT"
=
tok_number 254 (0xFE)
,
tok_identifier "SERIAL_NUMBER"
=
tok_number 255 (0xFF)
,
}
;
tok_enum
<
tok_ubyte
>
tok_identifier "FormatCode"
{
tok_identifier "RESERVED"
=
tok_number 0 (0x0)
,
tok_identifier "LPCM"
=
tok_number 1 (0x1)
,
tok_identifier "AC_3"
=
tok_number 2 (0x2)
,
tok_identifier "MPEG1"
=
tok_number 3 (0x3)
,
tok_identifier "MP3"
=
tok_number 4 (0x4)
,
tok_identifier "MPEG2"
=
tok_number 5 (0x5)
,
tok_identifier "AAC"
=
tok_number 6 (0x6)
,
tok_identifier "DTS"
=
tok_number 7 (0x7)
,
tok_identifier "ATRAC"
=
tok_number 8 (0x8)
,
tok_identifier "SACD"
=
tok_number 9 (0x9)
,
tok_identifier "DD_PLUS"
=
tok_number 10 (0xA)
,
tok_identifier "DTS_HD"
=
tok_number 11 (0xB)
,
tok_identifier "MLP_TRUEHD"
=
tok_number 12 (0xC)
,
tok_identifier "DST"
=
tok_number 13 (0xD)
,
tok_identifier "WMA_PRO"
=
tok_number 14 (0xE)
,
tok_identifier "RESERVED2"
=
tok_number 15 (0xF)
,
}
;
tok_enum
<
tok_ubyte
>
tok_identifier "BlockType"
{
tok_identifier "AUDIO"
=
tok_number 1 (0x1)
,
tok_identifier "VIDEO"
=
tok_number 2 (0x2)
,
tok_identifier "VENDOR_SPECIFIC"
=
tok_number 3 (0x3)
,
tok_identifier "SPEAKER"
=
tok_number 4 (0x4)
,
}
;
tok_enum
<
tok_ubyte
>
tok_identifier "SVDIndex"
{
tok_identifier "_DMT0659"
=
tok_number 1 (0x1)
,
tok_identifier "_480p"
=
tok_number 2 (0x2)
,
tok_identifier "_480pH"
=
tok_number 3 (0x3)
,
tok_identifier "_720p"
=
tok_number 4 (0x4)
,
tok_identifier "_1080i"
=
tok_number 5 (0x5)
,
tok_identifier "_480i"
=
tok_number 6 (0x6)
,
tok_identifier "_480iH"
=
tok_number 7 (0x7)
,
tok_identifier "_240p"
=
tok_number 8 (0x8)
,
tok_identifier "_240pH"
=
tok_number 9 (0x9)
,
tok_identifier "_480i4x"
=
tok_number 10 (0xA)
,
tok_identifier "_480i4xH"
=
tok_number 11 (0xB)
,
tok_identifier "_240p4x"
=
tok_number 12 (0xC)
,
tok_identifier "_240p4xH"
=
tok_number 13 (0xD)
,
tok_identifier "_480p2x"
=
tok_number 14 (0xE)
,
tok_identifier "_480p2xH"
=
tok_number 15 (0xF)
,
tok_identifier "_1080p"
=
tok_number 16 (0x10)
,
tok_identifier "_576p"
=
tok_number 17 (0x11)
,
tok_identifier "_576pH"
=
tok_number 18 (0x12)
,
tok_identifier "_720p50"
=
tok_number 19 (0x13)
,
tok_identifier "_1080i25"
=
tok_number 20 (0x14)
,
tok_identifier "_576i"
=
tok_number 21 (0x15)
,
tok_identifier "_576iH"
=
tok_number 22 (0x16)
,
tok_identifier "_288p"
=
tok_number 23 (0x17)
,
tok_identifier "_288pH"
=
tok_number 24 (0x18)
,
tok_identifier "_576i4x"
=
tok_number 25 (0x19)
,
tok_identifier "_576i4xH"
=
tok_number 26 (0x1A)
,
tok_identifier "_288p4x"
=
tok_number 27 (0x1B)
,
tok_identifier "_288p4xH"
=
tok_number 28 (0x1C)
,
tok_identifier "_576p2x"
=
tok_number 29 (0x1D)
,
tok_identifier "_576p2xH"
=
tok_number 30 (0x1E)
,
tok_identifier "_1080p50"
=
tok_number 31 (0x1F)
,
tok_identifier "_1080p24"
=
tok_number 32 (0x20)
,
tok_identifier "_1080p25"
=
tok_number 33 (0x21)
,
tok_identifier "_1080p30"
=
tok_number 34 (0x22)
,
tok_identifier "_480p4x"
=
tok_number 35 (0x23)
,
tok_identifier "_480p4xH"
=
tok_number 36 (0x24)
,
tok_identifier "_576p4x"
=
tok_number 37 (0x25)
,
tok_identifier "_576p4xH"
=
tok_number 38 (0x26)
,
tok_identifier "_1080i25b"
=
tok_number 39 (0x27)
,
tok_identifier "_1080i50"
=
tok_number 40 (0x28)
,
tok_identifier "_720p100"
=
tok_number 41 (0x29)
,
tok_identifier "_576p100"
=
tok_number 42 (0x2A)
,
tok_identifier "_576p100H"
=
tok_number 43 (0x2B)
,
tok_identifier "_576i50"
=
tok_number 44 (0x2C)
,
tok_identifier "_576i50H"
=
tok_number 45 (0x2D)
,
tok_identifier "_1080i60"
=
tok_number 46 (0x2E)
,
tok_identifier "_720p120"
=
tok_number 47 (0x2F)
,
tok_identifier "_480p119"
=
tok_number 48 (0x30)
,
tok_identifier "_480p119H"
=
tok_number 49 (0x31)
,
tok_identifier "_480i59"
=
tok_number 50 (0x32)
,
tok_identifier "_480i59H"
=
tok_number 51 (0x33)
,
tok_identifier "_576p200"
=
tok_number 52 (0x34)
,
tok_identifier "_576p200H"
=
tok_number 53 (0x35)
,
tok_identifier "_576i100"
=
tok_number 54 (0x36)
,
tok_identifier "_576i100H"
=
tok_number 55 (0x37)
,
tok_identifier "_480p239"
=
tok_number 56 (0x38)
,
tok_identifier "_480p239H"
=
tok_number 57 (0x39)
,
tok_identifier "_480i119"
=
tok_number 58 (0x3A)
,
tok_identifier "_480i119H"
=
tok_number 59 (0x3B)
,
tok_identifier "_720p24"
=
tok_number 60 (0x3C)
,
tok_identifier "_720p25"
=
tok_number 61 (0x3D)
,
tok_identifier "_720p30"
=
tok_number 62 (0x3E)
,
tok_identifier "_1080p120"
=
tok_number 63 (0x3F)
,
}
;
tok_typedef
tok_struct
{
tok_identifier "SVDIndex"
tok_identifier "index"
:
tok_number 7 (0x7)
<
tok_identifier "comment"
=
tok_stringlit "index value to a table of standard resolutions/timings from CEA/EIA-861E"
>
;
tok_ubyte
tok_identifier "native"
:
tok_number 1 (0x1)
<
tok_identifier "comment"
=
tok_stringlit "1 to designate that this should be considered a \"native\" resolution, 0 for non-native"
>
;
}
tok_identifier "SVD"
<
tok_identifier "read"
=
tok_identifier "SVDToString"
,
tok_identifier "comment"
=
tok_stringlit "Short Video Descriptor"
>
;
tok_string
tok_identifier "SVDToString"
(
tok_identifier "SVD"
&
tok_identifier "svd"
)
{
tok_string
tok_identifier "s"
;
tok_identifier "SPrintf"
(
tok_identifier "s"
,
tok_stringlit "%s%s (%u)"
,
(
tok_identifier "svd"
.
tok_identifier "native"
?
tok_stringlit "*"
:
tok_stringlit ""
)
,
tok_identifier "EnumToString"
(
tok_identifier "svd"
.
tok_identifier "index"
)
,
tok_identifier "svd"
.
tok_identifier "index"
)
;
tok_return
tok_identifier "s"
;
}
tok_string
tok_identifier "SPAToString"
(
tok_uint16
tok_identifier "spa"
)
{
tok_string
tok_identifier "s"
;
tok_identifier "SPrintf"
(
tok_identifier "s"
,
tok_stringlit "%u.%u.%u.%u"
,
tok_identifier "spa"
>
>
tok_number 4 (0x4)
&
tok_number 15 (0xF)
,
tok_identifier "spa"
>
>
tok_number 0 (0x0)
&
tok_number 15 (0xF)
,
tok_identifier "spa"
>
>
tok_number 12 (0xC)
&
tok_number 15 (0xF)
,
tok_identifier "spa"
>
>
tok_number 8 (0x8)
&
tok_number 15 (0xF)
)
;
tok_return
tok_identifier "s"
;
}
tok_string
tok_identifier "TDMSFreqToString"
(
tok_ubyte
tok_identifier "f"
)
{
tok_string
tok_identifier "s"
;
tok_identifier "SPrintf"
(
tok_identifier "s"
,
tok_stringlit "%u MHz"
,
(
tok_uint
)
tok_identifier "f"
*
tok_number 5 (0x5)
)
;
tok_return
tok_identifier "s"
;
}
tok_string
tok_identifier "PixelClockToString"
(
tok_uint16
tok_identifier "f"
)
{
tok_string
tok_identifier "s"
;
tok_identifier "SPrintf"
(
tok_identifier "s"
,
tok_stringlit "%.2lf MHz"
,
(
tok_double
)
tok_identifier "f"
/
tok_number 100 (0x64)
)
;
tok_return
tok_identifier "s"
;
}
tok_void
tok_identifier "StringToPixelClock"
(
tok_uint16
&
tok_identifier "f"
,
tok_string
tok_identifier "s"
)
{
tok_identifier "f"
=
tok_identifier "Atof"
(
tok_identifier "s"
)
*
tok_number 100 (0x64)
;
}
tok_typedef
tok_ubyte
tok_identifier "PixelRate"
<
tok_identifier "read"
=
tok_identifier "PixelRateToString"
,
tok_identifier "write"
=
tok_identifier "StringToPixelRate"
>
;
tok_string
tok_identifier "PixelRateToString"
(
tok_identifier "PixelRate"
tok_identifier "f"
)
{
tok_string
tok_identifier "s"
;
tok_identifier "SPrintf"
(
tok_identifier "s"
,
tok_stringlit "%u MHz"
,
(
tok_uint
)
tok_identifier "f"
*
tok_number 10 (0xA)
)
;
tok_return
tok_identifier "s"
;
}
tok_void
tok_identifier "StringToPixelRate"
(
tok_identifier "PixelRate"
&
tok_identifier "f"
,
tok_string
tok_identifier "s"
)
{
tok_identifier "f"
=
tok_identifier "Atof"
(
tok_identifier "s"
)
/
tok_number 10 (0xA)
;
}
tok_typedef
tok_ubyte
tok_identifier "BitRate"
<
tok_identifier "read"
=
tok_identifier "BitRateToString"
,
tok_identifier "write"
=
tok_identifier "StringToBitRate"
,
tok_identifier "comment"
=
tok_stringlit "maximum supported bitrate divided by 8 kbit/s"
>
;
tok_string
tok_identifier "BitRateToString"
(
tok_identifier "BitRate"
tok_identifier "b"
)
{
tok_string
tok_identifier "s"
;
tok_identifier "SPrintf"
(
tok_identifier "s"
,
tok_stringlit "%u kHz"
,
(
tok_uint
)
tok_identifier "b"
*
tok_number 8 (0x8)
)
;
tok_return
tok_identifier "s"
;
}
tok_void
tok_identifier "StringToBitRate"
(
tok_identifier "BitRate"
&
tok_identifier "b"
,
tok_string
tok_identifier "s"
)
{
tok_identifier "b"
=
tok_identifier "Atof"
(
tok_identifier "s"
)
/
tok_number 8 (0x8)
;
}
tok_typedef
tok_ubyte
tok_identifier "Latency"
<
tok_identifier "read"
=
tok_identifier "LatencyToString"
,
tok_identifier "write"
=
tok_identifier "StringToLatency"
,
tok_identifier "comment"
=
tok_stringlit "Latency (value=1+ms/2 with a max of 251 meaning 500ms)"
>
;
tok_string
tok_identifier "LatencyToString"
(
tok_identifier "Latency"
tok_identifier "l"
)
{
tok_if
(
tok_identifier "l"
=
=
tok_number 0 (0x0)
)
tok_return
tok_stringlit "-"
;
tok_string
tok_identifier "s"
;
tok_identifier "SPrintf"
(
tok_identifier "s"
,
tok_stringlit "%u ms"
,
(
(
tok_uint
)
tok_identifier "l"
-
tok_number 1 (0x1)
)
*
tok_number 2 (0x2)
)
;
tok_return
tok_identifier "s"
;
}
tok_void
tok_identifier "StringToLatency"
(
tok_identifier "Latency"
&
tok_identifier "l"
,
tok_string
tok_identifier "s"
)
{
tok_if
(
tok_identifier "s"
=
=
tok_stringlit "-"
)
tok_identifier "l"
=
tok_number 0 (0x0)
;
tok_else
tok_identifier "l"
=
(
tok_uint
)
(
tok_identifier "Atof"
(
tok_identifier "s"
)
/
tok_number 2 (0x2)
)
+
tok_number 1 (0x1)
;
}
tok_typedef
tok_struct
{
tok_ubyte
tok_identifier "size"
:
tok_number 5 (0x5)
<
tok_identifier "comment"
=
tok_stringlit "Total number of bytes in this block following this byte"
>
;
tok_identifier "BlockType"
tok_identifier "typeTag"
:
tok_number 3 (0x3)
<
tok_identifier "comment"
=
tok_stringlit "Block Type Tag (1 is audio, 2 is video, 3 is vendor specific, 4 is speaker allocation, all other values Reserved)"
>
;
tok_switch
(
tok_identifier "typeTag"
)
{
tok_case
tok_identifier "AUDIO"
:
{
tok_ubyte
tok_identifier "channelCount"
:
tok_number 3 (0x3)
<
tok_identifier "comment"
=
tok_stringlit "number of channels minus 1"
>
;
tok_identifier "FormatCode"
tok_identifier "formatCode"
:
tok_number 4 (0x4)
<
tok_identifier "comment"
=
tok_stringlit "Audio format code"
>
;
tok_ubyte
tok_identifier "reserved1"
:
tok_number 1 (0x1)
;
tok_struct
tok_identifier "SampleRates"
{
tok_ubyte
tok_identifier "_32kHz"
:
tok_number 1 (0x1)
;
tok_ubyte
tok_identifier "_44kHz"
:
tok_number 1 (0x1)
;
tok_ubyte
tok_identifier "_48kHz"
:
tok_number 1 (0x1)
;
tok_ubyte
tok_identifier "_88kHz"
:
tok_number 1 (0x1)
;
tok_ubyte
tok_identifier "_96kHz"
:
tok_number 1 (0x1)
;
tok_ubyte
tok_identifier "_176kHz"
:
tok_number 1 (0x1)
;
tok_ubyte
tok_identifier "_192kHz"
:
tok_number 1 (0x1)
;
tok_ubyte
tok_identifier "reserved"
:
tok_number 1 (0x1)
;
}
tok_identifier "sampleRates"
<
tok_identifier "comment"
=
tok_stringlit "sampling frequencies supported"
>
;
tok_if
(
tok_identifier "formatCode"
=
=
tok_number 1 (0x1)
)
{
tok_ubyte
tok_identifier "_16bits"
:
tok_number 1 (0x1)
;
tok_ubyte
tok_identifier "_20bits"
:
tok_number 1 (0x1)
;
tok_ubyte
tok_identifier "_24bits"
:
tok_number 1 (0x1)
;
tok_ubyte
tok_identifier "reserved"
:
tok_number 5 (0x5)
;
}
tok_else
{
tok_identifier "BitRate"
tok_identifier "bitrate"
;
}
tok_break
;
}
tok_case
tok_identifier "VIDEO"
:
{
tok_identifier "SVD"
tok_identifier "svds"
[
tok_identifier "size"
]
<
tok_identifier "bgcolor"
=
tok_identifier "cLtGreen"
,
tok_identifier "comment"
=
tok_stringlit "Short Video Descriptors"
>
;
tok_break
;
}
tok_case
tok_identifier "VENDOR_SPECIFIC"
:
{
tok_ubyte
tok_identifier "oui"
[
tok_number 3 (0x3)
]
<
tok_identifier "format"
=
tok_identifier "hex"
,
tok_identifier "comment"
=
tok_stringlit "IEEE Registration Identifier"
>
;
tok_uint16
tok_identifier "spa"
<
tok_identifier "read"
=
tok_identifier "SPAToString"
,
tok_identifier "comment"
=
tok_stringlit "Source Physical Address"
>
;
tok_if
(
tok_identifier "size"
>
=
tok_number 3 (0x3)
)
{
tok_ubyte
tok_identifier "DVI_Dual"
:
tok_number 1 (0x1)
<
tok_identifier "comment"
=
tok_stringlit "sink supports DVI Dual Link Operation"
>
;
tok_ubyte
tok_identifier "reserved"
:
tok_number 1 (0x1)
;
tok_ubyte
tok_identifier "reserved"
:
tok_number 1 (0x1)
;
tok_ubyte
tok_identifier "dc_Y444"
:
tok_number 1 (0x1)
<
tok_identifier "comment"
=
tok_stringlit "sink supports 4:4:4 in deep color modes"
>
;
tok_ubyte
tok_identifier "dc_30bit"
:
tok_number 1 (0x1)
<
tok_identifier "comment"
=
tok_stringlit "sink supports 10-bit-per-channel deep color"
>
;
tok_ubyte
tok_identifier "dc_36bit"
:
tok_number 1 (0x1)
<
tok_identifier "comment"
=
tok_stringlit "sink supports 12-bit-per-channel deep color"
>
;
tok_ubyte
tok_identifier "dc_48bit"
:
tok_number 1 (0x1)
<
tok_identifier "comment"
=
tok_stringlit "sink supports 16-bit-per-channel deep color"
>
;
tok_ubyte
tok_identifier "supports_AI"
:
tok_number 1 (0x1)
<
tok_identifier "comment"
=
tok_stringlit "sink supports a function that needs info from ACP or ISRC packets"
>
;
}
tok_if
(
tok_identifier "size"
>
=
tok_number 4 (0x4)
)
tok_ubyte
tok_identifier "max_TMDS_Frequency"
<
tok_identifier "read"
=
tok_identifier "TDMSFreqToString"
,
tok_identifier "comment"
=
tok_stringlit "Maximum TMDS frequency"
>
;
tok_if
(
tok_identifier "size"
>
=
tok_number 5 (0x5)
)
{
tok_ubyte
tok_identifier "reserved"
:
tok_number 6 (0x6)
;
tok_ubyte
tok_identifier "i_latency_fields"
:
tok_number 1 (0x1)
<
tok_identifier "comment"
=
tok_stringlit "set if interlaced latency fields are present; if set four latency fields will be present"
>
;
tok_ubyte
tok_identifier "latency_fields"
:
tok_number 1 (0x1)
<
tok_identifier "comment"
=
tok_stringlit "set if latency fields are present"
>
;
tok_if
(
tok_identifier "latency_fields"
)
{
tok_identifier "Latency"
tok_identifier "videoLatency"
<
tok_identifier "comment"
=
tok_stringlit "Video Latency (value=1+ms/2 with a max of 251 meaning 500ms)"
>
;
tok_identifier "Latency"
tok_identifier "audioLatency"
<
tok_identifier "comment"
=
tok_stringlit "Audio Latency (value=1+ms/2 with a max of 251 meaning 500ms)"
>
;
}
tok_if
(
tok_identifier "i_latency_fields"
)
{
tok_identifier "Latency"
tok_identifier "interlacedVideoLatency"
<
tok_identifier "comment"
=
tok_stringlit "Interlaced Video Latency (value=1+ms/2 with a max of 251 meaning 500ms)"
>
;
tok_identifier "Latency"
tok_identifier "interlacedAudioLatency"
<
tok_identifier "comment"
=
tok_stringlit "Interlaced Audio Latency (value=1+ms/2 with a max of 251 meaning 500ms)"
>
;
}
}
tok_break
;
}
tok_case
tok_identifier "SPEAKER"
:
{
tok_ubyte
tok_identifier "frontLeftRight"
:
tok_number 1 (0x1)
<
tok_identifier "comment"
=
tok_stringlit "Front Left / Front Right present for 1, absent for 0"
>
;
tok_ubyte
tok_identifier "LFE"
:
tok_number 1 (0x1)
<
tok_identifier "comment"
=
tok_stringlit "LFE present for 1, absent for 0"
>
;
tok_ubyte
tok_identifier "frontCenter"
:
tok_number 1 (0x1)
<
tok_identifier "comment"
=
tok_stringlit "Front Center present for 1, absent for 0"
>
;
tok_ubyte
tok_identifier "rearLeftRight"
:
tok_number 1 (0x1)
<
tok_identifier "comment"
=
tok_stringlit "Rear Left / Rear Right present for 1, absent for 0"
>
;
tok_ubyte
tok_identifier "rearCenter"
:
tok_number 1 (0x1)
<
tok_identifier "comment"
=
tok_stringlit "Rear Center present for 1, absent for 0"
>
;
tok_ubyte
tok_identifier "frontLeftRightCenter"
:
tok_number 1 (0x1)
<
tok_identifier "comment"
=
tok_stringlit "Front Left Center / Front Right Center present for 1, absent for 0"
>
;
tok_ubyte
tok_identifier "rearLeftRightCenter"
:
tok_number 1 (0x1)
<
tok_identifier "comment"
=
tok_stringlit "Rear Left Center / Rear Right Center present for 1, absent for 0"
>
;
tok_ubyte
tok_identifier "reserved"
:
tok_number 1 (0x1)
;
tok_ubyte
tok_identifier "reserved"
[
tok_number 2 (0x2)
]
;
tok_break
;
}
}
/
*
tok_identifier "Assert"
(
tok_identifier "dataEnd"
-
tok_identifier "dataStart"
<
=
tok_identifier "size"
,
tok_stringlit "Data block size error"
)
;
tok_if
(
tok_identifier "dataEnd"
-
tok_identifier "dataStart"
<
tok_identifier "size"
)
{
tok_ubyte
tok_identifier "extraData"
[
tok_identifier "size"
-
(
tok_identifier "dataEnd"
-
tok_identifier "dataStart"
)
]
;
}
*
/
}
tok_identifier "DataBlock"
<
tok_identifier "size"
=
tok_identifier "DataBlockSize"
,
tok_identifier "optimize"
=
tok_false
,
tok_identifier "open"
=
tok_true
,
tok_identifier "comment"
=
tok_stringlit "Data block"
>
;
tok_int
tok_identifier "DataBlockSize"
(
tok_identifier "DataBlock"
&
tok_identifier "b"
)
{
tok_return
(
tok_identifier "ReadUByte"
(
tok_identifier "startof"
(
tok_identifier "b"
)
)
&
tok_number 31 (0x1F)
)
;
}
tok_typedef
tok_struct
{
tok_uint16
tok_identifier "pixelClock"
<
tok_identifier "read"
=
tok_identifier "PixelClockToString"
,
tok_identifier "write"
=
tok_identifier "StringToPixelClock"
,
tok_identifier "comment"
=
tok_stringlit "Pixel clock in 10 kHz units. (0.01-655.35 MHz, little-endian)"
>
;
tok_ubyte
tok_identifier "hActive_lsb"
<
tok_identifier "comment"
=
tok_stringlit "Horizontal active pixels 8 lsbits (0-4095)"
>
;
tok_ubyte
tok_identifier "hBlanking_lsb"
<
tok_identifier "comment"
=
tok_stringlit "Horizontal blanking pixels 8 lsbits (0-4095) End of active to start of next active."
>
;
tok_ubyte
tok_identifier "hBlanking_msb"
:
tok_number 4 (0x4)
<
tok_identifier "comment"
=
tok_stringlit "Horizontal blanking pixels 4 msbits"
>
;
tok_ubyte
tok_identifier "hActive_msb"
:
tok_number 4 (0x4)
<
tok_identifier "comment"
=
tok_stringlit "Horizontal active pixels 4 msbits"
>
;
tok_ubyte
tok_identifier "vActive_lsb"
<
tok_identifier "comment"
=
tok_stringlit "Vertical active lines 8 lsbits (0-4095)"
>
;
tok_ubyte
tok_identifier "vBlanking_lsb"
<
tok_identifier "comment"
=
tok_stringlit "Vertical blanking lines 8 lsbits (0-4095)"
>
;
tok_ubyte
tok_identifier "vBlanking_msb"
:
tok_number 4 (0x4)
<
tok_identifier "comment"
=
tok_stringlit "Vertical blanking lines 4 msbits"
>
;
tok_ubyte
tok_identifier "vActive_msb"
:
tok_number 4 (0x4)
<
tok_identifier "comment"
=
tok_stringlit "Vertical active lines 4 msbits"
>
;
tok_ubyte
tok_identifier "hSyncOffset_lsb"
<
tok_identifier "comment"
=
tok_stringlit "Horizontal sync offset pixels 8 lsbits (0-1023) From blanking start"
>
;
tok_ubyte
tok_identifier "hSync_lsb"
<
tok_identifier "comment"
=
tok_stringlit "Horizontal sync pulse width pixels 8 lsbits (0-1023)"
>
;
tok_ubyte
tok_identifier "vSync_lsb"
:
tok_number 4 (0x4)
<
tok_identifier "comment"
=
tok_stringlit "Vertical sync pulse width lines 4 lsbits (0-63)"
>
;
tok_ubyte
tok_identifier "vSyncOffset_lsb"
:
tok_number 4 (0x4)
<
tok_identifier "comment"
=
tok_stringlit "Vertical sync offset lines 4 lsbits (0-63)"
>
;
tok_ubyte
tok_identifier "vSync_msb"
:
tok_number 2 (0x2)
<
tok_identifier "comment"
=
tok_stringlit "Vertical sync pulse width lines 2 msbits"
>
;
tok_ubyte
tok_identifier "vSyncOffset_msb"
:
tok_number 2 (0x2)
<
tok_identifier "comment"
=
tok_stringlit "Vertical sync offset lines 2 msbits"
>
;
tok_ubyte
tok_identifier "hSync_msb"
:
tok_number 2 (0x2)
<
tok_identifier "comment"
=
tok_stringlit "Horizontal sync pulse width pixels 2 msbits"
>
;
tok_ubyte
tok_identifier "hSyncOffset_msb"
:
tok_number 2 (0x2)
<
tok_identifier "comment"
=
tok_stringlit "Horizontal sync offset pixels 2 msbits"
>
;
tok_ubyte
tok_identifier "hSize_lsb"
<
tok_identifier "comment"
=
tok_stringlit "Horizontal display size, mm, 8 lsbits (0-4095 mm, 161 in)"
>
;
tok_ubyte
tok_identifier "vSize_lsb"
<
tok_identifier "comment"
=
tok_stringlit "Vertical display size, mm, 8 lsbits (0-4095 mm, 161 in)"
>
;
tok_ubyte
tok_identifier "vSize_msb"
:
tok_number 4 (0x4)
<
tok_identifier "comment"
=
tok_stringlit "Vertical display size, mm, 4 msbits"
>
;
tok_ubyte
tok_identifier "hSize_msb"
:
tok_number 4 (0x4)
<
tok_identifier "comment"
=
tok_stringlit "Horizontal display size, mm, 4 msbits"
>
;
tok_ubyte
tok_identifier "hBorder"
<
tok_identifier "comment"
=
tok_stringlit "Horizontal border pixels (each side; total is twice this)"
>
;
tok_ubyte
tok_identifier "vBorder"
<
tok_identifier "comment"
=
tok_stringlit "Vertical border lines (each side; total is twice this)"
>
;
tok_ubyte
tok_identifier "_f0"
:
tok_number 1 (0x1)
<
tok_identifier "comment"
=
tok_stringlit "2-way line-interleaved stereo, if bits 4-3 are not 00."
>
;
tok_ubyte
tok_identifier "_f1"
:
tok_number 1 (0x1)
<
tok_identifier "comment"
=
tok_stringlit "If analog sync: Sync on all 3 RGB lines (else green only). Digital: HSync polarity (1=positive)"
>
;
tok_ubyte
tok_identifier "_f2"
:
tok_number 1 (0x1)
<
tok_identifier "comment"
=
tok_stringlit "If digital separate: Vertical sync polarity (1=positive). Other types: VSync serrated (HSync during VSync)"
>
;
tok_ubyte
tok_identifier "_f34"
:
tok_number 2 (0x2)
<
tok_identifier "comment"
=
tok_stringlit "Sync type: 00=Analog composite; 01=Bipolar analog composite; 10=Digital composite (on HSync); 11=Digital separate"
>
;
tok_ubyte
tok_identifier "_f56"
:
tok_number 2 (0x2)
<
tok_identifier "comment"
=
tok_stringlit "Stereo mode: 00=No stereo; other values depend on bit 0: Bit 0=0: 01=Field sequential, sync=1 during right; 10=similar, sync=1 during left; 11=4-way interleaved stereo. Bit 0=1 2-way interleaved stereo: 01=Right image on even lines; 10=Left image on even lines; 11=side-by-side"
>
;
tok_ubyte
tok_identifier "interlaced"
:
tok_number 1 (0x1)
<
tok_identifier "comment"
=
tok_stringlit "Interlaced"
>
;
}
tok_identifier "ModeLine"
<
tok_identifier "read"
=
tok_identifier "ModeLineToString"
,
tok_identifier "write"
=
tok_identifier "StringToModeLine"
,
tok_identifier "comment"
=
tok_stringlit "Xfree86 modeline"
>
;
tok_string
tok_identifier "ModeLineToString"
(
tok_identifier "ModeLine"
&
tok_identifier "n"
)
{
tok_uint
tok_identifier "hActive"
=
(
tok_uint
)
tok_identifier "n"
.
tok_identifier "hActive_msb"
<
<
tok_number 8 (0x8)
|
tok_identifier "n"
.
tok_identifier "hActive_lsb"
;
tok_uint
tok_identifier "hSyncOffset"
=
(
tok_uint
)
tok_identifier "n"
.
tok_identifier "hSyncOffset_msb"
<
<
tok_number 8 (0x8)
|
tok_identifier "n"
.
tok_identifier "hSyncOffset_lsb"
;
tok_uint
tok_identifier "hSync"
=
(
tok_uint
)
tok_identifier "n"
.
tok_identifier "hSync_msb"
<
<
tok_number 8 (0x8)
|
tok_identifier "n"
.
tok_identifier "hSync_lsb"
;
tok_uint
tok_identifier "hBlanking"
=
(
tok_uint
)
tok_identifier "n"
.
tok_identifier "hBlanking_msb"
<
<
tok_number 8 (0x8)
|
tok_identifier "n"
.
tok_identifier "hBlanking_lsb"
;
tok_uint
tok_identifier "vActive"
=
(
tok_uint
)
tok_identifier "n"
.
tok_identifier "vActive_msb"
<
<
tok_number 8 (0x8)
|
tok_identifier "n"
.
tok_identifier "vActive_lsb"
;
tok_uint
tok_identifier "vSyncOffset"
=
(
tok_uint
)
tok_identifier "n"
.
tok_identifier "vSyncOffset_msb"
<
<
tok_number 8 (0x8)
|
tok_identifier "n"
.
tok_identifier "vSyncOffset_lsb"
;
tok_uint
tok_identifier "vSync"
=
(
tok_uint
)
tok_identifier "n"
.
tok_identifier "vSync_msb"
<
<
tok_number 8 (0x8)
|
tok_identifier "n"
.
tok_identifier "vSync_lsb"
;
tok_uint
tok_identifier "vBlanking"
=
(
tok_uint
)
tok_identifier "n"
.
tok_identifier "vBlanking_msb"
<
<
tok_number 8 (0x8)
|
tok_identifier "n"
.
tok_identifier "vBlanking_lsb"
;
tok_uint
tok_identifier "im"
=
tok_identifier "n"
.
tok_identifier "interlaced"
?
tok_number 2 (0x2)
:
tok_number 1 (0x1)
;
tok_string
tok_identifier "s"
;
tok_identifier "SPrintf"
(
tok_identifier "s"
,
tok_stringlit "Modeline \"%ux%u\" %.2lf %4u %4u %4u %4u %4u %4u %4u %4u %chsync %cvsync %s ; %u %u"
,
tok_identifier "hActive"
,
tok_identifier "vActive"
*
tok_identifier "im"
,
(
tok_double
)
tok_identifier "n"
.
tok_identifier "pixelClock"
/
tok_number 100 (0x64)
,
tok_identifier "hActive"
,
tok_identifier "hActive"
+
tok_identifier "hSyncOffset"
,
tok_identifier "hActive"
+
tok_identifier "hSyncOffset"
+
tok_identifier "hSync"
,
tok_identifier "hActive"
+
tok_identifier "hBlanking"
,
tok_identifier "vActive"
*
tok_identifier "im"
,
(
tok_identifier "vActive"
+
tok_identifier "vSyncOffset"
)
*
tok_identifier "im"
,
(
tok_identifier "vActive"
+
tok_identifier "vSyncOffset"
+
tok_identifier "vSync"
)
*
tok_identifier "im"
,
(
tok_identifier "vActive"
+
tok_identifier "vBlanking"
)
*
tok_identifier "im"
,
tok_identifier "n"
.
tok_identifier "_f1"
?
'
+
'
:
'
-
'
,
tok_identifier "n"
.
tok_identifier "_f2"
?
'
+
'
:
'
-
'
,
tok_identifier "n"
.
tok_identifier "interlaced"
?
tok_stringlit "Interlace"
:
tok_stringlit ""
,
tok_identifier "n"
.
tok_identifier "hBorder"
,
tok_identifier "n"
.
tok_identifier "vBorder"
)
;
tok_return
tok_identifier "s"
;
}
tok_void
tok_identifier "StringToModeLine"
(
tok_identifier "ModeLine"
&
tok_identifier "n"
,
tok_string
tok_identifier "s"
)
{
tok_uint
tok_identifier "dummy"
;
tok_uint
tok_identifier "hActive"
,
tok_identifier "hActive_hSyncOffset"
,
tok_identifier "hActive_hSyncOffset_hSync"
,
tok_identifier "hActive_hBlanking"
;
tok_uint
tok_identifier "vActive"
,
tok_identifier "vActive_vSyncOffset"
,
tok_identifier "vActive_vSyncOffset_vSync"
,
tok_identifier "vActive_vBlanking"
;
tok_char
tok_identifier "hsync"
,
tok_identifier "vsync"
;
tok_string
tok_identifier "interlaced"
;
tok_double
tok_identifier "f"
;
tok_identifier "SScanf"
(
tok_identifier "s"
,
tok_stringlit "Modeline \"%ux%u\" %lf %u %u %u %u %u %u %u %u %chsync %cvsync %[^0-9;]"
,
tok_identifier "dummy"
,
tok_identifier "dummy"
,
tok_identifier "f"
,
tok_identifier "hActive"
,
tok_identifier "hActive_hSyncOffset"
,
tok_identifier "hActive_hSyncOffset_hSync"
,
tok_identifier "hActive_hBlanking"
,
tok_identifier "vActive"
,
tok_identifier "vActive_vSyncOffset"
,
tok_identifier "vActive_vSyncOffset_vSync"
,
tok_identifier "vActive_vBlanking"
,
tok_identifier "hsync"
,
tok_identifier "vsync"
,
tok_identifier "interlaced"
)
;
tok_int
tok_identifier "p"
=
tok_identifier "Strchr"
(
tok_identifier "s"
,
'
;
'
)
;
tok_if
(
tok_identifier "p"
>
=
tok_number 0 (0x0)
)
tok_identifier "SScanf"
(
tok_identifier "SubStr"
(
tok_identifier "s"
,
tok_identifier "p"
)
,
tok_stringlit "; %u %u"
,
tok_identifier "n"
.
tok_identifier "hBorder"
,
tok_identifier "n"
.
tok_identifier "vBorder"
)
;
tok_identifier "n"
.
tok_identifier "interlaced"
=
(
tok_identifier "interlaced"
[
tok_number 0 (0x0)
]
=
=
'
tok_identifier "I"
'
)
;
tok_uint
tok_identifier "im"
=
tok_identifier "n"
.
tok_identifier "interlaced"
?
tok_number 2 (0x2)
:
tok_number 1 (0x1)
;
tok_uint
tok_identifier "hBlanking"
=
tok_identifier "hActive_hBlanking"
-
tok_identifier "hActive"
;
tok_uint
tok_identifier "hSync"
=
tok_identifier "hActive_hSyncOffset_hSync"
-
tok_identifier "hActive_hSyncOffset"
;
tok_uint
tok_identifier "hSyncOffset"
=
tok_identifier "hActive_hSyncOffset"
-
tok_identifier "hActive"
;
tok_identifier "n"
.
tok_identifier "hActive_msb"
=
tok_identifier "hActive"
>
>
tok_number 8 (0x8)
;
tok_identifier "n"
.
tok_identifier "hActive_lsb"
=
(
tok_ubyte
)
tok_identifier "hActive"
;
tok_identifier "n"
.
tok_identifier "hSyncOffset_msb"
=
tok_identifier "hSyncOffset"
>
>
tok_number 8 (0x8)
;
tok_identifier "n"
.
tok_identifier "hSyncOffset_lsb"
=
(
tok_ubyte
)
tok_identifier "hSyncOffset"
;
tok_identifier "n"
.
tok_identifier "hSync_msb"
=
tok_identifier "hSync"
>
>
tok_number 8 (0x8)
;
tok_identifier "n"
.
tok_identifier "hSync_lsb"
=
(
tok_ubyte
)
tok_identifier "hSync"
;
tok_identifier "n"
.
tok_identifier "hBlanking_msb"
=
tok_identifier "hBlanking"
>
>
tok_number 8 (0x8)
;
tok_identifier "n"
.
tok_identifier "hBlanking_lsb"
=
(
tok_ubyte
)
tok_identifier "hBlanking"
;
tok_uint
tok_identifier "vBlanking"
=
(
tok_identifier "vActive_vBlanking"
-
tok_identifier "vActive"
)
/
tok_identifier "im"
;
tok_uint
tok_identifier "vSync"
=
(
tok_identifier "vActive_vSyncOffset_vSync"
-
tok_identifier "vActive_vSyncOffset"
)
/
tok_identifier "im"
;
tok_uint
tok_identifier "vSyncOffset"
=
(
tok_identifier "vActive_vSyncOffset"
-
tok_identifier "vActive"
)
/
tok_identifier "im"
;
tok_identifier "vActive"
/
=
tok_identifier "im"
;
tok_identifier "n"
.
tok_identifier "vActive_msb"
=
tok_identifier "vActive"
>
>
tok_number 8 (0x8)
;
tok_identifier "n"
.
tok_identifier "vActive_lsb"
=
(
tok_ubyte
)
tok_identifier "vActive"
;
tok_identifier "n"
.
tok_identifier "vSyncOffset_msb"
=
tok_identifier "vSyncOffset"
>
>
tok_number 8 (0x8)
;
tok_identifier "n"
.
tok_identifier "vSyncOffset_lsb"
=
(
tok_ubyte
)
tok_identifier "vSyncOffset"
;
tok_identifier "n"
.
tok_identifier "vSync_msb"
=
tok_identifier "vSync"
>
>
tok_number 8 (0x8)
;
tok_identifier "n"
.
tok_identifier "vSync_lsb"
=
(
tok_ubyte
)
tok_identifier "vSync"
;
tok_identifier "n"
.
tok_identifier "vBlanking_msb"
=
tok_identifier "vBlanking"
>
>
tok_number 8 (0x8)
;
tok_identifier "n"
.
tok_identifier "vBlanking_lsb"
=
(
tok_ubyte
)
tok_identifier "vBlanking"
;
tok_identifier "n"
.
tok_identifier "_f1"
=
tok_identifier "hsync"
=
=
'
+
'
?
tok_number 1 (0x1)
:
tok_number 0 (0x0)
;
tok_identifier "n"
.
tok_identifier "_f2"
=
tok_identifier "vsync"
=
=
'
+
'
?
tok_number 1 (0x1)
:
tok_number 0 (0x0)
;
tok_identifier "n"
.
tok_identifier "pixelClock"
=
tok_identifier "f"
*
tok_number 100 (0x64)
;
}
tok_struct
tok_identifier "File"
{
tok_struct
tok_identifier "Header"
{
tok_ubyte
tok_identifier "pattern"
[
tok_number 8 (0x8)
]
<
tok_identifier "format"
=
tok_identifier "hex"
,
tok_identifier "comment"
=
tok_stringlit "Fixed header pattern: 00 FF FF FF FF FF FF 00"
>
;
tok_identifier "EISAId"
tok_identifier "eisaId"
<
tok_identifier "comment"
=
tok_stringlit "EISA ID. Encoded as 3 5-bit letters (1=A, 26=Z), big-endian, with msbit reserved."
>
;
tok_uint16
tok_identifier "mfgProductId"
<
tok_identifier "comment"
=
tok_stringlit "Manufacturer product code. 16-bit number, little-endian."
>
;
tok_uint32
tok_identifier "serial"
<
tok_identifier "comment"
=
tok_stringlit "Serial number. 32 bits, little endian."
>
;
tok_ubyte
tok_identifier "mfgWeek"
<
tok_identifier "comment"
=
tok_stringlit "Week of manufacture. Week numbering is not consistent between manufacturers."
>
;
tok_ubyte
tok_identifier "mfgYear"
<
tok_identifier "comment"
=
tok_stringlit "Year of manufacture, less 1990. (1990-2245). If week=255, it is the model year instead."
>
;
tok_ubyte
tok_identifier "edidVersion"
<
tok_identifier "comment"
=
tok_stringlit "EDID version, usually 1 (for 1.3)"
>
;
tok_ubyte
tok_identifier "edidRevision"
<
tok_identifier "comment"
=
tok_stringlit "EDID revision, usually 3 (for 1.3)"
>
;
}
tok_identifier "header"
<
tok_identifier "open"
=
tok_false
,
tok_identifier "comment"
=
tok_stringlit "Header information"
>
;
tok_struct
tok_identifier "Basic"
{
tok_identifier "union"
tok_identifier "Bitmap"
{
tok_ubyte
tok_identifier "hmz"
;
tok_if
(
tok_identifier "hmz"
&
tok_number 128 (0x80)
)
{
tok_struct
tok_identifier "Digital"
{
tok_ubyte
tok_identifier "vesa"
:
tok_number 1 (0x1)
<
tok_identifier "comment"
=
tok_stringlit "Signal is compatible with VESA DFP 1.x TMDS CRGB, 1 pixel per clock, up to 8 bits per color, MSB aligned,"
>
;
tok_ubyte
tok_identifier "reserved"
:
tok_number 6 (0x6)
<
tok_identifier "comment"
=
tok_stringlit "Reserved, must be 0"
>
;
tok_ubyte
tok_identifier "digital"
:
tok_number 1 (0x1)
<
tok_identifier "comment"
=
tok_stringlit "1=Digital input"
>
;
}
tok_identifier "digital"
;
}
tok_else
{
tok_struct
tok_identifier "Analog"
{
tok_ubyte
tok_identifier "vSeparate"
:
tok_number 1 (0x1)
<
tok_identifier "comment"
=
tok_stringlit "VSync pulse must be separated when composite or sync-on-green is used"
>
;
tok_ubyte
tok_identifier "syncOnGreen"
:
tok_number 1 (0x1)
<
tok_identifier "comment"
=
tok_stringlit "Sync on green supported"
>
;
tok_ubyte
tok_identifier "compositeSync"
:
tok_number 1 (0x1)
<
tok_identifier "comment"
=
tok_stringlit "Composite sync (on HSync) supported"
>
;
tok_ubyte
tok_identifier "separateSync"
:
tok_number 1 (0x1)
<
tok_identifier "comment"
=
tok_stringlit "Separate sync supported"
>
;
tok_ubyte
tok_identifier "blankToBlack"
:
tok_number 1 (0x1)
<
tok_identifier "comment"
=
tok_stringlit "Blank-to-black setup (pedestal) expected"
>
;
tok_ubyte
tok_identifier "level"
:
tok_number 2 (0x2)
<
tok_identifier "comment"
=
tok_stringlit "Video white and sync levels, relative to blank: 00=+0.7/0.3 V; 01=+0.714/0.286 V; 10=+1.0/0.4 V; 11=+0.7/0 V"
>
;
tok_ubyte
tok_identifier "analog"
:
tok_number 1 (0x1)
<
tok_identifier "comment"
=
tok_stringlit "0=Analog input"
>
;
}
tok_identifier "analog"
;
}
}
tok_identifier "bitmap"
<
tok_identifier "comment"
=
tok_stringlit "Video input parameters bitmap"
>
;
tok_ubyte
tok_identifier "width"
<
tok_identifier "comment"
=
tok_stringlit "Maximum horizontal image size, in centimetres (max 292 cm/115 in at 16:9 aspect ratio)"
>
;
tok_ubyte
tok_identifier "height"
<
tok_identifier "comment"
=
tok_stringlit "Maximum vertical image size, in centimetres. If either byte is 0, undefined (e.g. projector)"
>
;
tok_ubyte
tok_identifier "gamma"
<
tok_identifier "comment"
=
tok_stringlit "Display gamma, minus 1, times 100 (range 1.00-3.54)"
>
;
tok_struct
tok_identifier "Features"
{
tok_ubyte
tok_identifier "gtf"
:
tok_number 1 (0x1)
<
tok_identifier "comment"
=
tok_stringlit "GTF supported with default parameter values."
>
;
tok_ubyte
tok_identifier "prefTimingDesc1"
:
tok_number 1 (0x1)
<
tok_identifier "comment"
=
tok_stringlit "Preferred timing mode specified in descriptor block 1."
>
;
tok_ubyte
tok_identifier "sRGB"
:
tok_number 1 (0x1)
<
tok_identifier "comment"
=
tok_stringlit "Standard sRGB colour space. Bytes 25-34 must contain sRGB standard values."
>
;
tok_if
(
tok_identifier "bitmap"
.
tok_identifier "hmz"
&
tok_number 128 (0x80)
)
tok_ubyte
tok_identifier "displayType"
:
tok_number 2 (0x2)
<
tok_identifier "comment"
=
tok_stringlit "Display type (digital): 00 = RGB 4:4:4; 01 = RGB 4:4:4 + YCrCb 4:4:4; 10 = RGB 4:4:4 + YCrCb 4:2:2; 11 = RGB 4:4:4 + YCrCb 4:4:4 + YCrCb 4:2:2"
>
;
tok_else
tok_ubyte
tok_identifier "displayType"
:
tok_number 2 (0x2)
<
tok_identifier "comment"
=
tok_stringlit "Display type (analog): 00 = Monochrome or Grayscale; 01 = RGB color; 10 = Non-RGB color; 11 = Undefined"
>
;
tok_ubyte
tok_identifier "dpmsActiveOff"
:
tok_number 1 (0x1)
<
tok_identifier "comment"
=
tok_stringlit "DPMS active-off supported"
>
;
tok_ubyte
tok_identifier "dpmsSusepend"
:
tok_number 1 (0x1)
<
tok_identifier "comment"
=
tok_stringlit "DPMS suspend supported"
>
;
tok_ubyte
tok_identifier "dpmsStandby"
:
tok_number 1 (0x1)
<
tok_identifier "comment"
=
tok_stringlit "DPMS standby supported"
>
;
}
tok_identifier "features"
<
tok_identifier "comment"
=
tok_stringlit "Supported features bitmap"
>
;
}
tok_identifier "basic"
<
tok_identifier "open"
=
tok_false
,
tok_identifier "comment"
=
tok_stringlit "Basic display parameters"
>
;
tok_struct
tok_identifier "Chromaticity"
{
tok_ubyte
tok_identifier "green_y_lsb"
:
tok_number 2 (0x2)
<
tok_identifier "comment"
=
tok_stringlit "Green y value least-significant 2 bits"
>
;
tok_ubyte
tok_identifier "green_x_lsb"
:
tok_number 2 (0x2)
<
tok_identifier "comment"
=
tok_stringlit "Green x value least-significant 2 bits"
>
;
tok_ubyte
tok_identifier "red_y_lsb"
:
tok_number 2 (0x2)
<
tok_identifier "comment"
=
tok_stringlit "Red y value least-significant 2 bits"
>
;
tok_ubyte
tok_identifier "red_x_lsb"
:
tok_number 2 (0x2)
<
tok_identifier "comment"
=
tok_stringlit "Red x value least-significant 2 bits"
>
;
tok_ubyte
tok_identifier "bluewhite_lsb"
:
tok_number 2 (0x2)
<
tok_identifier "comment"
=
tok_stringlit "Blue and white least-significant 2 bits"
>
;
tok_ubyte
tok_identifier "zero"
:
tok_number 6 (0x6)
;
tok_ubyte
tok_identifier "red_x_msb"
<
tok_identifier "comment"
=
tok_stringlit "Red x value most significant 8 bits. 0-255 encodes 0-0.996 (255/256); 0-0.999 (1023/1024) with lsbits"
>
;
tok_ubyte
tok_identifier "red_y_msb"
<
tok_identifier "comment"
=
tok_stringlit "Red y value most significant 8 bits"
>
;
tok_ubyte
tok_identifier "green_x_msb"
<
tok_identifier "comment"
=
tok_stringlit "Green x value most significant 8 bits"
>
;
tok_ubyte
tok_identifier "green_y_msb"
<
tok_identifier "comment"
=
tok_stringlit "Green y value most significant 8 bits"
>
;
tok_ubyte
tok_identifier "blue_x_msb"
<
tok_identifier "comment"
=
tok_stringlit "Blue x value most significant 8 bits"
>
;
tok_ubyte
tok_identifier "blue_y_msb"
<
tok_identifier "comment"
=
tok_stringlit "Blue y value most significant 8 bits"
>
;
tok_ubyte
tok_identifier "white_x_msb"
<
tok_identifier "comment"
=
tok_stringlit "Default white point x value most significant 8 bits"
>
;
tok_ubyte
tok_identifier "white_y_msb"
<
tok_identifier "comment"
=
tok_stringlit "Default white point y value most significant 8 bits"
>
;
}
tok_identifier "chromaticity"
<
tok_identifier "bgcolor"
=
tok_identifier "cLtAqua"
,
tok_identifier "comment"
=
tok_stringlit "Chromaticity coordinates. 10-bit CIE xy coordinates for red, green, blue, and white. [0-1023/1024]."
>
;
tok_struct
tok_identifier "Timings"
{
tok_ubyte
tok_identifier "_800x600_60"
:
tok_number 1 (0x1)
;
tok_ubyte
tok_identifier "_800x600_56"
:
tok_number 1 (0x1)
;
tok_ubyte
tok_identifier "_640x480_75"
:
tok_number 1 (0x1)
;
tok_ubyte
tok_identifier "_640x480_72"
:
tok_number 1 (0x1)
;
tok_ubyte
tok_identifier "_640x480_67"
:
tok_number 1 (0x1)
;
tok_ubyte
tok_identifier "_640x480_60"
:
tok_number 1 (0x1)
;
tok_ubyte
tok_identifier "_720x400_88"
:
tok_number 1 (0x1)
;
tok_ubyte
tok_identifier "_720x400_70"
:
tok_number 1 (0x1)
;
tok_ubyte
tok_identifier "_1280x1024_75"
:
tok_number 1 (0x1)
;
tok_ubyte
tok_identifier "_1024x768_75"
:
tok_number 1 (0x1)
;
tok_ubyte
tok_identifier "_1024x768_72"
:
tok_number 1 (0x1)
;
tok_ubyte
tok_identifier "_1024x768_60"
:
tok_number 1 (0x1)
;
tok_ubyte
tok_identifier "_1024x768i_87"
:
tok_number 1 (0x1)
;
tok_ubyte
tok_identifier "_832x624_75"
:
tok_number 1 (0x1)
;
tok_ubyte
tok_identifier "_800x600_75"
:
tok_number 1 (0x1)
;
tok_ubyte
tok_identifier "_800x600_72"
:
tok_number 1 (0x1)
;
tok_ubyte
tok_identifier "mfgSpecific"
:
tok_number 7 (0x7)
;
tok_ubyte
tok_identifier "_1152x870_75"
:
tok_number 1 (0x1)
;
}
tok_identifier "timings"
<
tok_identifier "bgcolor"
=
tok_identifier "cLtGreen"
,
tok_identifier "comment"
=
tok_stringlit "Established timing bitmap. Supported bitmap for very common timing modes."
>
;
tok_identifier "Timing"
tok_identifier "timings2"
[
tok_number 8 (0x8)
]
<
tok_identifier "bgcolor"
=
tok_identifier "cLtGreen"
,
tok_identifier "comment"
=
tok_stringlit "Standard timing information. Up to 8 2-byte fields describing standard display modes."
>
;
tok_struct
tok_identifier "Descriptor"
{
tok_if
(
tok_identifier "ReadUShort"
(
tok_identifier "FTell"
(
)
)
!
=
tok_number 0 (0x0)
)
{
tok_identifier "ModeLine"
tok_identifier "numbers"
;
}
tok_else
{
tok_uint16
tok_identifier "zero"
;
tok_ubyte
tok_identifier "zero"
;
tok_identifier "DescriptorType"
tok_identifier "descriptorType"
;
tok_ubyte
tok_identifier "zero"
;
tok_switch
(
tok_identifier "descriptorType"
)
{
tok_case
tok_identifier "TIMINGS"
:
tok_identifier "Timing"
tok_identifier "timings"
[
tok_number 6 (0x6)
]
<
tok_identifier "comment"
=
tok_stringlit "Additional standard timing identifiers. 6- 2-byte descriptors, padded with 0A."
>
;
tok_break
;
tok_case
tok_identifier "MONITOR_NAME"
:
tok_char
tok_identifier "name"
[
tok_number 13 (0xD)
]
<
tok_identifier "comment"
=
tok_stringlit "Monitor name (text)"
>
;
tok_break
;
tok_case
tok_identifier "SERIAL_NUMBER"
:
tok_char
tok_identifier "serial"
[
tok_number 13 (0xD)
]
<
tok_identifier "comment"
=
tok_stringlit "Monitor serial number (text)"
>
;
tok_break
;
tok_case
tok_identifier "UNSPECIFIED_TEXT"
:
tok_char
tok_identifier "text"
[
tok_number 13 (0xD)
]
<
tok_identifier "comment"
=
tok_stringlit "Unspecified text (text)"
>
;
tok_break
;
tok_case
tok_identifier "RANGE_LIMITS"
:
{
tok_ubyte
tok_identifier "vMinRate"
<
tok_identifier "comment"
=
tok_stringlit "Minimum vertical field rate"
>
;
tok_ubyte
tok_identifier "vMaxRate"
<
tok_identifier "comment"
=
tok_stringlit "Maximum vertical field rate"
>
;
tok_ubyte
tok_identifier "hMinRate"
<
tok_identifier "comment"
=
tok_stringlit "Minimum horizontal line rate"
>
;
tok_ubyte
tok_identifier "hMaxRate"
<
tok_identifier "comment"
=
tok_stringlit "Maximum horizontal line rate"
>
;
tok_identifier "PixelRate"
tok_identifier "maxPixelRate"
<
tok_identifier "comment"
=
tok_stringlit "Maximum pixel clock rate, rounded up to 10 MHz multiple (10-2550 MHz)"
>
;
tok_ubyte
tok_identifier "extended"
<
tok_identifier "comment"
=
tok_stringlit "02: Secondary GTF supported, parameters as follows."
>
;
tok_if
(
tok_identifier "extended"
=
=
tok_number 2 (0x2)
)
{
tok_ubyte
tok_identifier "reserved"
;
tok_ubyte
tok_identifier "startFreqSecondCurve"
<
tok_identifier "comment"
=
tok_stringlit "Start frequency for secondary curve, divided by 2 kHz (0-510 kHz)"
>
;
tok_ubyte
tok_identifier "gtf_C"
<
tok_identifier "comment"
=
tok_stringlit "C value, multiplied by 2 (0-127.5)"
>
;
tok_uint16
tok_identifier "gtf_M"
<
tok_identifier "comment"
=
tok_stringlit "GTF M value (0-65535, little-endian)"
>
;
tok_ubyte
tok_identifier "gtf_K"
<
tok_identifier "comment"
=
tok_stringlit "GTF K value (0-255)"
>
;
tok_ubyte
tok_identifier "gtf_J"
<
tok_identifier "comment"
=
tok_stringlit "GTF J value, multiplied by 2 (0-127.5)"
>
;
}
tok_else
{
tok_ubyte
tok_identifier "padding"
[
tok_number 7 (0x7)
]
<
tok_identifier "comment"
=
tok_stringlit "0A 20 20 20 20 20 20"
>
;
}
tok_break
;
}
tok_case
tok_identifier "WHITE_POINT"
:
{
tok_struct
{
tok_ubyte
tok_identifier "indexNumber"
<
tok_identifier "comment"
=
tok_stringlit "Point index number (1-255) Usually 1; 0 indicates descriptor not used."
>
;
tok_ubyte
tok_identifier "white_y_lsb"
:
tok_number 2 (0x2)
<
tok_identifier "comment"
=
tok_stringlit "White point y value least-significant 2 bits"
>
;
tok_ubyte
tok_identifier "white_x_lsb"
:
tok_number 2 (0x2)
<
tok_identifier "comment"
=
tok_stringlit "White point x value least-significant 2 bits"
>
;
tok_ubyte
tok_identifier "unused"
:
tok_number 4 (0x4)
;
tok_ubyte
tok_identifier "white_x_msb"
<
tok_identifier "comment"
=
tok_stringlit "White point x value most significant 8 bits (like EDID byte 27)"
>
;
tok_ubyte
tok_identifier "white_y_msb"
<
tok_identifier "comment"
=
tok_stringlit "White point y value most significant 8 bits (like EDID byte 28)"
>
;
tok_ubyte
tok_identifier "gamma"
<
tok_identifier "comment"
=
tok_stringlit "Gamma value, minus 1, time 100 (1.0-3.54, like EDID byte 23)"
>
;
}
tok_identifier "whitePoints"
[
tok_number 2 (0x2)
]
<
tok_identifier "bgcolor"
=
tok_identifier "cLtAqua"
,
tok_identifier "comment"
=
tok_stringlit "Additional white point descriptors"
>
;
tok_ubyte
tok_identifier "padding"
[
tok_number 3 (0x3)
]
<
tok_identifier "comment"
=
tok_stringlit "0A 20 20"
>
;
tok_break
;
}
tok_default
:
{
tok_ubyte
tok_identifier "unknown"
[
tok_number 13 (0xD)
]
;
tok_identifier "Warning"
(
tok_stringlit "Unknown descriptor type"
)
;
tok_break
;
}
}
}
}
tok_identifier "descriptors"
[
tok_number 4 (0x4)
]
<
tok_identifier "optimize"
=
tok_false
,
tok_identifier "bgcolor"
=
tok_identifier "cLtGray"
,
tok_identifier "comment"
=
tok_stringlit "Detailed Timing Descriptor blocks, in decreasing preference order. After all detailed timing descriptors, additional descriptors are permitted."
>
;
tok_ubyte
tok_identifier "extensionCount"
<
tok_identifier "comment"
=
tok_stringlit "Number of extensions to follow. 0 if no extensions."
>
;
tok_ubyte
tok_identifier "checksum"
<
tok_identifier "format"
=
tok_identifier "hex"
,
tok_identifier "comment"
=
tok_stringlit "Sum of all 128 bytes should equal 0 (mod 256)."
>
;
tok_struct
tok_identifier "CEA_EDID"
{
tok_local
tok_int64
tok_identifier "extensionBlockStart"
<
tok_identifier "hidden"
=
tok_true
>
=
tok_identifier "FTell"
(
)
;
tok_ubyte
tok_identifier "extensionTag"
<
tok_identifier "comment"
=
tok_stringlit "Extension tag (which kind of extension block this is); 02h for CEA EDID"
>
;
tok_switch
(
tok_identifier "extensionTag"
)
{
tok_case
tok_number 2 (0x2)
:
{
tok_ubyte
tok_identifier "revision"
<
tok_identifier "comment"
=
tok_stringlit "Revision number (Version number); 03h for Version 3"
>
;
tok_ubyte
tok_identifier "dtdStart"
<
tok_identifier "comment"
=
tok_stringlit "Byte number \"d\" within this block where the 18-byte DTDs begin."
>
;
tok_ubyte
tok_identifier "dtdCount"
:
tok_number 4 (0x4)
<
tok_identifier "comment"
=
tok_stringlit "total number of native formats in the DTDs included in this block"
>
;
tok_ubyte
tok_identifier "YCbCr422"
:
tok_number 1 (0x1)
<
tok_identifier "comment"
=
tok_stringlit "1 if display supports YCbCr 4:2:2, 0 if not"
>
;
tok_ubyte
tok_identifier "YCbCr444"
:
tok_number 1 (0x1)
<
tok_identifier "comment"
=
tok_stringlit "1 if display supports YCbCr 4:4:4, 0 if not"
>
;
tok_ubyte
tok_identifier "basic_audio"
:
tok_number 1 (0x1)
<
tok_identifier "comment"
=
tok_stringlit "1 if display supports basic audio, 0 if not"
>
;
tok_ubyte
tok_identifier "underscan"
:
tok_number 1 (0x1)
<
tok_identifier "comment"
=
tok_stringlit "if display supports underscan, 0 if not"
>
;
tok_while
(
tok_identifier "FTell"
(
)
<
tok_identifier "extensionBlockStart"
+
tok_identifier "dtdStart"
)
{
tok_identifier "DataBlock"
tok_identifier "dataBlock"
;
}
tok_if
(
tok_identifier "FTell"
(
)
!
=
tok_identifier "extensionBlockStart"
+
tok_identifier "dtdStart"
)
{
tok_identifier "Warning"
(
tok_stringlit "Unexpected DTD start"
)
;
}
tok_identifier "FSeek"
(
tok_identifier "extensionBlockStart"
+
tok_identifier "dtdStart"
)
;
tok_while
(
tok_identifier "ReadUShort"
(
tok_identifier "FTell"
(
)
)
!
=
tok_number 0 (0x0)
)
{
tok_identifier "Descriptor"
tok_identifier "descriptor"
<
tok_identifier "optimize"
=
tok_false
,
tok_identifier "bgcolor"
=
tok_identifier "cLtGray"
,
tok_identifier "comment"
=
tok_stringlit "Detailed Timing Descriptor block"
>
;
}
tok_ubyte
tok_identifier "padding"
[
tok_number 127 (0x7F)
-
(
tok_identifier "FTell"
(
)
-
tok_identifier "extensionBlockStart"
)
]
<
tok_identifier "format"
=
tok_identifier "hex"
,
tok_identifier "comment"
=
tok_stringlit "Post-DTD padding. Should be populated with 00h"
>
;
tok_ubyte
tok_idenPress any key to continue . . .
tifier "checksum"
<
tok_identifier "format"
=
tok_identifier "hex"
,
tok_identifier "comment"
=
tok_stringlit "This byte should be programmed such that the sum of all 128 bytes equals 00h."
>
;
tok_if
(
tok_identifier "Checksum"
(
tok_identifier "CHECKSUM_SUM8"
,
tok_identifier "extensionBlockStart"
,
tok_number 128 (0x80)
)
!
=
tok_number 0 (0x0)
)
tok_identifier "Warning"
(
tok_stringlit "Invalid extension block checksum!"
)
;
tok_break
;
}
tok_default
:
tok_identifier "Warning"
(
tok_stringlit "Unsupported extension block"
)
;
tok_break
;
}
}
tok_identifier "extensions"
[
tok_identifier "extensionCount"
]
<
tok_identifier "optimize"
=
tok_false
,
tok_identifier "open"
=
tok_true
,
tok_identifier "comment"
=
tok_stringlit "EDID Extensions"
>
;
}
tok_identifier "file"
<
tok_identifier "open"
=
tok_true
,
tok_identifier "fgcolor"
=
tok_identifier "cBlue"
>
;
tok_eof
Warning: \0 character in file data
Warning: \0 character in file data
Warning: \0 character in file data
lexer test for "test.bt" success!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment