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