1 /*        $NetBSD: ad1848var.h,v 1.45 2019/05/08 13:40:18 isaki Exp $ */
2 
3 /*-
4  * Copyright (c) 1999 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Ken Hornstein and John Kohl.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 /*
32  * Copyright (c) 1994 John Brezak
33  * Copyright (c) 1991-1993 Regents of the University of California.
34  * All rights reserved.
35  *
36  * Redistribution and use in source and binary forms, with or without
37  * modification, are permitted provided that the following conditions
38  * are met:
39  * 1. Redistributions of source code must retain the above copyright
40  *    notice, this list of conditions and the following disclaimer.
41  * 2. Redistributions in binary form must reproduce the above copyright
42  *    notice, this list of conditions and the following disclaimer in the
43  *    documentation and/or other materials provided with the distribution.
44  * 3. All advertising materials mentioning features or use of this software
45  *    must display the following acknowledgement:
46  *        This product includes software developed by the Computer Systems
47  *        Engineering Group at Lawrence Berkeley Laboratory.
48  * 4. Neither the name of the University nor of the Laboratory may be used
49  *    to endorse or promote products derived from this software without
50  *    specific prior written permission.
51  *
52  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
53  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
54  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
55  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
56  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
57  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
58  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
59  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
60  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
61  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
62  * SUCH DAMAGE.
63  *
64  */
65 
66 #define AD1848_NPORT          4
67 
68 #include <dev/ic/ad1848var.h>
69 
70 struct ad1848_isa_softc {
71           struct    ad1848_softc sc_ad1848;       /* AD1848 device */
72           void      *sc_ih;                       /* interrupt vectoring */
73           isa_chipset_tag_t sc_ic;      /* ISA chipset info */
74 
75           char      sc_playrun;                   /* running in continuous mode */
76           char      sc_recrun;                    /* running in continuous mode */
77 
78           int       sc_irq;                       /* interrupt */
79           int       sc_playdrq;                   /* playback DMA */
80           bus_size_t sc_play_maxsize;   /* playback DMA size */
81           int       sc_recdrq;                    /* record/capture DMA */
82           bus_size_t sc_rec_maxsize;    /* record/capture DMA size */
83 
84           u_long    sc_interrupts;                /* number of interrupts taken */
85           void      (*sc_pintr)(void *);          /* play DMA completion intr handler */
86           void      *sc_parg;           /* arg for sc_pintr() */
87           void      (*sc_rintr)(void *);          /* rec. DMA completion intr handler */
88           void      *sc_rarg;           /* arg for sc_rintr() */
89 
90           /* Only used by gus XXX */
91           int       sc_iobase;
92 
93 #ifndef AUDIO_NO_POWER_CTL
94           int       (*powerctl)(void *, int);
95           void      *powerarg;
96 #endif
97 };
98 
99 #ifdef _KERNEL
100 int       ad1848_isa_mapprobe(struct ad1848_isa_softc *, int);
101 int       ad1848_isa_probe(struct ad1848_isa_softc *);
102 void      ad1848_isa_unmap(struct ad1848_isa_softc *);
103 void      ad1848_isa_attach(struct ad1848_isa_softc *);
104 
105 int       ad1848_isa_open(void *, int);
106 void      ad1848_isa_close(void *);
107 
108 int       ad1848_isa_trigger_output(void *, void *, void *, int,
109               void (*)(void *), void *, const audio_params_t *);
110 int       ad1848_isa_trigger_input(void *, void *, void *, int,
111               void (*)(void *), void *, const audio_params_t *);
112 int       ad1848_isa_halt_output(void *);
113 int       ad1848_isa_halt_input(void *);
114 
115 int       ad1848_isa_intr(void *);
116 
117 void   *ad1848_isa_malloc(void *, int, size_t);
118 void      ad1848_isa_free(void *, void *, size_t);
119 size_t    ad1848_isa_round_buffersize(void *, int, size_t);
120 int       ad1848_isa_get_props(void *);
121 #endif
122