Import 1.3.39
[davej-history.git] / drivers / sound / configure.c
blob9c1eefede2369370d6929553512c329e24d73d4b
1 #define DISABLED_OPTIONS (B(OPT_PNP))
2 /*
3 * sound/configure.c - Configuration program for the Linux Sound Driver
5 * Copyright by Hannu Savolainen 1993-1995
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are
9 * met: 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 2.
11 * Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation
13 * and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
16 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
19 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22 * 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.
29 #include <stdio.h>
30 #include <unistd.h>
31 #include <stdlib.h>
33 #define B(x) (1 << (x))
36 * Option numbers
39 #define OPT_PAS 0
40 #define OPT_SB 1
41 #define OPT_ADLIB 2
42 #define OPT_LAST_MUTUAL 2
44 #define OPT_GUS 3
45 #define OPT_MPU401 4
46 #define OPT_UART6850 5
47 #define OPT_PSS 6
48 #define OPT_GUS16 7
49 #define OPT_GUSMAX 8
50 #define OPT_MSS 9
51 #define OPT_SSCAPE 10
52 #define OPT_TRIX 11
53 #define OPT_MAD16 12
54 #define OPT_CS4232 13
55 #define OPT_MAUI 14
56 #define OPT_PNP 15
58 #define OPT_HIGHLEVEL 16 /* This must be same than the next one */
59 #define OPT_SBPRO 16
60 #define OPT_SB16 17
61 #define OPT_AEDSP16 18
62 #define OPT_AUDIO 19
63 #define OPT_MIDI_AUTO 20
64 #define OPT_MIDI 21
65 #define OPT_YM3812_AUTO 22
66 #define OPT_YM3812 23
67 #define OPT_SEQUENCER 24
68 #define OPT_LAST 24 /* Last defined OPT number */
71 #define ANY_DEVS (B(OPT_AUDIO)|B(OPT_MIDI)|B(OPT_SEQUENCER)|B(OPT_GUS)| \
72 B(OPT_MPU401)|B(OPT_PSS)|B(OPT_GUS16)|B(OPT_GUSMAX)| \
73 B(OPT_MSS)|B(OPT_SSCAPE)|B(OPT_UART6850)|B(OPT_TRIX)| \
74 B(OPT_MAD16)|B(OPT_CS4232)|B(OPT_MAUI))
75 #define AUDIO_CARDS (B (OPT_PSS) | B (OPT_SB) | B (OPT_PAS) | B (OPT_GUS) | \
76 B (OPT_MSS) | B (OPT_GUS16) | B (OPT_GUSMAX) | B (OPT_TRIX) | \
77 B (OPT_SSCAPE)| B(OPT_MAD16) | B(OPT_CS4232))
78 #define MIDI_CARDS (B (OPT_PSS) | B (OPT_SB) | B (OPT_PAS) | B (OPT_MPU401) | \
79 B (OPT_GUS) | B (OPT_TRIX) | B (OPT_SSCAPE)|B(OPT_MAD16) | \
80 B (OPT_CS4232)|B(OPT_MAUI))
81 #define MPU_DEVS (B(OPT_PSS)|B(OPT_SSCAPE)|B(OPT_TRIX)|B(OPT_MAD16)|\
82 B(OPT_CS4232)|B(OPT_PNP)|B(OPT_MAUI))
83 #define AD1848_DEVS (B(OPT_GUS16)|B(OPT_MSS)|B(OPT_PSS)|B(OPT_GUSMAX)|\
84 B(OPT_SSCAPE)|B(OPT_TRIX)|B(OPT_MAD16)|B(OPT_CS4232)|\
85 B(OPT_PNP))
87 * Options that have been disabled for some reason (incompletely implemented
88 * and/or tested). Don't remove from this list before looking at file
89 * experimental.txt for further info.
92 typedef struct
94 unsigned long conditions;
95 unsigned long exclusive_options;
96 char macro[20];
97 int verify;
98 int alias;
99 int default_answ;
102 hw_entry;
106 * The rule table for the driver options. The first field defines a set of
107 * options which must be selected before this entry can be selected. The
108 * second field is a set of options which are not allowed with this one. If
109 * the fourth field is zero, the option is selected without asking
110 * confirmation from the user.
112 * With this version of the rule table it is possible to select just one type of
113 * hardware.
115 * NOTE! Keep the following table and the questions array in sync with the
116 * option numbering!
119 hw_entry hw_table[] =
124 {0, 0, "PAS", 1, 0, 0},
125 {0, 0, "SB", 1, 0, 0},
126 {0, B (OPT_PAS) | B (OPT_SB), "ADLIB", 1, 0, 0},
128 {0, 0, "GUS", 1, 0, 0},
129 {0, 0, "MPU401", 1, 0, 0},
130 {0, 0, "UART6850", 1, 0, 0},
131 {0, 0, "PSS", 1, 0, 0},
132 {B (OPT_GUS), 0, "GUS16", 1, 0, 0},
133 {B (OPT_GUS), B (OPT_GUS16), "GUSMAX", 1, 0, 0},
134 {0, 0, "MSS", 1, 0, 0},
135 {0, 0, "SSCAPE", 1, 0, 0},
136 {0, 0, "TRIX", 1, 0, 0},
137 {0, 0, "MAD16", 1, 0, 0},
138 {0, 0, "CS4232", 1, 0, 0},
139 {0, 0, "MAUI", 1, 0, 0},
140 {0, 0, "PNP", 1, 0, 0},
142 {B (OPT_SB), B (OPT_PAS), "SBPRO", 1, 0, 1},
143 {B (OPT_SB) | B (OPT_SBPRO), B (OPT_PAS), "SB16", 1, 0, 1},
144 {B (OPT_SBPRO) | B (OPT_MSS) | B (OPT_MPU401), 0, "AEDSP16", 1, 0, 0},
145 {AUDIO_CARDS, 0, "AUDIO", 1, 0, 1},
146 {B (OPT_MPU401) | B (OPT_MAUI), 0, "MIDI_AUTO", 0, OPT_MIDI, 0},
147 {MIDI_CARDS, 0, "MIDI", 1, 0, 1},
148 {B (OPT_ADLIB), 0, "YM3812_AUTO", 0, OPT_YM3812, 0},
149 {B (OPT_PSS) | B (OPT_SB) | B (OPT_PAS) | B (OPT_ADLIB) | B (OPT_MSS) | B (OPT_PSS), B (OPT_YM3812_AUTO), "YM3812", 1, 0, 1},
150 {B (OPT_MIDI) | B (OPT_YM3812) | B (OPT_YM3812_AUTO) | B (OPT_GUS), 0, "SEQUENCER", 0, 0, 1}
153 char *questions[] =
155 "ProAudioSpectrum 16 support",
156 "SoundBlaster support",
157 "Generic OPL2/OPL3 FM synthesizer support",
158 "Gravis Ultrasound support",
159 "MPU-401 support (NOT for SB16)",
160 "6850 UART Midi support",
161 "PSS (ECHO-ADI2111) support",
162 "16 bit sampling option of GUS (_NOT_ GUS MAX)",
163 "GUS MAX support",
164 "Microsoft Sound System support",
165 "Ensoniq Soundscape support",
166 "MediaTriX AudioTriX Pro support",
167 "Support for MAD16 and/or Mozart based cards",
168 "Support for Crystal CS4232 based (PnP) cards",
169 "Support for Turtle Beach Wave Front (Maui, Tropez) synthesizers",
170 "Support for PnP soundcards (_EXPERIMENTAL_)",
172 "SoundBlaster Pro support",
173 "SoundBlaster 16 support",
174 "Audio Excel DSP 16 initialization support",
175 "/dev/dsp and /dev/audio supports (usually required)",
176 "This should not be asked",
177 "MIDI interface support",
178 "This should not be asked",
179 "FM synthesizer (YM3812/OPL-3) support",
180 "/dev/sequencer support",
181 "Is the sky really falling"
184 struct kludge
186 char *name;
187 int mask;
189 extra_options[] =
192 "MPU_EMU", MPU_DEVS
196 "AD1848", AD1848_DEVS
200 NULL, 0
204 char *oldconf = "/etc/soundconf";
206 int old_config_used = 0;
208 unsigned long selected_options = 0;
209 int sb_dma = 0;
211 void build_defines (void);
213 #include "hex2hex.h"
214 int bin2hex (char *path, char *target, char *varname);
217 can_select_option (int nr)
220 if (hw_table[nr].conditions)
221 if (!(hw_table[nr].conditions & selected_options))
222 return 0;
224 if (hw_table[nr].exclusive_options)
225 if (hw_table[nr].exclusive_options & selected_options)
226 return 0;
228 if (DISABLED_OPTIONS & B (nr))
229 return 0;
231 return 1;
235 think_positively (int def_answ)
237 char answ[512];
238 int len;
240 if ((len = read (0, answ, sizeof (answ))) < 1)
242 fprintf (stderr, "\n\nERROR! Cannot read stdin\n");
244 perror ("stdin");
245 printf ("#undef CONFIGURE_SOUNDCARD\n");
246 printf ("#undef KERNEL_SOUNDCARD\n");
247 exit (-1);
250 if (len < 2) /*
251 * There is an additional LF at the end
253 return def_answ;
255 answ[len - 1] = 0;
257 if (!strcmp (answ, "y") || !strcmp (answ, "Y"))
258 return 1;
260 return 0;
264 ask_value (char *format, int default_answer)
266 char answ[512];
267 int len, num;
269 play_it_again_Sam:
271 if ((len = read (0, answ, sizeof (answ))) < 1)
273 fprintf (stderr, "\n\nERROR! Cannot read stdin\n");
275 perror ("stdin");
276 printf ("#undef CONFIGURE_SOUNDCARD\n");
277 printf ("#undef KERNEL_SOUNDCARD\n");
278 exit (-1);
281 if (len < 2) /*
282 * There is an additional LF at the end
284 return default_answer;
286 answ[len - 1] = 0;
288 if (sscanf (answ, format, &num) != 1)
290 fprintf (stderr, "Illegal format. Try again: ");
291 goto play_it_again_Sam;
294 return num;
297 void
298 rebuild_file (char *line)
300 char *method, *new, *old, *var, *p;
302 method = p = line;
304 while (*p && *p != ' ')
305 p++;
306 *p++ = 0;
308 old = p;
309 while (*p && *p != ' ')
310 p++;
311 *p++ = 0;
313 new = p;
314 while (*p && *p != ' ')
315 p++;
316 *p++ = 0;
318 var = p;
319 while (*p && *p != ' ')
320 p++;
321 *p++ = 0;
323 fprintf (stderr, "Rebuilding file %s (%s %s)\n", new, method, old);
325 if (strcmp (method, "bin2hex") == 0)
327 if (!bin2hex (old, new, var))
329 fprintf (stderr, "Rebuild failed\n");
330 exit (-1);
333 else if (strcmp (method, "hex2hex") == 0)
335 if (!hex2hex (old, new, var))
337 fprintf (stderr, "Rebuild failed\n");
338 exit (-1);
341 else
343 fprintf (stderr, "Failed to build '%s' - unknown method %s\n",
344 new, method);
345 exit (-1);
350 use_old_config (char *filename)
352 char buf[1024];
353 int i = 0;
355 FILE *oldf;
357 fprintf (stderr, "Copying old configuration from %s\n", filename);
359 if ((oldf = fopen (filename, "r")) == NULL)
361 fprintf (stderr, "Couldn't open previous configuration file\n");
362 perror (filename);
363 return 0;
366 while (fgets (buf, 1024, oldf) != NULL)
368 char tmp[100];
370 if (buf[0] != '#')
372 printf ("%s", buf);
374 strncpy (tmp, buf, 8);
375 tmp[8] = 0;
377 if (strcmp (tmp, "/*build ") == 0)
378 rebuild_file (&buf[8]);
380 continue;
383 strncpy (tmp, buf, 8);
384 tmp[8] = 0;
386 if (strcmp (tmp, "#define ") == 0)
388 char *id = &buf[8];
390 i = 0;
391 while (id[i] && id[i] != ' ' &&
392 id[i] != '\t' && id[i] != '\n')
393 i++;
395 strncpy (tmp, id, i);
396 tmp[i] = 0;
398 if (strcmp (tmp, "SELECTED_SOUND_OPTIONS") == 0)
399 continue;
401 tmp[8] = 0; /* Truncate the string */
402 if (strcmp (tmp, "EXCLUDE_") == 0)
403 continue; /* Skip excludes */
405 printf ("%s", buf);
406 continue;
409 if (strcmp (tmp, "#undef ") == 0)
411 char *id = &buf[8];
413 i = 0;
414 while (id[i] && id[i] != ' ' &&
415 id[i] != '\t' && id[i] != '\n')
416 i++;
418 strncpy (tmp, id, i);
419 tmp[i] = 0;
421 tmp[8] = 0; /* Truncate the string */
422 if (strcmp (tmp, "EXCLUDE_") != 0)
423 continue; /* Not a #undef EXCLUDE_ line */
424 strncpy (tmp, &id[8], i - 8);
425 tmp[i - 8] = 0;
427 for (i = 0; i <= OPT_LAST; i++)
428 if (strcmp (hw_table[i].macro, tmp) == 0)
430 selected_options |= (1 << i);
431 break;
433 continue;
436 printf ("%s", buf);
438 fclose (oldf);
440 for (i = 0; i <= OPT_LAST; i++)
441 if (!hw_table[i].alias)
442 if (selected_options & B (i))
443 printf ("#undef EXCLUDE_%s\n", hw_table[i].macro);
444 else
445 printf ("#define EXCLUDE_%s\n", hw_table[i].macro);
448 printf ("\n");
450 i = 0;
452 while (extra_options[i].name != NULL)
454 if (selected_options & extra_options[i].mask)
455 printf ("#undef EXCLUDE_%s\n", extra_options[i].name);
456 else
457 printf ("#define EXCLUDE_%s\n", extra_options[i].name);
458 i++;
461 printf ("\n");
463 printf ("#define SELECTED_SOUND_OPTIONS\t0x%08x\n", selected_options);
464 fprintf (stderr, "Old configuration copied.\n");
466 build_defines ();
467 old_config_used = 1;
468 return 1;
471 void
472 build_defines (void)
474 FILE *optf;
475 int i;
477 if ((optf = fopen (".defines", "w")) == NULL)
479 perror (".defines");
480 exit (-1);
484 for (i = 0; i <= OPT_LAST; i++)
485 if (!hw_table[i].alias)
486 if (selected_options & B (i))
487 fprintf (optf, "CONFIG_%s=y\n", hw_table[i].macro);
490 fprintf (optf, "\n");
492 i = 0;
494 while (extra_options[i].name != NULL)
496 if (selected_options & extra_options[i].mask)
497 fprintf (optf, "CONFIG_%s=y\n", extra_options[i].name);
498 i++;
501 fprintf (optf, "\n");
502 fclose (optf);
506 main (int argc, char *argv[])
508 int i, num, def_size, full_driver = 1;
509 char answ[10];
510 int sb_base = 0;
511 char old_config_file[200];
513 fprintf (stderr, "\nConfiguring the sound support\n\n");
515 if (getuid () != 0) /* Not root */
517 char *home;
519 if ((home = getenv ("HOME")) != NULL)
521 sprintf (old_config_file, "%s/.soundconf", home);
522 oldconf = old_config_file;
526 if (argc > 1)
528 if (strcmp (argv[1], "-o") == 0 &&
529 use_old_config (oldconf))
530 exit (0);
533 if (access (oldconf, R_OK) == 0)
535 fprintf (stderr, "Old configuration exists in %s. Use it (y/n) ? ",
536 oldconf);
537 if (think_positively (1))
538 if (use_old_config (oldconf))
539 exit (0);
543 printf ("/*\tGenerated by configure. Don't edit!!!!\t*/\n\n");
547 * Partial driver
550 full_driver = 0;
552 for (i = 0; i <= OPT_LAST; i++)
553 if (can_select_option (i))
555 if (!(selected_options & B (i))) /*
556 * Not selected yet
558 if (!hw_table[i].verify)
560 if (hw_table[i].alias)
561 selected_options |= B (hw_table[i].alias);
562 else
563 selected_options |= B (i);
565 else
567 int def_answ = hw_table[i].default_answ;
569 fprintf (stderr,
570 def_answ ? " %s (y/n) ? " : " %s (n/y) ? ",
571 questions[i]);
572 if (think_positively (def_answ))
573 if (hw_table[i].alias)
574 selected_options |= B (hw_table[i].alias);
575 else
576 selected_options |= B (i);
581 if (selected_options & B (OPT_SBPRO))
583 fprintf (stderr, "Do you want support for the mixer of SG NX Pro ? ");
584 if (think_positively (0))
585 printf ("#define __SGNXPRO__\n");
588 if (selected_options & B (OPT_SB))
590 fprintf (stderr, "Do you want support for the MV Jazz16 (ProSonic etc.) ? ");
591 if (think_positively (0))
593 printf ("#define JAZZ16\n");
596 fprintf (stderr, "\tValid 16 bit DMA channels for ProSonic/Jazz 16 are\n");
597 fprintf (stderr, "\t1, 3, 5 (default), 7\n");
598 fprintf (stderr, "\tEnter 16bit DMA channel for Prosonic : ");
599 num = ask_value ("%d", 5);
601 while (num != 1 && num != 3 && num != 5 && num != 7);
602 fprintf (stderr, "ProSonic 16 bit DMA set to %d\n", num);
603 printf ("#define JAZZ_DMA16 %d\n", num);
605 fprintf (stderr, "Do you have SoundMan Wave (n/y) ? ");
607 if (think_positively (0))
609 printf ("#define SM_WAVE\n");
611 midi0001_again:
612 fprintf
613 (stderr,
614 "Logitech SoundMan Wave has a microcontroller which must be initialized\n"
615 "before MIDI emulation works. This is possible only if the microcode\n"
616 "file is compiled into the driver.\n"
617 "Do you have access to the MIDI0001.BIN file (y/n) ? ");
618 if (think_positively (1))
620 char path[512];
622 fprintf (stderr,
623 "Enter full name of the MIDI0001.BIN file (pwd is sound): ");
624 scanf ("%s", path);
625 fprintf (stderr, "including microcode file %s\n", path);
627 if (!bin2hex (path, "smw-midi0001.h", "smw_ucode"))
629 fprintf (stderr, "couldn't open %s file\n",
630 path);
631 fprintf (stderr, "try again with correct path? ");
632 if (think_positively (1))
633 goto midi0001_again;
635 else
637 printf ("#define SMW_MIDI0001_INCLUDED\n");
638 printf ("/*build bin2hex %s smw-midi0001.h smw_ucode */\n", path);
645 if (selected_options & B (OPT_SBPRO))
647 fprintf (stderr, "\n\nThe Logitech SoundMan Games supports 44 kHz in stereo\n"
648 "while the standard SB Pro supports just 22 kHz/stereo\n"
649 "You have an option to enable the SM Games mode.\n"
650 "However do enable it only if you are _sure_ that your\n"
651 "card is a SM Games. Enabling this feature with a\n"
652 "plain old SB Pro _will_ cause troubles with stereo mode.\n"
653 "\n"
654 "DANGER! Read the above once again before answering 'y'\n"
655 "Answer 'n' in case you are unsure what to do!\n");
656 fprintf (stderr, "Do you have a Logitech SoundMan Games (n/y) ? ");
657 if (think_positively (0))
658 printf ("#define SM_GAMES\n");
661 if (selected_options & B (OPT_SB16))
662 selected_options |= B (OPT_SBPRO);
664 if (selected_options & B (OPT_AEDSP16))
666 int sel1 = 0;
668 if (selected_options & B (OPT_SBPRO))
670 fprintf (stderr, "Do you want support for the Audio Excel SoundBlaster pro mode ? ");
671 if (think_positively (1))
673 printf ("#define AEDSP16_SBPRO\n");
674 sel1 = 1;
678 if ((selected_options & B (OPT_MSS)) && (sel1 == 0))
680 fprintf (stderr, "Do you want support for the Audio Excel Microsoft Sound System mode? ");
681 if (think_positively (1))
683 printf ("#define AEDSP16_MSS\n");
684 sel1 = 1;
688 if (sel1 == 0)
690 printf ("#undef CONFIGURE_SOUNDCARD\n");
691 printf ("#undef KERNEL_SOUNDCARD\n");
692 fprintf (stderr, "ERROR!!!!!\nYou loose: you must select at least one mode when using Audio Excel!\n");
693 exit (-1);
695 if (selected_options & B (OPT_MPU401))
696 printf ("#define AEDSP16_MPU401\n");
699 if (selected_options & B (OPT_PSS))
701 genld_again:
702 fprintf
703 (stderr,
704 "if you wish to emulate the soundblaster and you have a DSPxxx.LD.\n"
705 "then you must include the LD in the kernel.\n"
706 "Do you wish to include a LD (y/n) ? ");
707 if (think_positively (1))
709 char path[512];
711 fprintf (stderr,
712 "Enter the path to your LD file (pwd is sound): ");
713 scanf ("%s", path);
714 fprintf (stderr, "including LD file %s\n", path);
716 if (!bin2hex (path, "synth-ld.h", "pss_synth"))
718 fprintf (stderr, "couldn't open %s as the ld file\n",
719 path);
720 fprintf (stderr, "try again with correct path? ");
721 if (think_positively (1))
722 goto genld_again;
724 else
726 printf ("#define PSS_HAVE_LD\n");
727 printf ("/*build bin2hex %s synth-ld.h pss_synth */\n", path);
730 else
732 FILE *sf = fopen ("synth-ld.h", "w");
734 fprintf (sf, "/* automaticaly generated by configure */\n");
735 fprintf (sf, "unsigned char pss_synth[1];\n"
736 "#define pss_synthLen 0\n");
737 fclose (sf);
741 if (selected_options & B (OPT_TRIX))
743 hex2hex_again:
744 fprintf (stderr, "MediaTriX audioTriX Pro has a onboard microcontroller\n"
745 "which needs to be initialized by downloading\n"
746 "the code from file TRXPRO.HEX in the DOS driver\n"
747 "directory. If you don't have the TRXPRO.HEX handy\n"
748 "you may skip this step. However SB and MPU-401\n"
749 "modes of AudioTriX Pro will not work without\n"
750 "this file!\n"
751 "\n"
752 "Do you want to include TRXPRO.HEX in your kernel (y/n) ? ");
754 if (think_positively (1))
756 char path[512];
758 fprintf (stderr,
759 "Enter the path to your TRXPRO.HEX file (pwd is sound): ");
760 scanf ("%s", path);
761 fprintf (stderr, "including HEX file %s\n", path);
763 if (!hex2hex (path, "trix_boot.h", "trix_boot"))
764 goto hex2hex_again;
765 printf ("/*build hex2hex %s trix_boot.h trix_boot */\n", path);
766 printf ("#define INCLUDE_TRIX_BOOT\n");
770 if (!(selected_options & ANY_DEVS))
772 printf ("#undef CONFIGURE_SOUNDCARD\n");
773 printf ("#undef KERNEL_SOUNDCARD\n");
774 fprintf (stderr, "\n*** This combination is useless. Sound driver disabled!!! ***\n\n");
775 exit (0);
777 else
778 printf ("#define KERNEL_SOUNDCARD\n");
780 for (i = 0; i <= OPT_LAST; i++)
781 if (!hw_table[i].alias)
782 if (selected_options & B (i))
783 printf ("#undef EXCLUDE_%s\n", hw_table[i].macro);
784 else
785 printf ("#define EXCLUDE_%s\n", hw_table[i].macro);
788 printf ("\n");
790 i = 0;
792 while (extra_options[i].name != NULL)
794 if (selected_options & extra_options[i].mask)
795 printf ("#undef EXCLUDE_%s\n", extra_options[i].name);
796 else
797 printf ("#define EXCLUDE_%s\n", extra_options[i].name);
798 i++;
801 printf ("\n");
805 build_defines ();
807 * IRQ and DMA settings
810 if (selected_options & B (OPT_AEDSP16))
812 fprintf (stderr, "\nI/O base for Audio Excel DSP 16 ?\n"
813 "Warning:\n"
814 "If you are using Audio Excel SoundBlaster emulation,\n"
815 "you must use the same I/O base for Audio Excel and SoundBlaster.\n"
816 "The factory default is 220 (other possible value is 240)\n"
817 "Enter the Audio Excel DSP 16 I/O base: ");
819 num = ask_value ("%x", 0x220);
820 fprintf (stderr, "Audio Excel DSP 16 I/O base set to %03x\n", num);
821 printf ("#define AEDSP16_BASE 0x%03x\n", num);
824 if ((selected_options & B (OPT_SB)) && selected_options & (B (OPT_AUDIO) | B (OPT_MIDI)))
826 fprintf (stderr, "\nI/O base for SB?\n"
827 "The factory default is 220\n"
828 "Enter the SB I/O base: ");
830 sb_base = num = ask_value ("%x", 0x220);
831 fprintf (stderr, "SB I/O base set to %03x\n", num);
832 printf ("#define SBC_BASE 0x%03x\n", num);
834 fprintf (stderr, "\nIRQ number for SoundBlaster?\n"
835 "The IRQ address is defined by the jumpers on your card.\n"
836 "The factory default is either 5 or 7 (depending on the model).\n"
837 "Valid values are 9(=2), 5, 7 and 10.\n"
838 "Enter the value: ");
840 num = ask_value ("%d", 7);
841 if (num != 9 && num != 5 && num != 7 && num != 10)
844 fprintf (stderr, "*** Illegal input! ***\n");
845 num = 7;
847 fprintf (stderr, "SoundBlaster IRQ set to %d\n", num);
849 printf ("#define SBC_IRQ %d\n", num);
851 if (selected_options & (B (OPT_SBPRO) | B (OPT_PAS)))
853 fprintf (stderr, "\nDMA channel for SoundBlaster?\n"
854 "For SB 1.0, 1.5 and 2.0 this MUST be 1\n"
855 "SB Pro supports DMA channels 0, 1 and 3 (jumper)\n"
856 "For SB16 give the 8 bit DMA# here\n"
857 "The default value is 1\n"
858 "Enter the value: ");
860 num = ask_value ("%d", 1);
861 if (num < 0 || num > 3)
864 fprintf (stderr, "*** Illegal input! ***\n");
865 num = 1;
867 fprintf (stderr, "SoundBlaster DMA set to %d\n", num);
868 printf ("#define SBC_DMA %d\n", num);
869 sb_dma = num;
872 if (selected_options & B (OPT_SB16))
875 fprintf (stderr, "\n16 bit DMA channel for SoundBlaster 16?\n"
876 "Possible values are 5, 6 or 7\n"
877 "The default value is 6\n"
878 "Enter the value: ");
880 num = ask_value ("%d", 6);
881 if ((num < 5 || num > 7) && (num != sb_dma))
884 fprintf (stderr, "*** Illegal input! ***\n");
885 num = 6;
887 fprintf (stderr, "SoundBlaster DMA set to %d\n", num);
888 printf ("#define SB16_DMA %d\n", num);
890 fprintf (stderr, "\nI/O base for SB16 Midi?\n"
891 "Possible values are 300 and 330\n"
892 "The factory default is 330\n"
893 "Enter the SB16 Midi I/O base: ");
895 num = ask_value ("%x", 0x330);
896 fprintf (stderr, "SB16 Midi I/O base set to %03x\n", num);
897 printf ("#define SB16MIDI_BASE 0x%03x\n", num);
901 if (selected_options & B (OPT_PAS))
904 if (selected_options & (B (OPT_AUDIO) | B (OPT_MIDI)))
906 fprintf (stderr, "\nIRQ number for ProAudioSpectrum?\n"
907 "The recommended value is the IRQ used under DOS.\n"
908 "Please refer to the ProAudioSpectrum User's Guide.\n"
909 "The default value is 10.\n"
910 "Enter the value: ");
912 num = ask_value ("%d", 10);
913 if (num == 6 || num < 3 || num > 15 || num == 2) /*
914 * Illegal
918 fprintf (stderr, "*** Illegal input! ***\n");
919 num = 10;
921 fprintf (stderr, "ProAudioSpectrum IRQ set to %d\n", num);
922 printf ("#define PAS_IRQ %d\n", num);
925 if (selected_options & B (OPT_AUDIO))
927 fprintf (stderr, "\nDMA number for ProAudioSpectrum?\n"
928 "The recommended value is the DMA channel under DOS.\n"
929 "Please refer to the ProAudioSpectrum User's Guide.\n"
930 "The default value is 3\n"
931 "Enter the value: ");
933 num = ask_value ("%d", 3);
934 if (num == 4 || num < 0 || num > 7)
937 fprintf (stderr, "*** Illegal input! ***\n");
938 num = 3;
940 fprintf (stderr, "\nProAudioSpectrum DMA set to %d\n", num);
941 printf ("#define PAS_DMA %d\n", num);
943 fprintf (stderr, "\nEnable Joystick port on ProAudioSpectrum (n/y) ? ");
944 if (think_positively (0))
945 printf ("#define PAS_JOYSTICK_ENABLE\n");
947 fprintf (stderr, "PAS16 could be noisy with some mother boards\n"
948 "There is a command line switch (was it :T?)\n"
949 "in the DOS driver for PAS16 which solves this.\n"
950 "Don't enable this feature unless you have problems!\n"
951 "Do you have to use this switch with DOS (y/n) ?");
952 if (think_positively (0))
953 printf ("#define BROKEN_BUS_CLOCK\n");
956 if (selected_options & B (OPT_GUS))
958 fprintf (stderr, "\nI/O base for Gravis Ultrasound?\n"
959 "Valid choices are 210, 220, 230, 240, 250 or 260\n"
960 "The factory default is 220\n"
961 "Enter the GUS I/O base: ");
963 num = ask_value ("%x", 0x220);
964 if ((num > 0x260) || ((num & 0xf0f) != 0x200) || ((num & 0x0f0) > 0x060))
967 fprintf (stderr, "*** Illegal input! ***\n");
968 num = 0x220;
971 if ((selected_options & B (OPT_SB)) && (num == sb_base))
973 fprintf (stderr, "FATAL ERROR!!!!!!!!!!!!!!\n"
974 "\t0x220 cannot be used if SoundBlaster is enabled.\n"
975 "\tRun the config again.\n");
976 printf ("#undef CONFIGURE_SOUNDCARD\n");
977 printf ("#undef KERNEL_SOUNDCARD\n");
978 exit (-1);
980 fprintf (stderr, "GUS I/O base set to %03x\n", num);
981 printf ("#define GUS_BASE 0x%03x\n", num);
983 fprintf (stderr, "\nIRQ number for Gravis UltraSound?\n"
984 "The recommended value is the IRQ used under DOS.\n"
985 "Please refer to the Gravis Ultrasound User's Guide.\n"
986 "The default value is 15.\n"
987 "Enter the value: ");
989 num = ask_value ("%d", 15);
990 if (num == 6 || num < 3 || num > 15 || num == 2) /*
991 * Invalid
995 fprintf (stderr, "*** Illegal input! ***\n");
996 num = 15;
998 fprintf (stderr, "Gravis UltraSound IRQ set to %d\n", num);
999 printf ("#define GUS_IRQ %d\n", num);
1001 fprintf (stderr, "\nDMA number for Gravis UltraSound?\n"
1002 "The recommended value is the DMA channel under DOS.\n"
1003 "Please refer to the Gravis Ultrasound User's Guide.\n"
1004 "The default value is 6\n"
1005 "Enter the value: ");
1007 num = ask_value ("%d", 6);
1008 if (num == 4 || num < 0 || num > 7)
1010 fprintf (stderr, "*** Illegal input! ***\n");
1011 num = 6;
1013 fprintf (stderr, "\nGravis UltraSound DMA set to %d\n", num);
1014 printf ("#define GUS_DMA %d\n", num);
1016 fprintf (stderr, "\nSecond DMA channel for GUS (optional)?\n"
1017 "The default value is 7 (-1 disables)\n"
1018 "Enter the value: ");
1020 num = ask_value ("%d", 7);
1021 if (num > 7)
1023 fprintf (stderr, "*** Illegal input! ***\n");
1024 num = 7;
1027 fprintf (stderr, "\nGUS DMA2 set to %d\n", num);
1028 printf ("#define GUS_DMA2 %d\n", num);
1030 if (selected_options & B (OPT_GUS16))
1032 fprintf (stderr, "\nI/O base for GUS16 (GUS 16 bit sampling option)?\n"
1033 "The factory default is 530\n"
1034 "Other possible values are 604, E80 or F40\n"
1035 "Enter the GUS16 I/O base: ");
1037 num = ask_value ("%x", 0x530);
1038 fprintf (stderr, "GUS16 I/O base set to %03x\n", num);
1039 printf ("#define GUS16_BASE 0x%03x\n", num);
1041 fprintf (stderr, "\nIRQ number for GUS16?\n"
1042 "Valid numbers are: 3, 4, 5, 7, or 9(=2).\n"
1043 "The default value is 7.\n"
1044 "Enter the value: ");
1046 num = ask_value ("%d", 7);
1047 if (num == 6 || num < 3 || num > 15)
1049 fprintf (stderr, "*** Illegal input! ***\n");
1050 num = 7;
1052 fprintf (stderr, "GUS16 IRQ set to %d\n", num);
1053 printf ("#define GUS16_IRQ %d\n", num);
1055 fprintf (stderr, "\nDMA number for GUS16?\n"
1056 "The default value is 3\n"
1057 "Enter the value: ");
1059 num = ask_value ("%d", 3);
1060 if (num < 0 || num > 3)
1062 fprintf (stderr, "*** Illegal input! ***\n");
1063 num = 3;
1065 fprintf (stderr, "\nGUS16 DMA set to %d\n", num);
1066 printf ("#define GUS16_DMA %d\n", num);
1070 if (selected_options & B (OPT_MPU401))
1072 fprintf (stderr, "\nI/O base for MPU-401?\n"
1073 "The factory default is 330\n"
1074 "Enter the MPU-401 I/O base: ");
1076 num = ask_value ("%x", 0x330);
1077 fprintf (stderr, "MPU-401 I/O base set to %03x\n", num);
1078 printf ("#define MPU_BASE 0x%03x\n", num);
1080 fprintf (stderr, "\nIRQ number for MPU-401?\n"
1081 "Valid numbers are: 3, 4, 5, 7 and 9(=2).\n"
1082 "The default value is 9.\n"
1083 "Enter the value: ");
1085 num = ask_value ("%d", 9);
1086 if (num == 6 || num < 3 || num > 15)
1089 fprintf (stderr, "*** Illegal input! ***\n");
1090 num = 5;
1092 fprintf (stderr, "MPU-401 IRQ set to %d\n", num);
1093 printf ("#define MPU_IRQ %d\n", num);
1096 if (selected_options & B (OPT_MAUI))
1098 fprintf (stderr, "\nI/O base for TB Maui (MIDI I/O of TB Tropez)?\n"
1099 "The factory default is 330\n"
1100 "Valid alternatives are 210, 230, 260, 290, 300, 320, 338 and 330\n"
1101 "Enter the Maui/Tropez MIDI I/O base: ");
1103 num = ask_value ("%x", 0x330);
1104 fprintf (stderr, "Maui I/O base set to %03x\n", num);
1105 printf ("#define MAUI_BASE 0x%03x\n", num);
1107 fprintf (stderr, "\nIRQ number for TB Maui (TB Tropez MIDI)?\n"
1108 "Valid numbers are: 5, 9, 12 and 15.\n"
1109 "The default value is 9.\n"
1110 "Enter the value: ");
1112 num = ask_value ("%d", 9);
1113 if (num == 6 || num < 3 || num > 15)
1116 fprintf (stderr, "*** Illegal input! ***\n");
1117 num = 5;
1119 fprintf (stderr, "Maui/Tropez MIDI IRQ set to %d\n", num);
1120 printf ("#define MAUI_IRQ %d\n", num);
1123 if (selected_options & B (OPT_UART6850))
1125 fprintf (stderr, "\nI/O base for 6850 UART Midi?\n"
1126 "Be carefull. No defaults.\n"
1127 "Enter the 6850 UART I/O base: ");
1129 num = ask_value ("%x", 0);
1130 if (num == 0)
1133 * Invalid value entered
1135 printf ("#define EXCLUDE_UART6850\n");
1137 else
1139 fprintf (stderr, "6850 UART I/O base set to %03x\n", num);
1140 printf ("#define U6850_BASE 0x%03x\n", num);
1142 fprintf (stderr, "\nIRQ number for 6850 UART?\n"
1143 "Valid numbers are: 3, 4, 5, 7 and 9(=2).\n"
1144 "The default value is 5.\n"
1145 "Enter the value: ");
1147 num = ask_value ("%d", 5);
1148 if (num == 6 || num < 3 || num > 15)
1151 fprintf (stderr, "*** Illegal input! ***\n");
1152 num = 5;
1154 fprintf (stderr, "6850 UART IRQ set to %d\n", num);
1155 printf ("#define U6850_IRQ %d\n", num);
1159 if (selected_options & B (OPT_PSS))
1161 fprintf (stderr, "\nI/O base for PSS?\n"
1162 "The factory default is 220 (240 also possible)\n"
1163 "Enter the PSS I/O base: ");
1165 num = ask_value ("%x", 0x220);
1166 fprintf (stderr, "PSS I/O base set to %03x\n", num);
1167 printf ("#define PSS_BASE 0x%03x\n", num);
1169 #if YOU_WANT_TO_WASTE_RESOURCES
1170 fprintf (stderr, "\nIRQ number for PSS?\n"
1171 "Valid numbers are: 3, 4, 5, 7, 9(=2) or 10.\n"
1172 "The default value is 10.\n"
1173 "Enter the value: ");
1175 num = ask_value ("%d", 10);
1176 if (num == 6 || num < 3 || num > 15)
1178 fprintf (stderr, "*** Illegal input! ***\n");
1179 num = 7;
1181 fprintf (stderr, "PSS IRQ set to %d\n", num);
1182 printf ("#define PSS_IRQ %d\n", num);
1184 fprintf (stderr, "\nDMA number for ECHO-PSS?\n"
1185 "The default value is 5\n"
1186 "Valid values are 5, 6 and 7\n"
1187 "Enter the value: ");
1189 num = ask_value ("%d", 5);
1190 if (num < 5 || num > 7)
1192 fprintf (stderr, "*** Illegal input! ***\n");
1193 num = 5;
1195 fprintf (stderr, "\nECHO-PSS DMA set to %d\n", num);
1196 printf ("#define PSS_DMA %d\n", num);
1197 #endif
1199 fprintf (stderr, "\nMSS (MS Sound System) I/O base for the PSS card?\n"
1200 "The factory default is 530\n"
1201 "Other possible values are 604, E80 or F40\n"
1202 "Enter the MSS I/O base: ");
1204 num = ask_value ("%x", 0x530);
1205 fprintf (stderr, "PSS/MSS I/O base set to %03x\n", num);
1206 printf ("#define PSS_MSS_BASE 0x%03x\n", num);
1208 fprintf (stderr, "\nIRQ number for the MSS mode of PSS ?\n"
1209 "Valid numbers are: 7, 9(=2), 10 and 11.\n"
1210 "The default value is 11.\n"
1211 "Enter the value: ");
1213 num = ask_value ("%d", 11);
1214 if (num == 6 || num < 3 || num > 15)
1216 fprintf (stderr, "*** Illegal input! ***\n");
1217 num = 11;
1219 fprintf (stderr, "PSS/MSS IRQ set to %d\n", num);
1220 printf ("#define PSS_MSS_IRQ %d\n", num);
1222 fprintf (stderr, "\nMSS DMA number for PSS?\n"
1223 "Valid values are 0, 1 and 3.\n"
1224 "The default value is 3\n"
1225 "Enter the value: ");
1227 num = ask_value ("%d", 3);
1228 if (num == 4 || num < 0 || num > 7)
1230 fprintf (stderr, "*** Illegal input! ***\n");
1231 num = 3;
1233 fprintf (stderr, "\nPSS/MSS DMA set to %d\n", num);
1234 printf ("#define PSS_MSS_DMA %d\n", num);
1236 fprintf (stderr, "\nMIDI I/O base for PSS?\n"
1237 "The factory default is 330\n"
1238 "Enter the PSS MIDI I/O base: ");
1240 num = ask_value ("%x", 0x330);
1241 fprintf (stderr, "PSS/MIDI I/O base set to %03x\n", num);
1242 printf ("#define PSS_MPU_BASE 0x%03x\n", num);
1244 fprintf (stderr, "\nIRQ number for PSS MIDI?\n"
1245 "Valid numbers are: 3, 4, 5, 7 and 9(=2).\n"
1246 "The default value is 9.\n"
1247 "Enter the value: ");
1249 num = ask_value ("%d", 9);
1250 if (num == 6 || num < 3 || num > 15)
1253 fprintf (stderr, "*** Illegal input! ***\n");
1254 num = 5;
1256 fprintf (stderr, "PSS MIDI IRQ set to %d\n", num);
1257 printf ("#define PSS_MPU_IRQ %d\n", num);
1260 if (selected_options & B (OPT_MSS))
1262 fprintf (stderr, "\nI/O base for MSS (MS Sound System)?\n"
1263 "The factory default is 530\n"
1264 "Other possible values are 604, E80 or F40\n"
1265 "Enter the MSS I/O base: ");
1267 num = ask_value ("%x", 0x530);
1268 fprintf (stderr, "MSS I/O base set to %03x\n", num);
1269 printf ("#define MSS_BASE 0x%03x\n", num);
1271 fprintf (stderr, "\nIRQ number for MSS?\n"
1272 "Valid numbers are: 7, 9(=2), 10 and 11.\n"
1273 "The default value is 10.\n"
1274 "Enter the value: ");
1276 num = ask_value ("%d", 10);
1277 if (num == 6 || num < 3 || num > 15)
1279 fprintf (stderr, "*** Illegal input! ***\n");
1280 num = 7;
1282 fprintf (stderr, "MSS IRQ set to %d\n", num);
1283 printf ("#define MSS_IRQ %d\n", num);
1285 fprintf (stderr, "\nDMA number for MSS?\n"
1286 "Valid values are 0, 1 and 3.\n"
1287 "The default value is 3\n"
1288 "Enter the value: ");
1290 num = ask_value ("%d", 3);
1291 if (num == 4 || num < 0 || num > 7)
1293 fprintf (stderr, "*** Illegal input! ***\n");
1294 num = 3;
1296 fprintf (stderr, "\nMSS DMA set to %d\n", num);
1297 printf ("#define MSS_DMA %d\n", num);
1300 if (selected_options & B (OPT_SSCAPE))
1302 int reveal_spea;
1304 fprintf (stderr, "\n(MIDI) I/O base for Ensoniq Soundscape?\n"
1305 "The factory default is 330\n"
1306 "Other possible values are 320, 340 or 350\n"
1307 "Enter the Soundscape I/O base: ");
1309 num = ask_value ("%x", 0x330);
1310 fprintf (stderr, "Soundscape I/O base set to %03x\n", num);
1311 printf ("#define SSCAPE_BASE 0x%03x\n", num);
1313 fprintf (stderr, "Is your SoundScape card made/marketed by Reveal or Spea? ");
1314 reveal_spea = think_positively (0);
1315 if (reveal_spea)
1316 printf ("#define REVEAL_SPEA\n");
1318 fprintf (stderr, "\nIRQ number for Soundscape?\n");
1320 if (reveal_spea)
1321 fprintf (stderr, "Check valid interrupts from the manual of your card.\n");
1322 else
1323 fprintf (stderr, "Valid numbers are: 5, 7, 9(=2) and 10.\n");
1325 fprintf (stderr, "The default value is 9.\n"
1326 "Enter the value: ");
1328 num = ask_value ("%d", 9);
1329 if (num == 6 || num < 3 || num > 15)
1331 fprintf (stderr, "*** Illegal input! ***\n");
1332 num = 9;
1334 fprintf (stderr, "Soundscape IRQ set to %d\n", num);
1335 printf ("#define SSCAPE_IRQ %d\n", num);
1337 fprintf (stderr, "\nDMA number for Soundscape?\n"
1338 "Valid values are 1 and 3 (sometimes 0)"
1339 "The default value is 3\n"
1340 "Enter the value: ");
1342 num = ask_value ("%d", 3);
1343 if (num == 4 || num < 0 || num > 7)
1345 fprintf (stderr, "*** Illegal input! ***\n");
1346 num = 3;
1348 fprintf (stderr, "\nSoundscape DMA set to %d\n", num);
1349 printf ("#define SSCAPE_DMA %d\n", num);
1351 fprintf (stderr, "\nMSS (MS Sound System) I/O base for the SSCAPE card?\n"
1352 "The factory default is 534\n"
1353 "Other possible values are 608, E84 or F44\n"
1354 "Enter the MSS I/O base: ");
1356 num = ask_value ("%x", 0x534);
1357 fprintf (stderr, "SSCAPE/MSS I/O base set to %03x\n", num);
1358 printf ("#define SSCAPE_MSS_BASE 0x%03x\n", num);
1360 fprintf (stderr, "\nIRQ number for the MSS mode of SSCAPE ?\n");
1361 if (reveal_spea)
1362 fprintf (stderr, "Valid numbers are: 5, 7, 9(=2) and 15.\n");
1363 else
1364 fprintf (stderr, "Valid numbers are: 5, 7, 9(=2) and 10.\n");
1365 fprintf (stderr, "The default value is 5.\n"
1366 "Enter the value: ");
1368 num = ask_value ("%d", 5);
1369 if (num == 6 || num < 3 || num > 15)
1371 fprintf (stderr, "*** Illegal input! ***\n");
1372 num = 10;
1374 fprintf (stderr, "SSCAPE/MSS IRQ set to %d\n", num);
1375 printf ("#define SSCAPE_MSS_IRQ %d\n", num);
1377 fprintf (stderr, "\nMSS DMA number for SSCAPE?\n"
1378 "Valid values are 0, 1 and 3.\n"
1379 "The default value is 3\n"
1380 "Enter the value: ");
1382 num = ask_value ("%d", 3);
1383 if (num == 4 || num < 0 || num > 7)
1385 fprintf (stderr, "*** Illegal input! ***\n");
1386 num = 3;
1388 fprintf (stderr, "\nSSCAPE/MSS DMA set to %d\n", num);
1389 printf ("#define SSCAPE_MSS_DMA %d\n", num);
1391 if (selected_options & B (OPT_TRIX))
1394 fprintf (stderr, "\nWindows Sound System I/O base for the AudioTriX card?\n"
1395 "The factory default is 530\n"
1396 "Other possible values are 604, E80 or F40\n"
1397 "Enter the MSS I/O base: ");
1399 num = ask_value ("%x", 0x530);
1400 fprintf (stderr, "AudioTriX MSS I/O base set to %03x\n", num);
1401 printf ("#define TRIX_BASE 0x%03x\n", num);
1403 fprintf (stderr, "\nIRQ number for the WSS mode of AudioTriX ?\n"
1404 "Valid numbers are: 5, 7, 9(=2), 10 and 11.\n"
1405 "The default value is 11.\n"
1406 "Enter the value: ");
1408 num = ask_value ("%d", 11);
1409 if (num != 5 && num != 7 && num != 9 && num != 10 && num != 11)
1411 fprintf (stderr, "*** Illegal input! ***\n");
1412 num = 11;
1414 fprintf (stderr, " AudioTriX WSS IRQ set to %d\n", num);
1415 printf ("#define TRIX_IRQ %d\n", num);
1417 fprintf (stderr, "\nWSS DMA number for AudioTriX?\n"
1418 "Valid values are 0, 1 and 3.\n"
1419 "The default value is 3\n"
1420 "Enter the value: ");
1422 num = ask_value ("%d", 3);
1423 if (num != 0 && num != 1 && num != 3)
1425 fprintf (stderr, "*** Illegal input! ***\n");
1426 num = 3;
1428 fprintf (stderr, "\nAudioTriX/WSS DMA set to %d\n", num);
1429 printf ("#define TRIX_DMA %d\n", num);
1431 fprintf (stderr, "\nSecond (capture) DMA number for AudioTriX?\n"
1432 "Valid values are 0, 1 and 3.\n"
1433 "The default value is 0\n"
1434 "(-1 disables the second DMA)\n"
1435 "Enter the value: ");
1437 num = ask_value ("%d", 0);
1438 if (num != 0 && num != 1 && num != 3 || num != -1)
1440 fprintf (stderr, "*** Illegal input! ***\n");
1441 num = 0;
1443 fprintf (stderr, "\nAudioTriX/WSS DMA2 set to %d\n", num);
1444 printf ("#define TRIX_DMA2 %d\n", num);
1446 fprintf (stderr, "\nSoundBlaster I/O address for the AudioTriX card?\n"
1447 "The factory default is 220\n"
1448 "Other possible values are 200, 210, 230, 240, 250, 260 and 270\n"
1449 "Enter the MSS I/O base: ");
1451 num = ask_value ("%x", 0x220);
1452 fprintf (stderr, "AudioTriX SB I/O base set to %03x\n", num);
1453 printf ("#define TRIX_SB_BASE 0x%03x\n", num);
1455 fprintf (stderr, "\nIRQ number for the SB mode of AudioTriX ?\n"
1456 "Valid numbers are: 3, 4, 5 and 7.\n"
1457 "The default value is 7.\n"
1458 "Enter the value: ");
1460 num = ask_value ("%d", 7);
1461 if (num != 3 && num != 4 && num != 5 && num != 7)
1463 fprintf (stderr, "*** Illegal input! ***\n");
1464 num = 7;
1466 fprintf (stderr, " AudioTriX SB IRQ set to %d\n", num);
1467 printf ("#define TRIX_SB_IRQ %d\n", num);
1469 fprintf (stderr, "\nSB DMA number for AudioTriX?\n"
1470 "Valid values are 1 and 3.\n"
1471 "The default value is 1\n"
1472 "Enter the value: ");
1474 num = ask_value ("%d", 1);
1475 if (num != 1 && num != 3)
1477 fprintf (stderr, "*** Illegal input! ***\n");
1478 num = 1;
1480 fprintf (stderr, "\nAudioTriX/SB DMA set to %d\n", num);
1481 printf ("#define TRIX_SB_DMA %d\n", num);
1483 fprintf (stderr, "\nMIDI (MPU-401) I/O address for the AudioTriX card?\n"
1484 "The factory default is 330\n"
1485 "Other possible values are 330, 370, 3B0 and 3F0\n"
1486 "Enter the MPU I/O base: ");
1488 num = ask_value ("%x", 0x330);
1489 fprintf (stderr, "AudioTriX MIDI I/O base set to %03x\n", num);
1490 printf ("#define TRIX_MPU_BASE 0x%03x\n", num);
1492 fprintf (stderr, "\nMIDI IRQ number for the AudioTriX ?\n"
1493 "Valid numbers are: 3, 4, 5, 7 and 9(=2).\n"
1494 "The default value is 5.\n"
1495 "Enter the value: ");
1497 num = ask_value ("%d", 5);
1498 if (num != 3 && num != 4 && num != 5 && num != 7 && num != 9)
1500 fprintf (stderr, "*** Illegal input! ***\n");
1501 num = 5;
1503 fprintf (stderr, " AudioTriX MIDI IRQ set to %d\n", num);
1504 printf ("#define TRIX_MPU_IRQ %d\n", num);
1507 if (selected_options & B (OPT_CS4232))
1509 int dma1;
1511 fprintf (stderr, "\nWindows Sound System I/O base for CS4232?\n"
1512 "The factory default is 534\n"
1513 "Other possible values are 608, E84 or F44\n"
1514 "Enter the MSS I/O base: ");
1516 num = ask_value ("%x", 0x534);
1517 fprintf (stderr, "CS4232 MSS I/O base set to %03x\n", num);
1518 printf ("#define CS4232_BASE 0x%03x\n", num);
1520 fprintf (stderr, "\nIRQ number for the WSS mode of CS4232 ?\n"
1521 "Valid numbers are: 5, 7, 9(=2), 11, 12 or 15.\n"
1522 "The default value is 11.\n"
1523 "Enter the value: ");
1525 num = ask_value ("%d", 11);
1526 if (num != 5 && num != 7 && num != 9 && num != 11 && num != 12 || num != 15)
1528 fprintf (stderr, "*** Illegal input! ***\n");
1529 num = 11;
1531 fprintf (stderr, " CS4232 WSS IRQ set to %d\n", num);
1532 printf ("#define CS4232_IRQ %d\n", num);
1534 fprintf (stderr, "\nWSS DMA number for CS4232?\n"
1535 "Valid values are 0, 1 and 3.\n"
1536 "The default value is 0\n"
1537 "(select the lowes possible one if you want to\n"
1538 "use full duplex mode)\n"
1539 "Enter the value: ");
1541 num = ask_value ("%d", 0);
1542 if (num != 0 && num != 1 && num != 3)
1544 fprintf (stderr, "*** Illegal input! ***\n");
1545 num = 0;
1547 fprintf (stderr, "\nCS4232/WSS DMA set to %d\n", num);
1548 printf ("#define CS4232_DMA %d\n", num);
1549 dma1 = num;
1551 fprintf (stderr, "\n Second WSS DMA number for CS4232?\n"
1552 "Valid values are 0, 1 and 3.\n"
1553 "The default value is 3\n"
1554 "Enter the value (-1 disables duplex mode): ");
1556 num = ask_value ("%d", 3);
1557 if (num == dma1 || (num != -1 && num != 0 && num != 1 && num != 3))
1559 fprintf (stderr, "*** Illegal input! ***\n");
1560 num = 3;
1562 fprintf (stderr, "\nCS4232/WSS DMA2 set to %d\n", num);
1563 printf ("#define CS4232_DMA2 %d\n", num);
1565 fprintf (stderr, "\nMIDI (MPU-401) I/O address for the CS4232 card?\n"
1566 "The factory default is 330\n"
1567 "Other possible values are 330, 370, 3B0 and 3F0\n"
1568 "Enter the MPU I/O base: ");
1570 num = ask_value ("%x", 0x330);
1571 fprintf (stderr, "CS4232 MIDI I/O base set to %03x\n", num);
1572 printf ("#define CS4232_MPU_BASE 0x%03x\n", num);
1574 fprintf (stderr, "\nMIDI IRQ number for CS4232?\n"
1575 "Valid numbers are: 5, 7, 9(=2), 11, 12 or 15.\n"
1576 "The default value is 5.\n"
1577 "Enter the value: ");
1579 num = ask_value ("%d", 5);
1580 if (num != 5 && num != 7 && num != 9 && num != 11 && num != 12 || num != 15)
1582 fprintf (stderr, "*** Illegal input! ***\n");
1583 num = 5;
1585 fprintf (stderr, " CS4232 MIDI IRQ set to %d\n", num);
1586 printf ("#define CS4232_MPU_IRQ %d\n", num);
1589 if (selected_options & B (OPT_MAD16))
1591 fprintf (stderr, "\n*** Options for the MAD16 and Mozart based cards ***\n\n");
1593 fprintf (stderr, "\nWindows Sound System I/O base for the MAD16/Mozart card?\n"
1594 "The factory default is 530\n"
1595 "Other possible values are 604, E80 or F40\n"
1596 "(Check which ones are supported by your card!!!!!!)\n"
1597 "Enter the MSS I/O base: ");
1599 num = ask_value ("%x", 0x530);
1600 fprintf (stderr, "MAD16 MSS I/O base set to %03x\n", num);
1601 printf ("#define MAD16_BASE 0x%03x\n", num);
1603 if ((sb_base == 0x220 && (num == 0x530 || num == 0x480)) ||
1604 (sb_base == 0x240 && (num == 0xf40 || num == 0x604)))
1606 fprintf (stderr, "FATAL ERROR!!!!!!!!!!!!!!\n"
1607 "\tThis I/O port selection makes MAD16/Mozart\n"
1608 "\tto use 0x%03x as the SB port.\n"
1609 "\tThis conflicts with the true SB card.\n"
1610 "\tRun the config again and select another I/O base.\n",
1611 sb_base);
1612 printf ("#undef CONFIGURE_SOUNDCARD\n");
1613 printf ("#undef KERNEL_SOUNDCARD\n");
1614 exit (-1);
1617 fprintf (stderr, "\nIRQ number for the WSS mode of MAD16/Mozart ?\n"
1618 "Valid numbers are: 7, 9(=2), 10 and 11.\n"
1619 "The default value is 11.\n"
1620 "Enter the value: ");
1622 num = ask_value ("%d", 11);
1623 if (num != 7 && num != 9 && num != 10 && num != 11)
1625 fprintf (stderr, "*** Illegal input! ***\n");
1626 num = 11;
1628 fprintf (stderr, " MAD16 WSS IRQ set to %d\n", num);
1629 printf ("#define MAD16_IRQ %d\n", num);
1631 fprintf (stderr, "\nWSS DMA (playback) number for MAD16/Mozart?\n"
1632 "Valid values are 0, 1 and 3.\n"
1633 "The default value is 3\n"
1634 "Enter the value: ");
1636 num = ask_value ("%d", 3);
1637 if (num != 0 && num != 1 && num != 3)
1639 fprintf (stderr, "*** Illegal input! ***\n");
1640 num = 3;
1642 fprintf (stderr, "\nMAD16/WSS DMA set to %d\n", num);
1643 printf ("#define MAD16_DMA %d\n", num);
1645 num = (num == 0) ? 1 : 0;
1647 fprintf (stderr, "\nMAD16/Mozart supports full duplex mode if the\n"
1648 "card has a suitable codec chip (CS423x or AD1845).\n"
1649 "This mode requires another DMA channel (DMA%d)\n"
1650 "Do you want to enable this mode? (n/y)", num);
1652 if (think_positively (0))
1654 fprintf (stderr, "\nMAD16/WSS capture DMA set to %d\n", num);
1655 printf ("#define MAD16_DMA2 %d\n", num);
1657 else
1658 printf ("#define MAD16_DMA2 -1\n");
1661 fprintf (stderr, "\nMIDI (MPU-401/SB) I/O address for the MAD16 card?\n"
1662 "(This is the second MIDI port in TB Tropez)\n"
1663 "Other possible values are 330, 320, 310 and 300\n"
1664 "For 82C928 and Mozart you may use any nonzero value\n"
1665 "since the driver ignores this setting.\n"
1666 "The factory default is 330 (use 0 to disable)\n"
1667 "Enter the MIDI I/O base: ");
1669 num = ask_value ("%x", 0x330);
1670 if (num == 0)
1671 fprintf (stderr, "MAD16/Mozart MIDI port disabled\n");
1672 else
1674 fprintf (stderr, "MAD16 MIDI I/O base set to %03x\n", num);
1675 printf ("#define MAD16_MPU_BASE 0x%03x\n", num);
1677 fprintf (stderr, "\nMIDI IRQ number for the MAD16 ?\n"
1678 "Valid numbers are: 5, 7, 9(=2) and 10.\n"
1679 "The default value is 5.\n"
1680 "Enter the value: ");
1682 num = ask_value ("%d", 5);
1683 if (num != 3 && num != 4 && num != 5 && num != 7 && num != 9)
1685 fprintf (stderr, "*** Illegal input! ***\n");
1686 num = 5;
1688 fprintf (stderr, " MAD16 MIDI IRQ set to %d\n", num);
1689 printf ("#define MAD16_MPU_IRQ %d\n", num);
1693 if (selected_options & B (OPT_AUDIO))
1695 def_size = 65536;
1697 fprintf (stderr, "\nSelect the DMA buffer size (4096, 16384, 32768 or 65536 bytes)\n"
1698 "%d is recommended value for this configuration.\n"
1699 "Enter the value: ", def_size);
1701 num = ask_value ("%d", def_size);
1702 if (num != 4096 && num != 16384 && num != 32768 && num != 65536)
1705 fprintf (stderr, "*** Illegal input! ***\n");
1706 num = def_size;
1708 fprintf (stderr, "The DMA buffer size set to %d\n", num);
1709 printf ("#define DSP_BUFFSIZE %d\n", num);
1712 printf ("#define SELECTED_SOUND_OPTIONS\t0x%08x\n", selected_options);
1713 fprintf (stderr, "The sound driver is now configured.\n");
1715 #if defined(SCO) || defined(ISC) || defined(SYSV)
1716 fprintf (stderr, "Remember to update the System file\n");
1717 #endif
1719 if (!old_config_used)
1721 fprintf (stderr, "Save copy of this configuration to %s (y/n)", oldconf);
1722 if (think_positively (1))
1724 char cmd[200];
1726 sprintf (cmd, "cp local.h %s", oldconf);
1728 fclose (stdout);
1729 if (system (cmd) != 0)
1730 perror (cmd);
1733 exit (0);
1737 bin2hex (char *path, char *target, char *varname)
1739 int fd;
1740 int count;
1741 char c;
1742 int i = 0;
1744 if ((fd = open (path, 0)) > 0)
1746 FILE *sf = fopen (target, "w");
1748 fprintf (sf, "/* automaticaly generated by configure */\n");
1749 fprintf (sf, "static unsigned char %s[] = {\n", varname);
1750 while (1)
1752 count = read (fd, &c, 1);
1753 if (count == 0)
1754 break;
1755 if (i != 0 && (i % 10) == 0)
1756 fprintf (sf, "\n");
1757 fprintf (sf, "0x%02x,", c & 0xFFL);
1758 i++;
1760 fprintf (sf, "};\n"
1761 "#define %sLen %d\n", varname, i);
1762 fclose (sf);
1763 close (fd);
1764 return 1;
1767 return 0;