]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/dev/sound/pci/emu10kx.h
This commit was generated by cvs2svn to compensate for changes in r165743,
[FreeBSD/FreeBSD.git] / sys / dev / sound / pci / emu10kx.h
1 /*-
2  * Copyright (c) 1999 Cameron Grant <gandalf@vilnya.demon.co.uk>
3  * Copyright (c) 2003-2006 Yuriy Tsibizov <yuriy.tsibizov@gfk.ru>
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHERIN CONTRACT, STRICT
23  * LIABILITY, 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  * $FreeBSD$
28  */
29
30 #ifndef EMU10KX_H
31 #define EMU10KX_H
32
33 #define SND_EMU10KX_MINVER      1
34 #define SND_EMU10KX_PREFVER     1
35 #define SND_EMU10KX_MAXVER      1
36
37 #ifdef _KERNEL
38
39 #define EMUPAGESIZE     4096
40 #define NUM_G           64
41 /* XXX */
42  /* 
43   * There are some problems when EMU_PLAY_BUFSZ is larger then EMU_PAGESIZE
44   *  1) there is a sound lag, because first round of playback is silence
45   *  2) the end of large file (equal to the lag duration) is lost
46   *  3) as a result of 1) and 2) no sound at all, when file size is less than 
47   *    EMU_PLAY_BUFSZ (it plays silence and then stops)
48   */ 
49 #define EMU_PLAY_BUFSZ  EMUPAGESIZE
50 #define EMU_REC_BUFSZ   EMUPAGESIZE*16
51 #define EMU_MAX_BUFSZ   EMUPAGESIZE*16
52 #define EMU_MAXPAGES    8192
53
54
55 #define EMU_VAR_FUNC            0
56 #define EMU_VAR_ROUTE           1
57 #define EMU_VAR_ISEMU10K1       2
58
59 #define RT_FRONT                0
60 #define RT_REAR                 1
61 #define RT_CENTER               2
62 #define RT_SUB                  3
63 #define RT_SIDE                 4
64
65 /* mixer controls */
66 /* fx play */
67 #define M_FX0_FRONT_L           0
68 #define M_FX1_FRONT_R           1
69 #define M_FX2_REAR_L            2
70 #define M_FX3_REAR_R            3
71 #define M_FX4_CENTER            4
72 #define M_FX5_SUBWOOFER         5
73 #define M_FX6_SIDE_L            6
74 #define M_FX7_SIDE_R            7
75 /* fx rec */
76 #define M_FX0_REC_L             8
77 #define M_FX1_REC_R             9
78 /* inputs play */
79 #define M_IN0_FRONT_L           10
80 #define M_IN0_FRONT_R           11
81 #define M_IN1_FRONT_L           12
82 #define M_IN1_FRONT_R           13
83 #define M_IN2_FRONT_L           14
84 #define M_IN2_FRONT_R           15
85 #define M_IN3_FRONT_L           16
86 #define M_IN3_FRONT_R           17
87 #define M_IN4_FRONT_L           18
88 #define M_IN4_FRONT_R           19
89 #define M_IN5_FRONT_L           20
90 #define M_IN5_FRONT_R           21
91 #define M_IN6_FRONT_L           22
92 #define M_IN6_FRONT_R           23
93 #define M_IN7_FRONT_L           24
94 #define M_IN7_FRONT_R           25
95 /* inputs rec */
96 #define M_IN0_REC_L             26
97 #define M_IN0_REC_R             27
98 #define M_IN1_REC_L             28
99 #define M_IN1_REC_R             29
100 #define M_IN2_REC_L             30
101 #define M_IN2_REC_R             31
102 #define M_IN3_REC_L             32
103 #define M_IN3_REC_R             33
104 #define M_IN4_REC_L             34
105 #define M_IN4_REC_R             35
106 #define M_IN5_REC_L             36
107 #define M_IN5_REC_R             37
108 #define M_IN6_REC_L             38
109 #define M_IN6_REC_R             39
110 #define M_IN7_REC_L             40
111 #define M_IN7_REC_R             41
112 /* master volume */
113 #define M_MASTER_FRONT_L        42
114 #define M_MASTER_FRONT_R        43
115 #define M_MASTER_REAR_L         44
116 #define M_MASTER_REAR_R         45
117 #define M_MASTER_CENTER         46
118 #define M_MASTER_SUBWOOFER      47
119 #define M_MASTER_SIDE_L         48
120 #define M_MASTER_SIDE_R         49
121 /* master rec volume */
122 #define M_MASTER_REC_L          50
123 #define M_MASTER_REC_R          51
124
125 #define NUM_MIXERS              52
126
127 struct emu_sc_info;
128
129 /* MIDI device parameters */
130 struct emu_midiinfo {
131         struct emu_sc_info *card;
132         int             port;
133         int             portnr;
134 };
135
136 /* PCM device parameters */
137 struct emu_pcminfo {
138         struct emu_sc_info *card;
139         int             route;
140 };
141
142 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);
143 int     emu_intr_unregister(struct emu_sc_info *sc, int ihandle);
144
145 uint32_t emu_rd(struct emu_sc_info *sc, unsigned int regno, unsigned int size);
146 void    emu_wr(struct emu_sc_info *sc, unsigned int regno, uint32_t data, unsigned int size);
147
148 uint32_t emu_rdptr(struct emu_sc_info *sc, unsigned int chn, unsigned int reg);
149 void    emu_wrptr(struct emu_sc_info *sc, unsigned int chn, unsigned int reg, uint32_t data);
150
151 uint32_t emu_rd_p16vptr(struct emu_sc_info *sc, uint16_t chn, uint16_t reg);
152 void    emu_wr_p16vptr(struct emu_sc_info *sc, uint16_t chn, uint16_t reg, uint32_t data);
153
154 int     emu_timer_create(struct emu_sc_info *sc);
155 int     emu_timer_set(struct emu_sc_info *sc, int timer, int delay);
156 int     emu_timer_enable(struct emu_sc_info *sc, int timer, int go);
157 int     emu_timer_clear(struct emu_sc_info *sc, int timer);
158
159 struct emu_voice;
160
161 struct emu_route {
162         int     routing_left[8];
163         int     amounts_left[8];
164         int     routing_right[8];
165         int     amounts_right[8];
166 };
167
168 struct emu_voice* emu_valloc(struct emu_sc_info *sc);
169 void    emu_vfree(struct emu_sc_info *sc, struct emu_voice *v);
170 int     emu_vinit(struct emu_sc_info *sc, struct emu_voice *m, struct emu_voice *s,
171     uint32_t sz, struct snd_dbuf *b);
172 void    emu_vroute(struct emu_sc_info *sc, struct emu_route *rt,  struct emu_voice *v);
173 void    emu_vsetup(struct emu_voice *v, int fmt, int spd);
174 void    emu_vwrite(struct emu_sc_info *sc, struct emu_voice *v);
175 void    emu_vtrigger(struct emu_sc_info *sc, struct emu_voice *v, int go);
176 int     emu_vpos(struct emu_sc_info *sc, struct emu_voice *v);
177
178 bus_dma_tag_t emu_gettag(struct emu_sc_info *sc);
179
180 void    emumix_set_volume(struct emu_sc_info *sc, int mixer_idx, int volume);
181 int     emumix_get_volume(struct emu_sc_info *sc, int mixer_idx);
182
183 void    emu_enable_ir(struct emu_sc_info *sc);
184 #endif                          /* _KERNEL */
185 #endif                          /* EMU10K1_H */