Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / dev / pci / esavar.h
blobf8351206f2589da6fdc1303a912f6df5dd1ec69b
1 /* $NetBSD: esavar.h,v 1.9 2007/12/09 20:28:07 jmcneill Exp $ */
3 /*
4 * Copyright (c) 2001, 2002 Jared D. McNeill <jmcneill@invisible.ca>
5 * All rights reserved.
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.
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.
29 * ESS Allegro-1 / Maestro3 Audio Driver
31 * Based on the FreeBSD maestro3 driver
36 * Number of simultaneous voices
38 * NOTE: The current code attaches audio0 thru audioESA_NUM_VOICES-1
39 * to this driver, and a lot of people probably don't want that.
40 * So, we'll default to 1 but we'll allow for the possibility of
41 * more.
43 * The current MINISRC image limits us to a maximum of 4 simultaneous voices.
45 #ifndef ESA_NUM_VOICES
46 #define ESA_NUM_VOICES 1
47 #endif
49 #define KERNADDR(p) ((void *)((p)->addr))
50 #define DMAADDR(p) ((p)->map->dm_segs[0].ds_addr)
52 #define ESA_MINRATE 8000
53 #define ESA_MAXRATE 48000
55 struct esa_list {
56 int currlen;
57 int mem_addr;
58 int max;
59 int indexmap[ESA_NUM_VOICES * 2];
62 struct esa_dma {
63 bus_dmamap_t map;
64 void * addr;
65 bus_dma_segment_t segs[1];
66 int nsegs;
67 size_t size;
68 struct esa_dma *next;
71 struct esa_channel {
72 int active;
73 int data_offset;
74 int index;
75 size_t bufsize;
76 int blksize;
77 int pos;
78 void *buf;
79 uint32_t start;
80 uint32_t count;
82 /* mode settings */
83 struct audio_params mode;
85 void (*intr)(void *);
86 void *arg;
89 struct esa_voice {
90 device_t parent; /* pointer to our parent */
91 struct esa_channel play;
92 struct esa_channel rec;
93 struct esa_dma *dma;
94 int inlist;
95 int index; /* 0: play, 1: record */
98 struct esa_softc
100 device_t sc_dev;
101 bus_space_tag_t sc_iot;
102 bus_space_handle_t sc_ioh;
103 bus_addr_t sc_iob;
104 bus_size_t sc_ios;
106 pcitag_t sc_tag;
107 pci_chipset_tag_t sc_pct;
108 bus_dma_tag_t sc_dmat;
109 pcireg_t sc_pcireg;
111 void *sc_ih;
113 struct ac97_codec_if *codec_if;
114 struct ac97_host_if host_if;
115 enum ac97_host_flags codec_flags;
117 struct device *sc_audiodev[ESA_NUM_VOICES];
119 struct esa_voice voice[ESA_NUM_VOICES];
120 struct esa_dma *sc_dmas;
121 int count;
123 /* timer management */
124 int sc_ntimers;
126 /* packed list structures */
127 struct esa_list mixer_list;
128 struct esa_list adc1_list;
129 struct esa_list dma_list;
130 struct esa_list msrc_list;
132 int type; /* Allegro-1 or Maestro 3? */
133 int delay1, delay2;
135 uint16_t *savemem;