root/drivers/sound/configure.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. can_select_option
  2. think_positively
  3. ask_value
  4. main
  5. bin2hex

   1 #define DISABLED_OPTIONS        0
   2 /*
   3  * sound/configure.c  - Configuration program for the Linux Sound Driver
   4  *
   5  * Copyright by Hannu Savolainen 1993-1995
   6  *
   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.
  14  *
  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.
  26  *
  27  */
  28 
  29 #include <stdio.h>
  30 #include <unistd.h>
  31 #include <stdlib.h>
  32 
  33 #define B(x)    (1 << (x))
  34 
  35 /*
  36  * Option numbers
  37  */
  38 
  39 #define OPT_PAS         0
  40 #define OPT_SB          1
  41 #define OPT_ADLIB       2
  42 #define OPT_LAST_MUTUAL 2
  43 
  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 
  57 #define OPT_HIGHLEVEL   15      /* This must be same than the next one */
  58 #define OPT_SBPRO       15
  59 #define OPT_SB16        16
  60 #define OPT_AEDSP16     17
  61 #define OPT_AUDIO       18
  62 #define OPT_MIDI_AUTO   19
  63 #define OPT_MIDI        20
  64 #define OPT_YM3812_AUTO 21
  65 #define OPT_YM3812      22
  66 #define OPT_SEQUENCER   23
  67 #define OPT_LAST        23      /* Last defined OPT number */
  68 
  69 #define ANY_DEVS (B(OPT_AUDIO)|B(OPT_MIDI)|B(OPT_SEQUENCER)|B(OPT_GUS)| \
  70                   B(OPT_MPU401)|B(OPT_PSS)|B(OPT_GUS16)|B(OPT_GUSMAX)| \
  71                   B(OPT_MSS)|B(OPT_SSCAPE)|B(OPT_UART6850)|B(OPT_TRIX)| \
  72                   B(OPT_MAD16)|B(OPT_CS4232)|B(OPT_MAUI))
  73 #define AUDIO_CARDS (B (OPT_PSS) | B (OPT_SB) | B (OPT_PAS) | B (OPT_GUS) | \
  74                 B (OPT_MSS) | B (OPT_GUS16) | B (OPT_GUSMAX) | B (OPT_TRIX) | \
  75                 B (OPT_SSCAPE)| B(OPT_MAD16) | B(OPT_CS4232))
  76 #define MIDI_CARDS (B (OPT_PSS) | B (OPT_SB) | B (OPT_PAS) | B (OPT_MPU401) | \
  77                     B (OPT_GUS) | B (OPT_TRIX) | B (OPT_SSCAPE)|B(OPT_MAD16) | \
  78                     B (OPT_CS4232)|B(OPT_MAUI))
  79 /*
  80  * Options that have been disabled for some reason (incompletely implemented
  81  * and/or tested). Don't remove from this list before looking at file
  82  * experimental.txt for further info.
  83  */
  84 
  85 typedef struct
  86   {
  87     unsigned long   conditions;
  88     unsigned long   exclusive_options;
  89     char            macro[20];
  90     int             verify;
  91     int             alias;
  92     int             default_answ;
  93   }
  94 
  95 hw_entry;
  96 
  97 
  98 /*
  99  * The rule table for the driver options. The first field defines a set of
 100  * options which must be selected before this entry can be selected. The
 101  * second field is a set of options which are not allowed with this one. If
 102  * the fourth field is zero, the option is selected without asking
 103  * confirmation from the user.
 104  *
 105  * With this version of the rule table it is possible to select just one type of
 106  * hardware.
 107  *
 108  * NOTE!        Keep the following table and the questions array in sync with the
 109  * option numbering!
 110  */
 111 
 112 hw_entry        hw_table[] =
 113 {
 114 /*
 115  * 0
 116  */
 117   {0, 0, "PAS", 1, 0, 0},
 118   {0, 0, "SB", 1, 0, 0},
 119   {0, B (OPT_PAS) | B (OPT_SB), "ADLIB", 1, 0, 0},
 120 
 121   {0, 0, "GUS", 1, 0, 0},
 122   {0, 0, "MPU401", 1, 0, 0},
 123   {0, 0, "UART6850", 1, 0, 0},
 124   {0, 0, "PSS", 1, 0, 0},
 125   {B (OPT_GUS), 0, "GUS16", 1, 0, 0},
 126   {B (OPT_GUS), B (OPT_GUS16), "GUSMAX", 1, 0, 0},
 127   {0, 0, "MSS", 1, 0, 0},
 128   {0, 0, "SSCAPE", 1, 0, 0},
 129   {0, 0, "TRIX", 1, 0, 0},
 130   {0, 0, "MAD16", 1, 0, 0},
 131   {0, 0, "CS4232", 1, 0, 0},
 132   {0, 0, "MAUI", 1, 0, 0},
 133 
 134   {B (OPT_SB), B (OPT_PAS), "SBPRO", 1, 0, 1},
 135   {B (OPT_SB) | B (OPT_SBPRO), B (OPT_PAS), "SB16", 1, 0, 1},
 136   {B (OPT_SBPRO) | B (OPT_MSS) | B (OPT_MPU401), 0, "AEDSP16", 1, 0, 0},
 137   {AUDIO_CARDS, 0, "AUDIO", 1, 0, 1},
 138   {B (OPT_MPU401), 0, "MIDI_AUTO", 0, OPT_MIDI, 0},
 139   {MIDI_CARDS, 0, "MIDI", 1, 0, 1},
 140   {B (OPT_ADLIB), 0, "YM3812_AUTO", 0, OPT_YM3812, 0},
 141   {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},
 142   {B (OPT_MIDI) | B (OPT_YM3812) | B (OPT_YM3812_AUTO) | B (OPT_GUS), 0, "SEQUENCER", 0, 0, 1}
 143 };
 144 
 145 char           *questions[] =
 146 {
 147   "ProAudioSpectrum 16 support",
 148   "SoundBlaster support",
 149   "Generic OPL2/OPL3 FM synthesizer support",
 150   "Gravis Ultrasound support",
 151   "MPU-401 support (NOT for SB16)",
 152   "6850 UART Midi support",
 153   "PSS (ECHO-ADI2111) support",
 154   "16 bit sampling option of GUS (_NOT_ GUS MAX)",
 155   "GUS MAX support",
 156   "Microsoft Sound System support",
 157   "Ensoniq Soundscape support",
 158   "MediaTriX AudioTriX Pro support",
 159   "Support for MAD16 and/or Mozart based cards",
 160   "Support for Crystal CS4232 based (PnP) cards",
 161   "Support for Turtle Beach Wave Front (Maui, Tropez) synthesizers",
 162 
 163   "SoundBlaster Pro support",
 164   "SoundBlaster 16 support",
 165   "Audio Excel DSP 16 initialization support",
 166   "/dev/dsp and /dev/audio supports (usually required)",
 167   "This should not be asked",
 168   "MIDI interface support",
 169   "This should not be asked",
 170   "FM synthesizer (YM3812/OPL-3) support",
 171   "/dev/sequencer support",
 172   "Is the sky really falling"
 173 };
 174 
 175 unsigned long   selected_options = 0;
 176 int             sb_dma = 0;
 177 
 178 #include "hex2hex.h"
 179 int             bin2hex (char *path, char *target, char *varname);
 180 
 181 int
 182 can_select_option (int nr)
     /* [previous][next][first][last][top][bottom][index][help] */
 183 {
 184 
 185   if (hw_table[nr].conditions)
 186     if (!(hw_table[nr].conditions & selected_options))
 187       return 0;
 188 
 189   if (hw_table[nr].exclusive_options)
 190     if (hw_table[nr].exclusive_options & selected_options)
 191       return 0;
 192 
 193   if (DISABLED_OPTIONS & B (nr))
 194     return 0;
 195 
 196   return 1;
 197 }
 198 
 199 int
 200 think_positively (int def_answ)
     /* [previous][next][first][last][top][bottom][index][help] */
 201 {
 202   char            answ[512];
 203   int             len;
 204 
 205   if ((len = read (0, answ, sizeof (answ))) < 1)
 206     {
 207       fprintf (stderr, "\n\nERROR! Cannot read stdin\n");
 208 
 209       perror ("stdin");
 210       printf ("#undef CONFIGURE_SOUNDCARD\n");
 211       printf ("#undef KERNEL_SOUNDCARD\n");
 212       exit (-1);
 213     }
 214 
 215   if (len < 2)                  /*
 216                                  * There is an additional LF at the end
 217                                  */
 218     return def_answ;
 219 
 220   answ[len - 1] = 0;
 221 
 222   if (!strcmp (answ, "y") || !strcmp (answ, "Y"))
 223     return 1;
 224 
 225   return 0;
 226 }
 227 
 228 int
 229 ask_value (char *format, int default_answer)
     /* [previous][next][first][last][top][bottom][index][help] */
 230 {
 231   char            answ[512];
 232   int             len, num;
 233 
 234 play_it_again_Sam:
 235 
 236   if ((len = read (0, answ, sizeof (answ))) < 1)
 237     {
 238       fprintf (stderr, "\n\nERROR! Cannot read stdin\n");
 239 
 240       perror ("stdin");
 241       printf ("#undef CONFIGURE_SOUNDCARD\n");
 242       printf ("#undef KERNEL_SOUNDCARD\n");
 243       exit (-1);
 244     }
 245 
 246   if (len < 2)                  /*
 247                                  * There is an additional LF at the end
 248                                  */
 249     return default_answer;
 250 
 251   answ[len - 1] = 0;
 252 
 253   if (sscanf (answ, format, &num) != 1)
 254     {
 255       fprintf (stderr, "Illegal format. Try again: ");
 256       goto play_it_again_Sam;
 257     }
 258 
 259   return num;
 260 }
 261 
 262 int
 263 main (int argc, char *argv[])
     /* [previous][next][first][last][top][bottom][index][help] */
 264 {
 265   int             i, num, def_size, full_driver = 1;
 266   char            answ[10];
 267   int             sb_base = 0;
 268 
 269   printf ("/*\tGenerated by configure. Don't edit!!!!\t*/\n\n");
 270 
 271   fprintf (stderr, "\nConfiguring the sound support\n\n");
 272   {
 273     /*
 274      * Partial driver
 275      */
 276 
 277     full_driver = 0;
 278 
 279     for (i = 0; i <= OPT_LAST; i++)
 280       if (can_select_option (i))
 281         {
 282           if (!(selected_options & B (i)))      /*
 283                                                  * Not selected yet
 284                                                  */
 285             if (!hw_table[i].verify)
 286               {
 287                 if (hw_table[i].alias)
 288                   selected_options |= B (hw_table[i].alias);
 289                 else
 290                   selected_options |= B (i);
 291               }
 292             else
 293               {
 294                 int             def_answ = hw_table[i].default_answ;
 295 
 296                 fprintf (stderr,
 297                          def_answ ? "  %s (y/n) ? " : "  %s (n/y) ? ",
 298                          questions[i]);
 299                 if (think_positively (def_answ))
 300                   if (hw_table[i].alias)
 301                     selected_options |= B (hw_table[i].alias);
 302                   else
 303                     selected_options |= B (i);
 304               }
 305         }
 306   }
 307 
 308   if (selected_options & B (OPT_SBPRO))
 309     {
 310       fprintf (stderr, "Do you want support for the mixer of SG NX Pro ? ");
 311       if (think_positively (0))
 312         printf ("#define __SGNXPRO__\n");
 313     }
 314 
 315   if (selected_options & B (OPT_SB))
 316     {
 317       fprintf (stderr, "Do you want support for the MV Jazz16 (ProSonic etc.) ? ");
 318       if (think_positively (0))
 319         {
 320           printf ("#define JAZZ16\n");
 321           do
 322             {
 323               fprintf (stderr, "\tValid 16 bit DMA channels for ProSonic/Jazz 16 are\n");
 324               fprintf (stderr, "\t1, 3, 5 (default), 7\n");
 325               fprintf (stderr, "\tEnter 16bit DMA channel for Prosonic : ");
 326               num = ask_value ("%d", 5);
 327             }
 328           while (num != 1 && num != 3 && num != 5 && num != 7);
 329           fprintf (stderr, "ProSonic 16 bit DMA set to %d\n", num);
 330           printf ("#define JAZZ_DMA16 %d\n", num);
 331 
 332           fprintf (stderr, "Do you have SoundMan Wave (n/y) ? ");
 333 
 334           if (think_positively (0))
 335             {
 336               printf ("#define SM_WAVE\n");
 337 
 338             midi0001_again:
 339               fprintf
 340                 (stderr,
 341                  "Logitech SoundMan Wave has a microcontroller which must be initialized\n"
 342                  "before MIDI emulation works. This is possible only if the microcode\n"
 343                  "file is compiled into the driver.\n"
 344                  "Do you have access to the MIDI0001.BIN file (y/n) ? ");
 345               if (think_positively (1))
 346                 {
 347                   char            path[512];
 348 
 349                   fprintf (stderr,
 350                            "Enter full name of the MIDI0001.BIN file (pwd is sound): ");
 351                   scanf ("%s", path);
 352                   fprintf (stderr, "including microcode file %s\n", path);
 353 
 354                   if (!bin2hex (path, "smw-midi0001.h", "smw_ucode"))
 355                     {
 356                       fprintf (stderr, "couldn't open %s file\n",
 357                                path);
 358                       fprintf (stderr, "try again with correct path? ");
 359                       if (think_positively (1))
 360                         goto midi0001_again;
 361                     }
 362                   else
 363                     printf ("#define SMW_MIDI0001_INCLUDED\n");
 364                 }
 365             }
 366         }
 367     }
 368 
 369   if (selected_options & B (OPT_SBPRO))
 370     {
 371       fprintf (stderr, "\n\nThe Logitech SoundMan Games supports 44 kHz in stereo\n"
 372                "while the standard SB Pro supports just 22 kHz/stereo\n"
 373                "You have an option to enable the SM Games mode.\n"
 374                "However do enable it only if you are _sure_ that your\n"
 375                "card is a SM Games. Enabling this feature with a\n"
 376                "plain old SB Pro _will_ cause troubles with stereo mode.\n"
 377                "\n"
 378                "DANGER! Read the above once again before answering 'y'\n"
 379                "Answer 'n' in case you are unsure what to do!\n");
 380       fprintf (stderr, "Do you have a Logitech SoundMan Games (n/y) ? ");
 381       if (think_positively (0))
 382         printf ("#define SM_GAMES\n");
 383     }
 384 
 385   if (selected_options & B (OPT_SB16))
 386     selected_options |= B (OPT_SBPRO);
 387 
 388   if (selected_options & B (OPT_AEDSP16))
 389     {
 390       int             sel1 = 0;
 391 
 392       if (selected_options & B (OPT_SBPRO))
 393         {
 394           fprintf (stderr, "Do you want support for the Audio Excel SoundBlaster pro mode ? ");
 395           if (think_positively (1))
 396             {
 397               printf ("#define AEDSP16_SBPRO\n");
 398               sel1 = 1;
 399             }
 400         }
 401 
 402       if ((selected_options & B (OPT_MSS)) && (sel1 == 0))
 403         {
 404           fprintf (stderr, "Do you want support for the Audio Excel Microsoft Sound System mode? ");
 405           if (think_positively (1))
 406             {
 407               printf ("#define AEDSP16_MSS\n");
 408               sel1 = 1;
 409             }
 410         }
 411 
 412       if (sel1 == 0)
 413         {
 414           printf ("#undef CONFIGURE_SOUNDCARD\n");
 415           printf ("#undef KERNEL_SOUNDCARD\n");
 416           fprintf (stderr, "ERROR!!!!!\nYou loose: you must select at least one mode when using Audio Excel!\n");
 417           exit (-1);
 418         }
 419       if (selected_options & B (OPT_MPU401))
 420         printf ("#define AEDSP16_MPU401\n");
 421     }
 422 
 423   if (selected_options & B (OPT_PSS))
 424     {
 425     genld_again:
 426       fprintf
 427         (stderr,
 428        "if you wish to emulate the soundblaster and you have a DSPxxx.LD.\n"
 429          "then you must include the LD in the kernel.\n"
 430          "Do you wish to include a LD (y/n) ? ");
 431       if (think_positively (1))
 432         {
 433           char            path[512];
 434 
 435           fprintf (stderr,
 436                    "Enter the path to your LD file (pwd is sound): ");
 437           scanf ("%s", path);
 438           fprintf (stderr, "including LD file %s\n", path);
 439 
 440           if (!bin2hex (path, "synth-ld.h", "pss_synth"))
 441             {
 442               fprintf (stderr, "couldn't open %s as the ld file\n",
 443                        path);
 444               fprintf (stderr, "try again with correct path? ");
 445               if (think_positively (1))
 446                 goto genld_again;
 447             }
 448           else
 449             printf ("#define PSS_HAVE_LD\n");
 450         }
 451       else
 452         {
 453           FILE           *sf = fopen ("synth-ld.h", "w");
 454 
 455           fprintf (sf, "/* automaticaly generated by configure */\n");
 456           fprintf (sf, "unsigned char pss_synth[1];\n"
 457                    "#define pss_synthLen 0\n");
 458           fclose (sf);
 459         }
 460     }
 461 
 462   if (selected_options & B (OPT_TRIX))
 463     {
 464     hex2hex_again:
 465       fprintf (stderr, "MediaTriX audioTriX Pro has a onboard microcontroller\n"
 466                "which needs to be initialized by downloading\n"
 467                "the code from file TRXPRO.HEX in the DOS driver\n"
 468                "directory. If you don't have the TRXPRO.HEX handy\n"
 469                "you may skip this step. However SB and MPU-401\n"
 470                "modes of AudioTriX Pro will not work without\n"
 471                "this file!\n"
 472                "\n"
 473                "Do you want to include TRXPRO.HEX in your kernel (y/n) ? ");
 474 
 475       if (think_positively (1))
 476         {
 477           char            path[512];
 478 
 479           fprintf (stderr,
 480                  "Enter the path to your TRXPRO.HEX file (pwd is sound): ");
 481           scanf ("%s", path);
 482           fprintf (stderr, "including HEX file %s\n", path);
 483 
 484           if (!hex2hex (path, "trix_boot.h", "static unsigned char trix_boot"))
 485             goto hex2hex_again;
 486           printf ("#define INCLUDE_TRIX_BOOT\n");
 487         }
 488     }
 489 
 490   if (!(selected_options & ANY_DEVS))
 491     {
 492       printf ("#undef CONFIGURE_SOUNDCARD\n");
 493       printf ("#undef KERNEL_SOUNDCARD\n");
 494       fprintf (stderr, "\n*** This combination is useless. Sound driver disabled!!! ***\n\n");
 495       exit (0);
 496     }
 497   else
 498     printf ("#define KERNEL_SOUNDCARD\n");
 499 
 500   printf ("#define EXCLUDE_PNP\n");
 501 
 502   for (i = 0; i <= OPT_LAST; i++)
 503     if (!hw_table[i].alias)
 504       if (selected_options & B (i))
 505         printf ("#undef  EXCLUDE_%s\n", hw_table[i].macro);
 506       else
 507         printf ("#define EXCLUDE_%s\n", hw_table[i].macro);
 508 
 509 
 510   /*
 511    * IRQ and DMA settings
 512    */
 513   printf ("\n");
 514 
 515   if (selected_options & B (OPT_AEDSP16))
 516     {
 517       fprintf (stderr, "\nI/O base for Audio Excel DSP 16 ?\n"
 518                "Warning:\n"
 519                "If you are using Audio Excel SoundBlaster emulation,\n"
 520         "you must use the same I/O base for Audio Excel and SoundBlaster.\n"
 521                "The factory default is 220 (other possible value is 240)\n"
 522                "Enter the Audio Excel DSP 16 I/O base: ");
 523 
 524       num = ask_value ("%x", 0x220);
 525       fprintf (stderr, "Audio Excel DSP 16 I/O base set to %03x\n", num);
 526       printf ("#define AEDSP16_BASE 0x%03x\n", num);
 527     }
 528 
 529   if ((selected_options & B (OPT_SB)) && selected_options & (B (OPT_AUDIO) | B (OPT_MIDI)))
 530     {
 531       fprintf (stderr, "\nI/O base for SB?\n"
 532                "The factory default is 220\n"
 533                "Enter the SB I/O base: ");
 534 
 535       sb_base = num = ask_value ("%x", 0x220);
 536       fprintf (stderr, "SB I/O base set to %03x\n", num);
 537       printf ("#define SBC_BASE 0x%03x\n", num);
 538 
 539       fprintf (stderr, "\nIRQ number for SoundBlaster?\n"
 540                "The IRQ address is defined by the jumpers on your card.\n"
 541           "The factory default is either 5 or 7 (depending on the model).\n"
 542                "Valid values are 9(=2), 5, 7 and 10.\n"
 543                "Enter the value: ");
 544 
 545       num = ask_value ("%d", 7);
 546       if (num != 9 && num != 5 && num != 7 && num != 10)
 547         {
 548 
 549           fprintf (stderr, "*** Illegal input! ***\n");
 550           num = 7;
 551         }
 552       fprintf (stderr, "SoundBlaster IRQ set to %d\n", num);
 553 
 554       printf ("#define SBC_IRQ %d\n", num);
 555 
 556       if (selected_options & (B (OPT_SBPRO) | B (OPT_PAS)))
 557         {
 558           fprintf (stderr, "\nDMA channel for SoundBlaster?\n"
 559                    "For SB 1.0, 1.5 and 2.0 this MUST be 1\n"
 560                    "SB Pro supports DMA channels 0, 1 and 3 (jumper)\n"
 561                    "For SB16 give the 8 bit DMA# here\n"
 562                    "The default value is 1\n"
 563                    "Enter the value: ");
 564 
 565           num = ask_value ("%d", 1);
 566           if (num < 0 || num > 3)
 567             {
 568 
 569               fprintf (stderr, "*** Illegal input! ***\n");
 570               num = 1;
 571             }
 572           fprintf (stderr, "SoundBlaster DMA set to %d\n", num);
 573           printf ("#define SBC_DMA %d\n", num);
 574           sb_dma = num;
 575         }
 576 
 577       if (selected_options & B (OPT_SB16))
 578         {
 579 
 580           fprintf (stderr, "\n16 bit DMA channel for SoundBlaster 16?\n"
 581                    "Possible values are 5, 6 or 7\n"
 582                    "The default value is 6\n"
 583                    "Enter the value: ");
 584 
 585           num = ask_value ("%d", 6);
 586           if ((num < 5 || num > 7) && (num != sb_dma))
 587             {
 588 
 589               fprintf (stderr, "*** Illegal input! ***\n");
 590               num = 6;
 591             }
 592           fprintf (stderr, "SoundBlaster DMA set to %d\n", num);
 593           printf ("#define SB16_DMA %d\n", num);
 594 
 595           fprintf (stderr, "\nI/O base for SB16 Midi?\n"
 596                    "Possible values are 300 and 330\n"
 597                    "The factory default is 330\n"
 598                    "Enter the SB16 Midi I/O base: ");
 599 
 600           num = ask_value ("%x", 0x330);
 601           fprintf (stderr, "SB16 Midi I/O base set to %03x\n", num);
 602           printf ("#define SB16MIDI_BASE 0x%03x\n", num);
 603         }
 604     }
 605 
 606   if (selected_options & B (OPT_PAS))
 607     {
 608 
 609       if (selected_options & (B (OPT_AUDIO) | B (OPT_MIDI)))
 610         {
 611           fprintf (stderr, "\nIRQ number for ProAudioSpectrum?\n"
 612                    "The recommended value is the IRQ used under DOS.\n"
 613                    "Please refer to the ProAudioSpectrum User's Guide.\n"
 614                    "The default value is 10.\n"
 615                    "Enter the value: ");
 616 
 617           num = ask_value ("%d", 10);
 618           if (num == 6 || num < 3 || num > 15 || num == 2)      /*
 619                                                                  * Illegal
 620                                                                  */
 621             {
 622 
 623               fprintf (stderr, "*** Illegal input! ***\n");
 624               num = 10;
 625             }
 626           fprintf (stderr, "ProAudioSpectrum IRQ set to %d\n", num);
 627           printf ("#define PAS_IRQ %d\n", num);
 628         }
 629 
 630       if (selected_options & B (OPT_AUDIO))
 631         {
 632           fprintf (stderr, "\nDMA number for ProAudioSpectrum?\n"
 633                    "The recommended value is the DMA channel under DOS.\n"
 634                    "Please refer to the ProAudioSpectrum User's Guide.\n"
 635                    "The default value is 3\n"
 636                    "Enter the value: ");
 637 
 638           num = ask_value ("%d", 3);
 639           if (num == 4 || num < 0 || num > 7)
 640             {
 641 
 642               fprintf (stderr, "*** Illegal input! ***\n");
 643               num = 3;
 644             }
 645           fprintf (stderr, "\nProAudioSpectrum DMA set to %d\n", num);
 646           printf ("#define PAS_DMA %d\n", num);
 647         }
 648       fprintf (stderr, "\nEnable Joystick port on ProAudioSpectrum (n/y) ? ");
 649       if (think_positively (0))
 650         printf ("#define PAS_JOYSTICK_ENABLE\n");
 651 
 652       fprintf (stderr, "PAS16 could be noisy with some mother boards\n"
 653                "There is a command line switch (was it :T?)\n"
 654                "in the DOS driver for PAS16 which solves this.\n"
 655                "Don't enable this feature unless you have problems!\n"
 656                "Do you have to use this switch with DOS (y/n) ?");
 657       if (think_positively (0))
 658         printf ("#define BROKEN_BUS_CLOCK\n");
 659     }
 660 
 661   if (selected_options & B (OPT_GUS))
 662     {
 663       fprintf (stderr, "\nI/O base for Gravis Ultrasound?\n"
 664                "Valid choices are 210, 220, 230, 240, 250 or 260\n"
 665                "The factory default is 220\n"
 666                "Enter the GUS I/O base: ");
 667 
 668       num = ask_value ("%x", 0x220);
 669       if ((num > 0x260) || ((num & 0xf0f) != 0x200) || ((num & 0x0f0) > 0x060))
 670         {
 671 
 672           fprintf (stderr, "*** Illegal input! ***\n");
 673           num = 0x220;
 674         }
 675 
 676       if ((selected_options & B (OPT_SB)) && (num == sb_base))
 677         {
 678           fprintf (stderr, "FATAL ERROR!!!!!!!!!!!!!!\n"
 679                    "\t0x220 cannot be used if SoundBlaster is enabled.\n"
 680                    "\tRun the config again.\n");
 681           printf ("#undef CONFIGURE_SOUNDCARD\n");
 682           printf ("#undef KERNEL_SOUNDCARD\n");
 683           exit (-1);
 684         }
 685       fprintf (stderr, "GUS I/O base set to %03x\n", num);
 686       printf ("#define GUS_BASE 0x%03x\n", num);
 687 
 688       fprintf (stderr, "\nIRQ number for Gravis UltraSound?\n"
 689                "The recommended value is the IRQ used under DOS.\n"
 690                "Please refer to the Gravis Ultrasound User's Guide.\n"
 691                "The default value is 15.\n"
 692                "Enter the value: ");
 693 
 694       num = ask_value ("%d", 15);
 695       if (num == 6 || num < 3 || num > 15 || num == 2)  /*
 696                                                          * Invalid
 697                                                          */
 698         {
 699 
 700           fprintf (stderr, "*** Illegal input! ***\n");
 701           num = 15;
 702         }
 703       fprintf (stderr, "Gravis UltraSound IRQ set to %d\n", num);
 704       printf ("#define GUS_IRQ %d\n", num);
 705 
 706       fprintf (stderr, "\nDMA number for Gravis UltraSound?\n"
 707                "The recommended value is the DMA channel under DOS.\n"
 708                "Please refer to the Gravis Ultrasound User's Guide.\n"
 709                "The default value is 6\n"
 710                "Enter the value: ");
 711 
 712       num = ask_value ("%d", 6);
 713       if (num == 4 || num < 0 || num > 7)
 714         {
 715           fprintf (stderr, "*** Illegal input! ***\n");
 716           num = 6;
 717         }
 718       fprintf (stderr, "\nGravis UltraSound DMA set to %d\n", num);
 719       printf ("#define GUS_DMA %d\n", num);
 720 
 721       fprintf (stderr, "\nSecond DMA channel for GUS (optional)?\n"
 722                "The default value is 7 (-1 disables)\n"
 723                "Enter the value: ");
 724 
 725       num = ask_value ("%d", 7);
 726       if (num > 7)
 727         {
 728           fprintf (stderr, "*** Illegal input! ***\n");
 729           num = 7;
 730         }
 731 
 732       fprintf (stderr, "\nGUS DMA2 set to %d\n", num);
 733       printf ("#define GUS_DMA2 %d\n", num);
 734 
 735       if (selected_options & B (OPT_GUS16))
 736         {
 737           fprintf (stderr, "\nI/O base for GUS16 (GUS 16 bit sampling option)?\n"
 738                    "The factory default is 530\n"
 739                    "Other possible values are  604, E80 or F40\n"
 740                    "Enter the GUS16 I/O base: ");
 741 
 742           num = ask_value ("%x", 0x530);
 743           fprintf (stderr, "GUS16 I/O base set to %03x\n", num);
 744           printf ("#define GUS16_BASE 0x%03x\n", num);
 745 
 746           fprintf (stderr, "\nIRQ number for GUS16?\n"
 747                    "Valid numbers are: 3, 4, 5, 7, or 9(=2).\n"
 748                    "The default value is 7.\n"
 749                    "Enter the value: ");
 750 
 751           num = ask_value ("%d", 7);
 752           if (num == 6 || num < 3 || num > 15)
 753             {
 754               fprintf (stderr, "*** Illegal input! ***\n");
 755               num = 7;
 756             }
 757           fprintf (stderr, "GUS16 IRQ set to %d\n", num);
 758           printf ("#define GUS16_IRQ %d\n", num);
 759 
 760           fprintf (stderr, "\nDMA number for GUS16?\n"
 761                    "The default value is 3\n"
 762                    "Enter the value: ");
 763 
 764           num = ask_value ("%d", 3);
 765           if (num < 0 || num > 3)
 766             {
 767               fprintf (stderr, "*** Illegal input! ***\n");
 768               num = 3;
 769             }
 770           fprintf (stderr, "\nGUS16 DMA set to %d\n", num);
 771           printf ("#define GUS16_DMA %d\n", num);
 772         }
 773     }
 774 
 775   if (selected_options & B (OPT_MPU401))
 776     {
 777       fprintf (stderr, "\nI/O base for MPU-401?\n"
 778                "The factory default is 330\n"
 779                "Enter the MPU-401 I/O base: ");
 780 
 781       num = ask_value ("%x", 0x330);
 782       fprintf (stderr, "MPU-401 I/O base set to %03x\n", num);
 783       printf ("#define MPU_BASE 0x%03x\n", num);
 784 
 785       fprintf (stderr, "\nIRQ number for MPU-401?\n"
 786                "Valid numbers are: 3, 4, 5, 7 and 9(=2).\n"
 787                "The default value is 9.\n"
 788                "Enter the value: ");
 789 
 790       num = ask_value ("%d", 9);
 791       if (num == 6 || num < 3 || num > 15)
 792         {
 793 
 794           fprintf (stderr, "*** Illegal input! ***\n");
 795           num = 5;
 796         }
 797       fprintf (stderr, "MPU-401 IRQ set to %d\n", num);
 798       printf ("#define MPU_IRQ %d\n", num);
 799     }
 800 
 801   if (selected_options & B (OPT_UART6850))
 802     {
 803       fprintf (stderr, "\nI/O base for 6850 UART Midi?\n"
 804                "Be carefull. No defaults.\n"
 805                "Enter the 6850 UART I/O base: ");
 806 
 807       num = ask_value ("%x", 0);
 808       if (num == 0)
 809         {
 810           /*
 811              * Invalid value entered
 812            */
 813           printf ("#define EXCLUDE_UART6850\n");
 814         }
 815       else
 816         {
 817           fprintf (stderr, "6850 UART I/O base set to %03x\n", num);
 818           printf ("#define U6850_BASE 0x%03x\n", num);
 819 
 820           fprintf (stderr, "\nIRQ number for 6850 UART?\n"
 821                    "Valid numbers are: 3, 4, 5, 7 and 9(=2).\n"
 822                    "The default value is 5.\n"
 823                    "Enter the value: ");
 824 
 825           num = ask_value ("%d", 5);
 826           if (num == 6 || num < 3 || num > 15)
 827             {
 828 
 829               fprintf (stderr, "*** Illegal input! ***\n");
 830               num = 5;
 831             }
 832           fprintf (stderr, "6850 UART IRQ set to %d\n", num);
 833           printf ("#define U6850_IRQ %d\n", num);
 834         }
 835     }
 836 
 837   if (selected_options & B (OPT_PSS))
 838     {
 839       fprintf (stderr, "\nI/O base for PSS?\n"
 840                "The factory default is 220 (240 also possible)\n"
 841                "Enter the PSS I/O base: ");
 842 
 843       num = ask_value ("%x", 0x220);
 844       fprintf (stderr, "PSS I/O base set to %03x\n", num);
 845       printf ("#define PSS_BASE 0x%03x\n", num);
 846 
 847 #if YOU_WANT_TO_WASTE_RESOURCES
 848       fprintf (stderr, "\nIRQ number for PSS?\n"
 849                "Valid numbers are: 3, 4, 5, 7, 9(=2) or 10.\n"
 850                "The default value is 10.\n"
 851                "Enter the value: ");
 852 
 853       num = ask_value ("%d", 10);
 854       if (num == 6 || num < 3 || num > 15)
 855         {
 856           fprintf (stderr, "*** Illegal input! ***\n");
 857           num = 7;
 858         }
 859       fprintf (stderr, "PSS IRQ set to %d\n", num);
 860       printf ("#define PSS_IRQ %d\n", num);
 861 
 862       fprintf (stderr, "\nDMA number for ECHO-PSS?\n"
 863                "The default value is 5\n"
 864                "Valid values are 5, 6 and 7\n"
 865                "Enter the value: ");
 866 
 867       num = ask_value ("%d", 5);
 868       if (num < 5 || num > 7)
 869         {
 870           fprintf (stderr, "*** Illegal input! ***\n");
 871           num = 5;
 872         }
 873       fprintf (stderr, "\nECHO-PSS DMA set to %d\n", num);
 874       printf ("#define PSS_DMA %d\n", num);
 875 #endif
 876 
 877       fprintf (stderr, "\nMSS (MS Sound System) I/O base for the PSS card?\n"
 878                "The factory default is 530\n"
 879                "Other possible values are  604, E80 or F40\n"
 880                "Enter the MSS I/O base: ");
 881 
 882       num = ask_value ("%x", 0x530);
 883       fprintf (stderr, "PSS/MSS I/O base set to %03x\n", num);
 884       printf ("#define PSS_MSS_BASE 0x%03x\n", num);
 885 
 886       fprintf (stderr, "\nIRQ number for the MSS mode of PSS ?\n"
 887                "Valid numbers are: 7, 9(=2), 10 and 11.\n"
 888                "The default value is 11.\n"
 889                "Enter the value: ");
 890 
 891       num = ask_value ("%d", 11);
 892       if (num == 6 || num < 3 || num > 15)
 893         {
 894           fprintf (stderr, "*** Illegal input! ***\n");
 895           num = 11;
 896         }
 897       fprintf (stderr, "PSS/MSS IRQ set to %d\n", num);
 898       printf ("#define PSS_MSS_IRQ %d\n", num);
 899 
 900       fprintf (stderr, "\nMSS DMA number for PSS?\n"
 901                "Valid values are 0, 1 and 3.\n"
 902                "The default value is 3\n"
 903                "Enter the value: ");
 904 
 905       num = ask_value ("%d", 3);
 906       if (num == 4 || num < 0 || num > 7)
 907         {
 908           fprintf (stderr, "*** Illegal input! ***\n");
 909           num = 3;
 910         }
 911       fprintf (stderr, "\nPSS/MSS DMA set to %d\n", num);
 912       printf ("#define PSS_MSS_DMA %d\n", num);
 913 
 914       fprintf (stderr, "\nMIDI I/O base for PSS?\n"
 915                "The factory default is 330\n"
 916                "Enter the PSS MIDI I/O base: ");
 917 
 918       num = ask_value ("%x", 0x330);
 919       fprintf (stderr, "PSS/MIDI I/O base set to %03x\n", num);
 920       printf ("#define PSS_MPU_BASE 0x%03x\n", num);
 921 
 922       fprintf (stderr, "\nIRQ number for PSS MIDI?\n"
 923                "Valid numbers are: 3, 4, 5, 7 and 9(=2).\n"
 924                "The default value is 9.\n"
 925                "Enter the value: ");
 926 
 927       num = ask_value ("%d", 9);
 928       if (num == 6 || num < 3 || num > 15)
 929         {
 930 
 931           fprintf (stderr, "*** Illegal input! ***\n");
 932           num = 5;
 933         }
 934       fprintf (stderr, "PSS MIDI IRQ set to %d\n", num);
 935       printf ("#define PSS_MPU_IRQ %d\n", num);
 936     }
 937 
 938   if (selected_options & B (OPT_MSS))
 939     {
 940       fprintf (stderr, "\nI/O base for MSS (MS Sound System)?\n"
 941                "The factory default is 530\n"
 942                "Other possible values are  604, E80 or F40\n"
 943                "Enter the MSS I/O base: ");
 944 
 945       num = ask_value ("%x", 0x530);
 946       fprintf (stderr, "MSS I/O base set to %03x\n", num);
 947       printf ("#define MSS_BASE 0x%03x\n", num);
 948 
 949       fprintf (stderr, "\nIRQ number for MSS?\n"
 950                "Valid numbers are: 7, 9(=2), 10 and 11.\n"
 951                "The default value is 10.\n"
 952                "Enter the value: ");
 953 
 954       num = ask_value ("%d", 10);
 955       if (num == 6 || num < 3 || num > 15)
 956         {
 957           fprintf (stderr, "*** Illegal input! ***\n");
 958           num = 7;
 959         }
 960       fprintf (stderr, "MSS IRQ set to %d\n", num);
 961       printf ("#define MSS_IRQ %d\n", num);
 962 
 963       fprintf (stderr, "\nDMA number for MSS?\n"
 964                "Valid values are 0, 1 and 3.\n"
 965                "The default value is 3\n"
 966                "Enter the value: ");
 967 
 968       num = ask_value ("%d", 3);
 969       if (num == 4 || num < 0 || num > 7)
 970         {
 971           fprintf (stderr, "*** Illegal input! ***\n");
 972           num = 3;
 973         }
 974       fprintf (stderr, "\nMSS DMA set to %d\n", num);
 975       printf ("#define MSS_DMA %d\n", num);
 976     }
 977 
 978   if (selected_options & B (OPT_SSCAPE))
 979     {
 980       int             reveal_spea;
 981 
 982       fprintf (stderr, "\n(MIDI) I/O base for Ensoniq Soundscape?\n"
 983                "The factory default is 330\n"
 984                "Other possible values are 320, 340 or 350\n"
 985                "Enter the Soundscape I/O base: ");
 986 
 987       num = ask_value ("%x", 0x330);
 988       fprintf (stderr, "Soundscape I/O base set to %03x\n", num);
 989       printf ("#define SSCAPE_BASE 0x%03x\n", num);
 990 
 991       fprintf (stderr, "Is your SoundScape card made/marketed by Reveal or Spea? ");
 992       reveal_spea = think_positively (0);
 993       if (reveal_spea)
 994         printf ("#define REVEAL_SPEA\n");
 995 
 996       fprintf (stderr, "\nIRQ number for Soundscape?\n");
 997 
 998       if (reveal_spea)
 999         fprintf (stderr, "Check valid interrupts from the manual of your card.\n");
1000       else
1001         fprintf (stderr, "Valid numbers are: 5, 7, 9(=2) and 10.\n");
1002 
1003       fprintf (stderr, "The default value is 9.\n"
1004                "Enter the value: ");
1005 
1006       num = ask_value ("%d", 9);
1007       if (num == 6 || num < 3 || num > 15)
1008         {
1009           fprintf (stderr, "*** Illegal input! ***\n");
1010           num = 9;
1011         }
1012       fprintf (stderr, "Soundscape IRQ set to %d\n", num);
1013       printf ("#define SSCAPE_IRQ %d\n", num);
1014 
1015       fprintf (stderr, "\nDMA number for Soundscape?\n"
1016                "Valid values are 1 and 3 (sometimes 0)"
1017                "The default value is 3\n"
1018                "Enter the value: ");
1019 
1020       num = ask_value ("%d", 3);
1021       if (num == 4 || num < 0 || num > 7)
1022         {
1023           fprintf (stderr, "*** Illegal input! ***\n");
1024           num = 3;
1025         }
1026       fprintf (stderr, "\nSoundscape DMA set to %d\n", num);
1027       printf ("#define SSCAPE_DMA %d\n", num);
1028 
1029       fprintf (stderr, "\nMSS (MS Sound System) I/O base for the SSCAPE card?\n"
1030                "The factory default is 534\n"
1031                "Other possible values are  608, E84 or F44\n"
1032                "Enter the MSS I/O base: ");
1033 
1034       num = ask_value ("%x", 0x534);
1035       fprintf (stderr, "SSCAPE/MSS I/O base set to %03x\n", num);
1036       printf ("#define SSCAPE_MSS_BASE 0x%03x\n", num);
1037 
1038       fprintf (stderr, "\nIRQ number for the MSS mode of SSCAPE ?\n");
1039       if (reveal_spea)
1040         fprintf (stderr, "Valid numbers are: 5, 7, 9(=2) and 15.\n");
1041       else
1042         fprintf (stderr, "Valid numbers are: 5, 7, 9(=2) and 10.\n");
1043       fprintf (stderr, "The default value is 5.\n"
1044                "Enter the value: ");
1045 
1046       num = ask_value ("%d", 5);
1047       if (num == 6 || num < 3 || num > 15)
1048         {
1049           fprintf (stderr, "*** Illegal input! ***\n");
1050           num = 10;
1051         }
1052       fprintf (stderr, "SSCAPE/MSS IRQ set to %d\n", num);
1053       printf ("#define SSCAPE_MSS_IRQ %d\n", num);
1054 
1055       fprintf (stderr, "\nMSS DMA number for SSCAPE?\n"
1056                "Valid values are 0, 1 and 3.\n"
1057                "The default value is 3\n"
1058                "Enter the value: ");
1059 
1060       num = ask_value ("%d", 3);
1061       if (num == 4 || num < 0 || num > 7)
1062         {
1063           fprintf (stderr, "*** Illegal input! ***\n");
1064           num = 3;
1065         }
1066       fprintf (stderr, "\nSSCAPE/MSS DMA set to %d\n", num);
1067       printf ("#define SSCAPE_MSS_DMA %d\n", num);
1068     }
1069   if (selected_options & B (OPT_TRIX))
1070     {
1071 
1072       fprintf (stderr, "\nWindows Sound System I/O base for the AudioTriX card?\n"
1073                "The factory default is 530\n"
1074                "Other possible values are  604, E80 or F40\n"
1075                "Enter the MSS I/O base: ");
1076 
1077       num = ask_value ("%x", 0x530);
1078       fprintf (stderr, "AudioTriX MSS I/O base set to %03x\n", num);
1079       printf ("#define TRIX_BASE 0x%03x\n", num);
1080 
1081       fprintf (stderr, "\nIRQ number for the WSS mode of AudioTriX ?\n"
1082                "Valid numbers are: 5, 7, 9(=2), 10 and 11.\n"
1083                "The default value is 11.\n"
1084                "Enter the value: ");
1085 
1086       num = ask_value ("%d", 11);
1087       if (num != 5 && num != 7 && num != 9 && num != 10 && num != 11)
1088         {
1089           fprintf (stderr, "*** Illegal input! ***\n");
1090           num = 11;
1091         }
1092       fprintf (stderr, " AudioTriX WSS IRQ set to %d\n", num);
1093       printf ("#define TRIX_IRQ %d\n", num);
1094 
1095       fprintf (stderr, "\nWSS DMA number for AudioTriX?\n"
1096                "Valid values are 0, 1 and 3.\n"
1097                "The default value is 3\n"
1098                "Enter the value: ");
1099 
1100       num = ask_value ("%d", 3);
1101       if (num != 0 && num != 1 && num != 3)
1102         {
1103           fprintf (stderr, "*** Illegal input! ***\n");
1104           num = 3;
1105         }
1106       fprintf (stderr, "\nAudioTriX/WSS DMA set to %d\n", num);
1107       printf ("#define TRIX_DMA %d\n", num);
1108 
1109       fprintf (stderr, "\nSecond (capture) DMA number for AudioTriX?\n"
1110                "Valid values are 0, 1 and 3.\n"
1111                "The default value is 0\n"
1112                "(-1 disables the second DMA)\n"
1113                "Enter the value: ");
1114 
1115       num = ask_value ("%d", 0);
1116       if (num != 0 && num != 1 && num != 3 || num != -1)
1117         {
1118           fprintf (stderr, "*** Illegal input! ***\n");
1119           num = 0;
1120         }
1121       fprintf (stderr, "\nAudioTriX/WSS DMA2 set to %d\n", num);
1122       printf ("#define TRIX_DMA2 %d\n", num);
1123 
1124       fprintf (stderr, "\nSoundBlaster I/O address for the AudioTriX card?\n"
1125                "The factory default is 220\n"
1126           "Other possible values are 200, 210, 230, 240, 250, 260 and 270\n"
1127                "Enter the MSS I/O base: ");
1128 
1129       num = ask_value ("%x", 0x220);
1130       fprintf (stderr, "AudioTriX SB I/O base set to %03x\n", num);
1131       printf ("#define TRIX_SB_BASE 0x%03x\n", num);
1132 
1133       fprintf (stderr, "\nIRQ number for the SB mode of AudioTriX ?\n"
1134                "Valid numbers are: 3, 4, 5 and 7.\n"
1135                "The default value is 7.\n"
1136                "Enter the value: ");
1137 
1138       num = ask_value ("%d", 7);
1139       if (num != 3 && num != 4 && num != 5 && num != 7)
1140         {
1141           fprintf (stderr, "*** Illegal input! ***\n");
1142           num = 7;
1143         }
1144       fprintf (stderr, " AudioTriX SB IRQ set to %d\n", num);
1145       printf ("#define TRIX_SB_IRQ %d\n", num);
1146 
1147       fprintf (stderr, "\nSB DMA number for AudioTriX?\n"
1148                "Valid values are 1 and 3.\n"
1149                "The default value is 1\n"
1150                "Enter the value: ");
1151 
1152       num = ask_value ("%d", 1);
1153       if (num != 1 && num != 3)
1154         {
1155           fprintf (stderr, "*** Illegal input! ***\n");
1156           num = 1;
1157         }
1158       fprintf (stderr, "\nAudioTriX/SB DMA set to %d\n", num);
1159       printf ("#define TRIX_SB_DMA %d\n", num);
1160 
1161       fprintf (stderr, "\nMIDI (MPU-401) I/O address for the AudioTriX card?\n"
1162                "The factory default is 330\n"
1163                "Other possible values are 330, 370, 3B0 and 3F0\n"
1164                "Enter the MPU I/O base: ");
1165 
1166       num = ask_value ("%x", 0x330);
1167       fprintf (stderr, "AudioTriX MIDI I/O base set to %03x\n", num);
1168       printf ("#define TRIX_MPU_BASE 0x%03x\n", num);
1169 
1170       fprintf (stderr, "\nMIDI IRQ number for the AudioTriX ?\n"
1171                "Valid numbers are: 3, 4, 5, 7 and 9(=2).\n"
1172                "The default value is 5.\n"
1173                "Enter the value: ");
1174 
1175       num = ask_value ("%d", 5);
1176       if (num != 3 && num != 4 && num != 5 && num != 7 && num != 9)
1177         {
1178           fprintf (stderr, "*** Illegal input! ***\n");
1179           num = 5;
1180         }
1181       fprintf (stderr, " AudioTriX MIDI IRQ set to %d\n", num);
1182       printf ("#define TRIX_MPU_IRQ %d\n", num);
1183     }
1184 
1185   if (selected_options & B (OPT_CS4232))
1186     {
1187       int             dma1;
1188 
1189       fprintf (stderr, "\nWindows Sound System I/O base for CS4232?\n"
1190                "The factory default is 534\n"
1191                "Other possible values are  608, E84 or F44\n"
1192                "Enter the MSS I/O base: ");
1193 
1194       num = ask_value ("%x", 0x534);
1195       fprintf (stderr, "CS4232 MSS I/O base set to %03x\n", num);
1196       printf ("#define CS4232_BASE 0x%03x\n", num);
1197 
1198       fprintf (stderr, "\nIRQ number for the WSS mode of CS4232 ?\n"
1199                "Valid numbers are: 5, 7, 9(=2), 11, 12 or 15.\n"
1200                "The default value is 11.\n"
1201                "Enter the value: ");
1202 
1203       num = ask_value ("%d", 11);
1204       if (num != 5 && num != 7 && num != 9 && num != 11 && num != 12 || num != 15)
1205         {
1206           fprintf (stderr, "*** Illegal input! ***\n");
1207           num = 11;
1208         }
1209       fprintf (stderr, " CS4232 WSS IRQ set to %d\n", num);
1210       printf ("#define CS4232_IRQ %d\n", num);
1211 
1212       fprintf (stderr, "\nWSS DMA number for CS4232?\n"
1213                "Valid values are 0, 1 and 3.\n"
1214                "The default value is 0\n"
1215                "(select the lowes possible one if you want to\n"
1216                "use full duplex mode)\n"
1217                "Enter the value: ");
1218 
1219       num = ask_value ("%d", 0);
1220       if (num != 0 && num != 1 && num != 3)
1221         {
1222           fprintf (stderr, "*** Illegal input! ***\n");
1223           num = 0;
1224         }
1225       fprintf (stderr, "\nCS4232/WSS DMA set to %d\n", num);
1226       printf ("#define CS4232_DMA %d\n", num);
1227       dma1 = num;
1228 
1229       fprintf (stderr, "\n Second WSS DMA number for CS4232?\n"
1230                "Valid values are 0, 1 and 3.\n"
1231                "The default value is 3\n"
1232                "Enter the value (-1 disables duplex mode): ");
1233 
1234       num = ask_value ("%d", 3);
1235       if (num == dma1 || (num != -1 && num != 0 && num != 1 && num != 3))
1236         {
1237           fprintf (stderr, "*** Illegal input! ***\n");
1238           num = 3;
1239         }
1240       fprintf (stderr, "\nCS4232/WSS DMA2 set to %d\n", num);
1241       printf ("#define CS4232_DMA2 %d\n", num);
1242 
1243       fprintf (stderr, "\nMIDI (MPU-401) I/O address for the CS4232 card?\n"
1244                "The factory default is 330\n"
1245                "Other possible values are 330, 370, 3B0 and 3F0\n"
1246                "Enter the MPU I/O base: ");
1247 
1248       num = ask_value ("%x", 0x330);
1249       fprintf (stderr, "CS4232 MIDI I/O base set to %03x\n", num);
1250       printf ("#define CS4232_MPU_BASE 0x%03x\n", num);
1251 
1252       fprintf (stderr, "\nMIDI IRQ number for CS4232?\n"
1253                "Valid numbers are: 5, 7, 9(=2), 11, 12 or 15.\n"
1254                "The default value is 5.\n"
1255                "Enter the value: ");
1256 
1257       num = ask_value ("%d", 5);
1258       if (num != 5 && num != 7 && num != 9 && num != 11 && num != 12 || num != 15)
1259         {
1260           fprintf (stderr, "*** Illegal input! ***\n");
1261           num = 5;
1262         }
1263       fprintf (stderr, " CS4232 MIDI IRQ set to %d\n", num);
1264       printf ("#define CS4232_MPU_IRQ %d\n", num);
1265     }
1266 
1267   if (selected_options & B (OPT_MAD16))
1268     {
1269       fprintf (stderr, "\n*** Options for the MAD16 and Mozart based cards ***\n\n");
1270 
1271       fprintf (stderr, "\nWindows Sound System I/O base for the MAD16/Mozart card?\n"
1272                "The factory default is 530\n"
1273                "Other possible values are  604, E80 or F40\n"
1274                "(Check which ones are supported by your card!!!!!!)\n"
1275                "Enter the MSS I/O base: ");
1276 
1277       num = ask_value ("%x", 0x530);
1278       fprintf (stderr, "MAD16 MSS I/O base set to %03x\n", num);
1279       printf ("#define MAD16_BASE 0x%03x\n", num);
1280 
1281       if ((sb_base == 0x220 && (num == 0x530 || num == 0x480)) ||
1282           (sb_base == 0x240 && (num == 0xf40 || num == 0x604)))
1283         {
1284           fprintf (stderr, "FATAL ERROR!!!!!!!!!!!!!!\n"
1285                    "\tThis I/O port selection makes MAD16/Mozart\n"
1286                    "\tto use 0x%03x as the SB port.\n"
1287                    "\tThis conflicts with the true SB card.\n"
1288                    "\tRun the config again and select another I/O base.\n",
1289                    sb_base);
1290           printf ("#undef CONFIGURE_SOUNDCARD\n");
1291           printf ("#undef KERNEL_SOUNDCARD\n");
1292           exit (-1);
1293         }
1294 
1295       fprintf (stderr, "\nIRQ number for the WSS mode of MAD16/Mozart ?\n"
1296                "Valid numbers are: 7, 9(=2), 10 and 11.\n"
1297                "The default value is 11.\n"
1298                "Enter the value: ");
1299 
1300       num = ask_value ("%d", 11);
1301       if (num != 7 && num != 9 && num != 10 && num != 11)
1302         {
1303           fprintf (stderr, "*** Illegal input! ***\n");
1304           num = 11;
1305         }
1306       fprintf (stderr, " MAD16 WSS IRQ set to %d\n", num);
1307       printf ("#define MAD16_IRQ %d\n", num);
1308 
1309       fprintf (stderr, "\nWSS DMA (playback) number for MAD16/Mozart?\n"
1310                "Valid values are 0, 1 and 3.\n"
1311                "The default value is 3\n"
1312                "Enter the value: ");
1313 
1314       num = ask_value ("%d", 3);
1315       if (num != 0 && num != 1 && num != 3)
1316         {
1317           fprintf (stderr, "*** Illegal input! ***\n");
1318           num = 3;
1319         }
1320       fprintf (stderr, "\nMAD16/WSS DMA set to %d\n", num);
1321       printf ("#define MAD16_DMA %d\n", num);
1322 
1323       num = (num == 0) ? 1 : 0;
1324 
1325       fprintf (stderr, "\nMAD16/Mozart supports full duplex mode if the\n"
1326                "card has a suitable codec chip (CS423x or AD1845).\n"
1327                "This mode requires another DMA channel (DMA%d)\n"
1328                "Do you want to enable this mode? (n/y)", num);
1329 
1330       if (think_positively (0))
1331         {
1332           fprintf (stderr, "\nMAD16/WSS capture DMA set to %d\n", num);
1333           printf ("#define MAD16_DMA2 %d\n", num);
1334         }
1335       else
1336         printf ("#define MAD16_DMA2 -1\n");
1337 
1338 
1339       fprintf (stderr, "\nMIDI (MPU-401/SB) I/O address for the MAD16 card?\n"
1340                "(This is the second MIDI port in TB Tropez)\n"
1341                "Other possible values are 330, 320, 310 and 300\n"
1342                "For 82C928 and Mozart you may use any nonzero value\n"
1343                "since the driver ignores this setting.\n"
1344                "The factory default is 330 (use 0 to disable)\n"
1345                "Enter the MIDI I/O base: ");
1346 
1347       num = ask_value ("%x", 0x330);
1348       if (num == 0)
1349         fprintf (stderr, "MAD16/Mozart MIDI port disabled\n");
1350       else
1351         {
1352           fprintf (stderr, "MAD16 MIDI I/O base set to %03x\n", num);
1353           printf ("#define MAD16_MPU_BASE 0x%03x\n", num);
1354 
1355           fprintf (stderr, "\nMIDI IRQ number for the MAD16 ?\n"
1356                    "Valid numbers are: 5, 7, 9(=2) and 10.\n"
1357                    "The default value is 5.\n"
1358                    "Enter the value: ");
1359 
1360           num = ask_value ("%d", 5);
1361           if (num != 3 && num != 4 && num != 5 && num != 7 && num != 9)
1362             {
1363               fprintf (stderr, "*** Illegal input! ***\n");
1364               num = 5;
1365             }
1366           fprintf (stderr, " MAD16 MIDI IRQ set to %d\n", num);
1367           printf ("#define MAD16_MPU_IRQ %d\n", num);
1368         }
1369     }
1370 
1371   if (selected_options & B (OPT_AUDIO))
1372     {
1373       def_size = 65536;
1374 
1375       fprintf (stderr, "\nSelect the DMA buffer size (4096, 16384, 32768 or 65536 bytes)\n"
1376                "%d is recommended value for this configuration.\n"
1377                "Enter the value: ", def_size);
1378 
1379       num = ask_value ("%d", def_size);
1380       if (num != 4096 && num != 16384 && num != 32768 && num != 65536)
1381         {
1382 
1383           fprintf (stderr, "*** Illegal input! ***\n");
1384           num = def_size;
1385         }
1386       fprintf (stderr, "The DMA buffer size set to %d\n", num);
1387       printf ("#define DSP_BUFFSIZE %d\n", num);
1388     }
1389 
1390   printf ("#define SELECTED_SOUND_OPTIONS\t0x%08x\n", selected_options);
1391   fprintf (stderr, "The sound driver is now configured.\n");
1392 
1393 #if defined(SCO) || defined(ISC) || defined(SYSV)
1394   fprintf (stderr, "Remember to update the System file\n");
1395 #endif
1396 
1397   exit (0);
1398 }
1399 
1400 int
1401 bin2hex (char *path, char *target, char *varname)
     /* [previous][next][first][last][top][bottom][index][help] */
1402 {
1403   int             fd;
1404   int             count;
1405   char            c;
1406   int             i = 0;
1407 
1408   if ((fd = open (path, 0)) > 0)
1409     {
1410       FILE           *sf = fopen (target, "w");
1411 
1412       fprintf (sf, "/* automaticaly generated by configure */\n");
1413       fprintf (sf, "static unsigned char %s[] = {\n", varname);
1414       while (1)
1415         {
1416           count = read (fd, &c, 1);
1417           if (count == 0)
1418             break;
1419           if (i != 0 && (i % 10) == 0)
1420             fprintf (sf, "\n");
1421           fprintf (sf, "0x%02x,", c & 0xFFL);
1422           i++;
1423         }
1424       fprintf (sf, "};\n"
1425                "#define %sLen %d\n", varname, i);
1426       fclose (sf);
1427       close (fd);
1428       return 1;
1429     }
1430 
1431   return 0;
1432 }

/* [previous][next][first][last][top][bottom][index][help] */