libcsu: Assign environment when environ is NULL
[dragonfly.git] / sys / dev / sound / isa / gusc.c
1 /*-
2  * Copyright (c) 1999 Seigo Tanimura
3  * Copyright (c) 1999 Ville-Pertti Keinonen
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, WHETHER IN 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: src/sys/dev/sound/isa/gusc.c,v 1.16 2005/01/06 01:43:17 imp Exp $
28  */
29
30 #include <sys/param.h>
31 #include <sys/systm.h>
32 #include <sys/kernel.h>
33 #include <sys/bus.h>
34 #include <sys/malloc.h>
35 #include <sys/module.h>
36 #include <sys/rman.h>
37 #include <sys/soundcard.h>
38
39 #include <dev/sound/pcm/sound.h>
40 #include <dev/sound/chip.h>
41 #include "bus_if.h"
42
43 #include <bus/isa/isavar.h>
44 #include <bus/isa/isa_common.h>
45
46 SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/isa/gusc.c,v 1.11 2007/01/04 21:47:02 corecode Exp $");
47
48 #define LOGICALID_NOPNP 0
49 #define LOGICALID_PCM   0x0000561e
50 #define LOGICALID_OPL   0x0300561e
51 #define LOGICALID_MIDI  0x0400561e
52
53 /* PnP IDs */
54 static struct isa_pnp_id gusc_ids[] = {
55         {LOGICALID_PCM,  "GRV0000 Gravis UltraSound PnP PCM"},  /* GRV0000 */
56         {LOGICALID_OPL,  "GRV0003 Gravis UltraSound PnP OPL"},  /* GRV0003 */
57         {LOGICALID_MIDI, "GRV0004 Gravis UltraSound PnP MIDI"}, /* GRV0004 */
58 };
59
60 /* Interrupt handler.  */
61 struct gusc_ihandler {
62         void (*intr)(void *);
63         void *arg;
64 };
65
66 /* Here is the parameter structure per a device. */
67 struct gusc_softc {
68         device_t dev; /* device */
69         int io_rid[3]; /* io port rids */
70         struct resource *io[3]; /* io port resources */
71         int io_alloced[3]; /* io port alloc flag */
72         int irq_rid; /* irq rids */
73         struct resource *irq; /* irq resources */
74         int irq_alloced; /* irq alloc flag */
75         int drq_rid[2]; /* drq rids */
76         struct resource *drq[2]; /* drq resources */
77         int drq_alloced[2]; /* drq alloc flag */
78
79         /* Interrupts are shared (XXX non-PnP only?) */
80         struct gusc_ihandler midi_intr;
81         struct gusc_ihandler pcm_intr;
82 };
83
84 typedef struct gusc_softc *sc_p;
85
86 static int gusc_probe(device_t dev);
87 static int gusc_attach(device_t dev);
88 static int gusisa_probe(device_t dev);
89 static void gusc_intr(void *);
90 static struct resource *gusc_alloc_resource(device_t bus, device_t child, int type, int *rid,
91     u_long start, u_long end, u_long count, u_int flags, int cpuid);
92 static int gusc_release_resource(device_t bus, device_t child, int type, int rid,
93                                    struct resource *r);
94
95 static device_t find_masterdev(sc_p scp);
96 static int alloc_resource(sc_p scp);
97 static int release_resource(sc_p scp);
98
99 static devclass_t gusc_devclass;
100
101 static int
102 gusc_probe(device_t dev)
103 {
104         device_t child;
105         u_int32_t logical_id;
106         char *s;
107         struct sndcard_func *func;
108         int ret;
109
110         logical_id = isa_get_logicalid(dev);
111         s = NULL;
112
113         /* Check isapnp ids */
114         if (logical_id != 0 && (ret = ISA_PNP_PROBE(device_get_parent(dev), dev, gusc_ids)) != 0)
115                 return (ret);
116         else {
117                 if (logical_id == 0)
118                         return gusisa_probe(dev);
119         }
120
121         switch (logical_id) {
122         case LOGICALID_PCM:
123                 s = "Gravis UltraSound Plug & Play PCM";
124                 func = kmalloc(sizeof(struct sndcard_func), M_DEVBUF,
125                                 M_WAITOK | M_ZERO);
126                 func->func = SCF_PCM;
127                 child = device_add_child(dev, "pcm", -1);
128                 device_set_ivars(child, func);
129                 break;
130         case LOGICALID_OPL:
131                 s = "Gravis UltraSound Plug & Play OPL";
132                 func = kmalloc(sizeof(struct sndcard_func), M_DEVBUF,
133                                 M_WAITOK | M_ZERO);
134                 func->func = SCF_SYNTH;
135                 child = device_add_child(dev, "midi", -1);
136                 device_set_ivars(child, func);
137                 break;
138         case LOGICALID_MIDI:
139                 s = "Gravis UltraSound Plug & Play MIDI";
140                 func = kmalloc(sizeof(struct sndcard_func), M_DEVBUF,
141                                 M_WAITOK | M_ZERO);
142                 func->func = SCF_MIDI;
143                 child = device_add_child(dev, "midi", -1);
144                 device_set_ivars(child, func);
145                 break;
146         }
147
148         if (s != NULL) {
149                 device_set_desc(dev, s);
150                 return (0);
151         }
152
153         return (ENXIO);
154 }
155
156 static void
157 port_wr(struct resource *r, int i, unsigned char v)
158 {
159         bus_space_write_1(rman_get_bustag(r), rman_get_bushandle(r), i, v);
160 }
161
162 static int
163 port_rd(struct resource *r, int i)
164 {
165         return bus_space_read_1(rman_get_bustag(r), rman_get_bushandle(r), i);
166 }
167
168 /*
169  * Probe for an old (non-PnP) GUS card on the ISA bus.
170  */
171
172 static int
173 gusisa_probe(device_t dev)
174 {
175         device_t child;
176         struct resource *res, *res2;
177         int base, rid, rid2, flags;
178         unsigned char val;
179
180         base = isa_get_port(dev);
181         flags = device_get_flags(dev);
182         rid = 1;
183         res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, base + 0x100,
184                                  base + 0x107, 8, RF_ACTIVE);
185
186         if (res == NULL)
187                 return ENXIO;
188
189         res2 = NULL;
190
191         /*
192          * Check for the presence of some GUS card.  Reset the card,
193          * then see if we can access the memory on it.
194          */
195
196         port_wr(res, 3, 0x4c);
197         port_wr(res, 5, 0);
198         DELAY(30 * 1000);
199
200         port_wr(res, 3, 0x4c);
201         port_wr(res, 5, 1);
202         DELAY(30 * 1000);
203
204         crit_enter();
205
206         /* Write to DRAM.  */
207
208         port_wr(res, 3, 0x43);          /* Register select */
209         port_wr(res, 4, 0);             /* Low addr */
210         port_wr(res, 5, 0);             /* Med addr */
211
212         port_wr(res, 3, 0x44);          /* Register select */
213         port_wr(res, 4, 0);             /* High addr */
214         port_wr(res, 7, 0x55);          /* DRAM */
215
216         /* Read from DRAM.  */
217
218         port_wr(res, 3, 0x43);          /* Register select */
219         port_wr(res, 4, 0);             /* Low addr */
220         port_wr(res, 5, 0);             /* Med addr */
221
222         port_wr(res, 3, 0x44);          /* Register select */
223         port_wr(res, 4, 0);             /* High addr */
224         val = port_rd(res, 7);          /* DRAM */
225
226         crit_exit();
227
228         if (val != 0x55)
229                 goto fail;
230
231         rid2 = 0;
232         res2 = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid2, base, base, 1,
233                                   RF_ACTIVE);
234
235         if (res2 == NULL)
236                 goto fail;
237
238         crit_enter();
239         port_wr(res2, 0x0f, 0x20);
240         val = port_rd(res2, 0x0f);
241         crit_exit();
242
243         if (val == 0xff || (val & 0x06) == 0)
244                 val = 0;
245         else {
246                 val = port_rd(res2, 0x506);     /* XXX Out of range.  */
247                 if (val == 0xff)
248                         val = 0;
249         }
250
251         bus_release_resource(dev, SYS_RES_IOPORT, rid2, res2);
252         bus_release_resource(dev, SYS_RES_IOPORT, rid, res);
253
254         if (val >= 10) {
255                 struct sndcard_func *func;
256
257                 /* Looks like a GUS MAX.  Set the rest of the resources.  */
258
259                 bus_set_resource(dev, SYS_RES_IOPORT, 2, base + 0x10c, 8, -1);
260
261                 if (flags & DV_F_DUAL_DMA)
262                         bus_set_resource(dev, SYS_RES_DRQ, 1,
263                                          flags & DV_F_DRQ_MASK, 1, -1);
264
265                 /* We can support the CS4231 and MIDI devices.  */
266
267                 func = kmalloc(sizeof(struct sndcard_func), M_DEVBUF,
268                                 M_WAITOK | M_ZERO);
269                 func->func = SCF_MIDI;
270                 child = device_add_child(dev, "midi", -1);
271                 device_set_ivars(child, func);
272
273                 func = kmalloc(sizeof(struct sndcard_func), M_DEVBUF,
274                                 M_WAITOK | M_ZERO);
275                 {
276                         func->func = SCF_PCM;
277                         child = device_add_child(dev, "pcm", -1);
278                         device_set_ivars(child, func);
279                 }
280                 device_set_desc(dev, "Gravis UltraSound MAX");
281                 return 0;
282         } else {
283
284                 /*
285                  * TODO: Support even older GUS cards.  MIDI should work on
286                  * all models.
287                  */
288                 return ENXIO;
289         }
290
291 fail:
292         bus_release_resource(dev, SYS_RES_IOPORT, rid, res);
293         return ENXIO;
294 }
295
296 static int
297 gusc_attach(device_t dev)
298 {
299         sc_p scp;
300         void *ih;
301
302         scp = device_get_softc(dev);
303
304         bzero(scp, sizeof(*scp));
305
306         scp->dev = dev;
307         if (alloc_resource(scp)) {
308                 release_resource(scp);
309                 return (ENXIO);
310         }
311
312         if (scp->irq != NULL)
313                 bus_setup_intr(dev, scp->irq, INTR_TYPE_AV, gusc_intr, scp, &ih, NULL);
314         bus_generic_attach(dev);
315
316         return (0);
317 }
318
319 /*
320  * Handle interrupts on GUS devices until there aren't any left.
321  */
322 static void
323 gusc_intr(void *arg)
324 {
325         sc_p scp = (sc_p)arg;
326         int did_something;
327
328         do {
329                 did_something = 0;
330                 if (scp->pcm_intr.intr != NULL &&
331                     (port_rd(scp->io[2], 2) & 1)) {
332                         (*scp->pcm_intr.intr)(scp->pcm_intr.arg);
333                         did_something = 1;
334                 }
335                 if (scp->midi_intr.intr != NULL &&
336                     (port_rd(scp->io[1], 0) & 0x80)) {
337                         (*scp->midi_intr.intr)(scp->midi_intr.arg);
338                         did_something = 1;
339                 }
340         } while (did_something != 0);
341 }
342
343 static struct resource *
344 gusc_alloc_resource(device_t bus, device_t child, int type, int *rid,
345     u_long start, u_long end, u_long count, u_int flags, int cpuid __unused)
346 {
347         sc_p scp;
348         int *alloced, rid_max, alloced_max;
349         struct resource **res;
350
351         scp = device_get_softc(bus);
352         switch (type) {
353         case SYS_RES_IOPORT:
354                 alloced = scp->io_alloced;
355                 res = scp->io;
356                 rid_max = 2;
357                 alloced_max = 2; /* pcm + midi (more to include synth) */
358                 break;
359         case SYS_RES_IRQ:
360                 alloced = &scp->irq_alloced;
361                 res = &scp->irq;
362                 rid_max = 0;
363                 alloced_max = 2; /* pcm and midi share the single irq. */
364                 break;
365         case SYS_RES_DRQ:
366                 alloced = scp->drq_alloced;
367                 res = scp->drq;
368                 rid_max = 1;
369                 alloced_max = 1;
370                 break;
371         default:
372                 return (NULL);
373         }
374
375         if (*rid > rid_max || alloced[*rid] == alloced_max)
376                 return (NULL);
377
378         alloced[*rid]++;
379         return (res[*rid]);
380 }
381
382 static int
383 gusc_release_resource(device_t bus, device_t child, int type, int rid,
384                         struct resource *r)
385 {
386         sc_p scp;
387         int *alloced, rid_max;
388
389         scp = device_get_softc(bus);
390         switch (type) {
391         case SYS_RES_IOPORT:
392                 alloced = scp->io_alloced;
393                 rid_max = 2;
394                 break;
395         case SYS_RES_IRQ:
396                 alloced = &scp->irq_alloced;
397                 rid_max = 0;
398                 break;
399         case SYS_RES_DRQ:
400                 alloced = scp->drq_alloced;
401                 rid_max = 1;
402                 break;
403         default:
404                 return (1);
405         }
406
407         if (rid > rid_max || alloced[rid] == 0)
408                 return (1);
409
410         alloced[rid]--;
411         return (0);
412 }
413
414 static int
415 gusc_setup_intr(device_t dev, device_t child, struct resource *irq,
416                 int flags, driver_intr_t *intr, void *arg, void **cookiep)
417 {
418         sc_p scp = (sc_p)device_get_softc(dev);
419         devclass_t devclass;
420
421         devclass = device_get_devclass(child);
422         if (strcmp(devclass_get_name(devclass), "midi") == 0) {
423                 scp->midi_intr.intr = intr;
424                 scp->midi_intr.arg = arg;
425                 return 0;
426         } else if (strcmp(devclass_get_name(devclass), "pcm") == 0) {
427                 scp->pcm_intr.intr = intr;
428                 scp->pcm_intr.arg = arg;
429                 return 0;
430         }
431         return bus_generic_setup_intr(dev, child, irq, flags, intr,
432                                       arg, cookiep, NULL, NULL);
433 }
434
435 static device_t
436 find_masterdev(sc_p scp)
437 {
438         int i, units;
439         devclass_t devclass;
440         device_t dev;
441
442         devclass = device_get_devclass(scp->dev);
443         units = devclass_get_maxunit(devclass);
444         dev = NULL;
445         for (i = 0 ; i < units ; i++) {
446                 dev = devclass_get_device(devclass, i);
447                 if (isa_get_vendorid(dev) == isa_get_vendorid(scp->dev)
448                     && isa_get_logicalid(dev) == LOGICALID_PCM
449                     && isa_get_serial(dev) == isa_get_serial(scp->dev))
450                         break;
451         }
452         if (i == units)
453                 return (NULL);
454
455         return (dev);
456 }
457
458 static int io_range[3]  = {0x10, 0x8  , 0x4  };
459 static int io_offset[3] = {0x0 , 0x100, 0x10c};
460 static int
461 alloc_resource(sc_p scp)
462 {
463         int i, base, lid, flags;
464         device_t dev;
465
466         flags = 0;
467         if (isa_get_vendorid(scp->dev))
468                 lid = isa_get_logicalid(scp->dev);
469         else {
470                 lid = LOGICALID_NOPNP;
471                 flags = device_get_flags(scp->dev);
472         }
473         switch(lid) {
474         case LOGICALID_PCM:
475         case LOGICALID_NOPNP:           /* XXX Non-PnP */
476                 if (lid == LOGICALID_NOPNP)
477                         base = isa_get_port(scp->dev);
478                 else
479                         base = 0;
480                 for (i = 0 ; i < NELEM(scp->io) ; i++) {
481                         if (scp->io[i] == NULL) {
482                                 scp->io_rid[i] = i;
483                                 if (base == 0)
484                                         scp->io[i] = bus_alloc_resource(scp->dev, SYS_RES_IOPORT, &scp->io_rid[i],
485                                                                         0, ~0, io_range[i], RF_ACTIVE);
486                                 else
487                                         scp->io[i] = bus_alloc_resource(scp->dev, SYS_RES_IOPORT, &scp->io_rid[i],
488                                                                         base + io_offset[i],
489                                                                         base + io_offset[i] + io_range[i] - 1
490                                                                         , io_range[i], RF_ACTIVE);
491                                 if (scp->io[i] == NULL)
492                                         return (1);
493                                 scp->io_alloced[i] = 0;
494                         }
495                 }
496                 if (scp->irq == NULL) {
497                         scp->irq_rid = 0;
498                         scp->irq = 
499                                 bus_alloc_resource_any(scp->dev, SYS_RES_IRQ, 
500                                                        &scp->irq_rid,
501                                                        RF_ACTIVE|RF_SHAREABLE);
502                         if (scp->irq == NULL)
503                                 return (1);
504                         scp->irq_alloced = 0;
505                 }
506                 for (i = 0 ; i < NELEM(scp->drq) ; i++) {
507                         if (scp->drq[i] == NULL) {
508                                 scp->drq_rid[i] = i;
509                                 if (base == 0 || i == 0)
510                                         scp->drq[i] = 
511                                                 bus_alloc_resource_any(
512                                                         scp->dev, SYS_RES_DRQ,
513                                                         &scp->drq_rid[i],
514                                                         RF_ACTIVE);
515                                 else if ((flags & DV_F_DUAL_DMA) != 0)
516                                         /* XXX The secondary drq is specified in the flag. */
517                                         scp->drq[i] = bus_alloc_resource(scp->dev, SYS_RES_DRQ, &scp->drq_rid[i],
518                                                                          flags & DV_F_DRQ_MASK,
519                                                                          flags & DV_F_DRQ_MASK, 1, RF_ACTIVE);
520                                 if (scp->drq[i] == NULL)
521                                         return (1);
522                                 scp->drq_alloced[i] = 0;
523                         }
524                 }
525                 break;
526         case LOGICALID_OPL:
527                 if (scp->io[0] == NULL) {
528                         scp->io_rid[0] = 0;
529                         scp->io[0] = bus_alloc_resource(scp->dev, SYS_RES_IOPORT, &scp->io_rid[0],
530                                                         0, ~0, io_range[0], RF_ACTIVE);
531                         if (scp->io[0] == NULL)
532                                 return (1);
533                         scp->io_alloced[0] = 0;
534                 }
535                 break;
536         case LOGICALID_MIDI:
537                 if (scp->io[0] == NULL) {
538                         scp->io_rid[0] = 0;
539                         scp->io[0] = bus_alloc_resource(scp->dev, SYS_RES_IOPORT, &scp->io_rid[0],
540                                                         0, ~0, io_range[0], RF_ACTIVE);
541                         if (scp->io[0] == NULL)
542                                 return (1);
543                         scp->io_alloced[0] = 0;
544                 }
545                 if (scp->irq == NULL) {
546                         /* The irq is shared with pcm audio. */
547                         dev = find_masterdev(scp);
548                         if (dev == NULL)
549                                 return (1);
550                         scp->irq_rid = 0;
551                         scp->irq = BUS_ALLOC_RESOURCE(dev, NULL, SYS_RES_IRQ, &scp->irq_rid,
552                                                       0, ~0, 1, RF_ACTIVE | RF_SHAREABLE, -1);
553                         if (scp->irq == NULL)
554                                 return (1);
555                         scp->irq_alloced = 0;
556                 }
557                 break;
558         }
559         return (0);
560 }
561
562 static int
563 release_resource(sc_p scp)
564 {
565         int i, lid;
566         device_t dev;
567
568         if (isa_get_vendorid(scp->dev))
569                 lid = isa_get_logicalid(scp->dev);
570         else
571                 lid = LOGICALID_NOPNP;
572         switch(lid) {
573         case LOGICALID_PCM:
574         case LOGICALID_NOPNP:           /* XXX Non-PnP */
575                 for (i = 0 ; i < NELEM(scp->io) ; i++) {
576                         if (scp->io[i] != NULL) {
577                                 bus_release_resource(scp->dev, SYS_RES_IOPORT, scp->io_rid[i], scp->io[i]);
578                                 scp->io[i] = NULL;
579                         }
580                 }
581                 if (scp->irq != NULL) {
582                         bus_release_resource(scp->dev, SYS_RES_IRQ, scp->irq_rid, scp->irq);
583                         scp->irq = NULL;
584                 }
585                 for (i = 0 ; i < NELEM(scp->drq) ; i++) {
586                         if (scp->drq[i] != NULL) {
587                                 bus_release_resource(scp->dev, SYS_RES_DRQ, scp->drq_rid[i], scp->drq[i]);
588                                 scp->drq[i] = NULL;
589                         }
590                 }
591                 break;
592         case LOGICALID_OPL:
593                 if (scp->io[0] != NULL) {
594                         bus_release_resource(scp->dev, SYS_RES_IOPORT, scp->io_rid[0], scp->io[0]);
595                         scp->io[0] = NULL;
596                 }
597                 break;
598         case LOGICALID_MIDI:
599                 if (scp->io[0] != NULL) {
600                         bus_release_resource(scp->dev, SYS_RES_IOPORT, scp->io_rid[0], scp->io[0]);
601                         scp->io[0] = NULL;
602                 }
603                 if (scp->irq != NULL) {
604                         /* The irq is shared with pcm audio. */
605                         dev = find_masterdev(scp);
606                         if (dev == NULL)
607                                 return (1);
608                         BUS_RELEASE_RESOURCE(dev, NULL, SYS_RES_IOPORT, scp->irq_rid, scp->irq);
609                         scp->irq = NULL;
610                 }
611                 break;
612         }
613         return (0);
614 }
615
616 static device_method_t gusc_methods[] = {
617         /* Device interface */
618         DEVMETHOD(device_probe,         gusc_probe),
619         DEVMETHOD(device_attach,        gusc_attach),
620         DEVMETHOD(device_detach,        bus_generic_detach),
621         DEVMETHOD(device_shutdown,      bus_generic_shutdown),
622         DEVMETHOD(device_suspend,       bus_generic_suspend),
623         DEVMETHOD(device_resume,        bus_generic_resume),
624
625         /* Bus interface */
626         DEVMETHOD(bus_print_child,      bus_generic_print_child),
627         DEVMETHOD(bus_alloc_resource,   gusc_alloc_resource),
628         DEVMETHOD(bus_release_resource, gusc_release_resource),
629         DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
630         DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
631         DEVMETHOD(bus_setup_intr,       gusc_setup_intr),
632         DEVMETHOD(bus_teardown_intr,    bus_generic_teardown_intr),
633
634         { 0, 0 }
635 };
636
637 static driver_t gusc_driver = {
638         "gusc",
639         gusc_methods,
640         sizeof(struct gusc_softc),
641 };
642
643 /*
644  * gusc can be attached to an isa bus.
645  */
646 DRIVER_MODULE(snd_gusc, isa, gusc_driver, gusc_devclass, NULL, NULL);
647 DRIVER_MODULE(snd_gusc, acpi, gusc_driver, gusc_devclass, NULL, NULL);
648 MODULE_DEPEND(snd_gusc, sound, SOUND_MINVER, SOUND_PREFVER, SOUND_MAXVER);
649 MODULE_VERSION(snd_gusc, 1);
650
651