Home | History | Annotate | Line # | Download | only in hdaudio
      1 /* $NetBSD: hdmireg.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 _HDMIREG_H
     29 #define _HDMIREG_H
     30 
     31 struct hdmi_audio_infoframe_header {
     32 	uint8_t		packet_type;
     33 	uint8_t		version;
     34 	uint8_t		length;
     35 } __packed;
     36 
     37 #define	HDMI_AI_PACKET_TYPE	0x84
     38 #define	HDMI_AI_VERSION		0x01
     39 #define	HDMI_AI_LENGTH		0x0a
     40 
     41 struct hdmi_audio_infoframe {
     42 	struct hdmi_audio_infoframe_header header;
     43 	uint8_t		checksum;
     44 	uint8_t		ct_cc;
     45 	uint8_t		sf_ss;
     46 	uint8_t		ct_ext;
     47 	uint8_t		ca;
     48 	uint8_t		dm_inh_lsv;
     49 	uint8_t		reserved;
     50 } __packed;
     51 
     52 #define	HDMI_AI_CHANNEL_COUNT(ai)	((ai)->ct_cc & 0x07)
     53 #define	HDMI_AI_CODING_TYPE(ai)		((ai)->ct_cc & 0xf0)
     54 #define	HDMI_AI_SAMPLE_SIZE(ai)		((ai)->sf_ss & 0x03)
     55 #define	HDMI_AI_SAMPLE_FREQUENCY(ai)	((ai)->sf_ss & 0x18)
     56 #define	HDMI_AI_LSV(ai)			((ai)->dm_inh_lsv & 0x78)
     57 #define	HDMI_AI_DM_INH(ai)		((ai)->dm_inh_lsv & 0x80)
     58 
     59 #endif /* !_HDMIREG_H */
     60