Deleted Added
sdiff udiff text old ( 53465 ) new ( 53553 )
full compact
1/*
2 * Copyright (c) 1999 Cameron Grant <gandalf@vilnya.demon.co.uk>
3 * Copyright 1997,1998 Luigi Rizzo.
4 *
5 * Derived from files in the Voxware 3.5 distribution,
6 * Copyright by Hannu Savolainen 1994, under the same copyright
7 * conditions.
8 * All rights reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 *
31 * $FreeBSD: head/sys/dev/sound/isa/sb8.c 53465 1999-11-20 16:50:33Z cg $
32 */
33
34#include <dev/sound/pcm/sound.h>
35#if NPCM > 0
36
37#define __SB_MIXER_C__ /* XXX warning... */
38#include <dev/sound/isa/sb.h>
39
40/* channel interface */
41static void *sbchan_init(void *devinfo, snd_dbuf *b, pcm_channel *c, int dir);
42static int sbchan_setdir(void *data, int dir);
43static int sbchan_setformat(void *data, u_int32_t format);
44static int sbchan_setspeed(void *data, u_int32_t speed);
45static int sbchan_setblocksize(void *data, u_int32_t blocksize);
46static int sbchan_trigger(void *data, int go);
47static int sbchan_getptr(void *data);
48static pcmchan_caps *sbchan_getcaps(void *data);
49
50/* channel interface for ESS */
51#ifdef notyet
52static void *esschan_init(void *devinfo, snd_dbuf *b, pcm_channel *c, int dir);
53#endif
54static int esschan_setdir(void *data, int dir);
55static int esschan_setformat(void *data, u_int32_t format);
56static int esschan_setspeed(void *data, u_int32_t speed);
57static int esschan_setblocksize(void *data, u_int32_t blocksize);
58static int esschan_trigger(void *data, int go);
59static int esschan_getptr(void *data);
60static pcmchan_caps *esschan_getcaps(void *data);
61static pcmchan_caps sb_playcaps = {
62 4000, 22050,
63 AFMT_U8,
64 AFMT_U8
65};
66
67static pcmchan_caps sb_reccaps = {
68 4000, 13000,
69 AFMT_U8,
70 AFMT_U8
71};
72
73static pcmchan_caps sbpro_playcaps = {
74 4000, 45000,
75 AFMT_STEREO | AFMT_U8,
76 AFMT_STEREO | AFMT_U8
77};
78
79static pcmchan_caps sbpro_reccaps = {
80 4000, 15000,
81 AFMT_STEREO | AFMT_U8,
82 AFMT_STEREO | AFMT_U8
83};
84
85static pcmchan_caps sb16_playcaps = {
86 5000, 45000,
87 AFMT_STEREO | AFMT_S16_LE,
88 AFMT_STEREO | AFMT_S16_LE
89};
90
91static pcmchan_caps sb16_reccaps = {
92 5000, 45000,
93 AFMT_STEREO | AFMT_U8,
94 AFMT_STEREO | AFMT_U8
95};
96
97static pcmchan_caps ess_playcaps = {
98 5000, 49000,
99 AFMT_STEREO | AFMT_U8 | AFMT_S16_LE,
100 AFMT_STEREO | AFMT_S16_LE
101};
102
103static pcmchan_caps ess_reccaps = {
104 5000, 49000,
105 AFMT_STEREO | AFMT_U8 | AFMT_S16_LE,
106 AFMT_STEREO | AFMT_S16_LE
107};
108
109static pcm_channel sb_chantemplate = {
110 sbchan_init,
111 sbchan_setdir,
112 sbchan_setformat,
113 sbchan_setspeed,
114 sbchan_setblocksize,
115 sbchan_trigger,
116 sbchan_getptr,
117 sbchan_getcaps,
118};
119
120static pcm_channel ess_chantemplate = {
121 sbchan_init,
122 esschan_setdir,
123 esschan_setformat,
124 esschan_setspeed,
125 esschan_setblocksize,
126 esschan_trigger,
127 esschan_getptr,
128 esschan_getcaps,
129};
130#define PLAIN_SB16(x) ((((x)->bd_flags) & (BD_F_SB16|BD_F_SB16X)) == BD_F_SB16)
131
132struct sb_info;
133
134struct sb_chinfo {
135 struct sb_info *parent;
136 pcm_channel *channel;
137 snd_dbuf *buffer;
138 int dir;
139 u_int32_t fmt;
140 int ess_dma_started;
141};
142
143struct sb_info {
144 struct resource *io_base; /* I/O address for the board */
145 int io_rid;
146 struct resource *irq;
147 int irq_rid;
148 struct resource *drq1; /* play */
149 int drq1_rid;
150 struct resource *drq2; /* rec */
151 int drq2_rid;
152 bus_dma_tag_t parent_dmat;
153
154 int dma16, dma8;
155 int bd_id;
156 u_long bd_flags; /* board-specific flags */
157 struct sb_chinfo pch, rch;
158};
159
160static int sb_rd(struct sb_info *sb, int reg);
161static void sb_wr(struct sb_info *sb, int reg, u_int8_t val);
162static int sb_dspready(struct sb_info *sb);
163static int sb_cmd(struct sb_info *sb, u_char val);
164static int sb_cmd1(struct sb_info *sb, u_char cmd, int val);
165static int sb_cmd2(struct sb_info *sb, u_char cmd, int val);
166static u_int sb_get_byte(struct sb_info *sb);
167static int ess_write(struct sb_info *sb, u_char reg, int val);
168static int ess_read(struct sb_info *sb, u_char reg);
169
170/*
171 * in the SB, there is a set of indirect "mixer" registers with
172 * address at offset 4, data at offset 5
173 */
174static void sb_setmixer(struct sb_info *sb, u_int port, u_int value);
175static int sb_getmixer(struct sb_info *sb, u_int port);
176
177static void sb_intr(void *arg);
178static void ess_intr(void *arg);
179static int sb_init(device_t dev, struct sb_info *sb);
180static int sb_reset_dsp(struct sb_info *sb);
181
182static int sb_format(struct sb_chinfo *ch, u_int32_t format);
183static int sb_speed(struct sb_chinfo *ch, int speed);
184static int sb_start(struct sb_chinfo *ch);
185static int sb_stop(struct sb_chinfo *ch);
186
187static int ess_format(struct sb_chinfo *ch, u_int32_t format);
188static int ess_speed(struct sb_chinfo *ch, int speed);
189static int ess_start(struct sb_chinfo *ch);
190static int ess_stop(struct sb_chinfo *ch);
191static int ess_abort(struct sb_chinfo *ch);
192static int sbmix_init(snd_mixer *m);
193static int sbmix_set(snd_mixer *m, unsigned dev, unsigned left, unsigned right);
194static int sbmix_setrecsrc(snd_mixer *m, u_int32_t src);
195
196static snd_mixer sb_mixer = {
197 "SoundBlaster mixer",
198 sbmix_init,
199 sbmix_set,
200 sbmix_setrecsrc,
201};
202
203static devclass_t pcm_devclass;
204
205/*
206 * Common code for the midi and pcm functions
207 *
208 * sb_cmd write a single byte to the CMD port.
209 * sb_cmd1 write a CMD + 1 byte arg
210 * sb_cmd2 write a CMD + 2 byte arg
211 * sb_get_byte returns a single byte from the DSP data port
212 *
213 * ess_write is actually sb_cmd1
214 * ess_read access ext. regs via sb_cmd(0xc0, reg) followed by sb_get_byte
215 */
216
217static int
218port_rd(struct resource *port, int off)
219{
220 return bus_space_read_1(rman_get_bustag(port),
221 rman_get_bushandle(port),
222 off);
223}
224
225static void
226port_wr(struct resource *port, int off, u_int8_t data)
227{
228 return bus_space_write_1(rman_get_bustag(port),
229 rman_get_bushandle(port),
230 off, data);
231}
232
233static int
234sb_rd(struct sb_info *sb, int reg)
235{
236 return port_rd(sb->io_base, reg);
237}
238
239static void
240sb_wr(struct sb_info *sb, int reg, u_int8_t val)
241{
242 port_wr(sb->io_base, reg, val);
243}
244
245static int
246sb_dspready(struct sb_info *sb)
247{
248 return ((sb_rd(sb, SBDSP_STATUS) & 0x80) == 0);
249}
250
251static int
252sb_dspwr(struct sb_info *sb, u_char val)
253{
254 int i;
255
256 for (i = 0; i < 1000; i++) {
257 if (sb_dspready(sb)) {
258 sb_wr(sb, SBDSP_CMD, val);
259 return 1;
260 }
261 if (i > 10) DELAY((i > 100)? 1000 : 10);
262 }
263 printf("sb_dspwr(0x%02x) timed out.\n", val);
264 return 0;
265}
266
267static int
268sb_cmd(struct sb_info *sb, u_char val)
269{
270#if 0
271 printf("sb_cmd: %x\n", val);
272#endif
273 return sb_dspwr(sb, val);
274}
275
276static int
277sb_cmd1(struct sb_info *sb, u_char cmd, int val)
278{
279#if 0
280 printf("sb_cmd1: %x, %x\n", cmd, val);
281#endif
282 if (sb_dspwr(sb, cmd)) {
283 return sb_dspwr(sb, val & 0xff);
284 } else return 0;
285}
286
287static int
288sb_cmd2(struct sb_info *sb, u_char cmd, int val)
289{
290#if 0
291 printf("sb_cmd2: %x, %x\n", cmd, val);
292#endif
293 if (sb_dspwr(sb, cmd)) {
294 return sb_dspwr(sb, val & 0xff) &&
295 sb_dspwr(sb, (val >> 8) & 0xff);
296 } else return 0;
297}
298
299/*
300 * in the SB, there is a set of indirect "mixer" registers with
301 * address at offset 4, data at offset 5
302 */
303static void
304sb_setmixer(struct sb_info *sb, u_int port, u_int value)
305{
306 u_long flags;
307
308 flags = spltty();
309 sb_wr(sb, SB_MIX_ADDR, (u_char) (port & 0xff)); /* Select register */
310 DELAY(10);
311 sb_wr(sb, SB_MIX_DATA, (u_char) (value & 0xff));
312 DELAY(10);
313 splx(flags);
314}
315
316static int
317sb_getmixer(struct sb_info *sb, u_int port)
318{
319 int val;
320 u_long flags;
321
322 flags = spltty();
323 sb_wr(sb, SB_MIX_ADDR, (u_char) (port & 0xff)); /* Select register */
324 DELAY(10);
325 val = sb_rd(sb, SB_MIX_DATA);
326 DELAY(10);
327 splx(flags);
328
329 return val;
330}
331
332static u_int
333sb_get_byte(struct sb_info *sb)
334{
335 int i;
336
337 for (i = 1000; i > 0; i--) {
338 if (sb_rd(sb, DSP_DATA_AVAIL) & 0x80)
339 return sb_rd(sb, DSP_READ);
340 else
341 DELAY(20);
342 }
343 return 0xffff;
344}
345
346static int
347ess_write(struct sb_info *sb, u_char reg, int val)
348{
349 return sb_cmd1(sb, reg, val);
350}
351
352static int
353ess_read(struct sb_info *sb, u_char reg)
354{
355 return (sb_cmd(sb, 0xc0) && sb_cmd(sb, reg))? sb_get_byte(sb) : 0xffff;
356}
357
358static int
359sb_reset_dsp(struct sb_info *sb)
360{
361 sb_wr(sb, SBDSP_RST, 3);
362 DELAY(100);
363 sb_wr(sb, SBDSP_RST, 0);
364 if (sb_get_byte(sb) != 0xAA) {
365 DEB(printf("sb_reset_dsp 0x%lx failed\n",
366 rman_get_start(d->io_base)));
367 return ENXIO; /* Sorry */
368 }
369 if (sb->bd_flags & BD_F_ESS) sb_cmd(sb, 0xc6);
370 return 0;
371}
372
373static void
374sb_release_resources(struct sb_info *sb, device_t dev)
375{
376 /* should we bus_teardown_intr here? */
377 if (sb->irq) {
378 bus_release_resource(dev, SYS_RES_IRQ, sb->irq_rid, sb->irq);
379 sb->irq = 0;
380 }
381 if (sb->drq1) {
382 bus_release_resource(dev, SYS_RES_DRQ, sb->drq1_rid, sb->drq1);
383 sb->drq1 = 0;
384 }
385 if (sb->drq2) {
386 bus_release_resource(dev, SYS_RES_DRQ, sb->drq2_rid, sb->drq2);
387 sb->drq2 = 0;
388 }
389 if (sb->io_base) {
390 bus_release_resource(dev, SYS_RES_IOPORT, sb->io_rid,
391 sb->io_base);
392 sb->io_base = 0;
393 }
394 free(sb, M_DEVBUF);
395}
396
397static int
398sb_alloc_resources(struct sb_info *sb, device_t dev)
399{
400 if (!sb->io_base)
401 sb->io_base = bus_alloc_resource(dev, SYS_RES_IOPORT,
402 &sb->io_rid, 0, ~0, 1,
403 RF_ACTIVE);
404 if (!sb->irq)
405 sb->irq = bus_alloc_resource(dev, SYS_RES_IRQ,
406 &sb->irq_rid, 0, ~0, 1,
407 RF_ACTIVE);
408 if (!sb->drq1)
409 sb->drq1 = bus_alloc_resource(dev, SYS_RES_DRQ,
410 &sb->drq1_rid, 0, ~0, 1,
411 RF_ACTIVE);
412 if (!sb->drq2 && sb->drq2_rid > 0)
413 sb->drq2 = bus_alloc_resource(dev, SYS_RES_DRQ,
414 &sb->drq2_rid, 0, ~0, 1,
415 RF_ACTIVE);
416
417 if (sb->io_base && sb->drq1 && sb->irq) {
418 sb->dma8 = rman_get_start(sb->drq1);
419 isa_dma_acquire(sb->dma8);
420 isa_dmainit(sb->dma8, DSP_BUFFSIZE);
421
422 if (sb->drq2) {
423 sb->dma16 = rman_get_start(sb->drq2);
424 isa_dma_acquire(sb->dma16);
425 isa_dmainit(sb->dma16, DSP_BUFFSIZE);
426 } else sb->dma16 = sb->dma8;
427
428 if (sb->dma8 > sb->dma16) {
429 int tmp = sb->dma16;
430 sb->dma16 = sb->dma8;
431 sb->dma8 = tmp;
432 }
433 return 0;
434 } else return ENXIO;
435}
436
437static int
438sb_identify_board(device_t dev, struct sb_info *sb)
439{
440 char *fmt = NULL;
441 static char buf[64];
442 int essver = 0;
443
444 sb_cmd(sb, DSP_CMD_GETVER); /* Get version */
445 sb->bd_id = (sb_get_byte(sb) << 8) | sb_get_byte(sb);
446
447 switch (sb->bd_id >> 8) {
448 case 1: /* old sound blaster has nothing... */
449 case 2:
450 fmt = "SoundBlaster %d.%d" ; /* default */
451 break;
452
453 case 3:
454 fmt = "SoundBlaster Pro %d.%d";
455 if (sb->bd_id == 0x301) {
456 int rev;
457
458 /* Try to detect ESS chips. */
459 sb_cmd(sb, DSP_CMD_GETID); /* Return ident. bytes. */
460 essver = (sb_get_byte(sb) << 8) | sb_get_byte(sb);
461 rev = essver & 0x000f;
462 essver &= 0xfff0;
463 if (essver == 0x4880) {
464 /* the ESS488 can be treated as an SBPRO */
465 fmt = "SoundBlaster Pro (ESS488 rev %d)";
466 } else if (essver == 0x6880) {
467 if (rev < 8) fmt = "ESS688 rev %d";
468 else fmt = "ESS1868 rev %d";
469 sb->bd_flags |= BD_F_ESS;
470 } else return ENXIO;
471 sb->bd_id &= 0xff00;
472 sb->bd_id |= ((essver & 0xf000) >> 8) | rev;
473 }
474 break;
475
476 case 4:
477 sb->bd_flags |= BD_F_SB16;
478 if (sb->bd_flags & BD_F_SB16X) fmt = "SB16 ViBRA16X %d.%d";
479 else fmt = "SoundBlaster 16 %d.%d";
480 break;
481
482 default:
483 device_printf(dev, "failed to get SB version (%x)\n",
484 sb->bd_id);
485 return ENXIO;
486 }
487 if (essver) snprintf(buf, sizeof buf, fmt, sb->bd_id & 0x000f);
488 else snprintf(buf, sizeof buf, fmt, sb->bd_id >> 8, sb->bd_id & 0xff);
489 device_set_desc_copy(dev, buf);
490 return sb_reset_dsp(sb);
491}
492
493static int
494sb_init(device_t dev, struct sb_info *sb)
495{
496 int x, irq;
497
498 sb->bd_flags &= ~BD_F_MIX_MASK;
499 /* do various initializations depending on board id. */
500 switch (sb->bd_id >> 8) {
501 case 1: /* old sound blaster has nothing... */
502 break;
503
504 case 2:
505 sb->bd_flags |= BD_F_DUP_MIDI;
506 if (sb->bd_id > 0x200) sb->bd_flags |= BD_F_MIX_CT1335;
507 break;
508
509 case 3:
510 sb->bd_flags |= BD_F_DUP_MIDI | BD_F_MIX_CT1345;
511 break;
512
513 case 4:
514 sb->bd_flags |= BD_F_SB16 | BD_F_MIX_CT1745;
515 if (sb->dma16 != sb->dma8) sb->bd_flags |= BD_F_DUPLEX;
516
517 /* soft irq/dma configuration */
518 x = -1;
519 irq = rman_get_start(sb->irq);
520 if (irq == 5) x = 2;
521 else if (irq == 7) x = 4;
522 else if (irq == 9) x = 1;
523 else if (irq == 10) x = 8;
524 if (x == -1) device_printf(dev,
525 "bad irq %d (5/7/9/10 valid)\n",
526 irq);
527 else sb_setmixer(sb, IRQ_NR, x);
528 sb_setmixer(sb, DMA_NR, (1 << sb->dma16) | (1 << sb->dma8));
529 break;
530 }
531 return 0;
532}
533
534static int
535sb_probe(device_t dev)
536{
537 snddev_info *d = device_get_softc(dev);
538 struct sb_info *sb;
539 int allocated, i;
540 int error;
541
542 if (isa_get_vendorid(dev)) return ENXIO; /* not yet */
543
544 device_set_desc(dev, "SoundBlaster");
545 bzero(d, sizeof *d);
546 sb = (struct sb_info *)malloc(sizeof *sb, M_DEVBUF, M_NOWAIT);
547 if (!sb) return ENXIO;
548 bzero(sb, sizeof *sb);
549
550 allocated = 0;
551 sb->io_rid = 0;
552 sb->io_base = bus_alloc_resource(dev, SYS_RES_IOPORT, &sb->io_rid,
553 0, ~0, 16, RF_ACTIVE);
554 if (!sb->io_base) {
555 BVDDB(printf("sb_probe: no addr, trying (0x220, 0x240)\n"));
556 allocated = 1;
557 sb->io_rid = 0;
558 sb->io_base = bus_alloc_resource(dev, SYS_RES_IOPORT,
559 &sb->io_rid, 0x220, 0x22f,
560 16, RF_ACTIVE);
561 if (!sb->io_base) {
562 sb->io_base = bus_alloc_resource(dev, SYS_RES_IOPORT,
563 &sb->io_rid, 0x240,
564 0x24f, 16, RF_ACTIVE);
565 }
566 }
567 if (!sb->io_base) return ENXIO;
568
569 error = sb_reset_dsp(sb);
570 if (error) goto no;
571 error = sb_identify_board(dev, sb);
572 if (error) goto no;
573no:
574 i = sb->io_rid;
575 sb_release_resources(sb, dev);
576 if (allocated) bus_delete_resource(dev, SYS_RES_IOPORT, i);
577 return error;
578}
579
580static int
581sb_doattach(device_t dev, struct sb_info *sb)
582{
583 snddev_info *d = device_get_softc(dev);
584 void *ih;
585 int error;
586 char status[SND_STATUSLEN];
587
588 sb->irq_rid = 0;
589 sb->drq1_rid = 0;
590 sb->drq2_rid = 1;
591 if (sb_alloc_resources(sb, dev)) goto no;
592 error = sb_reset_dsp(sb);
593 if (error) goto no;
594 error = sb_identify_board(dev, sb);
595 if (error) goto no;
596
597 sb_init(dev, sb);
598 mixer_init(d, &sb_mixer, sb);
599 if (sb->bd_flags & BD_F_ESS)
600 bus_setup_intr(dev, sb->irq, INTR_TYPE_TTY, ess_intr, sb, &ih);
601 else
602 bus_setup_intr(dev, sb->irq, INTR_TYPE_TTY, sb_intr, sb, &ih);
603
604 if (sb->bd_flags & BD_F_SB16)
605 pcm_setflags(dev, pcm_getflags(dev) | SD_F_EVILSB16);
606 if (sb->dma16 == sb->dma8)
607 pcm_setflags(dev, pcm_getflags(dev) | SD_F_SIMPLEX);
608 if (bus_dma_tag_create(/*parent*/NULL, /*alignment*/2, /*boundary*/0,
609 /*lowaddr*/BUS_SPACE_MAXADDR_24BIT,
610 /*highaddr*/BUS_SPACE_MAXADDR,
611 /*filter*/NULL, /*filterarg*/NULL,
612 /*maxsize*/DSP_BUFFSIZE, /*nsegments*/1,
613 /*maxsegz*/0x3ffff,
614 /*flags*/0, &sb->parent_dmat) != 0) {
615 device_printf(dev, "unable to create dma tag\n");
616 goto no;
617 }
618
619 snprintf(status, SND_STATUSLEN, "at io 0x%lx irq %ld drq %d",
620 rman_get_start(sb->io_base), rman_get_start(sb->irq),
621 sb->dma8);
622 if (sb->dma16 != sb->dma8) snprintf(status + strlen(status),
623 SND_STATUSLEN - strlen(status), ":%d", sb->dma16);
624
625 if (pcm_register(dev, sb, 1, 1)) goto no;
626 if (sb->bd_flags & BD_F_ESS) {
627 pcm_addchan(dev, PCMDIR_REC, &ess_chantemplate, sb);
628 pcm_addchan(dev, PCMDIR_PLAY, &ess_chantemplate, sb);
629 } else {
630 pcm_addchan(dev, PCMDIR_REC, &sb_chantemplate, sb);
631 pcm_addchan(dev, PCMDIR_PLAY, &sb_chantemplate, sb);
632 }
633 pcm_setstatus(dev, status);
634
635 return 0;
636
637no:
638 sb_release_resources(sb, dev);
639 return ENXIO;
640}
641
642static int
643sb_attach(device_t dev)
644{
645 struct sb_info *sb;
646 int flags = device_get_flags(dev);
647
648 if (flags & DV_F_DUAL_DMA) {
649 bus_set_resource(dev, SYS_RES_DRQ, 1,
650 flags & DV_F_DRQ_MASK, 1);
651 }
652 sb = (struct sb_info *)malloc(sizeof *sb, M_DEVBUF, M_NOWAIT);
653 if (!sb) return ENXIO;
654 bzero(sb, sizeof *sb);
655
656 /* XXX in probe should set io resource to right val instead of this */
657 sb->io_rid = 0;
658 sb->io_base = bus_alloc_resource(dev, SYS_RES_IOPORT, &sb->io_rid,
659 0, ~0, 16, RF_ACTIVE);
660 if (!sb->io_base) {
661 BVDDB(printf("sb_probe: no addr, trying (0x220, 0x240)\n"));
662 sb->io_rid = 0;
663 sb->io_base = bus_alloc_resource(dev, SYS_RES_IOPORT,
664 &sb->io_rid, 0x220, 0x22f,
665 16, RF_ACTIVE);
666 if (!sb->io_base) {
667 sb->io_base = bus_alloc_resource(dev, SYS_RES_IOPORT,
668 &sb->io_rid, 0x240,
669 0x24f, 16, RF_ACTIVE);
670 }
671 }
672 if (!sb->io_base) return ENXIO;
673
674 return sb_doattach(dev, sb);
675}
676
677static device_method_t sb_methods[] = {
678 /* Device interface */
679 DEVMETHOD(device_probe, sb_probe),
680 DEVMETHOD(device_attach, sb_attach),
681
682 { 0, 0 }
683};
684
685static driver_t sb_driver = {
686 "pcm",
687 sb_methods,
688 sizeof(snddev_info),
689};
690
691DRIVER_MODULE(sb, isa, sb_driver, pcm_devclass, 0, 0);
692
693static void
694sb_intr(void *arg)
695{
696 struct sb_info *sb = (struct sb_info *)arg;
697 int reason = 3, c;
698
699 /*
700 * SB < 4.0 is half duplex and has only 1 bit for int source,
701 * so we fake it. SB 4.x (SB16) has the int source in a separate
702 * register.
703 * The Vibra16X has separate flags for 8 and 16 bit transfers, but
704 * I have no idea how to tell capture from playback interrupts...
705 */
706 if (sb->bd_flags & BD_F_SB16) {
707 c = sb_getmixer(sb, IRQ_STAT);
708 /* this tells us if the source is 8-bit or 16-bit dma. We
709 * have to check the io channel to map it to read or write...
710 */
711 reason = 0;
712 if (c & 1) { /* 8-bit dma */
713 if (sb->pch.fmt & AFMT_U8) reason |= 1;
714 if (sb->rch.fmt & AFMT_U8) reason |= 2;
715 }
716 if (c & 2) { /* 16-bit dma */
717 if (sb->pch.fmt & AFMT_S16_LE) reason |= 1;
718 if (sb->rch.fmt & AFMT_S16_LE) reason |= 2;
719 }
720 } else c = 1;
721#if 0
722 printf("sb_intr: reason=%d c=0x%x\n", reason, c);
723#endif
724 if ((reason & 1) && (sb->pch.buffer->dl > 0))
725 chn_intr(sb->pch.channel);
726 if ((reason & 2) && (sb->rch.buffer->dl > 0))
727 chn_intr(sb->rch.channel);
728 if (c & 1) sb_rd(sb, DSP_DATA_AVAIL); /* 8-bit int ack */
729 if (c & 2) sb_rd(sb, DSP_DATA_AVL16); /* 16-bit int ack */
730}
731
732static void
733ess_intr(void *arg)
734{
735 struct sb_info *sb = (struct sb_info *)arg;
736 sb_rd(sb, DSP_DATA_AVAIL); /* int ack */
737#ifdef notyet
738 /*
739 * XXX
740 * for full-duplex mode:
741 * should read port 0x6 to identify where interrupt came from.
742 */
743#endif
744 /*
745 * We are transferring data in DSP normal mode,
746 * so clear the dl to indicate the DMA is stopped.
747 */
748 if (sb->pch.buffer->dl > 0) {
749 sb->pch.buffer->dl = -1;
750 chn_intr(sb->pch.channel);
751 }
752 if (sb->rch.buffer->dl > 0) {
753 sb->rch.buffer->dl = -1;
754 chn_intr(sb->rch.channel);
755 }
756}
757
758static int
759sb_format(struct sb_chinfo *ch, u_int32_t format)
760{
761 ch->fmt = format;
762 return 0;
763}
764
765static int
766sb_speed(struct sb_chinfo *ch, int speed)
767{
768 struct sb_info *sb = ch->parent;
769 int play = (ch->dir == PCMDIR_PLAY)? 1 : 0;
770 int stereo = (ch->fmt & AFMT_STEREO)? 1 : 0;
771
772 if (sb->bd_flags & BD_F_SB16) {
773 RANGE(speed, 5000, 45000);
774 sb_cmd(sb, 0x42 - play);
775 sb_cmd(sb, speed >> 8);
776 sb_cmd(sb, speed & 0xff);
777 } else {
778 u_char tconst;
779 int max_speed = 45000, tmp;
780 u_long flags;
781
782 /* here enforce speed limitations - max 22050 on sb 1.x*/
783 if (sb->bd_id <= 0x200) max_speed = 22050;
784
785 /*
786 * SB models earlier than SB Pro have low limit for the
787 * input rate. Note that this is only for input, but since
788 * we do not support separate values for rec & play....
789 */
790 if (!play) {
791 if (sb->bd_id <= 0x200) max_speed = 13000;
792 else if (sb->bd_id < 0x300) max_speed = 15000;
793 }
794 RANGE(speed, 4000, max_speed);
795 if (stereo) speed <<= 1;
796
797 /*
798 * Now the speed should be valid. Compute the value to be
799 * programmed into the board.
800 */
801 if (speed > 22050) { /* High speed mode on 2.01/3.xx */
802 tconst = (u_char)
803 ((65536 - ((256000000 + speed / 2) / speed))
804 >> 8);
805 sb->bd_flags |= BD_F_HISPEED;
806 tmp = 65536 - (tconst << 8);
807 speed = (256000000 + tmp / 2) / tmp;
808 } else {
809 sb->bd_flags &= ~BD_F_HISPEED;
810 tconst = (256 - ((1000000 + speed / 2) / speed)) & 0xff;
811 tmp = 256 - tconst;
812 speed = (1000000 + tmp / 2) / tmp;
813 }
814 flags = spltty();
815 sb_cmd1(sb, 0x40, tconst); /* set time constant */
816 splx(flags);
817 if (stereo) speed >>= 1;
818 }
819 return speed;
820}
821
822static int
823sb_start(struct sb_chinfo *ch)
824{
825 struct sb_info *sb = ch->parent;
826 int play = (ch->dir == PCMDIR_PLAY)? 1 : 0;
827 int b16 = (ch->fmt & AFMT_S16_LE)? 1 : 0;
828 int stereo = (ch->fmt & AFMT_STEREO)? 1 : 0;
829 int l = ch->buffer->dl;
830 u_char i1, i2 = 0;
831
832 if (b16) l >>= 1;
833 l--;
834 if (play) sb_cmd(sb, DSP_CMD_SPKON);
835 if (sb->bd_flags & BD_F_SB16) {
836 i1 = DSP_F16_AUTO | DSP_F16_FIFO_ON |
837 (play? DSP_F16_DAC : DSP_F16_ADC);
838 i1 |= (b16 && (sb->bd_flags & BD_F_DUPLEX))? DSP_DMA16 : DSP_DMA8;
839 i2 = (stereo? DSP_F16_STEREO : 0) | (b16? DSP_F16_SIGNED : 0);
840 sb_cmd(sb, i1);
841 sb_cmd2(sb, i2, l);
842 } else {
843 if (sb->bd_flags & BD_F_HISPEED) i1 = play? 0x90 : 0x98;
844 else i1 = play? 0x1c : 0x2c;
845 sb_setmixer(sb, 0x0e, stereo? 2 : 0);
846 /* an ESS extension -- they can do 16 bits */
847 if (b16) i1 |= 1;
848 sb_cmd2(sb, 0x48, l);
849 sb_cmd(sb, i1);
850 }
851 sb->bd_flags |= BD_F_DMARUN << b16;
852 return 0;
853}
854
855static int
856sb_stop(struct sb_chinfo *ch)
857{
858 struct sb_info *sb = ch->parent;
859 int play = (ch->dir == PCMDIR_PLAY)? 1 : 0;
860 int b16 = (ch->fmt & AFMT_S16_LE)? 1 : 0;
861
862 if (sb->bd_flags & BD_F_HISPEED) sb_reset_dsp(sb);
863 else {
864 sb_cmd(sb, b16? DSP_CMD_DMAPAUSE_16 : DSP_CMD_DMAPAUSE_8);
865 /*
866 * The above seems to have the undocumented side effect of
867 * blocking the other side as well. If the other
868 * channel was active (SB16) I have to re-enable it :(
869 */
870 if (sb->bd_flags & (BD_F_DMARUN << (1 - b16)))
871 sb_cmd(sb, b16? 0xd4 : 0xd6 );
872 }
873 if (play) sb_cmd(sb, DSP_CMD_SPKOFF); /* speaker off */
874 sb->bd_flags &= ~(BD_F_DMARUN << b16);
875 return 0;
876}
877
878/* utility functions for ESS */
879static int
880ess_format(struct sb_chinfo *ch, u_int32_t format)
881{
882 struct sb_info *sb = ch->parent;
883 int play = (ch->dir == PCMDIR_PLAY)? 1 : 0;
884 int b16 = (format & AFMT_S16_LE)? 1 : 0;
885 int stereo = (format & AFMT_STEREO)? 1 : 0;
886 u_char c;
887 ch->fmt = format;
888 sb_reset_dsp(sb);
889 /* normal DMA mode */
890 ess_write(sb, 0xb8, play ? 0x00 : 0x0a);
891 /* mono/stereo */
892 c = (ess_read(sb, 0xa8) & ~0x03) | 1;
893 if (!stereo) c++;
894 ess_write(sb, 0xa8, c);
895 /* demand mode, 4 bytes/xfer */
896 ess_write(sb, 0xb9, 2);
897 /* setup dac/adc */
898 if (play) ess_write(sb, 0xb6, b16? 0x00 : 0x80);
899 ess_write(sb, 0xb7, 0x51 | (b16? 0x20 : 0x00));
900 ess_write(sb, 0xb7, 0x98 + (b16? 0x24 : 0x00) + (stereo? 0x00 : 0x38));
901 /* irq/drq control */
902 ess_write(sb, 0xb1, (ess_read(sb, 0xb1) & 0x0f) | 0x50);
903 ess_write(sb, 0xb2, (ess_read(sb, 0xb2) & 0x0f) | 0x50);
904 return 0;
905}
906
907static int
908ess_speed(struct sb_chinfo *ch, int speed)
909{
910 struct sb_info *sb = ch->parent;
911 int t;
912 RANGE (speed, 5000, 49000);
913 if (speed > 22000) {
914 t = (795500 + speed / 2) / speed;
915 speed = (795500 + t / 2) / t;
916 t = (256 - t ) | 0x80;
917 } else {
918 t = (397700 + speed / 2) / speed;
919 speed = (397700 + t / 2) / t;
920 t = 128 - t;
921 }
922 ess_write(sb, 0xa1, t); /* set time constant */
923#if 0
924 d->play_speed = d->rec_speed = speed;
925 speed = (speed * 9 ) / 20;
926#endif
927 t = 256 - 7160000 / ((speed * 9 / 20) * 82);
928 ess_write(sb, 0xa2, t);
929 return speed;
930}
931
932static int
933ess_start(struct sb_chinfo *ch)
934{
935 struct sb_info *sb = ch->parent;
936 int play = (ch->dir == PCMDIR_PLAY)? 1 : 0;
937 short c = - ch->buffer->dl;
938 u_char c1;
939 /*
940 * clear bit 0 of register B8h
941 */
942#if 1
943 c1 = play ? 0x00 : 0x0a;
944 ess_write(sb, 0xb8, c1++);
945#else
946 c1 = ess_read(sb, 0xb8) & 0xfe;
947 ess_write(sb, 0xb8, c1++);
948#endif
949 /*
950 * update ESS Transfer Count Register
951 */
952 ess_write(sb, 0xa4, (u_char)((u_short)c & 0xff));
953 ess_write(sb, 0xa5, (u_char)(((u_short)c >> 8) & 0xff));
954 /*
955 * set bit 0 of register B8h
956 */
957 ess_write(sb, 0xb8, c1);
958 if (play)
959 sb_cmd(sb, DSP_CMD_SPKON);
960 return 0;
961}
962
963static int
964ess_stop(struct sb_chinfo *ch)
965{
966 struct sb_info *sb = ch->parent;
967 /*
968 * no need to send a stop command if the DMA has already stopped.
969 */
970 if (ch->buffer->dl > 0) {
971 sb_cmd(sb, DSP_CMD_DMAPAUSE_8); /* pause dma. */
972 }
973 return 0;
974}
975
976static int
977ess_abort(struct sb_chinfo *ch)
978{
979 struct sb_info *sb = ch->parent;
980 int play = (ch->dir == PCMDIR_PLAY)? 1 : 0;
981 if (play) sb_cmd(sb, DSP_CMD_SPKOFF); /* speaker off */
982 sb_reset_dsp(sb);
983 ess_format(ch, ch->fmt);
984 ess_speed(ch, ch->channel->speed);
985 return 0;
986}
987
988/* channel interface */
989static void *
990sbchan_init(void *devinfo, snd_dbuf *b, pcm_channel *c, int dir)
991{
992 struct sb_info *sb = devinfo;
993 struct sb_chinfo *ch = (dir == PCMDIR_PLAY)? &sb->pch : &sb->rch;
994
995 ch->parent = sb;
996 ch->channel = c;
997 ch->buffer = b;
998 ch->buffer->bufsize = DSP_BUFFSIZE;
999 if (chn_allocbuf(ch->buffer, sb->parent_dmat) == -1) return NULL;
1000 ch->buffer->chan = (dir == PCMDIR_PLAY)? sb->dma16 : sb->dma8;
1001 return ch;
1002}
1003
1004static int
1005sbchan_setdir(void *data, int dir)
1006{
1007 struct sb_chinfo *ch = data;
1008 ch->dir = dir;
1009 return 0;
1010}
1011
1012static int
1013sbchan_setformat(void *data, u_int32_t format)
1014{
1015 struct sb_chinfo *ch = data;
1016 sb_format(ch, format);
1017 return 0;
1018}
1019
1020static int
1021sbchan_setspeed(void *data, u_int32_t speed)
1022{
1023 struct sb_chinfo *ch = data;
1024 return sb_speed(ch, speed);
1025}
1026
1027static int
1028sbchan_setblocksize(void *data, u_int32_t blocksize)
1029{
1030 return blocksize;
1031}
1032
1033static int
1034sbchan_trigger(void *data, int go)
1035{
1036 struct sb_chinfo *ch = data;
1037 buf_isadma(ch->buffer, go);
1038 if (go == PCMTRIG_START) sb_start(ch); else sb_stop(ch);
1039 return 0;
1040}
1041
1042static int
1043sbchan_getptr(void *data)
1044{
1045 struct sb_chinfo *ch = data;
1046 return buf_isadmaptr(ch->buffer);
1047}
1048
1049static pcmchan_caps *
1050sbchan_getcaps(void *data)
1051{
1052 struct sb_chinfo *ch = data;
1053 int p = (ch->dir == PCMDIR_PLAY)? 1 : 0;
1054 if (ch->parent->bd_id <= 0x200)
1055 return p? &sb_playcaps : &sb_reccaps;
1056 else if (ch->parent->bd_id >= 0x400)
1057 return p? &sb16_playcaps : &sb16_reccaps;
1058 else
1059 return p? &sbpro_playcaps : &sbpro_reccaps;
1060}
1061/* channel interface for ESS18xx */
1062#ifdef notyet
1063static void *
1064esschan_init(void *devinfo, snd_dbuf *b, pcm_channel *c, int dir)
1065{
1066 /* the same as sbchan_init()? */
1067}
1068#endif
1069
1070static int
1071esschan_setdir(void *data, int dir)
1072{
1073 struct sb_chinfo *ch = data;
1074 ch->dir = dir;
1075 return 0;
1076}
1077
1078static int
1079esschan_setformat(void *data, u_int32_t format)
1080{
1081 struct sb_chinfo *ch = data;
1082 ess_format(ch, format);
1083 return 0;
1084}
1085
1086static int
1087esschan_setspeed(void *data, u_int32_t speed)
1088{
1089 struct sb_chinfo *ch = data;
1090 return ess_speed(ch, speed);
1091}
1092
1093static int
1094esschan_setblocksize(void *data, u_int32_t blocksize)
1095{
1096 return blocksize;
1097}
1098
1099static int
1100esschan_trigger(void *data, int go)
1101{
1102 struct sb_chinfo *ch = data;
1103 switch (go) {
1104 case PCMTRIG_START:
1105 if (!ch->ess_dma_started)
1106 buf_isadma(ch->buffer, go);
1107 ch->ess_dma_started = 1;
1108 ess_start(ch);
1109 break;
1110 case PCMTRIG_STOP:
1111 if (ch->buffer->dl >= 0) {
1112 buf_isadma(ch->buffer, go);
1113 ch->ess_dma_started = 0;
1114 ess_stop(ch);
1115 }
1116 break;
1117 case PCMTRIG_ABORT:
1118 default:
1119 ch->ess_dma_started = 0;
1120 ess_abort(ch);
1121 buf_isadma(ch->buffer, go);
1122 break;
1123 }
1124 return 0;
1125}
1126
1127static int
1128esschan_getptr(void *data)
1129{
1130 struct sb_chinfo *ch = data;
1131 return buf_isadmaptr(ch->buffer);
1132}
1133
1134static pcmchan_caps *
1135esschan_getcaps(void *data)
1136{
1137 struct sb_chinfo *ch = data;
1138 return (ch->dir == PCMDIR_PLAY)? &ess_playcaps : &ess_reccaps;
1139}
1140
1141/************************************************************/
1142
1143static int
1144sbmix_init(snd_mixer *m)
1145{
1146 struct sb_info *sb = mix_getdevinfo(m);
1147
1148 switch (sb->bd_flags & BD_F_MIX_MASK) {
1149 case BD_F_MIX_CT1345: /* SB 3.0 has 1345 mixer */
1150 mix_setdevs(m, SBPRO_MIXER_DEVICES);
1151 mix_setrecdevs(m, SBPRO_RECORDING_DEVICES);
1152 sb_setmixer(sb, 0, 1); /* reset mixer */
1153 sb_setmixer(sb, MIC_VOL, 0x6); /* mic volume max */
1154 sb_setmixer(sb, RECORD_SRC, 0x0); /* mic source */
1155 sb_setmixer(sb, FM_VOL, 0x0); /* no midi */
1156 break;
1157
1158 case BD_F_MIX_CT1745: /* SB16 mixer ... */
1159 mix_setdevs(m, SB16_MIXER_DEVICES);
1160 mix_setrecdevs(m, SB16_RECORDING_DEVICES);
1161 sb_setmixer(sb, 0x3c, 0x1f); /* make all output active */
1162 sb_setmixer(sb, 0x3d, 0); /* make all inputs-l off */
1163 sb_setmixer(sb, 0x3e, 0); /* make all inputs-r off */
1164 }
1165 return 0;
1166}
1167
1168static int
1169sbmix_set(snd_mixer *m, unsigned dev, unsigned left, unsigned right)
1170{
1171 struct sb_info *sb = mix_getdevinfo(m);
1172 int regoffs;
1173 u_char val;
1174 mixer_tab *iomap;
1175
1176 switch (sb->bd_flags & BD_F_MIX_MASK) {
1177 case BD_F_MIX_CT1345:
1178 if (sb->bd_flags & BD_F_ESS)
1179 iomap = &ess_mix;
1180 else
1181 iomap = &sbpro_mix;
1182 break;
1183
1184 case BD_F_MIX_CT1745:
1185 iomap = &sb16_mix;
1186 break;
1187
1188 default:
1189 return -1;
1190 /* XXX how about the SG NX Pro, iomap = sgnxpro_mix */
1191 }
1192
1193 /* Change left channel */
1194 regoffs = (*iomap)[dev][LEFT_CHN].regno;
1195 if (regoffs != 0) {
1196 val = sb_getmixer(sb, regoffs);
1197 change_bits(iomap, &val, dev, LEFT_CHN, left);
1198 sb_setmixer(sb, regoffs, val);
1199 }
1200
1201 /* Change right channel */
1202 regoffs = (*iomap)[dev][RIGHT_CHN].regno;
1203 if (regoffs != 0) {
1204 val = sb_getmixer(sb, regoffs); /* Read the new one */
1205 change_bits(iomap, &val, dev, RIGHT_CHN, right);
1206 sb_setmixer(sb, regoffs, val);
1207 } else
1208 right = left;
1209
1210 return left | (right << 8);
1211}
1212
1213static int
1214sbmix_setrecsrc(snd_mixer *m, u_int32_t src)
1215{
1216 struct sb_info *sb = mix_getdevinfo(m);
1217 u_char recdev;
1218
1219 switch (sb->bd_flags & BD_F_MIX_MASK) {
1220 case BD_F_MIX_CT1345:
1221 if (src == SOUND_MASK_LINE) recdev = 0x06;
1222 else if (src == SOUND_MASK_CD) recdev = 0x02;
1223 else { /* default: mic */
1224 src = SOUND_MASK_MIC;
1225 recdev = 0;
1226 }
1227 sb_setmixer(sb, RECORD_SRC, recdev |
1228 (sb_getmixer(sb, RECORD_SRC) & ~0x07));
1229 break;
1230
1231 case BD_F_MIX_CT1745: /* sb16 */
1232 recdev = 0;
1233 if (src & SOUND_MASK_MIC) recdev |= 0x01; /* mono mic */
1234 if (src & SOUND_MASK_CD) recdev |= 0x06; /* l+r cd */
1235 if (src & SOUND_MASK_LINE) recdev |= 0x18; /* l+r line */
1236 if (src & SOUND_MASK_SYNTH) recdev |= 0x60; /* l+r midi */
1237 sb_setmixer(sb, SB16_IMASK_L, recdev);
1238 sb_setmixer(sb, SB16_IMASK_R, recdev);
1239 /*
1240 * since the same volume controls apply to the input and
1241 * output sections, the best approach to have a consistent
1242 * behaviour among cards would be to disable the output path
1243 * on devices which are used to record.
1244 * However, since users like to have feedback, we only disable
1245 * the mic -- permanently.
1246 */
1247 sb_setmixer(sb, SB16_OMASK, 0x1f & ~1);
1248 break;
1249 }
1250 return src;
1251}
1252
1253#if NPNP > 0
1254static int
1255sbpnp_probe(device_t dev)
1256{
1257 char *s = NULL;
1258 u_int32_t logical_id = isa_get_logicalid(dev);
1259
1260 switch(logical_id) {
1261 case 0x43008c0e: /* CTL0043 */
1262 case 0x01008c0e: /* CTL0001 */
1263 s = "Vibra16X";
1264 break;
1265
1266 case 0x31008c0e: /* CTL0031 */
1267 case 0x41008c0e: /* CTL0041 */
1268 case 0x42008c0e: /* CTL0042 */
1269 s = "SB16 PnP";
1270 break;
1271
1272 case 0x44008c0e: /* CTL0044 */
1273 s = "Creative SB AWE64 Gold";
1274 break;
1275
1276 case 0x45008c0e: /* CTL0045 */
1277 s = "Creative AWE64 PnP";
1278 break;
1279
1280 case 0x01100000: /* @@@1001 */
1281 s = "Avance Asound 110";
1282 break;
1283
1284 case 0x01200000: /* @@@2001 */
1285 s = "Avance Logic ALS120";
1286 break;
1287
1288 case 0x68187316: /* ESS1868 */
1289 s = "ESS1868";
1290 break;
1291
1292 case 0x69187316: /* ESS1869 */
1293 s = "ESS1869";
1294 break;
1295
1296 case 0x88187316: /* ESS1888 */
1297 s = "ESS1888";
1298 break;
1299 }
1300 if (s) {
1301 device_set_desc(dev, s);
1302 return 0;
1303 }
1304 return ENXIO;
1305}
1306
1307static int
1308sbpnp_attach(device_t dev)
1309{
1310 struct sb_info *sb;
1311 u_int32_t vend_id = isa_get_vendorid(dev);
1312
1313 sb = (struct sb_info *)malloc(sizeof *sb, M_DEVBUF, M_NOWAIT);
1314 if (!sb) return ENXIO;
1315 bzero(sb, sizeof *sb);
1316
1317 switch(vend_id) {
1318 case 0xf0008c0e:
1319 case 0x10019305:
1320 case 0x20019305:
1321 /* XXX add here the vend_id for other vibra16X cards... */
1322 sb->bd_flags = BD_F_SB16X;
1323 }
1324 return sb_doattach(dev, sb);
1325}
1326
1327static device_method_t sbpnp_methods[] = {
1328 /* Device interface */
1329 DEVMETHOD(device_probe, sbpnp_probe),
1330 DEVMETHOD(device_attach, sbpnp_attach),
1331
1332 { 0, 0 }
1333};
1334
1335static driver_t sbpnp_driver = {
1336 "pcm",
1337 sbpnp_methods,
1338 sizeof(snddev_info),
1339};
1340
1341DRIVER_MODULE(sbpnp, isa, sbpnp_driver, pcm_devclass, 0, 0);
1342
1343#endif /* NPNP > 0 */
1344
1345#endif /* NPCM > 0 */
1346
1347