eldreg.h revision 1.1 1 /* $NetBSD: eldreg.h,v 1.1 2015/03/28 14:09:59 jmcneill Exp $ */
2
3 /*
4 * Copyright (c) 2011 Jared D. McNeill <jmcneill (at) invisible.ca>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. The name of the author may not be used to endorse or promote products
13 * derived from this software without specific prior written permission.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
20 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
22 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 */
27
28 #ifndef _ELDREG_H
29 #define _ELDREG_H
30
31 #define ELD_MAX_NBYTES 80 /* version 2; 15 SAD count */
32
33 struct eld_header_block {
34 uint8_t flags; /* ver */
35 uint8_t reserved1;
36 uint8_t baseline_eld_len; /* dword count */
37 uint8_t reserved2;
38 } __packed;
39
40 struct eld_baseline_block {
41 struct eld_header_block header;
42 uint8_t flags[4]; /* cea_edid_ver, mnl,
43 * sad_count, conn_type, s_ai, hdcp,
44 * aud_synch_delay,
45 * rlrc, flrc, rc, rlr, fc, lfe, flr
46 */
47 uint64_t port_id;
48 uint16_t vendor;
49 uint16_t product;
50 /* monitor name string, CEA SADs, vendor data ... */
51 } __packed;
52
53 #define ELD_VER(block) (((block)->header.flags >> 3) & 0x1f)
54 #define ELD_VER_2 0x02
55 #define ELD_VER_UNCONF 0x1f
56 #define ELD_CEA_EDID_VER(block) (((block)->flags[0] >> 5) & 0x07)
57 #define ELD_CEA_EDID_VER_NONE 0x0
58 #define ELD_CEA_EDID_VER_861 0x1
59 #define ELD_CEA_EDID_VER_861A 0x2
60 #define ELD_CEA_EDID_VER_861BCD 0x3
61 #define ELD_MNL(block) (((block)->flags[0] >> 0) & 0x1f)
62 #define ELD_SAD_COUNT(block) (((block)->flags[1] >> 4) & 0x0f)
63 #define ELD_CONN_TYPE(block) (((block)->flags[1] >> 2) & 0x03)
64 #define ELD_CONN_TYPE_HDMI 0x0
65 #define ELD_S_AI(block) (((block)->flags[1] >> 1) & 0x01)
66 #define ELD_HDCP(block) (((block)->flags[1] >> 0) & 0x01)
67 #define ELD_AUDIO_DELAY(block) ((block)->flags[2])
68 #define ELD_AUDIO_DELAY_NONE 0x00
69 #define ELD_AUDIO_DELAY_MS(x) ((x) * 2)
70 #define ELD_AUDIO_DELAY_MS_MAX 500
71 #define ELD_SPEAKER(block) ((block)->flags[3])
72 #define ELD_SPEAKER_RLRC 0x40
73 #define ELD_SPEAKER_FLRC 0x20
74 #define ELD_SPEAKER_RC 0x10
75 #define ELD_SPEAKER_RLR 0x08
76 #define ELD_SPEAKER_FC 0x04
77 #define ELD_SPEAKER_LFE 0x02
78 #define ELD_SPEAKER_FLR 0x01
79
80 #endif /* !_ELDREG_H */
81