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