Home | History | Annotate | Line # | Download | only in ic
am7930var.h revision 1.5
      1 /*	$NetBSD: am7930var.h,v 1.5 1998/06/24 11:09:23 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 	volatile struct am7930 *au_amd;/* chip registers */
     75 
     76 	u_char	*au_rdata;		/* record data */
     77 	u_char	*au_rend;		/* end of record data */
     78 	u_char	*au_pdata;		/* play data */
     79 	u_char	*au_pend;		/* end of play data */
     80 	struct	evcnt au_intrcnt;	/* statistics */
     81 };
     82 
     83 
     84 
     85 struct am7930_softc {
     86 	struct	device sc_dev;		/* base device */
     87 	bus_space_tag_t	sc_bustag;
     88 
     89 	int	sc_open;		/* single use device */
     90 	int	sc_locked;		/* true when transfering data */
     91 	struct	mapreg sc_map;		/* current contents of map registers */
     92 
     93 	u_char	sc_rlevel;		/* record level */
     94 	u_char	sc_plevel;		/* play level */
     95 	u_char	sc_mlevel;		/* monitor level */
     96 	u_char	sc_out_port;		/* output port */
     97 
     98 	volatile struct am7930	*sc_amd;/* chip registers */
     99 
    100 	/* Callbacks */
    101 	void	(*sc_wam16) __P((volatile struct am7930 *amd, u_int16_t val));
    102 #define	WAMD16(sc, amd, v) (sc)->sc_wam16((amd), (v))
    103 	void	(*sc_onopen) __P((struct am7930_softc *sc));
    104 	void	(*sc_onclose) __P((struct am7930_softc *sc));
    105 
    106 
    107 	/*
    108 	 * interface to the sparc MD interrupt handlers.
    109 	 *  XXX should really either be in MD sparc derived softc struct,
    110 	 *  or replaced with an MI pdma type.
    111 	 */
    112 
    113 	/*struct intrhand sc_hwih;	-* hardware interrupt vector */
    114 	struct	intrhand sc_swih;	/* software interrupt vector */
    115 	void	(*sc_rintr)(void*);	/* input completion intr handler */
    116 	void	*sc_rarg;		/* arg for sc_rintr() */
    117 	void	(*sc_pintr)(void*);	/* output completion intr handler */
    118 	void	*sc_parg;		/* arg for sc_pintr() */
    119 
    120         /* sc_au is special in that the hardware interrupt handler uses it */
    121         struct  auio sc_au;		/* recv and xmit buffers, etc */
    122 #define sc_intrcnt	sc_au.au_intrcnt	/* statistics */
    123 };
    124 
    125 extern int     am7930debug;
    126 /* Write 16 bits of data from variable v to the data port of the audio chip */
    127 
    128 /*
    129  * Sun-specific audio channel definitions.
    130  */
    131 
    132 #define SUNAUDIO_MIC_PORT	0
    133 #define SUNAUDIO_SPEAKER	1
    134 #define SUNAUDIO_HEADPHONES	2
    135 #define SUNAUDIO_MONITOR	3
    136 #define SUNAUDIO_SOURCE		4
    137 #define SUNAUDIO_OUTPUT		5
    138 #define SUNAUDIO_INPUT_CLASS	6
    139 #define SUNAUDIO_OUTPUT_CLASS	7
    140 #define SUNAUDIO_RECORD_CLASS	8
    141 #define SUNAUDIO_MONITOR_CLASS	9
    142 
    143 
    144 /* declarations */
    145 void am7930_init __P((struct am7930_softc *));
    146 
    147 /*
    148  * audio(9) MI callbacks from upper-level audio layer.
    149  */
    150 struct audio_device;
    151 struct audio_encoding;
    152 struct audio_params;
    153 
    154 int	am7930_open __P((void *, int));
    155 void	am7930_close __P((void *));
    156 int	am7930_query_encoding __P((void *, struct audio_encoding *));
    157 int	am7930_set_params __P((void *, int, int, struct audio_params *, struct audio_params *));
    158 int	am7930_commit_settings __P((void *));
    159 int	am7930_round_blocksize __P((void *, int));
    160 int	am7930_halt_output __P((void *));
    161 int	am7930_halt_input __P((void *));
    162 int	am7930_getdev __P((void *, struct audio_device *));
    163 int	am7930_get_props __P((void *));
    164 
    165 #endif /* !_LOCORE */
    166