esavar.h revision 1.1 1 /* $NetBSD: esavar.h,v 1.1 2002/01/06 16:06:14 jmcneill Exp $ */
2
3 /*
4 * Copyright (c) 2001, 2002 Jared D. McNeill <jmcneill (at) invisible.yi.org>
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. The name of the author may not be used to endorse or promote products
13 * derived from this software without specific prior written permission.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
20 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
22 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 */
27
28 /*
29 * ESS Allegro-1 / Maestro3 Audio Driver
30 *
31 * Based on the FreeBSD maestro3 driver
32 *
33 */
34
35 #define KERNADDR(p) ((void *)((p)->addr))
36 #define DMAADDR(p) ((p)->map->dm_segs[0].ds_addr)
37
38 #define ESA_MINRATE 8000
39 #define ESA_MAXRATE 48000
40
41 struct esa_dma {
42 bus_dmamap_t map;
43 caddr_t addr;
44 bus_dma_segment_t segs[1];
45 int nsegs;
46 size_t size;
47 struct esa_dma *next;
48 };
49
50 struct esa_channel {
51 int active;
52 size_t bufsize;
53 int blksize;
54 int pos;
55 void *buf;
56 u_int32_t start;
57 u_int32_t count;
58 struct esa_dma *dma;
59 };
60
61 struct esa_softc
62 {
63 struct device sc_dev;
64 bus_space_tag_t sc_iot;
65 bus_space_handle_t sc_ioh;
66 bus_addr_t sc_iob;
67 bus_size_t sc_ios;
68
69 pcitag_t sc_tag;
70 pci_chipset_tag_t sc_pct;
71 bus_dma_tag_t sc_dmat;
72 pcireg_t sc_pcireg;
73
74 void *sc_ih;
75
76 struct ac97_codec_if *codec_if;
77 struct ac97_host_if host_if;
78 enum ac97_host_flags codec_flags;
79
80 void (*intr)(void *);
81 void *arg;
82
83 struct device *sc_audiodev;
84
85 struct esa_channel play;
86 struct esa_dma *sc_dmas;
87
88 int type; /* Allegro-1 or Maestro 3? */
89 int delay1, delay2;
90 };
91