This source file includes following definitions.
- ad1848_devmap_t
- ad1848_to_vol
- ad1848_from_vol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39 #define AD1848_NPORT 4
40
41 struct ad1848_volume {
42 u_char left;
43 u_char right;
44 };
45
46 struct ad1848_softc {
47 struct device sc_dev;
48 struct isadev sc_id;
49 void *sc_ih;
50 bus_space_tag_t sc_iot;
51 bus_space_handle_t sc_ioh;
52 int sc_iooffs;
53
54 void *parent;
55 struct device *sc_isa;
56
57 u_short sc_locked;
58 u_int sc_lastcc;
59 int sc_mode;
60
61 int sc_dma_flags;
62 void *sc_dma_bp;
63 u_int sc_dma_cnt;
64
65 char sc_playrun;
66 char sc_recrun;
67 #define NOTRUNNING 0
68 #define DMARUNNING 1
69 #define PCMRUNNING 2
70
71 int sc_irq;
72 int sc_drq;
73 int sc_recdrq;
74
75
76 struct ad1848_volume gains[6];
77
78 struct ad1848_volume rec_gain;
79
80 int rec_port;
81
82
83 u_char MCE_bit;
84 char mic_gain_on;
85 char mute[6];
86
87 char *chip_name;
88 int mode;
89
90 u_int precision;
91 int channels;
92
93 u_char speed_bits;
94 u_char format_bits;
95 u_char need_commit;
96
97 u_long sc_interrupts;
98 void (*sc_intr)(void *);
99 void *sc_arg;
100
101
102 int sc_iobase;
103 };
104
105 #define MUTE_LEFT 1
106 #define MUTE_RIGHT 2
107 #define MUTE_ALL (MUTE_LEFT | MUTE_RIGHT)
108 #define MUTE_MONO MUTE_ALL
109
110
111
112
113 #define AD1848_AUX2_CHANNEL 0
114 #define AD1848_AUX1_CHANNEL 1
115 #define AD1848_DAC_CHANNEL 2
116 #define AD1848_LINE_CHANNEL 3
117 #define AD1848_MONO_CHANNEL 4
118 #define AD1848_MONITOR_CHANNEL 5
119
120
121
122
123 #define MIC_IN_PORT 0
124 #define LINE_IN_PORT 1
125 #define AUX1_IN_PORT 2
126 #define DAC_IN_PORT 3
127
128 #ifdef _KERNEL
129
130 #define AD1848_KIND_LVL 0
131 #define AD1848_KIND_MUTE 1
132 #define AD1848_KIND_RECORDGAIN 2
133 #define AD1848_KIND_MICGAIN 3
134 #define AD1848_KIND_RECORDSOURCE 4
135
136 typedef struct ad1848_devmap {
137 int id;
138 int kind;
139 int dev;
140 } ad1848_devmap_t;
141
142 static __inline int ad1848_to_vol(mixer_ctrl_t *, struct ad1848_volume *);
143 static __inline int ad1848_from_vol(mixer_ctrl_t *, struct ad1848_volume *);
144
145 static __inline int
146 ad1848_to_vol(cp, vol)
147 mixer_ctrl_t *cp;
148 struct ad1848_volume *vol;
149 {
150 if (cp->un.value.num_channels == 1) {
151 vol->left = vol->right = cp->un.value.level[AUDIO_MIXER_LEVEL_MONO];
152 return(1);
153 }
154 else if (cp->un.value.num_channels == 2) {
155 vol->left = cp->un.value.level[AUDIO_MIXER_LEVEL_LEFT];
156 vol->right = cp->un.value.level[AUDIO_MIXER_LEVEL_RIGHT];
157 return(1);
158 }
159 return(0);
160 }
161
162 static __inline int
163 ad1848_from_vol(cp, vol)
164 mixer_ctrl_t *cp;
165 struct ad1848_volume *vol;
166 {
167 if (cp->un.value.num_channels == 1) {
168 cp->un.value.level[AUDIO_MIXER_LEVEL_MONO] = vol->left;
169 return(1);
170 }
171 else if (cp->un.value.num_channels == 2) {
172 cp->un.value.level[AUDIO_MIXER_LEVEL_LEFT] = vol->left;
173 cp->un.value.level[AUDIO_MIXER_LEVEL_RIGHT] = vol->right;
174 return(1);
175 }
176 return(0);
177 }
178
179
180 int ad1848_mixer_get_port(struct ad1848_softc *, ad1848_devmap_t *, int cnt, mixer_ctrl_t *);
181 int ad1848_mixer_set_port(struct ad1848_softc *, ad1848_devmap_t *, int, mixer_ctrl_t *);
182 int ad1848_mapprobe(struct ad1848_softc *, int);
183 int ad1848_probe(struct ad1848_softc *);
184 void ad1848_unmap(struct ad1848_softc *);
185 void ad1848_attach(struct ad1848_softc *);
186
187 int ad1848_open(void *, int);
188 void ad1848_close(void *);
189
190 void ad1848_forceintr(struct ad1848_softc *);
191
192 int ad1848_query_encoding(void *, struct audio_encoding *);
193 int ad1848_set_params(void *, int, int, struct audio_params *, struct audio_params *);
194
195 int ad1848_round_blocksize(void *, int);
196
197 int ad1848_dma_init_output(void *, void *, int);
198 int ad1848_dma_init_input(void *, void *, int);
199 int ad1848_dma_output(void *, void *, int, void (*)(void *), void *);
200 int ad1848_dma_input(void *, void *, int, void (*)(void *), void *);
201
202 int ad1848_commit_settings(void *);
203
204 int ad1848_halt_in_dma(void *);
205 int ad1848_halt_out_dma(void *);
206
207 int ad1848_intr(void *);
208
209 int ad1848_set_rec_port(struct ad1848_softc *, int);
210 int ad1848_get_rec_port(struct ad1848_softc *);
211
212 int ad1848_set_channel_gain(struct ad1848_softc *, int, struct ad1848_volume *);
213 int ad1848_get_device_gain(struct ad1848_softc *, int, struct ad1848_volume *);
214 int ad1848_set_rec_gain(struct ad1848_softc *, struct ad1848_volume *);
215 int ad1848_get_rec_gain(struct ad1848_softc *, struct ad1848_volume *);
216
217 int ad1848_set_mic_gain(struct ad1848_softc *, struct ad1848_volume *);
218 int ad1848_get_mic_gain(struct ad1848_softc *, struct ad1848_volume *);
219 void ad1848_mute_channel(struct ad1848_softc *, int device, int mute);
220
221 void *ad1848_malloc(void *, int, size_t, int, int);
222 void ad1848_free(void *, void *, int);
223 size_t ad1848_round(void *, int, size_t);
224 paddr_t ad1848_mappage(void *, void *, off_t, int);
225
226 int ad1848_get_props(void *);
227
228 #endif