The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/videomode/edidreg.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: edidreg.h,v 1.3 2011/03/30 18:49:56 jdc Exp $  */
    2 /*      $FreeBSD$       */
    3 
    4 /*-
    5  * Copyright (c) 2006 Itronix Inc.
    6  * All rights reserved.
    7  *
    8  * Written by Garrett D'Amore for Itronix Inc.
    9  *
   10  * Redistribution and use in source and binary forms, with or without
   11  * modification, are permitted provided that the following conditions
   12  * are met:
   13  * 1. Redistributions of source code must retain the above copyright
   14  *    notice, this list of conditions and the following disclaimer.
   15  * 2. Redistributions in binary form must reproduce the above copyright
   16  *    notice, this list of conditions and the following disclaimer in the
   17  *    documentation and/or other materials provided with the distribution.
   18  * 3. The name of Itronix Inc. may not be used to endorse
   19  *    or promote products derived from this software without specific
   20  *    prior written permission.
   21  *
   22  * THIS SOFTWARE IS PROVIDED BY ITRONIX INC. ``AS IS'' AND ANY EXPRESS
   23  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
   24  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   25  * ARE DISCLAIMED.  IN NO EVENT SHALL ITRONIX INC. BE LIABLE FOR ANY
   26  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
   28  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   29  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
   30  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
   31  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
   32  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   33  */ 
   34 
   35 #ifndef _DEV_VIDEOMODE_EDIDREG_H
   36 #define _DEV_VIDEOMODE_EDIDREG_H
   37 
   38 #define EDID_OFFSET_SIGNATURE           0x00
   39 #define EDID_OFFSET_MANUFACTURER_ID     0x08
   40 #define EDID_OFFSET_PRODUCT_ID          0x0a
   41 #define EDID_OFFSET_SERIAL_NUMBER       0x0c
   42 #define EDID_OFFSET_MANUFACTURE_WEEK    0x10
   43 #define EDID_OFFSET_MANUFACTURE_YEAR    0x11
   44 #define EDID_OFFSET_VERSION             0x12
   45 #define EDID_OFFSET_REVISION            0x13
   46 #define EDID_OFFSET_VIDEO_INPUT         0x14
   47 #define EDID_OFFSET_MAX_HSIZE           0x15    /* in cm */
   48 #define EDID_OFFSET_MAX_VSIZE           0x16
   49 #define EDID_OFFSET_GAMMA               0x17
   50 #define EDID_OFFSET_FEATURE             0x18
   51 #define EDID_OFFSET_CHROMA              0x19
   52 #define EDID_OFFSET_EST_TIMING_1        0x23
   53 #define EDID_OFFSET_EST_TIMING_2        0x24
   54 #define EDID_OFFSET_MFG_TIMING          0x25
   55 #define EDID_OFFSET_STD_TIMING          0x26
   56 #define EDID_OFFSET_DESC_BLOCK          0x36
   57 #define EDID_SIGNATURE          { 0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0 }
   58 
   59 /* assume x is 16-bit value */
   60 #define EDID_VENDOR_ID(ptr)             ((((ptr)[8]) << 8) + ptr[9])
   61 #define EDID_MANFID_0(x)                ((((x) >> 10) & 0x1f) + '@')
   62 #define EDID_MANFID_1(x)                ((((x) >> 5) & 0x1f) + '@')
   63 #define EDID_MANFID_2(x)                ((((x) >> 0) & 0x1f) + '@')
   64 
   65 /* relative to edid block */
   66 #define EDID_PRODUCT_ID(ptr)            (((ptr)[10]) | (((ptr)[11]) << 8))
   67 #define EDID_SERIAL_NUMBER(ptr)         (((ptr)[12] << 24) + \
   68                                         ((ptr)[13] << 16) + \
   69                                         ((ptr)[14] << 8) + \
   70                                         (ptr)[15])
   71 
   72 /* relative to edid block */
   73 #define EDID_WEEK(ptr)                  ((ptr)[16])
   74 #define EDID_YEAR(ptr)                  (((ptr)[17]) + 1990)
   75 
   76 #define EDID_VERSION(ptr)               ((ptr)[18])
   77 #define EDID_REVISION(ptr)              ((ptr)[19])
   78 
   79 #define EDID_VIDEO_INPUT(ptr)           ((ptr)[20])
   80 #define EDID_VIDEO_INPUT_DIGITAL        0x80
   81 /* if INPUT_BIT_DIGITAL set */
   82 #define EDID_VIDEO_INPUT_DFP1_COMPAT    0x01
   83 /* if INPUT_BIT_DIGITAL not set */
   84 #define EDID_VIDEO_INPUT_BLANK_TO_BLACK 0x10
   85 #define EDID_VIDEO_INPUT_SEPARATE_SYNCS 0x08
   86 #define EDID_VIDEO_INPUT_COMPOSITE_SYNC 0x04
   87 #define EDID_VIDEO_INPUT_SYNC_ON_GRN    0x02
   88 #define EDID_VIDEO_INPUT_SERRATION      0x01
   89 #define EDID_VIDEO_INPUT_LEVEL(x)       (((x) & 0x60) >> 5)
   90 /* meanings of level bits are as follows, I don't know names */
   91 /* 0 = 0.7,0.3,  1 = 0.714,0.286, 2 = 1.0,0.4, 3 = 0.7,0.0 */
   92 
   93 /* relative to edid block */
   94 #define EDID_MAX_HSIZE(ptr)             ((ptr)[21])     /* cm */
   95 #define EDID_MAX_VSIZE(ptr)             ((ptr)[22])     /* cm */
   96 /* gamma is scaled by 100 (avoid fp), e.g. 213 == 2.13 */
   97 #define _GAMMA(x)                       ((x) == 0xff ? 100 : ((x) + 100))
   98 #define EDID_GAMMA(ptr)                 _GAMMA(ptr[23])
   99 
  100 #define EDID_FEATURES(ptr)              ((ptr)[24])
  101 #define EDID_FEATURES_STANDBY                   0x80
  102 #define EDID_FEATURES_SUSPEND                   0x40
  103 #define EDID_FEATURES_ACTIVE_OFF                0x20
  104 #define EDID_FEATURES_DISP_TYPE(x)              (((x) & 0x18) >> 3)
  105 #define EDID_FEATURES_DISP_TYPE_MONO            0
  106 #define EDID_FEATURES_DISP_TYPE_RGB             1
  107 #define EDID_FEATURES_DISP_TYPE_NON_RGB         2
  108 #define EDID_FEATURES_DISP_TYPE_UNDEFINED       3
  109 #define EDID_FEATURES_STD_COLOR                 0x04
  110 #define EDID_FEATURES_PREFERRED_TIMING          0x02
  111 #define EDID_FEATURES_DEFAULT_GTF               0x01
  112 
  113 /* chroma values 0.0 - 0.999 scaled as 0-999 */
  114 #define _CHLO(byt, shft)        (((byt) >> (shft)) & 0x3)
  115 #define _CHHI(byt)              ((byt) << 2)
  116 #define _CHHILO(ptr, l, s, h)   (_CHLO((ptr)[l], s) | _CHHI((ptr)[h]))
  117 #define _CHROMA(ptr, l, s, h)   ((_CHHILO(ptr, l, s, h) * 1000) / 1024)
  118 
  119 #define EDID_CHROMA_REDX(ptr)   (_CHROMA(ptr, 25, 6, 27))
  120 #define EDID_CHROMA_REDY(ptr)   (_CHROMA(ptr, 25, 4, 28))
  121 #define EDID_CHROMA_GREENX(ptr) (_CHROMA(ptr, 25, 2, 29))
  122 #define EDID_CHROMA_GREENY(ptr) (_CHROMA(ptr, 25, 0, 30))
  123 #define EDID_CHROMA_BLUEX(ptr)  (_CHROMA(ptr, 26, 6, 31))
  124 #define EDID_CHROMA_BLUEY(ptr)  (_CHROMA(ptr, 26, 4, 32))
  125 #define EDID_CHROMA_WHITEX(ptr) (_CHROMA(ptr, 26, 2, 33))
  126 #define EDID_CHROMA_WHITEY(ptr) (_CHROMA(ptr, 26, 0, 34))
  127 
  128 /* relative to edid block */
  129 #define EDID_EST_TIMING(ptr)            (((ptr)[35] << 8) | (ptr)[36])
  130 #define EDID_EST_TIMING_720_400_70      0x8000  /* 720x400 @ 70Hz */
  131 #define EDID_EST_TIMING_720_400_88      0x4000  /* 720x400 @ 88Hz */
  132 #define EDID_EST_TIMING_640_480_60      0x2000  /* 640x480 @ 60Hz */
  133 #define EDID_EST_TIMING_640_480_67      0x1000  /* 640x480 @ 67Hz */
  134 #define EDID_EST_TIMING_640_480_72      0x0800  /* 640x480 @ 72Hz */
  135 #define EDID_EST_TIMING_640_480_75      0x0400  /* 640x480 @ 75Hz */
  136 #define EDID_EST_TIMING_800_600_56      0x0200  /* 800x600 @ 56Hz */
  137 #define EDID_EST_TIMING_800_600_60      0x0100  /* 800x600 @ 60Hz */
  138 #define EDID_EST_TIMING_800_600_72      0x0080  /* 800x600 @ 72Hz */
  139 #define EDID_EST_TIMING_800_600_75      0x0040  /* 800x600 @ 75Hz */
  140 #define EDID_EST_TIMING_832_624_75      0x0020  /* 832x624 @ 75Hz */
  141 #define EDID_EST_TIMING_1024_768_87I    0x0010  /* 1024x768i @ 87Hz */
  142 #define EDID_EST_TIMING_1024_768_60     0x0008  /* 1024x768 @ 60Hz */
  143 #define EDID_EST_TIMING_1024_768_70     0x0004  /* 1024x768 @ 70Hz */
  144 #define EDID_EST_TIMING_1024_768_75     0x0002  /* 1024x768 @ 75Hz */
  145 #define EDID_EST_TIMING_1280_1024_75    0x0001  /* 1280x1024 @ 75Hz */
  146 
  147 /*
  148  * N.B.: ptr is relative to standard timing block - used for standard timing
  149  * descriptors as well as standard timings section of edid!
  150  */
  151 #define EDID_STD_TIMING_HRES(ptr)       ((((ptr)[0]) * 8) + 248)
  152 #define EDID_STD_TIMING_VFREQ(ptr)      ((((ptr)[1]) & 0x3f) + 60)
  153 #define EDID_STD_TIMING_RATIO(ptr)      ((ptr)[1] & 0xc0)
  154 #define EDID_STD_TIMING_RATIO_16_10     0x00
  155 #define EDID_STD_TIMING_RATIO_4_3       0x40
  156 #define EDID_STD_TIMING_RATIO_5_4       0x80
  157 #define EDID_STD_TIMING_RATIO_16_9      0xc0
  158 
  159 #define EDID_STD_TIMING_SIZE            16
  160 #define EDID_STD_TIMING_COUNT           8
  161 
  162 /*
  163  * N.B.: ptr is relative to descriptor block start
  164  */
  165 #define EDID_BLOCK_SIZE                 18
  166 #define EDID_BLOCK_COUNT                4
  167 
  168 /* detailed timing block.... what a mess */
  169 #define EDID_BLOCK_IS_DET_TIMING(ptr)           ((ptr)[0] | (ptr)[1])
  170 
  171 #define EDID_DET_TIMING_DOT_CLOCK(ptr)  (((ptr)[0] | ((ptr)[1] << 8)) * 10000)
  172 #define _HACT_LO(ptr)                   ((ptr)[2])
  173 #define _HBLK_LO(ptr)                   ((ptr)[3])
  174 #define _HACT_HI(ptr)                   (((ptr)[4] & 0xf0) << 4)
  175 #define _HBLK_HI(ptr)                   (((ptr)[4] & 0x0f) << 8)
  176 #define EDID_DET_TIMING_HACTIVE(ptr)            (_HACT_LO(ptr) | _HACT_HI(ptr))
  177 #define EDID_DET_TIMING_HBLANK(ptr)             (_HBLK_LO(ptr) | _HBLK_HI(ptr))
  178 #define _VACT_LO(ptr)                   ((ptr)[5])
  179 #define _VBLK_LO(ptr)                   ((ptr)[6])
  180 #define _VACT_HI(ptr)                   (((ptr)[7] & 0xf0) << 4)
  181 #define _VBLK_HI(ptr)                   (((ptr)[7] & 0x0f) << 8)
  182 #define EDID_DET_TIMING_VACTIVE(ptr)            (_VACT_LO(ptr) | _VACT_HI(ptr))
  183 #define EDID_DET_TIMING_VBLANK(ptr)             (_VBLK_LO(ptr) | _VBLK_HI(ptr))
  184 #define _HOFF_LO(ptr)                   ((ptr)[8])
  185 #define _HWID_LO(ptr)                   ((ptr)[9])
  186 #define _VOFF_LO(ptr)                   ((ptr)[10] >> 4)
  187 #define _VWID_LO(ptr)                   ((ptr)[10] & 0xf)
  188 #define _HOFF_HI(ptr)                   (((ptr)[11] & 0xc0) << 2)
  189 #define _HWID_HI(ptr)                   (((ptr)[11] & 0x30) << 4)
  190 #define _VOFF_HI(ptr)                   (((ptr)[11] & 0x0c) << 2)
  191 #define _VWID_HI(ptr)                   (((ptr)[11] & 0x03) << 4)
  192 #define EDID_DET_TIMING_HSYNC_OFFSET(ptr)       (_HOFF_LO(ptr) | _HOFF_HI(ptr))
  193 #define EDID_DET_TIMING_HSYNC_WIDTH(ptr)        (_HWID_LO(ptr) | _HWID_HI(ptr))
  194 #define EDID_DET_TIMING_VSYNC_OFFSET(ptr)       (_VOFF_LO(ptr) | _VOFF_HI(ptr))
  195 #define EDID_DET_TIMING_VSYNC_WIDTH(ptr)        (_VWID_LO(ptr) | _VWID_HI(ptr))
  196 #define _HSZ_LO(ptr)                    ((ptr)[12])
  197 #define _VSZ_LO(ptr)                    ((ptr)[13])
  198 #define _HSZ_HI(ptr)                    (((ptr)[14] & 0xf0) << 4)
  199 #define _VSZ_HI(ptr)                    (((ptr)[14] & 0x0f) << 8)
  200 #define EDID_DET_TIMING_HSIZE(ptr)              (_HSZ_LO(ptr) | _HSZ_HI(ptr))
  201 #define EDID_DET_TIMING_VSIZE(ptr)              (_VSZ_LO(ptr) | _VSZ_HI(ptr))
  202 #define EDID_DET_TIMING_HBORDER(ptr)    ((ptr)[15])
  203 #define EDID_DET_TIMING_VBORDER(ptr)    ((ptr)[16])
  204 #define EDID_DET_TIMING_FLAGS(ptr)      ((ptr)[17])
  205 #define EDID_DET_TIMING_FLAG_INTERLACE          0x80
  206 #define EDID_DET_TIMING_FLAG_STEREO             0x60    /* stereo or not */
  207 #define EDID_DET_TIMING_FLAG_SYNC_SEPARATE      0x18
  208 #define EDID_DET_TIMING_FLAG_VSYNC_POSITIVE     0x04
  209 #define EDID_DET_TIMING_FLAG_HSYNC_POSITIVE     0x02
  210 #define EDID_DET_TIMING_FLAG_STEREO_MODE        0x01    /* stereo mode */
  211 
  212 /* N.B.: these tests assume that we already checked for detailed timing! */
  213 #define EDID_BLOCK_TYPE(ptr)                    ((ptr)[3])
  214 
  215 #define EDID_DESC_BLOCK_SIZE                    18
  216 #define EDID_DESC_BLOCK_TYPE_SERIAL             0xFF
  217 #define EDID_DESC_BLOCK_TYPE_ASCII              0xFE
  218 #define EDID_DESC_BLOCK_TYPE_RANGE              0xFD
  219 #define EDID_DESC_BLOCK_TYPE_NAME               0xFC
  220 #define EDID_DESC_BLOCK_TYPE_COLOR_POINT        0xFB
  221 #define EDID_DESC_BLOCK_TYPE_STD_TIMING         0xFA
  222 
  223 /* used for descriptors 0xFF, 0xFE, and 0xFC */
  224 #define EDID_DESC_ASCII_DATA_OFFSET             5
  225 #define EDID_DESC_ASCII_DATA_LEN                13
  226 
  227 #define EDID_DESC_RANGE_MIN_VFREQ(ptr)          ((ptr)[5])      /* Hz */
  228 #define EDID_DESC_RANGE_MAX_VFREQ(ptr)          ((ptr)[6])      /* Hz */
  229 #define EDID_DESC_RANGE_MIN_HFREQ(ptr)          ((ptr)[7])      /* kHz */
  230 #define EDID_DESC_RANGE_MAX_HFREQ(ptr)          ((ptr)[8])      /* kHz */
  231 #define EDID_DESC_RANGE_MAX_CLOCK(ptr)          (((ptr)[9]) * 10) /* MHz */
  232 #define EDID_DESC_RANGE_HAVE_GTF2(ptr)          (((ptr)[10]) == 0x02)
  233 #define EDID_DESC_RANGE_GTF2_HFREQ(ptr)         (((ptr)[12]) * 2)
  234 #define EDID_DESC_RANGE_GTF2_C(ptr)             (((ptr)[13]) / 2)
  235 #define EDID_DESC_RANGE_GTF2_M(ptr)             ((ptr)[14] + ((ptr)[15] << 8))
  236 #define EDID_DESC_RANGE_GTF2_K(ptr)             ((ptr)[16])
  237 #define EDID_DESC_RANGE_GTF2_J(ptr)             ((ptr)[17] / 2)
  238 
  239 #define EDID_DESC_COLOR_WHITEX(ptr)
  240 #define EDID_DESC_COLOR_WHITE_INDEX_1(ptr)      ((ptr)[5])
  241 #define EDID_DESC_COLOR_WHITEX_1(ptr)           _CHROMA(ptr, 6, 2, 7)
  242 #define EDID_DESC_COLOR_WHITEY_1(ptr)           _CHROMA(ptr, 6, 0, 8)
  243 #define EDID_DESC_COLOR_GAMMA_1(ptr)            _GAMMA(ptr[9])
  244 #define EDID_DESC_COLOR_WHITE_INDEX_2(ptr)      ((ptr)[10])
  245 #define EDID_DESC_COLOR_WHITEX_2(ptr)           _CHROMA(ptr, 11, 2, 12)
  246 #define EDID_DESC_COLOR_WHITEY_2(ptr)           _CHROMA(ptr, 11, 0, 13)
  247 #define EDID_DESC_COLOR_GAMMA_2(ptr)            _GAMMA(ptr[14])
  248 
  249 #define EDID_DESC_STD_TIMING_START              5
  250 #define EDID_DESC_STD_TIMING_COUNT              6
  251 
  252 #define EDID_EXT_BLOCK_COUNT(ptr)               ((ptr)[126])
  253 
  254 #endif /* _DEV_VIDEOMODE_EDIDREG_H */

Cache object: 1706f7b66e84e03e050936e887b125a4


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.