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

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