esavar.h revision 1.3 1 /* $NetBSD: esavar.h,v 1.3 2002/01/13 10:06:51 pooka 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 int data_offset;
53 size_t bufsize;
54 int blksize;
55 int pos;
56 void *buf;
57 u_int32_t start;
58 u_int32_t count;
59 struct esa_dma *dma;
60
61 void (*intr)(void *);
62 void *arg;
63 };
64
65 struct esa_softc
66 {
67 struct device sc_dev;
68 bus_space_tag_t sc_iot;
69 bus_space_handle_t sc_ioh;
70 bus_addr_t sc_iob;
71 bus_size_t sc_ios;
72
73 pcitag_t sc_tag;
74 pci_chipset_tag_t sc_pct;
75 bus_dma_tag_t sc_dmat;
76 pcireg_t sc_pcireg;
77
78 void *sc_ih;
79
80 struct ac97_codec_if *codec_if;
81 struct ac97_host_if host_if;
82 enum ac97_host_flags codec_flags;
83
84 struct device *sc_audiodev;
85
86 struct esa_channel play;
87 struct esa_channel rec;
88 struct esa_dma *sc_dmas;
89
90 int type; /* Allegro-1 or Maestro 3? */
91 int delay1, delay2;
92
93 void *powerhook;
94 u_int16_t *savemem;
95 };
96