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. rebuild_file
  5. use_old_config
  6. build_defines
  7. main
  8. bin2hex

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

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