1 /* $OpenBSD: am7930var.h,v 1.2 2011/09/04 20:08:37 miod Exp $ */ 2 /* $NetBSD: am7930var.h,v 1.10 2005/01/15 15:19:52 kent Exp $ */ 3 4 /* 5 * Copyright (c) 1992, 1993 6 * The Regents of the University of California. All rights reserved. 7 * 8 * This software was developed by the Computer Systems Engineering group 9 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 10 * contributed to Berkeley. 11 * 12 * All advertising materials mentioning features or use of this software 13 * must display the following acknowledgement: 14 * This product includes software developed by the University of 15 * California, Lawrence Berkeley Laboratory. 16 * 17 * Redistribution and use in source and binary forms, with or without 18 * modification, are permitted provided that the following conditions 19 * are met: 20 * 1. Redistributions of source code must retain the above copyright 21 * notice, this list of conditions and the following disclaimer. 22 * 2. Redistributions in binary form must reproduce the above copyright 23 * notice, this list of conditions and the following disclaimer in the 24 * documentation and/or other materials provided with the distribution. 25 * 3. Neither the name of the University nor the names of its contributors 26 * may be used to endorse or promote products derived from this software 27 * without specific prior written permission. 28 * 29 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 30 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 31 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 32 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 33 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 34 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 35 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 36 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 37 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 38 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 39 * SUCH DAMAGE. 40 * 41 * @(#)bsd_audiovar.h 8.1 (Berkeley) 6/11/93 42 */ 43 44 struct am7930_softc; 45 46 struct am7930_glue { 47 uint8_t (*codec_iread)(struct am7930_softc *sc, int); 48 void (*codec_iwrite)(struct am7930_softc *sc, int, uint8_t); 49 uint16_t (*codec_iread16)(struct am7930_softc *sc, int); 50 void (*codec_iwrite16)(struct am7930_softc *sc, int, uint16_t); 51 void (*onopen)(struct am7930_softc *sc); 52 void (*onclose)(struct am7930_softc *sc); 53 int factor; 54 void (*input_conv)(void *, u_char *, int); 55 void (*output_conv)(void *, u_char *, int); 56 }; 57 58 struct am7930_softc { 59 struct device sc_dev; /* base device */ 60 int sc_open; 61 int sc_locked; 62 63 uint8_t sc_rlevel; /* record level */ 64 uint8_t sc_plevel; /* play level */ 65 uint8_t sc_mlevel; /* monitor level */ 66 uint8_t sc_out_port; /* output port */ 67 uint8_t sc_mic_mute; 68 69 struct am7930_glue *sc_glue; 70 71 /* saved audio_params sw_code if overwritten with the glue pointers */ 72 void (*play_sw_code)(void *, u_char *, int); 73 void (*rec_sw_code)(void *, u_char *, int); 74 }; 75 76 extern int am7930debug; 77 78 void am7930_init(struct am7930_softc *, int); 79 80 #define AM7930_IWRITE(x,y,z) (*(x)->sc_glue->codec_iwrite)((x),(y),(z)) 81 #define AM7930_IREAD(x,y) (*(x)->sc_glue->codec_iread)((x),(y)) 82 #define AM7930_IWRITE16(x,y,z) (*(x)->sc_glue->codec_iwrite16)((x),(y),(z)) 83 #define AM7930_IREAD16(x,y) (*(x)->sc_glue->codec_iread16)((x),(y)) 84 85 #define AUDIOAMD_POLL_MODE 0 86 #define AUDIOAMD_DMA_MODE 1 87 88 /* 89 * audio channel definitions. 90 */ 91 92 #define AUDIOAMD_SPEAKER_VOL 0 /* speaker volume */ 93 #define AUDIOAMD_HEADPHONES_VOL 1 /* headphones volume */ 94 #define AUDIOAMD_OUTPUT_CLASS 2 95 96 #define AUDIOAMD_MONITOR_VOL 3 /* monitor input volume */ 97 #define AUDIOAMD_MONITOR_OUTPUT 4 /* output selector */ 98 #define AUDIOAMD_MONITOR_CLASS 5 99 100 #define AUDIOAMD_MIC_VOL 6 /* microphone volume */ 101 #define AUDIOAMD_MIC_MUTE 7 102 #define AUDIOAMD_INPUT_CLASS 8 103 104 #define AUDIOAMD_RECORD_SOURCE 9 /* source selector */ 105 #define AUDIOAMD_RECORD_CLASS 10 106 107 /* 108 * audio(9) MI callbacks from upper-level audio layer. 109 */ 110 111 struct audio_device; 112 struct audio_encoding; 113 struct audio_params; 114 115 int am7930_open(void *, int); 116 void am7930_close(void *); 117 int am7930_query_encoding(void *, struct audio_encoding *); 118 int am7930_set_params(void *, int, int, struct audio_params *, 119 struct audio_params *); 120 int am7930_commit_settings(void *); 121 int am7930_round_blocksize(void *, int); 122 int am7930_halt_output(void *); 123 int am7930_halt_input(void *); 124 int am7930_getdev(void *, struct audio_device *); 125 int am7930_get_props(void *); 126 int am7930_set_port(void *, mixer_ctrl_t *); 127 int am7930_get_port(void *, mixer_ctrl_t *); 128 int am7930_query_devinfo(void *, mixer_devinfo_t *); 129