ascaudiovar.h revision 1.3 1 /* $NetBSD: ascaudiovar.h,v 1.3 2025/05/14 07:15:03 nat Exp $ */
2
3 /*-
4 * Copyright (c) 2017, 2023 Nathanial Sloss <nathanialsloss (at) yahoo.com.au>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE.
27 */
28
29 #ifndef _SYS_ARCH_MAC68K_OBIO_ASCAUDIOVAR_H
30 #define _SYS_ARCH_MAC68K_OBIO_ASCAUDIOVAR_H
31
32 #define ASCAUDIOUNIT(d) ((d) & 0x7)
33
34 typedef struct ascaudio_softc {
35 device_t sc_dev;
36 bus_space_tag_t sc_tag;
37 bus_space_handle_t sc_handle;
38 int sc_open;
39
40 device_t sc_audiodev;
41 struct audio_encoding_set *sc_encodings;
42 void *sc_intr;
43 void (*sc_pintr)(void *);
44 void *sc_pintrarg;
45 void (*sc_rintr)(void *);
46 void *sc_rintrarg;
47
48 kmutex_t sc_lock;
49 kmutex_t sc_intr_lock;
50
51 callout_t sc_pcallout;
52 callout_t sc_rcallout;
53
54 uint8_t *sc_playbuf;
55 uint8_t *sc_wptr;
56 uint8_t *sc_putptr;
57 int sc_avail;
58
59 uint8_t *sc_recbuf;
60 uint8_t *sc_rptr;
61 uint8_t *sc_getptr;
62 int sc_recavail;
63
64 uint8_t sc_vol;
65 uint8_t sc_recvol;
66 uint8_t sc_ver;
67 int sc_options; /* options for this instance. */
68 uint8_t sc_speakers;
69 uint sc_rate;
70 int sc_recfreq;
71 bool sc_slowcpu;
72 } ascaudio_softc_t;
73
74 #define LOWQUALITY 0x1
75 #define HIGHQUALITY 0x2
76 #define ASCAUDIO_OPTIONS_MASK (LOWQUALITY|HIGHQUALITY)
77 #define ASCAUDIO_OPTIONS_BITS "\10\2HIGHQUALITY\1LOWQUALITY"
78
79 #endif /* !_SYS_ARCH_MAC68K_OBIO_ASCAUDIOVAR_H */
80