Home | History | Annotate | Line # | Download | only in ic
am7930var.h revision 1.6
      1 /*	$NetBSD: am7930var.h,v 1.6 1999/03/14 22:29:01 jonathan Exp $ */
      2 
      3 /*
      4  * Copyright (c) 1992, 1993
      5  *	The Regents of the University of California.  All rights reserved.
      6  *
      7  * This software was developed by the Computer Systems Engineering group
      8  * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
      9  * contributed to Berkeley.
     10  *
     11  * All advertising materials mentioning features or use of this software
     12  * must display the following acknowledgement:
     13  *	This product includes software developed by the University of
     14  *	California, Lawrence Berkeley Laboratory.
     15  *
     16  * Redistribution and use in source and binary forms, with or without
     17  * modification, are permitted provided that the following conditions
     18  * are met:
     19  * 1. Redistributions of source code must retain the above copyright
     20  *    notice, this list of conditions and the following disclaimer.
     21  * 2. Redistributions in binary form must reproduce the above copyright
     22  *    notice, this list of conditions and the following disclaimer in the
     23  *    documentation and/or other materials provided with the distribution.
     24  * 3. All advertising materials mentioning features or use of this software
     25  *    must display the following acknowledgement:
     26  *	This product includes software developed by the University of
     27  *	California, Berkeley and its contributors.
     28  * 4. Neither the name of the University nor the names of its contributors
     29  *    may be used to endorse or promote products derived from this software
     30  *    without specific prior written permission.
     31  *
     32  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     33  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     34  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     35  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     36  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     37  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     38  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     39  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     40  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     41  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     42  * SUCH DAMAGE.
     43  *
     44  *	@(#)bsd_audiovar.h	8.1 (Berkeley) 6/11/93
     45  */
     46 
     47 #ifndef _LOCORE
     48 
     49 /*
     50  * MI Software state, per AMD79C30 audio chip.
     51  */
     52 struct intrhand;
     53 
     54 /*
     55  * Chip interface
     56  */
     57 struct mapreg {
     58         u_short mr_x[8];
     59         u_short mr_r[8];
     60         u_short mr_gx;
     61         u_short mr_gr;
     62         u_short mr_ger;
     63         u_short mr_stgr;
     64         u_short mr_ftgr;
     65         u_short mr_atgr;
     66         u_char  mr_mmr1;
     67         u_char  mr_mmr2;
     68 };
     69 
     70 /*
     71  * pdma state
     72  */
     73 struct auio {
     74 	bus_space_tag_t		au_bt;	/* bus tag */
     75 	bus_space_handle_t	au_bh;	/* handle to chip registers */
     76 
     77 	u_char	*au_rdata;		/* record data */
     78 	u_char	*au_rend;		/* end of record data */
     79 	u_char	*au_pdata;		/* play data */
     80 	u_char	*au_pend;		/* end of play data */
     81 	struct	evcnt au_intrcnt;	/* statistics */
     82 };
     83 
     84 
     85 /*
     86  * interrupt-hanlder status
     87  * XXX should be MI or required in each port's <machine/cpu.h>
     88  */
     89 struct am7930_intrhand {
     90 	int	(*ih_fun) __P((void *));
     91 	void	*ih_arg;
     92 };
     93 
     94 struct am7930_softc {
     95 	struct	device sc_dev;		/* base device */
     96 	bus_space_tag_t	sc_bustag;	/* bus cookie */
     97 	bus_space_handle_t sc_bh;	/* device registers */
     98 
     99 	int	sc_open;		/* single use device */
    100 	int	sc_locked;		/* true when transfering data */
    101 	struct	mapreg sc_map;		/* current contents of map registers */
    102 
    103 	u_char	sc_rlevel;		/* record level */
    104 	u_char	sc_plevel;		/* play level */
    105 	u_char	sc_mlevel;		/* monitor level */
    106 	u_char	sc_out_port;		/* output port */
    107 
    108 
    109 	/* Callbacks */
    110 	void	(*sc_wam16) __P((bus_space_tag_t bt, bus_space_handle_t bh,
    111 				 u_int16_t val));
    112 #define	WAMD16(bt, bh,  v) (sc)->sc_wam16((bt), (bh), (v))
    113 	void	(*sc_onopen) __P((struct am7930_softc *sc));
    114 	void	(*sc_onclose) __P((struct am7930_softc *sc));
    115 
    116 
    117 	/*
    118 	 * interface to the sparc MD interrupt handlers.
    119 	 *  XXX should really either be in MD sparc derived softc struct,
    120 	 *  or replaced with an MI pdma type.
    121 	 */
    122 
    123 	struct	am7930_intrhand sc_ih;	/* interrupt vector (hw or sw)  */
    124 	void	(*sc_rintr)(void*);	/* input completion intr handler */
    125 	void	*sc_rarg;		/* arg for sc_rintr() */
    126 	void	(*sc_pintr)(void*);	/* output completion intr handler */
    127 	void	*sc_parg;		/* arg for sc_pintr() */
    128 
    129         /* sc_au is special in that the hardware interrupt handler uses it */
    130         struct  auio sc_au;		/* recv and xmit buffers, etc */
    131 #define sc_intrcnt	sc_au.au_intrcnt	/* statistics */
    132 };
    133 
    134 extern int     am7930debug;
    135 /* Write 16 bits of data from variable v to the data port of the audio chip */
    136 
    137 /*
    138  * Sun-specific audio channel definitions.
    139  */
    140 
    141 #define SUNAUDIO_MIC_PORT	0
    142 #define SUNAUDIO_SPEAKER	1
    143 #define SUNAUDIO_HEADPHONES	2
    144 #define SUNAUDIO_MONITOR	3
    145 #define SUNAUDIO_SOURCE		4
    146 #define SUNAUDIO_OUTPUT		5
    147 #define SUNAUDIO_INPUT_CLASS	6
    148 #define SUNAUDIO_OUTPUT_CLASS	7
    149 #define SUNAUDIO_RECORD_CLASS	8
    150 #define SUNAUDIO_MONITOR_CLASS	9
    151 
    152 
    153 /* declarations */
    154 void am7930_init __P((struct am7930_softc *));
    155 
    156 /*
    157  * audio(9) MI callbacks from upper-level audio layer.
    158  */
    159 struct audio_device;
    160 struct audio_encoding;
    161 struct audio_params;
    162 
    163 int	am7930_open __P((void *, int));
    164 void	am7930_close __P((void *));
    165 int	am7930_query_encoding __P((void *, struct audio_encoding *));
    166 int	am7930_set_params __P((void *, int, int, struct audio_params *, struct audio_params *));
    167 int	am7930_commit_settings __P((void *));
    168 int	am7930_round_blocksize __P((void *, int));
    169 int	am7930_halt_output __P((void *));
    170 int	am7930_halt_input __P((void *));
    171 int	am7930_getdev __P((void *, struct audio_device *));
    172 int	am7930_get_props __P((void *));
    173 
    174 #endif /* !_LOCORE */
    175