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

   1 /*
   2  * sound/configure.c  - Configuration program for the Linux Sound Driver
   3  *
   4  * Copyright by Hannu Savolainen 1993
   5  *
   6  * Redistribution and use in source and binary forms, with or without
   7  * modification, are permitted provided that the following conditions are
   8  * met: 1. Redistributions of source code must retain the above copyright
   9  * notice, this list of conditions and the following disclaimer. 2.
  10  * Redistributions in binary form must reproduce the above copyright notice,
  11  * this list of conditions and the following disclaimer in the documentation
  12  * and/or other materials provided with the distribution.
  13  *
  14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
  15  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  16  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  17  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
  18  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  20  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  21  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  24  * SUCH DAMAGE.
  25  *
  26  */
  27 
  28 #include <stdio.h>
  29 
  30 #define B(x)    (1 << (x))
  31 
  32 /*
  33  * Option numbers
  34  */
  35 
  36 #define OPT_PAS         0
  37 #define OPT_SB          1
  38 #define OPT_ADLIB       2
  39 #define OPT_LAST_MUTUAL 2
  40 
  41 #define OPT_GUS         3
  42 #define OPT_MPU401      4
  43 #define OPT_UART6850    5
  44 #define OPT_PSS         6
  45 #define OPT_GUS16       7
  46 #define OPT_GUSMAX      8
  47 #define OPT_MSS         9
  48 
  49 #define OPT_HIGHLEVEL   10      /* This must be same than the next one */
  50 #define OPT_SBPRO       10
  51 #define OPT_SB16        11
  52 #define OPT_AUDIO       12
  53 #define OPT_MIDI_AUTO   13
  54 #define OPT_MIDI        14
  55 #define OPT_YM3812_AUTO 15
  56 #define OPT_YM3812      16
  57 #define OPT_SEQUENCER   17
  58 #define OPT_LAST        17      /* Must be the same than the defined OPT */
  59 
  60 #define ANY_DEVS (B(OPT_AUDIO)|B(OPT_MIDI)|B(OPT_SEQUENCER)|B(OPT_GUS)| \
  61                   B(OPT_MPU401)|B(OPT_PSS)|B(OPT_GUS16)|B(OPT_GUSMAX)|B(OPT_MSS))
  62 /*
  63  * Options that have been disabled for some reason (incompletely implemented
  64  * and/or tested). Don't remove from this list before looking at file
  65  * experimental.txt for further info.
  66  */
  67 #define DISABLED_OPTIONS (B(OPT_PSS))
  68 
  69 typedef struct
  70   {
  71     unsigned long   conditions;
  72     unsigned long   exclusive_options;
  73     char            macro[20];
  74     int             verify;
  75     int             alias;
  76     int             default_answ;
  77   }
  78 
  79 hw_entry;
  80 
  81 
  82 /*
  83  * The rule table for the driver options. The first field defines a set of
  84  * options which must be selected before this entry can be selected. The
  85  * second field is a set of options which are not allowed with this one. If
  86  * the fourth field is zero, the option is selected without asking
  87  * confirmation from the user.
  88  *
  89  * With this version of the rule table it is possible to select just one type of
  90  * hardware.
  91  *
  92  * NOTE!        Keep the following table and the questions array in sync with the
  93  * option numbering!
  94  */
  95 
  96 hw_entry        hw_table[] =
  97 {
  98 /*
  99  * 0
 100  */
 101   {0, 0, "PAS", 1, 0, 0},
 102   {0, 0, "SB", 1, 0, 0},
 103   {0, B (OPT_PAS) | B (OPT_SB), "ADLIB", 1, 0, 0},
 104 
 105   {0, 0, "GUS", 1, 0, 0},
 106   {0, 0, "MPU401", 1, 0, 0},
 107   {0, 0, "UART6850", 1, 0, 0},
 108   {0, 0, "PSS", 1, 0, 0},
 109   {B (OPT_GUS), 0, "GUS16", 1, 0, 0},
 110   {B (OPT_GUS), B (OPT_GUS16), "GUSMAX", 1, 0, 0},
 111   {0, 0, "MSS", 1, 0, 0},
 112 
 113   {B (OPT_SB), B (OPT_PAS), "SBPRO", 1, 0, 1},
 114   {B (OPT_SB) | B (OPT_SBPRO), B (OPT_PAS), "SB16", 1, 0, 1},
 115 {B (OPT_PSS) | B (OPT_SB) | B (OPT_PAS) | B (OPT_GUS) | B (OPT_MSS), 0, "AUDIO", 1, 0, 1},
 116   {B (OPT_MPU401), 0, "MIDI_AUTO", 0, OPT_MIDI, 0},
 117   {B (OPT_PSS) | B (OPT_SB) | B (OPT_PAS) | B (OPT_MPU401) | B (OPT_GUS), 0, "MIDI", 1, 0, 1},
 118   {B (OPT_ADLIB), 0, "YM3812_AUTO", 0, OPT_YM3812, 0},
 119   {B (OPT_PSS) | B (OPT_SB) | B (OPT_PAS) | B (OPT_ADLIB), B (OPT_YM3812_AUTO), "YM3812", 1, 0, 1},
 120   {B (OPT_MIDI) | B (OPT_YM3812) | B (OPT_YM3812_AUTO) | B (OPT_GUS), 0, "SEQUENCER", 0, 0, 1}
 121 };
 122 
 123 char           *questions[] =
 124 {
 125   "ProAudioSpectrum 16 support",
 126   "SoundBlaster support",
 127   "AdLib support",
 128   "Gravis Ultrasound support",
 129   "MPU-401 support (NOT for SB16)",
 130   "6850 UART Midi support",
 131   "PSS (ECHO-ADI2111) support",
 132   "16 bit sampling option of GUS (_NOT_ GUS MAX)",
 133   "GUS MAX support",
 134   "Microsoft Sound System support",
 135 
 136   "SoundBlaster Pro support",
 137   "SoundBlaster 16 support",
 138   "/dev/dsp and /dev/audio support (_recommended_)",
 139   "This should not be asked",
 140   "MIDI interface support",
 141   "This should not be asked",
 142   "FM synthesizer (YM3812/OPL-3) support",
 143   "/dev/sequencer support",
 144   "Should I die"
 145 };
 146 
 147 unsigned long   selected_options = 0;
 148 int             sb_dma = 0;
 149 
 150 int
 151 can_select_option (int nr)
     /* [previous][next][first][last][top][bottom][index][help] */
 152 {
 153   switch (nr)
 154     {
 155     case 0:
 156       fprintf (stderr, "The SoundBlaster, AdLib and ProAudioSpectrum\n"
 157                "CARDS cannot be installed at the same time.\n\n"
 158                "However the PAS16 has a SB emulator so you could select"
 159                "the SoundBlaster DRIVER with it.\n");
 160       fprintf (stderr, "        - ProAudioSpectrum 16\n");
 161       fprintf (stderr, "        - SoundBlaster / SB Pro\n");
 162       fprintf (stderr, "          (Could be selected with a PAS16 also)\n");
 163       fprintf (stderr, "        - AdLib\n");
 164       fprintf (stderr, "\nDon't enable SoundBlaster if you have GUS at 0x220!\n\n");
 165       break;
 166 
 167     case OPT_LAST_MUTUAL + 1:
 168       fprintf (stderr, "\nThe following cards should work with any other cards.\n"
 169                "CAUTION! Don't enable MPU-401 if you don't have it.\n");
 170       break;
 171 
 172     case OPT_HIGHLEVEL:
 173       fprintf (stderr, "\nSelect one or more of the following options\n");
 174       break;
 175 
 176 
 177     }
 178 
 179   if (hw_table[nr].conditions)
 180     if (!(hw_table[nr].conditions & selected_options))
 181       return 0;
 182 
 183   if (hw_table[nr].exclusive_options)
 184     if (hw_table[nr].exclusive_options & selected_options)
 185       return 0;
 186 
 187   if (DISABLED_OPTIONS & B (nr))
 188     return 0;
 189 
 190   return 1;
 191 }
 192 
 193 int
 194 think_positively (int def_answ)
     /* [previous][next][first][last][top][bottom][index][help] */
 195 {
 196   char            answ[512];
 197   int             len;
 198 
 199   if ((len = read (0, &answ, sizeof (answ))) < 1)
 200     {
 201       fprintf (stderr, "\n\nERROR! Cannot read stdin\n");
 202 
 203       perror ("stdin");
 204       printf ("#undef CONFIGURE_SOUNDCARD\n");
 205       printf ("#undef KERNEL_SOUNDCARD\n");
 206       exit (-1);
 207     }
 208 
 209   if (len < 2)                  /*
 210                                  * There is an additional LF at the end
 211                                  */
 212     return def_answ;
 213 
 214   answ[len - 1] = 0;
 215 
 216   if (!strcmp (answ, "y") || !strcmp (answ, "Y"))
 217     return 1;
 218 
 219   return 0;
 220 }
 221 
 222 int
 223 ask_value (char *format, int default_answer)
     /* [previous][next][first][last][top][bottom][index][help] */
 224 {
 225   char            answ[512];
 226   int             len, num;
 227 
 228 play_it_again_Sam:
 229 
 230   if ((len = read (0, &answ, sizeof (answ))) < 1)
 231     {
 232       fprintf (stderr, "\n\nERROR! Cannot read stdin\n");
 233 
 234       perror ("stdin");
 235       printf ("#undef CONFIGURE_SOUNDCARD\n");
 236       printf ("#undef KERNEL_SOUNDCARD\n");
 237       exit (-1);
 238     }
 239 
 240   if (len < 2)                  /*
 241                                  * There is an additional LF at the end
 242                                  */
 243     return default_answer;
 244 
 245   answ[len - 1] = 0;
 246 
 247   if (sscanf (answ, format, &num) != 1)
 248     {
 249       fprintf (stderr, "Illegal format. Try again: ");
 250       goto play_it_again_Sam;
 251     }
 252 
 253   return num;
 254 }
 255 
 256 int
 257 main (int argc, char *argv[])
     /* [previous][next][first][last][top][bottom][index][help] */
 258 {
 259   int             i, num, def_size, full_driver = 1;
 260   char            answ[10];
 261 
 262   printf ("/*\tGenerated by configure. Don't edit!!!!\t*/\n\n");
 263 
 264   fprintf (stderr, "\nConfiguring the sound support\n\n");
 265 
 266   fprintf (stderr, "Do you want to include full version of the sound driver (n/y) ? ");
 267 
 268   if (think_positively (0))
 269     {
 270       /*
 271  * Select all but some most dangerous cards. These cards are difficult to
 272  * detect reliably or conflict with some other cards (SCSI, Mitsumi)
 273  */
 274       selected_options = 0xffffffff &
 275         ~(B (OPT_MPU401) | B (OPT_UART6850) | B (OPT_PSS)) &
 276         ~DISABLED_OPTIONS;
 277 
 278       fprintf (stderr, "Note! MPU-401, PSS and 6850 UART drivers not enabled\n");
 279       full_driver = 1;
 280     }
 281   else
 282     {
 283       fprintf (stderr, "Do you want to DISABLE the Sound Driver (n/y) ?");
 284       if (think_positively (0))
 285         {
 286           printf ("#undef CONFIGURE_SOUNDCARD\n");
 287           printf ("#undef KERNEL_SOUNDCARD\n");
 288           exit (0);
 289         }
 290       /*
 291        * Partial driver
 292        */
 293 
 294       full_driver = 0;
 295 
 296       for (i = 0; i <= OPT_LAST; i++)
 297         if (can_select_option (i))
 298           {
 299             if (!(selected_options & B (i)))    /*
 300                                                  * Not selected yet
 301                                                  */
 302               if (!hw_table[i].verify)
 303                 {
 304                   if (hw_table[i].alias)
 305                     selected_options |= B (hw_table[i].alias);
 306                   else
 307                     selected_options |= B (i);
 308                 }
 309               else
 310                 {
 311                   int             def_answ = hw_table[i].default_answ;
 312 
 313                   fprintf (stderr,
 314                            def_answ ? "  %s (y/n) ? " : "  %s (n/y) ? ",
 315                            questions[i]);
 316                   if (think_positively (def_answ))
 317                     if (hw_table[i].alias)
 318                       selected_options |= B (hw_table[i].alias);
 319                     else
 320                       selected_options |= B (i);
 321                 }
 322           }
 323     }
 324 
 325   if (selected_options & B (OPT_SBPRO))
 326     {
 327       fprintf(stderr, "Do you want support for the mixer of SG NX Pro ? ");
 328       if (think_positively (0))
 329          printf("#define __SGNXPRO__\n");
 330     }
 331 
 332   if (selected_options & B (OPT_SB16))
 333     selected_options |= B (OPT_SBPRO);
 334 
 335   if (selected_options & B (OPT_PSS))
 336     {
 337     genld_again:
 338       fprintf
 339         (stderr,
 340        "if you wish to emulate the soundblaster and you have a DSPxxx.LD.\n"
 341          "then you must include the LD in the kernel.\n"
 342          "(do you wish to include a LD) ? ");
 343       if (think_positively (0))
 344         {
 345           char            path[512];
 346 
 347           fprintf (stderr,
 348                    "Enter the path to your LD file (pwd is sound): ");
 349           scanf ("%s", path);
 350           fprintf (stderr, "including LD file %s\n", path);
 351           selected_options |= B (OPT_SB) | B (OPT_MPU401) | B (OPT_ADLIB);
 352 
 353           /* Gen LD header */
 354           {
 355             int             fd;
 356             int             count;
 357             char            c;
 358             int             i = 0;
 359 
 360             if ((fd = open (path, 0)) > 0)
 361               {
 362                 FILE           *sf = fopen ("synth-ld.h", "w");
 363 
 364                 fprintf (sf, "/* automatically generated by configure */\n");
 365                 fprintf (sf, "unsigned char pss_synth[] = {\n");
 366                 while (1)
 367                   {
 368                     count = read (fd, &c, 1);
 369                     if (count == 0)
 370                       break;
 371                     if (i != 0 && (i % 10) == 0)
 372                       fprintf (sf, "\n");
 373                     fprintf (sf, "0x%02x,", c & 0xFFL);
 374                     i++;
 375                   }
 376                 fprintf (sf, "};\n"
 377                          "#define pss_synthLen %d\n", i);
 378                 fclose (sf);
 379                 close (fd);
 380               }
 381             else
 382               {
 383                 fprintf (stderr, "couldn't open %s as the ld file\n",
 384                          path);
 385                 fprintf (stderr, "try again with correct path? ");
 386                 if (think_positively (1))
 387                   goto genld_again;
 388               }
 389           }
 390         }
 391       else
 392         {
 393           FILE           *sf = fopen ("synth-ld.h", "w");
 394 
 395           fprintf (sf, "/* automatically generated by configure */\n");
 396           fprintf (sf, "unsigned char pss_synth[1];\n"
 397                    "#define pss_synthLen 0\n");
 398           fclose (sf);
 399         }
 400     }
 401 
 402   if (!(selected_options & ANY_DEVS))
 403     {
 404       printf ("#undef CONFIGURE_SOUNDCARD\n");
 405       printf ("#undef KERNEL_SOUNDCARD\n");
 406       fprintf (stderr, "\n*** This combination is useless. Sound driver disabled!!! ***\n\n");
 407       exit (0);
 408     }
 409   else
 410     printf ("#define KERNEL_SOUNDCARD\n");
 411 
 412   for (i = 0; i <= OPT_LAST; i++)
 413     if (!hw_table[i].alias)
 414       if (selected_options & B (i))
 415         printf ("#undef  EXCLUDE_%s\n", hw_table[i].macro);
 416       else
 417         printf ("#define EXCLUDE_%s\n", hw_table[i].macro);
 418 
 419 
 420   /*
 421    * IRQ and DMA settings
 422    */
 423   printf ("\n");
 424 
 425 #if defined(linux)
 426   if ((selected_options & B (OPT_SB)) && selected_options & (B (OPT_AUDIO) | B (OPT_MIDI)))
 427     {
 428       fprintf (stderr, "\nI/O base for SB?\n"
 429                "The factory default is 220\n"
 430                "Enter the SB I/O base: ");
 431 
 432       num = ask_value ("%x", 0x220);
 433       fprintf (stderr, "SB I/O base set to %03x\n", num);
 434       printf ("#define SBC_BASE 0x%03x\n", num);
 435 
 436       fprintf (stderr, "\nIRQ number for SoundBlaster?\n"
 437                "The IRQ address is defined by the jumpers on your card.\n"
 438           "The factory default is either 5 or 7 (depending on the model).\n"
 439                "Valid values are 9(=2), 5, 7 and 10.\n"
 440                "Enter the value: ");
 441 
 442       num = ask_value ("%d", 7);
 443       if (num != 9 && num != 5 && num != 7 && num != 10)
 444         {
 445 
 446           fprintf (stderr, "*** Illegal input! ***\n");
 447           num = 7;
 448         }
 449       fprintf (stderr, "SoundBlaster IRQ set to %d\n", num);
 450 
 451       printf ("#define SBC_IRQ %d\n", num);
 452 
 453       if (selected_options & (B (OPT_SBPRO) | B (OPT_PAS) | B (OPT_PSS)))
 454         {
 455           fprintf (stderr, "\nDMA channel for SoundBlaster?\n"
 456                    "For SB 1.0, 1.5 and 2.0 this MUST be 1\n"
 457                    "SB Pro supports DMA channels 0, 1 and 3 (jumper)\n"
 458                    "For SB16 give the 8 bit DMA# here\n"
 459                    "The default value is 1\n"
 460                    "Enter the value: ");
 461 
 462           num = ask_value ("%d", 1);
 463           if (num < 0 || num > 3)
 464             {
 465 
 466               fprintf (stderr, "*** Illegal input! ***\n");
 467               num = 1;
 468             }
 469           fprintf (stderr, "SoundBlaster DMA set to %d\n", num);
 470           printf ("#define SBC_DMA %d\n", num);
 471           sb_dma = num;
 472         }
 473 
 474       if (selected_options & B (OPT_SB16))
 475         {
 476 
 477           fprintf (stderr, "\n16 bit DMA channel for SoundBlaster 16?\n"
 478                    "Possible values are 5, 6 or 7\n"
 479                    "The default value is 6\n"
 480                    "Enter the value: ");
 481 
 482           num = ask_value ("%d", 6);
 483           if ((num < 5 || num > 7) && (num != sb_dma))
 484             {
 485 
 486               fprintf (stderr, "*** Illegal input! ***\n");
 487               num = 6;
 488             }
 489           fprintf (stderr, "SoundBlaster DMA set to %d\n", num);
 490           printf ("#define SB16_DMA %d\n", num);
 491 
 492           fprintf (stderr, "\nI/O base for SB16 Midi?\n"
 493                    "Possible values are 300 and 330\n"
 494                    "The factory default is 330\n"
 495                    "Enter the SB16 Midi I/O base: ");
 496 
 497           num = ask_value ("%x", 0x330);
 498           fprintf (stderr, "SB16 Midi I/O base set to %03x\n", num);
 499           printf ("#define SB16MIDI_BASE 0x%03x\n", num);
 500         }
 501     }
 502 
 503   if (selected_options & B (OPT_PAS))
 504     {
 505       if (selected_options & (B (OPT_AUDIO) | B (OPT_MIDI)))
 506         {
 507           fprintf (stderr, "\nIRQ number for ProAudioSpectrum?\n"
 508                    "The recommended value is the IRQ used under DOS.\n"
 509                    "Please refer to the ProAudioSpectrum User's Guide.\n"
 510                    "The default value is 10.\n"
 511                    "Enter the value: ");
 512 
 513           num = ask_value ("%d", 10);
 514           if (num == 6 || num < 3 || num > 15 || num == 2)      /*
 515                                                                  * Illegal
 516                                                                  */
 517             {
 518 
 519               fprintf (stderr, "*** Illegal input! ***\n");
 520               num = 10;
 521             }
 522           fprintf (stderr, "ProAudioSpectrum IRQ set to %d\n", num);
 523           printf ("#define PAS_IRQ %d\n", num);
 524         }
 525 
 526       if (selected_options & B (OPT_AUDIO))
 527         {
 528           fprintf (stderr, "\nDMA number for ProAudioSpectrum?\n"
 529                    "The recommended value is the DMA channel under DOS.\n"
 530                    "Please refer to the ProAudioSpectrum User's Guide.\n"
 531                    "The default value is 3\n"
 532                    "Enter the value: ");
 533 
 534           num = ask_value ("%d", 3);
 535           if (num == 4 || num < 0 || num > 7)
 536             {
 537 
 538               fprintf (stderr, "*** Illegal input! ***\n");
 539               num = 3;
 540             }
 541           fprintf (stderr, "\nProAudioSpectrum DMA set to %d\n", num);
 542           printf ("#define PAS_DMA %d\n", num);
 543         }
 544     }
 545 
 546   if (selected_options & B (OPT_GUS))
 547     {
 548       fprintf (stderr, "\nI/O base for Gravis Ultrasound?\n"
 549                "Valid choices are 210, 220, 230, 240, 250 or 260\n"
 550                "The factory default is 220\n"
 551                "Enter the GUS I/O base: ");
 552 
 553       num = ask_value ("%x", 0x220);
 554       if ((num > 0x260) || ((num & 0xf0f) != 0x200) || ((num & 0x0f0) > 0x060))
 555         {
 556 
 557           fprintf (stderr, "*** Illegal input! ***\n");
 558           num = 0x220;
 559         }
 560 
 561       if ((selected_options & B (OPT_SB)) && (num == 0x220))
 562         {
 563           fprintf (stderr, "FATAL ERROR!!!!!!!!!!!!!!\n"
 564                    "\t0x220 cannot be used if SoundBlaster is enabled.\n"
 565                    "\tRun the config again.\n");
 566           printf ("#undef CONFIGURE_SOUNDCARD\n");
 567           printf ("#undef KERNEL_SOUNDCARD\n");
 568           exit (-1);
 569         }
 570       fprintf (stderr, "GUS I/O base set to %03x\n", num);
 571       printf ("#define GUS_BASE 0x%03x\n", num);
 572 
 573       fprintf (stderr, "\nIRQ number for Gravis UltraSound?\n"
 574                "The recommended value is the IRQ used under DOS.\n"
 575                "Please refer to the Gravis Ultrasound User's Guide.\n"
 576                "The default value is 15.\n"
 577                "Enter the value: ");
 578 
 579       num = ask_value ("%d", 15);
 580       if (num == 6 || num < 3 || num > 15 || num == 2)  /*
 581                                                          * Invalid
 582                                                          */
 583         {
 584 
 585           fprintf (stderr, "*** Illegal input! ***\n");
 586           num = 15;
 587         }
 588       fprintf (stderr, "Gravis UltraSound IRQ set to %d\n", num);
 589       printf ("#define GUS_IRQ %d\n", num);
 590 
 591       fprintf (stderr, "\nDMA number for Gravis UltraSound?\n"
 592                "The recommended value is the DMA channel under DOS.\n"
 593                "Please refer to the Gravis Ultrasound User's Guide.\n"
 594                "The default value is 6\n"
 595                "Enter the value: ");
 596 
 597       num = ask_value ("%d", 6);
 598       if (num == 4 || num < 0 || num > 7)
 599         {
 600           fprintf (stderr, "*** Illegal input! ***\n");
 601           num = 6;
 602         }
 603       fprintf (stderr, "\nGravis UltraSound DMA set to %d\n", num);
 604       printf ("#define GUS_DMA %d\n", num);
 605     }
 606 
 607   if (selected_options & B (OPT_MPU401))
 608     {
 609       fprintf (stderr, "\nI/O base for MPU-401?\n"
 610                "The factory default is 330\n"
 611                "Enter the MPU-401 I/O base: ");
 612 
 613       num = ask_value ("%x", 0x330);
 614       fprintf (stderr, "MPU-401 I/O base set to %03x\n", num);
 615       printf ("#define MPU_BASE 0x%03x\n", num);
 616 
 617       fprintf (stderr, "\nIRQ number for MPU-401?\n"
 618                "Valid numbers are: 3, 4, 5, 7 and 9(=2).\n"
 619                "The default value is 9.\n"
 620                "Enter the value: ");
 621 
 622       num = ask_value ("%d", 9);
 623       if (num == 6 || num < 3 || num > 15)      /*
 624                                                  * Used for floppy
 625                                                  */
 626         {
 627 
 628           fprintf (stderr, "*** Illegal input! ***\n");
 629           num = 5;
 630         }
 631       fprintf (stderr, "MPU-401 IRQ set to %d\n", num);
 632       printf ("#define MPU_IRQ %d\n", num);
 633     }
 634 
 635   if (selected_options & B (OPT_UART6850))
 636     {
 637       fprintf (stderr, "\nI/O base for 6850 UART Midi?\n"
 638                "Be careful. No defaults.\n"
 639                "Enter the 6850 UART I/O base: ");
 640 
 641       num = ask_value ("%x", 0);
 642       if (num == 0)
 643         {
 644           /*
 645  * Invalid value entered
 646  */
 647           printf ("#define EXCLUDE_UART6850\n");
 648         }
 649       else
 650         {
 651           fprintf (stderr, "6850 UART I/O base set to %03x\n", num);
 652           printf ("#define U6850_BASE 0x%03x\n", num);
 653 
 654           fprintf (stderr, "\nIRQ number for 6850 UART?\n"
 655                    "Valid numbers are: 3, 4, 5, 7 and 9(=2).\n"
 656                    "The default value is 5.\n"
 657                    "Enter the value: ");
 658 
 659           num = ask_value ("%d", 5);
 660           if (num == 6 || num < 3 || num > 15)  /*
 661                                                  * Used for floppy
 662                                                  */
 663             {
 664 
 665               fprintf (stderr, "*** Illegal input! ***\n");
 666               num = 5;
 667             }
 668           fprintf (stderr, "6850 UART IRQ set to %d\n", num);
 669           printf ("#define U6850_IRQ %d\n", num);
 670         }
 671     }
 672 
 673   if (selected_options & B (OPT_PSS))
 674     {
 675       fprintf (stderr, "\nI/O base for PSS?\n"
 676                "The factory default is 220\n"
 677                "Enter the PSS I/O base: ");
 678 
 679       num = ask_value ("%x", 0x220);
 680       fprintf (stderr, "PSS I/O base set to %03x\n", num);
 681       printf ("#define PSS_BASE 0x%03x\n", num);
 682 
 683       fprintf (stderr, "\nIRQ number for PSS?\n"
 684                "Valid numbers are: 3, 4, 5, 7, 9(=2) or 10.\n"
 685                "The default value is 10.\n"
 686                "Enter the value: ");
 687 
 688       num = ask_value ("%d", 10);
 689       if (num == 6 || num < 3 || num > 15)      /* Used for floppy */
 690         {
 691           fprintf (stderr, "*** Illegal input! ***\n");
 692           num = 7;
 693         }
 694       fprintf (stderr, "PSS IRQ set to %d\n", num);
 695       printf ("#define PSS_IRQ %d\n", num);
 696 
 697       fprintf (stderr, "\nDMA number for ECHO-PSS?\n"
 698                "The default value is 3\n"
 699                "Enter the value: ");
 700 
 701       num = ask_value ("%d", 3);
 702       if (num == 4 || num < 0 || num > 7)
 703         {
 704           fprintf (stderr, "*** Illegal input! ***\n");
 705           num = 3;
 706         }
 707       fprintf (stderr, "\nECHO-PSS DMA set to %d\n", num);
 708       printf ("#define PSS_DMA %d\n", num);
 709     }
 710 
 711   if (selected_options & B (OPT_MSS))
 712     {
 713       fprintf (stderr, "\nI/O base for MSS (MS Sound System)?\n"
 714                "The factory default is 530\n"
 715                "Other possible values are  604, E80 or F40\n"
 716                "Enter the MSS I/O base: ");
 717 
 718       num = ask_value ("%x", 0x530);
 719       fprintf (stderr, "MSS I/O base set to %03x\n", num);
 720       printf ("#define MSS_BASE 0x%03x\n", num);
 721 
 722       fprintf (stderr, "\nIRQ number for MSS?\n"
 723                "Valid numbers are: 7, 9(=2), 10 and 11.\n"
 724                "The default value is 10.\n"
 725                "Enter the value: ");
 726 
 727       num = ask_value ("%d", 10);
 728       if (num == 6 || num < 3 || num > 15)      /* Used for floppy */
 729         {
 730           fprintf (stderr, "*** Illegal input! ***\n");
 731           num = 7;
 732         }
 733       fprintf (stderr, "MSS IRQ set to %d\n", num);
 734       printf ("#define MSS_IRQ %d\n", num);
 735 
 736       fprintf (stderr, "\nDMA number for MSS?\n"
 737                "Valid values are 1 and 3 (sometimes 0)"
 738                "The default value is 3\n"
 739                "Enter the value: ");
 740 
 741       num = ask_value ("%d", 3);
 742       if (num == 4 || num < 0 || num > 7)
 743         {
 744           fprintf (stderr, "*** Illegal input! ***\n");
 745           num = 3;
 746         }
 747       fprintf (stderr, "\nMSS DMA set to %d\n", num);
 748       printf ("#define MSS_DMA %d\n", num);
 749     }
 750 
 751   if (selected_options & B (OPT_GUS16))
 752     {
 753       fprintf (stderr, "\nI/O base for GUS16 (GUS 16 bit sampling option)?\n"
 754                "The factory default is 530\n"
 755                "Other possible values are  604, E80 or F40\n"
 756                "Enter the GUS16 I/O base: ");
 757 
 758       num = ask_value ("%x", 0x530);
 759       fprintf (stderr, "GUS16 I/O base set to %03x\n", num);
 760       printf ("#define GUS16_BASE 0x%03x\n", num);
 761 
 762       fprintf (stderr, "\nIRQ number for GUS16?\n"
 763                "Valid numbers are: 3, 4, 5, 7, or 9(=2).\n"
 764                "The default value is 7.\n"
 765                "Enter the value: ");
 766 
 767       num = ask_value ("%d", 7);
 768       if (num == 6 || num < 3 || num > 15)      /* Used for floppy */
 769         {
 770           fprintf (stderr, "*** Illegal input! ***\n");
 771           num = 7;
 772         }
 773       fprintf (stderr, "GUS16 IRQ set to %d\n", num);
 774       printf ("#define GUS16_IRQ %d\n", num);
 775 
 776       fprintf (stderr, "\nDMA number for GUS16?\n"
 777                "The default value is 3\n"
 778                "Enter the value: ");
 779 
 780       num = ask_value ("%d", 3);
 781       if (num < 0 || num > 3)
 782         {
 783           fprintf (stderr, "*** Illegal input! ***\n");
 784           num = 3;
 785         }
 786       fprintf (stderr, "\nGUS16 DMA set to %d\n", num);
 787       printf ("#define GUS16_DMA %d\n", num);
 788     }
 789 #endif
 790 
 791   if (selected_options & B (OPT_AUDIO))
 792     {
 793       def_size = 16384;
 794 
 795       if (selected_options & (B (OPT_SBPRO) | B (OPT_PAS) | B (OPT_SB16)))
 796         def_size = 32768;
 797 
 798 #ifndef __386BSD__
 799       if ((selected_options & (B (OPT_PAS) | B (OPT_PAS) | B (OPT_GUS16) | B (OPT_GUSMAX) |
 800                                B (OPT_MSS) | B (OPT_PSS))) &&
 801           !full_driver)
 802         def_size = 65536;       /*
 803                                  * PAS16 or SB16
 804                                  */
 805 #endif
 806 
 807       fprintf (stderr, "\nSelect the DMA buffer size (4096, 16384, 32768 or 65536 bytes)\n"
 808                "%d is recommended value for this configuration.\n"
 809                "Enter the value: ", def_size);
 810 
 811       num = ask_value ("%d", def_size);
 812       if (num != 4096 && num != 16384 && num != 32768 && num != 65536)
 813         {
 814 
 815           fprintf (stderr, "*** Illegal input! ***\n");
 816           num = def_size;
 817         }
 818       fprintf (stderr, "The DMA buffer size set to %d\n", num);
 819       printf ("#define DSP_BUFFSIZE %d\n", num);
 820     }
 821 
 822   printf ("#define SELECTED_SOUND_OPTIONS\t0x%08x\n", selected_options);
 823   fprintf (stderr, "The sound driver is now configured.\n");
 824 
 825 #if defined(SCO) || defined(ISC) || defined(SYSV)
 826   fprintf (stderr, "Remember to update the System file\n");
 827 #endif
 828 
 829   exit (0);
 830 }

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