Add the DragonFly cvs id and perform general cleanups on cvs/rcs/sccs ids. Most
[dragonfly.git] / sys / dev / sound / isa / i386 / soundcard.c
1 /*
2  * sound/386bsd/soundcard.c
3  * 
4  * Soundcard driver for 386BSD.
5  * 
6  * Copyright by Hannu Savolainen 1993
7  * 
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions are
10  * met: 1. Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer. 2.
12  * Redistributions in binary form must reproduce the above copyright notice,
13  * this list of conditions and the following disclaimer in the documentation
14  * and/or other materials provided with the distribution.
15  * 
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
17  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
20  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26  * SUCH DAMAGE.
27  *
28  * $FreeBSD: src/sys/i386/isa/sound/soundcard.c,v 1.87 1999/12/20 18:05:01 eivind Exp $
29  * $DragonFly: src/sys/dev/sound/isa/i386/Attic/soundcard.c,v 1.2 2003/06/17 04:28:38 dillon Exp $
30  *
31  */
32 #include <i386/isa/sound/sound_config.h>
33 #if NSND > 0    /* from "snd.h" */
34 #include "uart.h"
35
36 #include <sys/select.h>
37 #include <vm/vm.h>
38 #include <vm/pmap.h>
39 #include <sys/mman.h>
40
41 #include <i386/isa/isa_device.h>
42
43
44 /*
45 **  Register definitions for DMA controller 1 (channels 0..3):
46 */
47 #define DMA1_CHN(c)     (IO_DMA1 + 1*(2*(c)))   /* addr reg for channel c */
48 #define DMA1_SMSK       (IO_DMA1 + 1*10)        /* single mask register */
49 #define DMA1_MODE       (IO_DMA1 + 1*11)        /* mode register */
50 #define DMA1_FFC        (IO_DMA1 + 1*12)        /* clear first/last FF */
51
52 /*
53 **  Register definitions for DMA controller 2 (channels 4..7):
54 */
55 #define DMA2_CHN(c)     (IO_DMA2 + 2*(2*(c)))   /* addr reg for channel c */
56 #define DMA2_SMSK       (IO_DMA2 + 2*10)        /* single mask register */
57 #define DMA2_MODE       (IO_DMA2 + 2*11)        /* mode register */
58 #define DMA2_FFC        (IO_DMA2 + 2*12)        /* clear first/last FF */
59
60
61 #define FIX_RETURN(ret) {if ((ret)<0) return -(ret); else return 0;}
62
63 static int      soundcards_installed = 0; /* Number of installed soundcards */
64 static int      soundcard_configured = 0;
65
66 static struct fileinfo files[SND_NDEVS];
67 struct selinfo  selinfo[SND_NDEVS >> 4];
68
69 int
70 MIDIbuf_poll (int dev, struct fileinfo *file, int events, select_table * wait);
71
72 int
73 audio_poll(int dev, struct fileinfo * file, int events, select_table * wait);
74
75 int
76 sequencer_poll (int dev, struct fileinfo *file, int events, select_table * wait);
77
78 static int sndprobe    __P((struct isa_device *));
79 static int sndattach   __P((struct isa_device *));
80
81 static d_open_t sndopen;
82 static d_close_t sndclose;
83 static d_ioctl_t sndioctl;
84 static d_read_t sndread;
85 static d_write_t sndwrite;
86 static d_poll_t sndpoll;
87 static d_mmap_t sndmmap;
88
89 static char     driver_name[] = "snd";
90
91 #define CDEV_MAJOR 30
92 static struct cdevsw snd_cdevsw = {
93         /* open */      sndopen,
94         /* close */     sndclose,
95         /* read */      sndread,
96         /* write */     sndwrite,
97         /* ioctl */     sndioctl,
98         /* poll */      sndpoll,
99         /* mmap */      sndmmap,
100         /* strategy */  nostrategy,
101         /* name */      driver_name,
102         /* maj */       CDEV_MAJOR,
103         /* dump */      nodump,
104         /* psize */     nopsize,
105         /* flags */     0,
106         /* bmaj */      -1
107 };
108
109
110
111
112 static void     sound_mem_init(void);
113
114 /*
115  * for each "device XXX" entry in the config file, we have
116  * a struct isa_driver which is linked into isa_devtab_null[]
117  *
118  * XXX It is a bit stupid to call the generic routine so many times and
119  * switch then to the specific one, but the alternative way would be
120  * to replicate some code in the probe/attach routines.
121  */
122
123 struct isa_driver opldriver = {sndprobe, sndattach, "opl"};
124 struct isa_driver trixdriver = {sndprobe, sndattach, "trix"};
125 struct isa_driver trixsbdriver = {sndprobe, sndattach, "trixsb"};
126 struct isa_driver sbdriver = {sndprobe, sndattach, "sb"};
127 struct isa_driver sbxvidriver = {sndprobe, sndattach, "sbxvi"};
128 struct isa_driver sbmididriver = {sndprobe, sndattach, "sbmidi"};
129 struct isa_driver awedriver    = {sndprobe, sndattach, "awe"};
130 struct isa_driver pasdriver = {sndprobe, sndattach, "pas"};
131 struct isa_driver mpudriver = {sndprobe, sndattach, "mpu"};
132 struct isa_driver gusdriver = {sndprobe, sndattach, "gus"};
133 struct isa_driver gusxvidriver = {sndprobe, sndattach, "gusxvi"};
134 struct isa_driver gusmaxdriver = {sndprobe, sndattach, "gusmax"};
135 struct isa_driver uartdriver = {sndprobe, sndattach, "uart"};
136 struct isa_driver mssdriver = {sndprobe, sndattach, "mss"};
137 struct isa_driver cssdriver = {sndprobe, sndattach, "css"};
138 struct isa_driver sscapedriver = {sndprobe, sndattach, "sscape"};
139 struct isa_driver sscape_mssdriver = {sndprobe, sndattach, "sscape_mss"};
140 struct isa_driver nssdriver = {sndprobe, sndattach, "nss"};
141
142 short ipri_to_irq(u_short ipri);
143
144 static ointhand2_t sndintr;
145
146 u_long
147 get_time(void)
148 {
149     struct timeval  timecopy;
150
151     getmicrotime(&timecopy);
152     return timecopy.tv_usec / (1000000 / hz) +
153                 (u_long) timecopy.tv_sec * hz;
154 }
155
156 static int
157 sndmmap( dev_t dev, vm_offset_t offset, int nprot )
158 {
159         struct dma_buffparms * dmap;
160         u_int min = minor(dev) >> 4;
161
162         if (min > 0 ) return (-1);
163
164         dmap =  audio_devs[min]->dmap_out;
165
166         if (nprot & PROT_EXEC)
167                 return( -1 );
168         dmap->mapping_flags |= DMA_MAP_MAPPED ;
169         return( i386_btop(vtophys(dmap->raw_buf) + offset) );
170 }
171
172
173 static int
174 sndread(dev_t dev, struct uio * buf, int flag)
175 {
176     int             count = buf->uio_resid;
177     u_int min = minor(dev);
178
179     FIX_RETURN(sound_read_sw(min, &files[min], buf, count));
180 }
181
182
183 static int
184 sndwrite(dev_t dev, struct uio * buf, int flag)
185 {
186     int             count = buf->uio_resid;
187     u_int min = minor(dev);
188
189     FIX_RETURN(sound_write_sw(min, &files[min], buf, count));
190 }
191
192 static int
193 sndopen(dev_t dev, int flags, int mode, struct proc * p)
194 {
195     int             retval;
196     struct fileinfo tmp_file;
197     u_int min = minor(dev);
198
199     if (!soundcard_configured && min) {
200         printf("SoundCard Error: soundcard system has not been configured\n");
201         return ENODEV ;
202     }
203     tmp_file.mode = 0;
204
205     if (flags & FREAD && flags & FWRITE)
206         tmp_file.mode = OPEN_READWRITE;
207     else if (flags & FREAD)
208         tmp_file.mode = OPEN_READ;
209     else if (flags & FWRITE)
210         tmp_file.mode = OPEN_WRITE;
211
212     selinfo[min >> 4].si_pid = 0;
213     selinfo[min >> 4].si_flags = 0;
214     if ((retval = sound_open_sw(min, &tmp_file)) < 0)
215         FIX_RETURN(retval);
216
217     bcopy((char *) &tmp_file, (char *) &files[min], sizeof(tmp_file));
218
219     FIX_RETURN(retval);
220 }
221
222
223 static int
224 sndclose(dev_t dev, int flags, int mode, struct proc * p)
225 {
226     u_int min = minor(dev);
227
228     sound_release_sw(min, &files[min]);
229     return 0 ;
230 }
231
232 static int
233 sndioctl(dev_t dev, u_long cmd, caddr_t arg, int mode, struct proc * p)
234 {
235     u_int min = minor(dev);
236     FIX_RETURN(sound_ioctl_sw(min, &files[min], cmd, arg));
237 }
238
239 int
240 sndpoll(dev_t dev, int events, struct proc * p)
241 {
242     u_int min = minor(dev);
243
244     /* printf ("snd_select(dev=%d, rw=%d, pid=%d)\n", min, rw, p->p_pid); */
245 #ifdef ALLOW_POLL
246     switch (min & 0x0f) {
247 #ifdef CONFIG_SEQUENCER
248     case SND_DEV_SEQ:
249     case SND_DEV_SEQ2:
250         return sequencer_poll(min, &files[min], events, p);
251         break;
252 #endif
253
254 #ifdef CONFIG_MIDI
255     case SND_DEV_MIDIN:
256         return MIDIbuf_poll(min, &files[min], events, p);
257         break;
258 #endif
259
260 #ifdef CONFIG_AUDIO
261     case SND_DEV_DSP:
262     case SND_DEV_DSP16:
263     case SND_DEV_AUDIO:
264
265         return audio_poll(min, &files[min], events, p);
266         break;
267 #endif
268
269     default:
270         return 0;
271     }
272
273 #endif  /* ALLOW_POLL */
274     DEB(printf("sound_ioctl(min=%d, cmd=0x%x, arg=0x%x)\n", min, cmd, arg));
275
276     return 0 ;
277 }
278
279 /* XXX this should become ffs(ipri), perhaps -1 lr 970705 */
280 short
281 ipri_to_irq(u_short ipri)
282 {
283     /*
284      * Converts the ipri (bitmask) to the corresponding irq number
285      */
286     int             irq;
287
288     for (irq = 0; irq < 16; irq++)
289         if (ipri == (1 << irq))
290             return irq;
291
292     return -1;          /* Invalid argument */
293 }
294
295 static int
296 driver_to_voxunit(struct isa_driver * driver)
297 {
298     /*
299      * converts a sound driver pointer into the equivalent VoxWare device
300      * unit number
301      */
302     if (driver == &opldriver)
303         return (SNDCARD_ADLIB);
304     else if (driver == &sbdriver)
305         return (SNDCARD_SB);
306     else if (driver == &pasdriver)
307         return (SNDCARD_PAS);
308     else if (driver == &gusdriver)
309         return (SNDCARD_GUS);
310     else if (driver == &mpudriver)
311         return (SNDCARD_MPU401);
312     else if (driver == &sbxvidriver)
313         return (SNDCARD_SB16);
314     else if (driver == &sbmididriver)
315         return (SNDCARD_SB16MIDI);
316     else if(driver == &awedriver)
317         return(SNDCARD_AWE32);
318     else if (driver == &uartdriver)
319         return (SNDCARD_UART6850);
320     else if (driver == &gusdriver)
321         return (SNDCARD_GUS16);
322     else if (driver == &mssdriver)
323         return (SNDCARD_MSS);
324     else if (driver == &cssdriver)
325         return (SNDCARD_CS4232);
326     else if (driver == &sscapedriver)
327         return(SNDCARD_SSCAPE);
328     else if (driver == &sscape_mssdriver)
329         return(SNDCARD_SSCAPE_MSS);
330     else if (driver == &trixdriver)
331         return (SNDCARD_TRXPRO);
332     else if (driver == &trixsbdriver)
333         return (SNDCARD_TRXPRO_SB);
334     else if (driver == &nssdriver)
335         return (SNDCARD_NSS);
336     else
337         return (0);
338 }
339
340 /*
341  * very dirty: tmp_osp is allocated in sndprobe, and used at the next
342  * call in sndattach
343  */
344
345 static sound_os_info *temp_osp;
346
347 /*
348  * sndprobe is called for each isa_device. From here, a voxware unit
349  * number is determined, and the appropriate probe routine is selected.
350  * The parameters from the config line are passed to the hw_config struct.
351  */
352
353 static int
354 sndprobe(struct isa_device * dev)
355 {
356     struct address_info hw_config;
357     int             unit;
358
359     temp_osp = (sound_os_info *)malloc(sizeof(sound_os_info),
360             M_DEVBUF, M_NOWAIT);
361     if (!temp_osp)
362         panic("SOUND: Cannot allocate memory\n");
363
364     /*
365      * get config info from the kernel config. These may be overridden
366      * by the local autoconfiguration routines though (e.g. pnp stuff).
367      */
368
369     hw_config.io_base = dev->id_iobase;
370     hw_config.irq = ipri_to_irq(dev->id_irq);
371     hw_config.dma = dev->id_drq;
372
373     /*
374      * misuse the flags field for read dma. Note that, to use 0 as
375      * read dma channel, one of the high bits should be set.  lr970705 XXX
376      */
377
378     if (dev->id_flags != 0)
379         hw_config.dma2 = dev->id_flags & 0x7;
380     else
381         hw_config.dma2 = -1;
382
383     hw_config.always_detect = 0;
384     hw_config.name = NULL;
385     hw_config.card_subtype = 0;
386
387     temp_osp->unit = dev->id_unit;
388     hw_config.osp = temp_osp;
389     unit = driver_to_voxunit(dev->id_driver);
390
391     if (sndtable_probe(unit, &hw_config)) {
392         dev->id_iobase = hw_config.io_base;
393         dev->id_irq =  hw_config.irq == -1 ? 0 : (1 << hw_config.irq);
394         dev->id_drq = hw_config.dma;
395
396         if (hw_config.dma != hw_config.dma2 && ( hw_config.dma2 != -1))
397             dev->id_flags = hw_config.dma2 | 0x100; /* XXX lr */
398         else
399             dev->id_flags = 0;
400         return TRUE;
401     }
402     return 0;
403 }
404
405 static int
406 sndattach(struct isa_device * dev)
407 {
408     int             unit;
409     static int      midi_initialized = 0;
410     static int      seq_initialized = 0;
411     struct address_info hw_config;
412     char   *dname;
413
414     /*
415      * Associate interrupt handlers with devices.  XXX this may be incomplete.
416      */
417     dname = dev->id_driver->name;
418 #if defined(CONFIG_AD1848)
419     if (strcmp(dname, "css") == 0 || strcmp(dname, "gusxvi") == 0 ||
420         strcmp(dname, "mss") == 0)
421         dev->id_ointr = adintr;
422 #endif
423 #ifdef CONFIG_GUS
424     if (strcmp(dname, "gus") == 0)
425         dev->id_ointr = gusintr;
426 #endif
427 #ifdef CONFIG_PAS
428     if (strcmp(dname, "pas") == 0)
429         dev->id_ointr = pasintr;
430 #endif
431 #if NSB > 0 && (defined(CONFIG_MIDI) || defined(CONFIG_AUDIO))
432     if (strcmp(dname, "sb") == 0)
433         dev->id_ointr = sbintr;
434 #endif
435     if (strcmp(dname, "sscape_mss") == 0)
436         dev->id_ointr = sndintr;
437 #if NSSCAPE > 0
438     if (strcmp(dname, "sscape") == 0 || strcmp(dname, "trix") == 0)
439         dev->id_ointr = sscapeintr;
440 #endif
441 #if NUART > 0
442     if (strcmp(dname, "uart0") == 0)
443         dev->id_ointr = m6850intr;
444 #endif
445 #if NMPU > 0 && defined(CONFIG_MIDI)
446     if (strcmp(dname, "mpu") == 0)
447         dev->id_ointr = mpuintr;
448 #endif
449 #if NNSS > 0
450     if (strcmp(dname, "nss") == 0)
451         dev->id_ointr = nssintr;
452 #endif
453
454     unit = driver_to_voxunit(dev->id_driver);
455     hw_config.io_base = dev->id_iobase;
456     hw_config.irq = ipri_to_irq(dev->id_irq);
457     hw_config.dma = dev->id_drq;
458
459     /* misuse the flags field for read dma */
460     if (dev->id_flags != 0)
461         hw_config.dma2 = dev->id_flags & 0x7;
462     else
463         hw_config.dma2 = -1;
464
465     hw_config.card_subtype = 0;
466     hw_config.osp = temp_osp;
467
468     if (!unit)
469         return FALSE;
470
471     if (!(sndtable_init_card(unit, &hw_config))) {      /* init card */
472         printf(" <Driver not configured>");
473         return FALSE;
474     }
475     /*
476      * Init the high level sound driver
477      */
478
479     if (!(soundcards_installed = sndtable_get_cardcount())) {
480         DDB(printf("No drivers actually installed\n"));
481         return FALSE;   /* No cards detected */
482     }
483     printf("\n");
484
485 #ifdef CONFIG_AUDIO
486     if (num_audiodevs) {        /* Audio devices present */
487         DMAbuf_init();
488         sound_mem_init();
489     }
490     soundcard_configured = 1;
491 #endif
492
493     if (num_midis && !midi_initialized)
494         midi_initialized = 1;
495
496     if ((num_midis + num_synths) && !seq_initialized) {
497         seq_initialized = 1;
498         sequencer_init();
499     }
500
501     cdevsw_add(&snd_cdevsw);
502 #define GID_SND GID_GAMES
503 #define UID_SND UID_ROOT
504 #define PERM_SND 0660
505     /*
506      *  make links to first successfully probed device, don't do it if
507      *  duplicate creation of same node failed (ie. bad cookie returned)
508      */
509     if (dev->id_driver == &opldriver){
510         make_dev(&snd_cdevsw, (dev->id_unit << 4) | SND_DEV_SEQ,
511             UID_SND, GID_SND, PERM_SND, "sequencer%r", dev->id_unit);
512     } else if (dev->id_driver == &mpudriver || 
513                dev->id_driver == &sbmididriver ||
514                dev->id_driver == &uartdriver){
515         make_dev(&snd_cdevsw, (dev->id_unit << 4) | SND_DEV_MIDIN,
516             UID_SND, GID_SND, PERM_SND, "midi%r", dev->id_unit);
517     } else {
518         make_dev(&snd_cdevsw, (dev->id_unit << 4) | SND_DEV_DSP,
519             UID_SND, GID_SND, PERM_SND, "dsp%r", dev->id_unit);
520         make_dev(&snd_cdevsw, (dev->id_unit << 4) | SND_DEV_DSP16,
521             UID_SND, GID_SND, PERM_SND, "dspW%r", dev->id_unit);
522         make_dev(&snd_cdevsw, (dev->id_unit << 4) | SND_DEV_AUDIO,
523             UID_SND, GID_SND, PERM_SND, "audio%r", dev->id_unit);
524         make_dev(&snd_cdevsw, (dev->id_unit << 4) | SND_DEV_CTL,
525             UID_SND, GID_SND, PERM_SND, "mixer%r", dev->id_unit);
526         make_dev(&snd_cdevsw, (dev->id_unit << 4) | SND_DEV_STATUS,
527             UID_SND, GID_SND, PERM_SND, "sndstat%r", dev->id_unit);
528     }
529     return TRUE;
530 }
531
532
533 #ifdef CONFIG_AUDIO
534
535 static void
536 alloc_dmap(int dev, int chan, struct dma_buffparms * dmap)
537 {
538     char           *tmpbuf;
539     int            i;
540
541     tmpbuf = contigmalloc(audio_devs[dev]->buffsize, M_DEVBUF, M_NOWAIT,
542                 0ul, 0xfffffful, 1ul, chan & 4 ? 0x20000ul : 0x10000ul);
543     if (tmpbuf == NULL)
544         printf("soundcard buffer alloc failed \n");
545
546     if (tmpbuf == NULL) {
547         printf("snd: Unable to allocate %d bytes of buffer\n",
548                2 * (int) audio_devs[dev]->buffsize);
549         return;
550     }
551     dmap->raw_buf = tmpbuf;
552     /*
553      * Use virtual address as the physical address, since isa_dmastart
554      * performs the phys address computation.
555      */
556
557     dmap->raw_buf_phys = (uintptr_t) tmpbuf;
558     for (i = 0; i < audio_devs[dev]->buffsize; i++)   *tmpbuf++ = 0x80; 
559
560 }
561
562 static void
563 sound_mem_init(void)
564 {
565     int             dev;
566     static u_long dsp_init_mask = 0;
567
568     for (dev = 0; dev < num_audiodevs; dev++)   /* Enumerate devices */
569         if (!(dsp_init_mask & (1 << dev)))      /* Not already done */
570             if (audio_devs[dev]->dmachan1 >= 0) {
571                 dsp_init_mask |= (1 << dev);
572                 audio_devs[dev]->buffsize = DSP_BUFFSIZE;
573                 /* Now allocate the buffers */
574                 alloc_dmap(dev, audio_devs[dev]->dmachan1,
575                         audio_devs[dev]->dmap_out);
576                 if (audio_devs[dev]->flags & DMA_DUPLEX)
577                     alloc_dmap(dev, audio_devs[dev]->dmachan2,
578                             audio_devs[dev]->dmap_in);
579             }   /* for dev */
580 }
581
582 #endif
583
584
585 int
586 snd_ioctl_return(int *addr, int value)
587 {
588     if (value < 0)
589         return value;   /* Error */
590     suword(addr, value);
591     return 0;
592 }
593
594 #define MAX_UNIT 50
595 typedef void    (*irq_proc_t) (int irq);
596 static irq_proc_t irq_proc[MAX_UNIT] = {NULL};
597 static int      irq_irq[MAX_UNIT] = {0};
598
599 int
600 snd_set_irq_handler(int int_lvl, void (*hndlr) (int), sound_os_info * osp)
601 {
602     if (osp->unit >= MAX_UNIT) {
603         printf("Sound error: Unit number too high (%d)\n", osp->unit);
604         return 0;
605     }
606     irq_proc[osp->unit] = hndlr;
607     irq_irq[osp->unit] = int_lvl;
608     return 1;
609 }
610
611 static void
612 sndintr(int unit)
613 {
614     if ( (unit >= MAX_UNIT) || (irq_proc[unit] == NULL) )
615         return;
616
617     irq_proc[unit] (irq_irq[unit]);     /* Call the installed handler */
618 }
619
620 void
621 conf_printf(char *name, struct address_info * hw_config)
622 {
623     if (!trace_init)
624         return;
625
626     printf("snd0: <%s> ", name);
627 #if 0
628     if (hw_config->io_base != -1 ) 
629     printf("at 0x%03x", hw_config->io_base);
630
631     if (hw_config->irq != -1 )
632         printf(" irq %d", hw_config->irq);
633
634     if (hw_config->dma != -1 || hw_config->dma2 != -1) {
635         printf(" dma %d", hw_config->dma);
636         if (hw_config->dma2 != -1)
637             printf(",%d", hw_config->dma2);
638     }
639 #endif
640
641 }
642
643 void
644 conf_printf2(char *name, int base, int irq, int dma, int dma2)
645 {
646     if (!trace_init)
647         return;
648
649     printf("snd0: <%s> ", name);
650 #if 0
651     if (hw_config->io_base != -1 ) 
652     printf("at 0x%03x", hw_config->io_base);
653
654     if (irq)
655         printf(" irq %d", irq);
656
657     if (dma != -1 || dma2 != -1) {
658         printf(" dma %d", dma);
659         if (dma2 != -1)
660             printf(",%d", dma2);
661     }
662 #endif
663
664 }
665
666
667 void tenmicrosec (int j)
668 {
669   int             i, k;
670   for (k = 0; k < j/10 ; k++) {
671       for (i = 0; i < 16; i++)
672           inb (0x80);
673   }
674 }
675
676 #endif  /* NSND > 0 */
677
678
679
680