FreeBSD kernel sound device code
emu10kx.h
Go to the documentation of this file.
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 1999 Cameron Grant <gandalf@vilnya.demon.co.uk>
5 * Copyright (c) 2003-2006 Yuriy Tsibizov <yuriy.tsibizov@gfk.ru>
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHERIN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * $FreeBSD$
30 */
31
32#ifndef EMU10KX_H
33#define EMU10KX_H
34
35#define SND_EMU10KX_MINVER 1
36#define SND_EMU10KX_PREFVER 1
37#define SND_EMU10KX_MAXVER 1
38
39#ifdef _KERNEL
40
41#define EMUPAGESIZE 4096
42#define NUM_G 64
43/* XXX some (empty) samples are played when play buffer is > EMUPAGESIZE */
44#define EMU_PLAY_BUFSZ EMUPAGESIZE
45/* Recording is limited by EMUPAGESIZE*16=64K buffer */
46#define EMU_REC_BUFSZ EMUPAGESIZE*16
47#define EMU_MAX_BUFSZ EMUPAGESIZE*16
48#define EMU_MAXPAGES 8192
49
50#define EMU_VAR_FUNC 0
51#define EMU_VAR_ROUTE 1
52#define EMU_VAR_ISEMU10K1 2
53#define EMU_VAR_MCH_DISABLED 3
54#define EMU_VAR_MCH_REC 4
55
56#define EMU_A_IOCFG_DISABLE_ANALOG 0x0040 /* = 'enable' for Audigy2 */
57#define EMU_A_IOCFG_GPOUT2 0x0001
58#define EMU_AC97SLOT_REAR_RIGHT 0x01
59#define EMU_AC97SLOT_REAR_LEFT 0x02
60#define EMU_HCFG_GPOUT0 0x00001000
61#define EMU_HCFG_GPOUT1 0x00000800
62#define EMU_HCFG_GPOUT2 0x00000400
63
64#define RT_FRONT 0
65#define RT_REAR 1
66#define RT_CENTER 2
67#define RT_SUB 3
68#define RT_SIDE 4
69#define RT_MCHRECORD 5
70#define RT_COUNT 6
71
72/* mixer controls */
73/* fx play */
74#define M_FX0_FRONT_L 0
75#define M_FX1_FRONT_R 1
76#define M_FX2_REAR_L 2
77#define M_FX3_REAR_R 3
78#define M_FX4_CENTER 4
79#define M_FX5_SUBWOOFER 5
80#define M_FX6_SIDE_L 6
81#define M_FX7_SIDE_R 7
82/* fx rec */
83#define M_FX0_REC_L 8
84#define M_FX1_REC_R 9
85/* inputs play */
86#define M_IN0_FRONT_L 10
87#define M_IN0_FRONT_R 11
88#define M_IN1_FRONT_L 12
89#define M_IN1_FRONT_R 13
90#define M_IN2_FRONT_L 14
91#define M_IN2_FRONT_R 15
92#define M_IN3_FRONT_L 16
93#define M_IN3_FRONT_R 17
94#define M_IN4_FRONT_L 18
95#define M_IN4_FRONT_R 19
96#define M_IN5_FRONT_L 20
97#define M_IN5_FRONT_R 21
98#define M_IN6_FRONT_L 22
99#define M_IN6_FRONT_R 23
100#define M_IN7_FRONT_L 24
101#define M_IN7_FRONT_R 25
102/* inputs rec */
103#define M_IN0_REC_L 26
104#define M_IN0_REC_R 27
105#define M_IN1_REC_L 28
106#define M_IN1_REC_R 29
107#define M_IN2_REC_L 30
108#define M_IN2_REC_R 31
109#define M_IN3_REC_L 32
110#define M_IN3_REC_R 33
111#define M_IN4_REC_L 34
112#define M_IN4_REC_R 35
113#define M_IN5_REC_L 36
114#define M_IN5_REC_R 37
115#define M_IN6_REC_L 38
116#define M_IN6_REC_R 39
117#define M_IN7_REC_L 40
118#define M_IN7_REC_R 41
119/* master volume */
120#define M_MASTER_FRONT_L 42
121#define M_MASTER_FRONT_R 43
122#define M_MASTER_REAR_L 44
123#define M_MASTER_REAR_R 45
124#define M_MASTER_CENTER 46
125#define M_MASTER_SUBWOOFER 47
126#define M_MASTER_SIDE_L 48
127#define M_MASTER_SIDE_R 49
128/* master rec volume */
129#define M_MASTER_REC_L 50
130#define M_MASTER_REC_R 51
131
132#define NUM_MIXERS 52
133
134struct emu_sc_info;
135
136/* MIDI device parameters */
139 int port;
141};
142
143/* PCM device parameters */
146 int route;
147};
148
149int emu_intr_register(struct emu_sc_info *sc, uint32_t inte_mask, uint32_t intr_mask, uint32_t(*func) (void *softc, uint32_t irq), void *isc);
150int emu_intr_unregister(struct emu_sc_info *sc, int ihandle);
151
152uint32_t emu_rd(struct emu_sc_info *sc, unsigned int regno, unsigned int size);
153void emu_wr(struct emu_sc_info *sc, unsigned int regno, uint32_t data, unsigned int size);
154
155uint32_t emu_rdptr(struct emu_sc_info *sc, unsigned int chn, unsigned int reg);
156void emu_wrptr(struct emu_sc_info *sc, unsigned int chn, unsigned int reg, uint32_t data);
157
158uint32_t emu_rd_p16vptr(struct emu_sc_info *sc, uint16_t chn, uint16_t reg);
159void emu_wr_p16vptr(struct emu_sc_info *sc, uint16_t chn, uint16_t reg, uint32_t data);
160
161int emu_timer_create(struct emu_sc_info *sc);
162int emu_timer_set(struct emu_sc_info *sc, int timer, int delay);
163int emu_timer_enable(struct emu_sc_info *sc, int timer, int go);
164int emu_timer_clear(struct emu_sc_info *sc, int timer);
165
166struct emu_voice;
167
168struct emu_route {
173};
174
175struct emu_voice* emu_valloc(struct emu_sc_info *sc);
176void emu_vfree(struct emu_sc_info *sc, struct emu_voice *v);
177int emu_vinit(struct emu_sc_info *sc, struct emu_voice *m, struct emu_voice *s,
178 uint32_t sz, struct snd_dbuf *b);
179void emu_vroute(struct emu_sc_info *sc, struct emu_route *rt, struct emu_voice *v);
180void emu_vsetup(struct emu_voice *v, int fmt, int spd);
181void emu_vwrite(struct emu_sc_info *sc, struct emu_voice *v);
182void emu_vtrigger(struct emu_sc_info *sc, struct emu_voice *v, int go);
183int emu_vpos(struct emu_sc_info *sc, struct emu_voice *v);
184
185bus_dma_tag_t emu_gettag(struct emu_sc_info *sc);
186
187void emumix_set_volume(struct emu_sc_info *sc, int mixer_idx, int volume);
188int emumix_get_volume(struct emu_sc_info *sc, int mixer_idx);
189
190void emu_enable_ir(struct emu_sc_info *sc);
191#endif /* _KERNEL */
192#endif /* EMU10K1_H */
u_int32_t data
Definition: ac97_if.m:60
int regno
Definition: ac97_if.m:53
int go
Definition: audio_dai_if.m:64
unsigned int fmt
Definition: audio_soc.c:91
struct pcmchan_matrix * m
Definition: channel_if.m:232
struct snd_dbuf * b
Definition: channel_if.m:105
uint32_t spd
Definition: dsp.c:394
uint32_t emu_rd(struct emu_sc_info *sc, unsigned int regno, unsigned int size)
Definition: emu10kx.c:763
int emu_timer_clear(struct emu_sc_info *sc, int timer)
Definition: emu10kx.c:897
void emu_vroute(struct emu_sc_info *sc, struct emu_route *rt, struct emu_voice *v)
Definition: emu10kx.c:1355
int emu_timer_set(struct emu_sc_info *sc, int timer, int delay)
Definition: emu10kx.c:831
int emu_vinit(struct emu_sc_info *sc, struct emu_voice *m, struct emu_voice *s, uint32_t sz, struct snd_dbuf *b)
Definition: emu10kx.c:1289
void emumix_set_volume(struct emu_sc_info *sc, int mixer_idx, int volume)
Definition: emu10kx.c:2610
void emu_vsetup(struct emu_voice *v, int fmt, int spd)
Definition: emu10kx.c:1337
void emu_vwrite(struct emu_sc_info *sc, struct emu_voice *v)
Definition: emu10kx.c:1374
uint32_t emu_rdptr(struct emu_sc_info *sc, unsigned int chn, unsigned int reg)
Definition: emu10kx.c:649
void emu_wr_p16vptr(struct emu_sc_info *sc, uint16_t chn, uint16_t reg, uint32_t data)
Definition: emu10kx.c:721
struct emu_voice * emu_valloc(struct emu_sc_info *sc)
Definition: emu10kx.c:1251
int emu_intr_register(struct emu_sc_info *sc, uint32_t inte_mask, uint32_t intr_mask, uint32_t(*func)(void *softc, uint32_t irq), void *isc)
Definition: emu10kx.c:918
void emu_vfree(struct emu_sc_info *sc, struct emu_voice *v)
Definition: emu10kx.c:1268
int emu_timer_enable(struct emu_sc_info *sc, int timer, int go)
Definition: emu10kx.c:855
int emumix_get_volume(struct emu_sc_info *sc, int mixer_idx)
Definition: emu10kx.c:2621
void emu_wr(struct emu_sc_info *sc, unsigned int regno, uint32_t data, unsigned int size)
Definition: emu10kx.c:754
void emu_enable_ir(struct emu_sc_info *sc)
Definition: emu10kx.c:779
bus_dma_tag_t emu_gettag(struct emu_sc_info *sc)
Definition: emu10kx.c:1037
void emu_wrptr(struct emu_sc_info *sc, unsigned int chn, unsigned int reg, uint32_t data)
Definition: emu10kx.c:676
int emu_intr_unregister(struct emu_sc_info *sc, int ihandle)
Definition: emu10kx.c:947
uint32_t emu_rd_p16vptr(struct emu_sc_info *sc, uint16_t chn, uint16_t reg)
Definition: emu10kx.c:706
void emu_vtrigger(struct emu_sc_info *sc, struct emu_voice *v, int go)
Definition: emu10kx.c:1457
int emu_timer_create(struct emu_sc_info *sc)
Definition: emu10kx.c:811
int emu_vpos(struct emu_sc_info *sc, struct emu_voice *v)
Definition: emu10kx.c:1500
uint8_t reg
Definition: hdac.c:211
struct emu_sc_info * card
Definition: emu10kx.h:138
int portnr
Definition: emu10kx.h:140
int route
Definition: emu10kx.h:146
struct emu_sc_info * card
Definition: emu10kx.h:145
int amounts_right[8]
Definition: emu10kx.h:172
int routing_left[8]
Definition: emu10kx.h:169
int amounts_left[8]
Definition: emu10kx.h:170
int routing_right[8]
Definition: emu10kx.h:171
int timer[EMU_MAX_IRQ_CONSUMERS]
Definition: emu10kx.c:368
struct resource * irq
Definition: emu10kx.c:333