OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [rc203soc/] [sw/] [uClinux/] [arch/] [armnommu/] [drivers/] [sound/] [configure.c] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1622 jcastillo
/*
2
 *     PnP soundcard support is not included in this version.
3
 *
4
 *       AEDSP16 will not work without significant changes.
5
 */
6
#define DISABLED_OPTIONS        (B(OPT_SPNP)|B(OPT_AEDSP16)|B(OPT_UNUSED1)|B(OPT_UNUSED2))
7
/*
8
 * sound/configure.c  - Configuration program for the Linux Sound Driver
9
 */
10
/*
11
 * Copyright (C) by Hannu Savolainen 1993-1996
12
 *
13
 * USS/Lite for Linux is distributed under the GNU GENERAL PUBLIC LICENSE (GPL)
14
 * Version 2 (June 1991). See the "COPYING" file distributed with this software
15
 * for more info.
16
 */
17
 
18
 
19
#include <stdio.h>
20
#include <unistd.h>
21
#include <stdlib.h>
22
#include <fcntl.h>
23
#include <string.h>
24
 
25
#define B(x)    (1 << (x))
26
 
27
/*
28
 * Option numbers
29
 */
30
 
31
#define OPT_PAS         0
32
#define OPT_SB          1
33
#define OPT_ADLIB       2
34
#define OPT_LAST_MUTUAL 2
35
 
36
#define OPT_GUS         3
37
#define OPT_MPU401      4
38
#define OPT_UART6850    5
39
#define OPT_PSS         6
40
#define OPT_GUS16       7
41
#define OPT_GUSMAX      8
42
#define OPT_MSS         9
43
#define OPT_SSCAPE      10
44
#define OPT_TRIX        11
45
#define OPT_MAD16       12
46
#define OPT_CS4232      13
47
#define OPT_MAUI        14
48
#define OPT_SPNP        15
49
#define OPT_VIDC        16
50
 
51
#define OPT_HIGHLEVEL   17      /* This must be same than the next one */
52
#define OPT_UNUSED1     17
53
#define OPT_UNUSED2     18
54
#define OPT_AEDSP16     19
55
#define OPT_AUDIO       20
56
#define OPT_MIDI_AUTO   21
57
#define OPT_MIDI        22
58
#define OPT_YM3812_AUTO 23
59
#define OPT_YM3812      24
60
#define OPT_LAST        24      /* Last defined OPT number */
61
 
62
#define DUMMY_OPTS (B(OPT_MIDI_AUTO)|B(OPT_YM3812_AUTO))
63
 
64
#define ANY_DEVS (B(OPT_AUDIO)|B(OPT_MIDI)|B(OPT_GUS)| \
65
                  B(OPT_MPU401)|B(OPT_PSS)|B(OPT_GUS16)|B(OPT_GUSMAX)| \
66
                  B(OPT_MSS)|B(OPT_SSCAPE)|B(OPT_UART6850)|B(OPT_TRIX)| \
67
                  B(OPT_MAD16)|B(OPT_CS4232)|B(OPT_MAUI)|B(OPT_ADLIB)| \
68
                  B(OPT_VIDC))
69
#define AUDIO_CARDS (B (OPT_PSS) | B (OPT_SB) | B (OPT_PAS) | B (OPT_GUS) | \
70
                B (OPT_MSS) | B (OPT_GUS16) | B (OPT_GUSMAX) | B (OPT_TRIX) | \
71
                B (OPT_SSCAPE)| B(OPT_MAD16) | B(OPT_CS4232) | B (OPT_VIDC))
72
#define MPU_DEVS (B(OPT_PSS)|\
73
                  B(OPT_CS4232)|B(OPT_SPNP)|B(OPT_MAUI)|B(OPT_SSCAPE))
74
#define UART401_DEVS (SBDSP_DEVS|B(OPT_TRIX)|B(OPT_MAD16))
75
#define MIDI_CARDS (MPU_DEVS | UART401_DEVS | \
76
                    B (OPT_PSS) | B (OPT_SB) | B (OPT_PAS) | B (OPT_MPU401) | \
77
                    B (OPT_GUS) | B (OPT_TRIX) | B (OPT_SSCAPE)|B(OPT_MAD16) | \
78
                    B (OPT_CS4232)|B(OPT_MAUI))
79
#define AD1848_DEVS (B(OPT_GUS16)|B(OPT_MSS)|B(OPT_PSS)|B(OPT_GUSMAX)|\
80
                     B(OPT_SSCAPE)|B(OPT_TRIX)|B(OPT_MAD16)|B(OPT_CS4232)|\
81
                     B(OPT_SPNP))
82
#define SBDSP_DEVS (B(OPT_SB)|B(OPT_SPNP)|B(OPT_MAD16)|B(OPT_TRIX))
83
#define SEQUENCER_DEVS (B(OPT_MIDI)|B(OPT_YM3812)|B(OPT_ADLIB)|B(OPT_GUS)|B(OPT_MAUI)|MIDI_CARDS|B(OPT_VIDC))
84
/*
85
 * Options that have been disabled for some reason (incompletely implemented
86
 * and/or tested). Don't remove from this list before looking at file
87
 * experimental.txt for further info.
88
 */
89
 
90
typedef struct
91
  {
92
    unsigned long   conditions;
93
    unsigned long   exclusive_options;
94
    char            macro[20];
95
    int             verify;
96
    int             alias;
97
    int             default_answ;
98
  }
99
 
100
hw_entry;
101
 
102
 
103
/*
104
 * The rule table for the driver options. The first field defines a set of
105
 * options which must be selected before this entry can be selected. The
106
 * second field is a set of options which are not allowed with this one. If
107
 * the fourth field is zero, the option is selected without asking
108
 * confirmation from the user.
109
 *
110
 * With this version of the rule table it is possible to select just one type of
111
 * hardware.
112
 *
113
 * NOTE!        Keep the following table and the questions array in sync with the
114
 * option numbering!
115
 */
116
 
117
hw_entry        hw_table[] =
118
{
119
/*
120
 * 0
121
 */
122
  {0, 0, "PAS", 1, 0, 0},
123
  {0, 0, "SB", 1, 0, 0},
124
  {0, B (OPT_PAS) | B (OPT_SB), "ADLIB", 1, 0, 0},
125
 
126
  {0, 0, "GUS", 1, 0, 0},
127
  {0, 0, "MPU401", 1, 0, 0},
128
  {0, 0, "UART6850", 1, 0, 0},
129
  {0, 0, "PSS", 1, 0, 0},
130
  {B (OPT_GUS), 0, "GUS16", 1, 0, 0},
131
  {B (OPT_GUS), B (OPT_GUS16), "GUSMAX", 1, 0, 0},
132
  {0, 0, "MSS", 1, 0, 0},
133
  {0, 0, "SSCAPE", 1, 0, 0},
134
  {0, 0, "TRIX", 1, 0, 0},
135
  {0, 0, "MAD16", 1, 0, 0},
136
  {0, 0, "CS4232", 1, 0, 0},
137
  {0, 0, "MAUI", 1, 0, 0},
138
  {0, 0, "SPNP", 1, 0, 0},
139
  {0, 0, "VIDC", 1, 0, 0},
140
 
141
  {B (OPT_SB), B (OPT_PAS), "UNUSED1", 1, 0, 1},
142
  {B (OPT_SB) | B (OPT_UNUSED1), B (OPT_PAS), "UNUSED2", 1, 0, 1},
143
  {B (OPT_UNUSED1) | B (OPT_MSS) | B (OPT_MPU401), 0, "AEDSP16", 1, 0, 0},
144
  {AUDIO_CARDS, 0, "AUDIO", 1, 0, 1},
145
  {B (OPT_MPU401) | B (OPT_MAUI), 0, "MIDI_AUTO", 0, OPT_MIDI, 0},
146
  {MIDI_CARDS, 0, "MIDI", 1, 0, 1},
147
  {B (OPT_ADLIB), 0, "YM3812_AUTO", 0, OPT_YM3812, 0},
148
  {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}
149
};
150
 
151
char           *questions[] =
152
{
153
  "ProAudioSpectrum 16 support",
154
  "Sound Blaster (SB, SBPro, SB16, clones) support",
155
  "Generic OPL2/OPL3 FM synthesizer support",
156
  "Gravis Ultrasound support",
157
  "MPU-401 support (NOT for SB16)",
158
  "6850 UART Midi support",
159
  "PSS (ECHO-ADI2111) support",
160
  "16 bit sampling option of GUS (_NOT_ GUS MAX)",
161
  "GUS MAX support",
162
  "Microsoft Sound System support",
163
  "Ensoniq SoundScape support",
164
  "MediaTrix AudioTrix Pro support",
165
  "Support for MAD16 and/or Mozart based cards",
166
  "Support for Crystal CS4232 based (PnP) cards",
167
  "Support for Turtle Beach Wave Front (Maui, Tropez) synthesizers",
168
  "Support for PnP sound cards (_EXPERIMENTAL_)",
169
  "Support VIDC20 sound system",
170
 
171
  "*** Unused option 1 ***",
172
  "*** Unused option 2 ***",
173
  "Audio Excel DSP 16 initialization support",
174
  "/dev/dsp and /dev/audio support",
175
  "This should not be asked",
176
  "MIDI interface support",
177
  "This should not be asked",
178
  "FM synthesizer (YM3812/OPL-3) support",
179
  "Is the sky really falling"
180
};
181
 
182
/* help text for each option */
183
char           *help[] =
184
{
185
  "Enable this option only if you have a Pro Audio Spectrum 16,\n"
186
  "Pro Audio Studio 16, or Logitech SoundMan 16. Don't enable this if\n"
187
  "you have some other card made by MediaVision or Logitech as\n"
188
  "they are not PAS16 compatible.\n",
189
 
190
  "Enable this if you have an original Sound Blaster card made by\n"
191
  "Creative Labs or a 100%% hardware compatible clone. For an\n"
192
  "unknown card you may want to try this if it claims to be\n"
193
  "Sound Blaster compatible.\n",
194
 
195
  "Enable this option if your sound card has a Yamaha OPL2 or OPL3\n"
196
  "FM synthesizer chip.\n",
197
 
198
  "Enable this option for any type of Gravis Ultrasound card\n"
199
  "including the GUS or GUS MAX.\n",
200
 
201
  "The MPU401 interface is supported by almost all sound cards. However,\n"
202
  "some natively supported cards have their own driver for\n"
203
  "MPU401. Enabling the MPU401 option with these cards will cause a\n"
204
  "conflict. Also enabling MPU401 on a system that doesn't really have a\n"
205
  "MPU401 could cause some trouble. It's safe to enable this if you have a\n"
206
  "true MPU401 MIDI interface card.\n",
207
 
208
  "This option enables support for MIDI interfaces based on the 6850\n"
209
  "UART chip. This interface is rarely found on sound cards.\n",
210
 
211
  "Enable this option if you have an Orchid SW32, Cardinal DSP16 or other\n"
212
  "sound card based on the PSS chipset (AD1848 codec, ADSP-2115 DSP chip,\n"
213
  "and Echo ESC614 ASIC CHIP).\n",
214
 
215
  "Enable this if you have installed the 16-bit sampling daughtercard on\n"
216
  "your GUS card. Do not use if you have a GUS MAX as enabling this option\n"
217
  "disables GUS MAX support.\n",
218
 
219
  "Enable this option if you have a Gravis Ultrasound MAX sound\n"
220
  "card\n",
221
 
222
  "Enable this option if you have the original Windows Sound System\n"
223
  "card made by Microsoft or the Aztech SG 16 Pro or NX16 Pro.\n",
224
 
225
  "Enable this if you have a sound card based on the Ensoniq\n"
226
  "SoundScape chipset. Such cards are being manufactured by Ensoniq,\n"
227
  "Spea and Reveal (Reveal makes other cards as well).\n",
228
 
229
  "Enable this option if you have the AudioTrix Pro sound card\n"
230
  "manufactured by MediaTrix.\n",
231
 
232
  "Enable this if your card has a Mozart (OAK OTI-601) or MAD16 (OPTi\n"
233
  "82C928 or 82C929) audio interface chip. These chips are currently\n"
234
  "quite common so it's possible that many no-name cards have one of\n"
235
  "them. In addition the MAD16 chip is used in some cards made by known\n"
236
  "manufacturers such as Turtle Beach (Tropez), Reveal (some models) and\n"
237
  "Diamond (latest ones).\n",
238
 
239
  "Enable this if you have a card based on the Crystal CS4232 chip set.\n",
240
 
241
  "Enable this option if you have a Turtle Beach Wave Front, Maui,\n"
242
  "or Tropez sound card.\n",
243
 
244
  "Use this option to enable experimental support for cards that\n"
245
  "use the Plug and Play protocol.\n",
246
 
247
  "Enable this if you have a RiscPC\n",
248
 
249
  "Enable this option if your card is a Sound Blaster Pro or\n"
250
  "Sound Blaster 16. It also works with many Sound Blaster Pro clones.\n",
251
 
252
  "Enable this if you have a Sound Blaster 16, including the AWE32.\n",
253
 
254
  "Enable this if you have an Audio Excel DSP16 card. See the file\n"
255
  "Readme.aedsp16 for more information.\n",
256
 
257
  "This option enables the A/D and D/A converter (PCM) devices\n"
258
  "supported by almost all sound cards.\n",
259
 
260
  "This should not be asked",
261
 
262
  "This enables the dev/midixx devices and access to any MIDI ports\n"
263
  "using /dev/sequencer and /dev/music. This option also affects any\n"
264
  "MPU401 and/or General MIDI compatible devices.\n",
265
 
266
  "This should not be asked",
267
 
268
  "This enables the Yamaha FM synthesizer chip used on many sound\n"
269
  "cards.\n",
270
 
271
  "Is the sky really falling"
272
};
273
 
274
struct kludge
275
  {
276
    char           *name;
277
    int             mask;
278
  }
279
extra_options[] =
280
{
281
  {
282
    "MPU_EMU", MPU_DEVS
283
  }
284
  ,
285
  {
286
    "AD1848", AD1848_DEVS
287
  }
288
  ,
289
  {
290
    "SBDSP", SBDSP_DEVS
291
  }
292
  ,
293
  {
294
    "UART401", UART401_DEVS
295
  }
296
  ,
297
  {
298
    "SEQUENCER", SEQUENCER_DEVS
299
  }
300
  ,
301
  {
302
    NULL, 0
303
  }
304
};
305
 
306
char           *oldconf = "/etc/soundconf";
307
 
308
int             old_config_used = 0;
309
int             def_size, sb_base = 0;
310
 
311
unsigned long   selected_options = 0;
312
int             sb_dma = 0;
313
 
314
int             dump_only = 0;
315
 
316
void            build_defines (void);
317
 
318
#include "hex2hex.h"
319
int             bin2hex (char *path, char *target, char *varname);
320
 
321
int
322
can_select_option (int nr)
323
{
324
 
325
  if (hw_table[nr].conditions)
326
    if (!(hw_table[nr].conditions & selected_options))
327
      return 0;
328
 
329
  if (hw_table[nr].exclusive_options)
330
    if (hw_table[nr].exclusive_options & selected_options)
331
      return 0;
332
 
333
  if (DISABLED_OPTIONS & B (nr))
334
    return 0;
335
 
336
  return 1;
337
}
338
 
339
int
340
think_positively (char *prompt, int def_answ, char *help)
341
{
342
  char            answ[512];
343
  int             len;
344
 
345
response:
346
  fprintf (stderr, prompt);
347
  if (def_answ)
348
    fprintf (stderr, " [Y/n/?] ");
349
  else
350
    fprintf (stderr, " [N/y/?] ");
351
 
352
  if ((len = read (0, answ, sizeof (answ))) < 1)
353
    {
354
      fprintf (stderr, "\n\nERROR! Cannot read stdin\n");
355
 
356
      perror ("stdin");
357
      printf ("invalid_configuration__run_make_config_again\n");
358
      exit (-1);
359
    }
360
 
361
  if (len < 2)                  /*
362
                                 * There is an additional LF at the end
363
                                 */
364
    return def_answ;
365
 
366
  if (answ[0] == '?')
367
    {                           /* display help message */
368
      fprintf (stderr, "\n");
369
      fprintf (stderr, help);
370
      fprintf (stderr, "\n");
371
      goto response;
372
    }
373
 
374
  answ[len - 1] = 0;
375
 
376
  if (!strcmp (answ, "y") || !strcmp (answ, "Y"))
377
    return 1;
378
 
379
  return 0;
380
}
381
 
382
int
383
ask_value (char *format, int default_answer)
384
{
385
  char            answ[512];
386
  int             len, num;
387
 
388
play_it_again_Sam:
389
 
390
  if ((len = read (0, answ, sizeof (answ))) < 1)
391
    {
392
      fprintf (stderr, "\n\nERROR! Cannot read stdin\n");
393
 
394
      perror ("stdin");
395
      printf ("invalid_configuration__run_make_config_again\n");
396
      exit (-1);
397
    }
398
 
399
  if (len < 2)                  /*
400
                                 * There is an additional LF at the end
401
                                 */
402
    return default_answer;
403
 
404
  answ[len - 1] = 0;
405
 
406
  if (sscanf (answ, format, &num) != 1)
407
    {
408
      fprintf (stderr, "Illegal format. Try again: ");
409
      goto play_it_again_Sam;
410
    }
411
 
412
  return num;
413
}
414
 
415
#define FMT_HEX 1
416
#define FMT_INT 2
417
 
418
void
419
ask_int_choice (int mask, char *macro,
420
                char *question,
421
                int format,
422
                int defa,
423
                char *choices)
424
{
425
  int             num, i;
426
 
427
  if (dump_only)
428
    {
429
 
430
      for (i = 0; i < OPT_LAST; i++)
431
        if (mask == B (i))
432
          {
433
            unsigned int    j;
434
 
435
            for (j = 0; j < strlen (choices); j++)
436
              if (choices[j] == '\'')
437
                choices[j] = '_';
438
 
439
            printf ("\nif [ \"$CONFIG_%s\" = \"y\" ]; then\n",
440
                    hw_table[i].macro);
441
            if (format == FMT_INT)
442
              printf ("int '%s %s' %s %d\n", question, choices, macro, defa);
443
            else
444
              printf ("hex '%s %s' %s %x\n", question, choices, macro, defa);
445
            printf ("fi\n");
446
          }
447
    }
448
  else
449
    {
450
      if (!(mask & selected_options))
451
        return;
452
 
453
      fprintf (stderr, "\n%s\n", question);
454
      if (strcmp (choices, ""))
455
        fprintf (stderr, "Possible values are: %s\n", choices);
456
 
457
      if (format == FMT_INT)
458
        {
459
          if (defa == -1)
460
            fprintf (stderr, "\t(-1 disables this feature)\n");
461
          fprintf (stderr, "The default value is %d\n", defa);
462
          fprintf (stderr, "Enter the value: ");
463
          num = ask_value ("%d", defa);
464
          if (num == -1)
465
            return;
466
          fprintf (stderr, "%s set to %d.\n", question, num);
467
          printf ("#define %s %d\n", macro, num);
468
        }
469
      else
470
        {
471
          if (defa == 0)
472
            fprintf (stderr, "\t(0 disables this feature)\n");
473
          fprintf (stderr, "The default value is %x\n", defa);
474
          fprintf (stderr, "Enter the value: ");
475
          num = ask_value ("%x", defa);
476
          if (num == 0)
477
            return;
478
          fprintf (stderr, "%s set to %x.\n", question, num);
479
          printf ("#define %s 0x%x\n", macro, num);
480
        }
481
    }
482
}
483
 
484
void
485
rebuild_file (char *line)
486
{
487
  char           *method, *next, *old, *var, *p;
488
 
489
  method = p = line;
490
 
491
  while (*p && *p != ' ')
492
    p++;
493
  *p++ = 0;
494
 
495
  old = p;
496
  while (*p && *p != ' ')
497
    p++;
498
  *p++ = 0;
499
 
500
  next = p;
501
  while (*p && *p != ' ')
502
    p++;
503
  *p++ = 0;
504
 
505
  var = p;
506
  while (*p && *p != ' ')
507
    p++;
508
  *p++ = 0;
509
 
510
  fprintf (stderr, "Rebuilding file `%s' (%s %s)\n", next, method, old);
511
 
512
  if (strcmp (method, "bin2hex") == 0)
513
    {
514
      if (!bin2hex (old, next, var))
515
        {
516
          fprintf (stderr, "Rebuild failed\n");
517
          exit (-1);
518
        }
519
    }
520
  else if (strcmp (method, "hex2hex") == 0)
521
    {
522
      if (!hex2hex (old, next, var))
523
        {
524
          fprintf (stderr, "Rebuild failed\n");
525
          exit (-1);
526
        }
527
    }
528
  else
529
    {
530
      fprintf (stderr, "Failed to build `%s' - unknown method %s\n",
531
               next, method);
532
      exit (-1);
533
    }
534
}
535
 
536
int
537
use_old_config (char *filename)
538
{
539
  char            buf[1024];
540
  int             i = 0;
541
 
542
  FILE           *oldf;
543
 
544
  fprintf (stderr, "Copying old configuration from `%s'\n", filename);
545
 
546
  if ((oldf = fopen (filename, "r")) == NULL)
547
    {
548
      fprintf (stderr, "Couldn't open previous configuration file\n");
549
      perror (filename);
550
      return 0;
551
    }
552
 
553
  while (fgets (buf, 1024, oldf) != NULL)
554
    {
555
      char            tmp[100];
556
 
557
      if (buf[0] != '#')
558
        {
559
          printf ("%s", buf);
560
 
561
          strncpy (tmp, buf, 8);
562
          tmp[8] = 0;
563
 
564
          if (strcmp (tmp, "/*build ") == 0)
565
            rebuild_file (&buf[8]);
566
 
567
          continue;
568
        }
569
 
570
      strncpy (tmp, buf, 8);
571
      tmp[8] = 0;
572
 
573
      if (strcmp (tmp, "#define ") == 0)
574
        {
575
          char           *id = &buf[8];
576
 
577
          i = 0;
578
          while (id[i] && id[i] != ' ' &&
579
                 id[i] != '\t' && id[i] != '\n')
580
            i++;
581
 
582
          strncpy (tmp, id, i);
583
          tmp[i] = 0;
584
 
585
          if (strcmp (tmp, "SELECTED_SOUND_OPTIONS") == 0)
586
            continue;
587
 
588
          if (strcmp (tmp, "KERNEL_SOUNDCARD") == 0)
589
            continue;
590
 
591
          if (strcmp (tmp, "JAZZ_DMA16") == 0)   /* Rename it (hack) */
592
            {
593
              printf ("#define SB_DMA2 %s\n",
594
                      &buf[18]);
595
              continue;
596
            }
597
 
598
          if (strcmp (tmp, "SB16_DMA") == 0)     /* Rename it (hack) */
599
            {
600
              printf ("#define SB_DMA2 %s\n",
601
                      &buf[16]);
602
              continue;
603
            }
604
 
605
          tmp[8] = 0;            /* Truncate the string */
606
          if (strcmp (tmp, "EXCLUDE_") == 0)
607
            continue;           /* Skip excludes */
608
 
609
          strncpy (tmp, id, i);
610
          tmp[7] = 0;            /* Truncate the string */
611
 
612
          if (strcmp (tmp, "CONFIG_") == 0)
613
            {
614
              strncpy (tmp, &id[7], i - 7);
615
              tmp[i - 7] = 0;
616
 
617
              for (i = 0; i <= OPT_LAST; i++)
618
                if (strcmp (hw_table[i].macro, tmp) == 0)
619
                  {
620
                    selected_options |= (1 << i);
621
                    break;
622
                  }
623
              continue;
624
            }
625
 
626
          printf ("%s", buf);
627
          continue;
628
        }
629
 
630
      if (strcmp (tmp, "#undef  ") == 0)
631
        {
632
          char           *id = &buf[8];
633
 
634
          i = 0;
635
          while (id[i] && id[i] != ' ' &&
636
                 id[i] != '\t' && id[i] != '\n')
637
            i++;
638
 
639
          strncpy (tmp, id, i);
640
          tmp[7] = 0;            /* Truncate the string */
641
          if (strcmp (tmp, "CONFIG_") == 0)
642
            continue;
643
 
644
          strncpy (tmp, id, i);
645
 
646
          tmp[8] = 0;            /* Truncate the string */
647
          if (strcmp (tmp, "EXCLUDE_") != 0)
648
            continue;           /* Not a #undef  EXCLUDE_ line */
649
          strncpy (tmp, &id[8], i - 8);
650
          tmp[i - 8] = 0;
651
 
652
          for (i = 0; i <= OPT_LAST; i++)
653
            if (strcmp (hw_table[i].macro, tmp) == 0)
654
              {
655
                selected_options |= (1 << i);
656
                break;
657
              }
658
          continue;
659
        }
660
 
661
      printf ("%s", buf);
662
    }
663
  fclose (oldf);
664
 
665
  for (i = 0; i <= OPT_LAST; i++)
666
    if (!hw_table[i].alias)
667
      if (selected_options & B (i))
668
        printf ("#define CONFIG_%s\n", hw_table[i].macro);
669
      else
670
        printf ("#undef  CONFIG_%s\n", hw_table[i].macro);
671
 
672
 
673
  printf ("\n");
674
 
675
  i = 0;
676
 
677
  while (extra_options[i].name != NULL)
678
    {
679
      if (selected_options & extra_options[i].mask)
680
        printf ("#define CONFIG_%s\n", extra_options[i].name);
681
      else
682
        printf ("#undef  CONFIG_%s\n", extra_options[i].name);
683
      i++;
684
    }
685
 
686
  printf ("\n");
687
 
688
  printf ("#define SELECTED_SOUND_OPTIONS\t0x%08x\n", selected_options);
689
  fprintf (stderr, "Old configuration copied.\n");
690
 
691
#if defined(linux) || defined(Solaris)
692
  build_defines ();
693
#endif
694
  old_config_used = 1;
695
  return 1;
696
}
697
 
698
#if defined(linux) || defined(Solaris)
699
void
700
build_defines (void)
701
{
702
  FILE           *optf;
703
  int             i;
704
 
705
  if ((optf = fopen (".defines", "w")) == NULL)
706
    {
707
      perror (".defines");
708
      exit (-1);
709
    }
710
 
711
 
712
  for (i = 0; i <= OPT_LAST; i++)
713
    if (!hw_table[i].alias)
714
      if (selected_options & B (i))
715
        fprintf (optf, "CONFIG_%s=y\n", hw_table[i].macro);
716
 
717
 
718
  fprintf (optf, "\n");
719
 
720
  i = 0;
721
 
722
  while (extra_options[i].name != NULL)
723
    {
724
      if (selected_options & extra_options[i].mask)
725
        fprintf (optf, "CONFIG_%s=y\n", extra_options[i].name);
726
      i++;
727
    }
728
 
729
  fprintf (optf, "\n");
730
  fclose (optf);
731
}
732
#endif
733
 
734
void
735
ask_parameters (void)
736
{
737
  int             num;
738
 
739
  build_defines ();
740
  /*
741
   * IRQ and DMA settings
742
   */
743
 
744
#if 0   /* Disable this broken question. */
745
  ask_int_choice (B (OPT_AEDSP16), "AEDSP16_BASE",
746
                  "I/O base for Audio Excel DSP 16",
747
                  FMT_HEX,
748
                  0x220,
749
                  "220 or 240");
750
#endif
751
 
752
  ask_int_choice (B (OPT_SB), "SBC_BASE",
753
                  "I/O base for SB",
754
                  FMT_HEX,
755
                  0x220,
756
                  "Check from manual of the card");
757
 
758
  ask_int_choice (B (OPT_SB), "SBC_IRQ",
759
                  "Sound Blaster IRQ",
760
                  FMT_INT,
761
                  7,
762
                  "Check from manual of the card");
763
 
764
  ask_int_choice (B (OPT_SB), "SBC_DMA",
765
                  "Sound Blaster DMA",
766
                  FMT_INT,
767
                  1,
768
                  "0, 1 or 3");
769
 
770
  ask_int_choice (B (OPT_SB), "SB_DMA2",
771
                "Sound Blaster 16 bit DMA (_REQUIRED_for SB16, Jazz16, SMW)",
772
                  FMT_INT,
773
                  5,
774
                  "5, 6 or 7 (use 1 for 8 bit cards)");
775
 
776
  ask_int_choice (B (OPT_SB), "SB_MPU_BASE",
777
                  "MPU401 I/O base of SB16, Jazz16 and ES1688",
778
                  FMT_HEX,
779
                  0,
780
                  "Check from manual of the card");
781
 
782
  ask_int_choice (B (OPT_SB), "SB_MPU_IRQ",
783
                  "SB MPU401 IRQ (Jazz16, SM Wave and ES1688)",
784
                  FMT_INT,
785
                  -1,
786
                  "Use -1 with SB16");
787
 
788
  ask_int_choice (B (OPT_PAS), "PAS_IRQ",
789
                  "PAS16 IRQ",
790
                  FMT_INT,
791
                  10,
792
                  "3, 4, 5, 7, 9, 10, 11, 12, 14 or 15");
793
 
794
  ask_int_choice (B (OPT_PAS), "PAS_DMA",
795
                  "PAS16 DMA",
796
                  FMT_INT,
797
                  3,
798
                  "0, 1, 3, 5, 6 or 7");
799
 
800
  if (selected_options & B (OPT_PAS))
801
    {
802
      if (think_positively ("Enable Joystick port on ProAudioSpectrum", 0,
803
        "Enable this option if you want to use the joystick port provided\n"
804
                            "on the PAS sound card.\n"))
805
        printf ("#define PAS_JOYSTICK_ENABLE\n");
806
 
807
      if (think_positively ("Enable PAS16 bus clock option", 0,
808
       "The PAS16 can be noisy with some motherboards. There is a command\n"
809
        "line switch (:T?) in the DOS driver for PAS16 which solves this.\n"
810
      "Don't enable this feature unless you have problems and have to use\n"
811
                            "this switch with DOS\n"))
812
        printf ("#define BROKEN_BUS_CLOCK\n");
813
 
814
      if (think_positively ("Disable SB mode of PAS16", 0,
815
             "You should disable SB emulation of PAS16 if you want to use\n"
816
                         "Another SB compatible card in the same system\n"))
817
        printf ("#define DISABLE_SB_EMULATION\n");
818
    }
819
 
820
  ask_int_choice (B (OPT_GUS), "GUS_BASE",
821
                  "I/O base for GUS",
822
                  FMT_HEX,
823
                  0x220,
824
                  "210, 220, 230, 240, 250 or 260");
825
 
826
 
827
  ask_int_choice (B (OPT_GUS), "GUS_IRQ",
828
                  "GUS IRQ",
829
                  FMT_INT,
830
                  15,
831
                  "3, 5, 7, 9, 11, 12 or 15");
832
 
833
  ask_int_choice (B (OPT_GUS), "GUS_DMA",
834
                  "GUS DMA",
835
                  FMT_INT,
836
                  6,
837
                  "1, 3, 5, 6 or 7");
838
 
839
  ask_int_choice (B (OPT_GUS), "GUS_DMA2",
840
                  "Second DMA channel for GUS",
841
                  FMT_INT,
842
                  -1,
843
                  "1, 3, 5, 6 or 7");
844
 
845
  ask_int_choice (B (OPT_GUS16), "GUS16_BASE",
846
                  "I/O base for the 16 bit daughtercard of GUS",
847
                  FMT_HEX,
848
                  0x530,
849
                  "530, 604, E80 or F40");
850
 
851
 
852
  ask_int_choice (B (OPT_GUS16), "GUS16_IRQ",
853
                  "GUS 16 bit daughtercard IRQ",
854
                  FMT_INT,
855
                  7,
856
                  "3, 4, 5, 7, or 9");
857
 
858
  ask_int_choice (B (OPT_GUS16), "GUS16_DMA",
859
                  "GUS DMA",
860
                  FMT_INT,
861
                  3,
862
                  "0, 1 or 3");
863
 
864
  ask_int_choice (B (OPT_MPU401), "MPU_BASE",
865
                  "I/O base for MPU401",
866
                  FMT_HEX,
867
                  0x330,
868
                  "Check from manual of the card");
869
 
870
  ask_int_choice (B (OPT_MPU401), "MPU_IRQ",
871
                  "MPU401 IRQ",
872
                  FMT_INT,
873
                  9,
874
                  "Check from manual of the card");
875
 
876
  ask_int_choice (B (OPT_MAUI), "MAUI_BASE",
877
                  "I/O base for Maui",
878
                  FMT_HEX,
879
                  0x330,
880
                  "210, 230, 260, 290, 300, 320, 338 or 330");
881
 
882
  ask_int_choice (B (OPT_MAUI), "MAUI_IRQ",
883
                  "Maui IRQ",
884
                  FMT_INT,
885
                  9,
886
                  "5, 9, 12 or 15");
887
 
888
  ask_int_choice (B (OPT_UART6850), "U6850_BASE",
889
                  "I/O base for UART 6850 MIDI port",
890
                  FMT_HEX,
891
                  0,
892
                  "(Unknown)");
893
 
894
  ask_int_choice (B (OPT_UART6850), "U6850_IRQ",
895
                  "UART6850 IRQ",
896
                  FMT_INT,
897
                  -1,
898
                  "(Unknown)");
899
 
900
  ask_int_choice (B (OPT_PSS), "PSS_BASE",
901
                  "PSS I/O base",
902
                  FMT_HEX,
903
                  0x220,
904
                  "220 or 240");
905
 
906
  ask_int_choice (B (OPT_PSS), "PSS_MSS_BASE",
907
                  "PSS audio I/O base",
908
                  FMT_HEX,
909
                  0x530,
910
                  "530, 604, E80 or F40");
911
 
912
  ask_int_choice (B (OPT_PSS), "PSS_MSS_IRQ",
913
                  "PSS audio IRQ",
914
                  FMT_INT,
915
                  11,
916
                  "7, 9, 10 or 11");
917
 
918
  ask_int_choice (B (OPT_PSS), "PSS_MSS_DMA",
919
                  "PSS audio DMA",
920
                  FMT_INT,
921
                  3,
922
                  "0, 1 or 3");
923
 
924
  ask_int_choice (B (OPT_PSS), "PSS_MPU_BASE",
925
                  "PSS MIDI I/O base",
926
                  FMT_HEX,
927
                  0x330,
928
                  "");
929
 
930
  ask_int_choice (B (OPT_PSS), "PSS_MPU_IRQ",
931
                  "PSS MIDI IRQ",
932
                  FMT_INT,
933
                  9,
934
                  "3, 4, 5, 7 or 9");
935
 
936
  ask_int_choice (B (OPT_MSS), "MSS_BASE",
937
                  "MSS/WSS I/O base",
938
                  FMT_HEX,
939
                  0x530,
940
                  "530, 604, E80 or F40");
941
 
942
  ask_int_choice (B (OPT_MSS), "MSS_IRQ",
943
                  "MSS/WSS IRQ",
944
                  FMT_INT,
945
                  11,
946
                  "7, 9, 10 or 11");
947
 
948
  ask_int_choice (B (OPT_MSS), "MSS_DMA",
949
                  "MSS/WSS DMA",
950
                  FMT_INT,
951
                  3,
952
                  "0, 1 or 3");
953
 
954
  ask_int_choice (B (OPT_SSCAPE), "SSCAPE_BASE",
955
                  "SoundScape MIDI I/O base",
956
                  FMT_HEX,
957
                  0x330,
958
                  "320, 330, 340 or 350");
959
 
960
  ask_int_choice (B (OPT_SSCAPE), "SSCAPE_IRQ",
961
                  "SoundScape MIDI IRQ",
962
                  FMT_INT,
963
                  9,
964
                  "");
965
 
966
  ask_int_choice (B (OPT_SSCAPE), "SSCAPE_DMA",
967
                  "SoundScape initialization DMA",
968
                  FMT_INT,
969
                  3,
970
                  "0, 1 or 3");
971
 
972
  ask_int_choice (B (OPT_SSCAPE), "SSCAPE_MSS_BASE",
973
                  "SoundScape audio I/O base",
974
                  FMT_HEX,
975
                  0x534,
976
                  "534, 608, E84 or F44");
977
 
978
  ask_int_choice (B (OPT_SSCAPE), "SSCAPE_MSS_IRQ",
979
                  "SoundScape audio IRQ",
980
                  FMT_INT,
981
                  11,
982
                  "7, 9, 10 or 11");
983
 
984
 
985
  if (selected_options & B (OPT_SSCAPE))
986
    {
987
      int             reveal_spea;
988
 
989
      reveal_spea = think_positively (
990
                  "Is your SoundScape card made/marketed by Reveal or Spea",
991
                                       0,
992
                 "Enable if you have a SoundScape card with the Reveal or\n"
993
                                       "Spea name on it.\n");
994
      if (reveal_spea)
995
        printf ("#define REVEAL_SPEA\n");
996
 
997
    }
998
 
999
  ask_int_choice (B (OPT_TRIX), "TRIX_BASE",
1000
                  "AudioTrix audio I/O base",
1001
                  FMT_HEX,
1002
                  0x530,
1003
                  "530, 604, E80 or F40");
1004
 
1005
  ask_int_choice (B (OPT_TRIX), "TRIX_IRQ",
1006
                  "AudioTrix audio IRQ",
1007
                  FMT_INT,
1008
                  11,
1009
                  "7, 9, 10 or 11");
1010
 
1011
  ask_int_choice (B (OPT_TRIX), "TRIX_DMA",
1012
                  "AudioTrix audio DMA",
1013
                  FMT_INT,
1014
                  0,
1015
                  "0, 1 or 3");
1016
 
1017
  ask_int_choice (B (OPT_TRIX), "TRIX_DMA2",
1018
                  "AudioTrix second (duplex) DMA",
1019
                  FMT_INT,
1020
                  3,
1021
                  "0, 1 or 3");
1022
 
1023
  ask_int_choice (B (OPT_TRIX), "TRIX_MPU_BASE",
1024
                  "AudioTrix MIDI I/O base",
1025
                  FMT_HEX,
1026
                  0x330,
1027
                  "330, 370, 3B0 or 3F0");
1028
 
1029
  ask_int_choice (B (OPT_TRIX), "TRIX_MPU_IRQ",
1030
                  "AudioTrix MIDI IRQ",
1031
                  FMT_INT,
1032
                  9,
1033
                  "3, 4, 5, 7 or 9");
1034
 
1035
  ask_int_choice (B (OPT_TRIX), "TRIX_SB_BASE",
1036
                  "AudioTrix SB I/O base",
1037
                  FMT_HEX,
1038
                  0x220,
1039
                  "220, 210, 230, 240, 250, 260 or 270");
1040
 
1041
  ask_int_choice (B (OPT_TRIX), "TRIX_SB_IRQ",
1042
                  "AudioTrix SB IRQ",
1043
                  FMT_INT,
1044
                  7,
1045
                  "3, 4, 5 or 7");
1046
 
1047
  ask_int_choice (B (OPT_TRIX), "TRIX_SB_DMA",
1048
                  "AudioTrix SB DMA",
1049
                  FMT_INT,
1050
                  1,
1051
                  "1 or 3");
1052
 
1053
  ask_int_choice (B (OPT_CS4232), "CS4232_BASE",
1054
                  "CS4232 audio I/O base",
1055
                  FMT_HEX,
1056
                  0x530,
1057
                  "530, 604, E80 or F40");
1058
 
1059
  ask_int_choice (B (OPT_CS4232), "CS4232_IRQ",
1060
                  "CS4232 audio IRQ",
1061
                  FMT_INT,
1062
                  11,
1063
                  "5, 7, 9, 11, 12 or 15");
1064
 
1065
  ask_int_choice (B (OPT_CS4232), "CS4232_DMA",
1066
                  "CS4232 audio DMA",
1067
                  FMT_INT,
1068
                  0,
1069
                  "0, 1 or 3");
1070
 
1071
  ask_int_choice (B (OPT_CS4232), "CS4232_DMA2",
1072
                  "CS4232 second (duplex) DMA",
1073
                  FMT_INT,
1074
                  3,
1075
                  "0, 1 or 3");
1076
 
1077
  ask_int_choice (B (OPT_CS4232), "CS4232_MPU_BASE",
1078
                  "CS4232 MIDI I/O base",
1079
                  FMT_HEX,
1080
                  0x330,
1081
                  "330, 370, 3B0 or 3F0");
1082
 
1083
  ask_int_choice (B (OPT_CS4232), "CS4232_MPU_IRQ",
1084
                  "CS4232 MIDI IRQ",
1085
                  FMT_INT,
1086
                  9,
1087
                  "5, 7, 9, 11, 12 or 15");
1088
 
1089
  ask_int_choice (B (OPT_MAD16), "MAD16_BASE",
1090
                  "MAD16 audio I/O base",
1091
                  FMT_HEX,
1092
                  0x530,
1093
                  "530, 604, E80 or F40");
1094
 
1095
  ask_int_choice (B (OPT_MAD16), "MAD16_IRQ",
1096
                  "MAD16 audio IRQ",
1097
                  FMT_INT,
1098
                  11,
1099
                  "7, 9, 10 or 11");
1100
 
1101
  ask_int_choice (B (OPT_MAD16), "MAD16_DMA",
1102
                  "MAD16 audio DMA",
1103
                  FMT_INT,
1104
                  3,
1105
                  "0, 1 or 3");
1106
 
1107
  ask_int_choice (B (OPT_MAD16), "MAD16_DMA2",
1108
                  "MAD16 second (duplex) DMA",
1109
                  FMT_INT,
1110
                  0,
1111
                  "0, 1 or 3");
1112
 
1113
  ask_int_choice (B (OPT_MAD16), "MAD16_MPU_BASE",
1114
                  "MAD16 MIDI I/O base",
1115
                  FMT_HEX,
1116
                  0x330,
1117
                  "300, 310, 320 or 330 (0 disables)");
1118
 
1119
  ask_int_choice (B (OPT_MAD16), "MAD16_MPU_IRQ",
1120
                  "MAD16 MIDI IRQ",
1121
                  FMT_INT,
1122
                  9,
1123
                  "5, 7, 9 or 10");
1124
  ask_int_choice (B (OPT_AUDIO), "DSP_BUFFSIZE",
1125
                  "Audio DMA buffer size",
1126
                  FMT_INT,
1127
                  65536,
1128
                  "4096, 16384, 32768 or 65536");
1129
}
1130
 
1131
void
1132
dump_script (void)
1133
{
1134
  int             i;
1135
 
1136
  for (i = 0; i <= OPT_LAST; i++)
1137
    if (!(DUMMY_OPTS & B (i)))
1138
      if (!(DISABLED_OPTIONS & B (i)))
1139
        {
1140
          printf ("bool '%s' CONFIG_%s\n", questions[i], hw_table[i].macro);
1141
        }
1142
 
1143
/*
1144
 * Some "hardcoded" options
1145
 */
1146
 
1147
  dump_only = 1;
1148
  selected_options = 0;
1149
  ask_parameters ();
1150
 
1151
  printf ("#\n$MAKE -C drivers/sound kernelconfig || exit 1\n");
1152
}
1153
 
1154
void
1155
dump_fixed_local (void)
1156
{
1157
  int             i = 0;
1158
 
1159
  printf ("/* Computer generated file. Please don't edit! */\n\n");
1160
  printf ("#define KERNEL_COMPATIBLE_CONFIG\n\n");
1161
  printf ("#define SELECTED_SOUND_OPTIONS\t0x%08x\n\n", selected_options);
1162
 
1163
  while (extra_options[i].name != NULL)
1164
    {
1165
      int             n = 0, j;
1166
 
1167
      printf ("#if ");
1168
 
1169
      for (j = 0; j < OPT_LAST; j++)
1170
        if (!(DISABLED_OPTIONS & B (j)))
1171
          if (extra_options[i].mask & B (j))
1172
            {
1173
              if (n)
1174
                printf (" || ");
1175
              if (!(n++ % 2))
1176
                printf ("\\\n  ");
1177
 
1178
              printf ("defined(CONFIG_%s)", hw_table[j].macro);
1179
            }
1180
 
1181
      printf ("\n");
1182
      printf ("#\tdefine CONFIG_%s\n", extra_options[i].name);
1183
      printf ("#endif\n\n");
1184
      i++;
1185
    }
1186
}
1187
 
1188
void
1189
dump_fixed_defines (void)
1190
{
1191
  int             i = 0;
1192
 
1193
  printf ("# Computer generated file. Please don't edit\n\n");
1194
 
1195
  while (extra_options[i].name != NULL)
1196
    {
1197
      int             j;
1198
 
1199
      for (j = 0; j < OPT_LAST; j++)
1200
        if (!(DISABLED_OPTIONS & B (j)))
1201
          if (extra_options[i].mask & B (j))
1202
            {
1203
              printf ("ifdef CONFIG_%s\n", hw_table[j].macro);
1204
              printf ("CONFIG_%s=y\n", extra_options[i].name);
1205
              printf ("endif\n\n");
1206
            }
1207
 
1208
      i++;
1209
    }
1210
}
1211
 
1212
int
1213
main (int argc, char *argv[])
1214
{
1215
  int             i, full_driver = 1;
1216
  char            old_config_file[200];
1217
 
1218
  if (getuid () != 0)            /* Not root */
1219
    {
1220
      char           *home;
1221
 
1222
      if ((home = getenv ("HOME")) != NULL)
1223
        {
1224
          sprintf (old_config_file, "%s/.soundconf", home);
1225
          oldconf = old_config_file;
1226
        }
1227
    }
1228
 
1229
  if (argc > 1)
1230
    {
1231
      if (strcmp (argv[1], "-o") == 0 &&
1232
          use_old_config (oldconf))
1233
        exit (0);
1234
      else if (strcmp (argv[1], "script") == 0)
1235
        {
1236
          dump_script ();
1237
          exit (0);
1238
        }
1239
      else if (strcmp (argv[1], "fixedlocal") == 0)
1240
        {
1241
          dump_fixed_local ();
1242
          exit (0);
1243
        }
1244
      else if (strcmp (argv[1], "fixeddefines") == 0)
1245
        {
1246
          dump_fixed_defines ();
1247
          exit (0);
1248
        }
1249
    }
1250
 
1251
  fprintf (stderr, "\nConfiguring Sound Support\n\n");
1252
 
1253
  if (access (oldconf, R_OK) == 0)
1254
    {
1255
      char            str[255];
1256
 
1257
      sprintf (str, "Old configuration exists in `%s'. Use it", oldconf);
1258
      if (think_positively (str, 1,
1259
      "Enable this option to load the previously saved configuration file\n"
1260
                            "for all of the sound driver parameters.\n"))
1261
        if (use_old_config (oldconf))
1262
          exit (0);
1263
    }
1264
 
1265
  printf ("/*\tGenerated by configure. Don't edit!!!!\t*/\n");
1266
  printf ("/*\tMaking changes to this file is not as simple as it may look.\t*/\n\n");
1267
  printf ("/*\tIf you change the CONFIG_ settings in local.h you\t*/\n");
1268
  printf ("/*\t_have_ to edit .defines too.\t*/\n\n");
1269
 
1270
  {
1271
    /*
1272
     * Partial driver
1273
     */
1274
 
1275
    full_driver = 0;
1276
 
1277
    for (i = 0; i <= OPT_LAST; i++)
1278
      if (can_select_option (i))
1279
        {
1280
          if (!(selected_options & B (i)))      /*
1281
                                                 * Not selected yet
1282
                                                 */
1283
            if (!hw_table[i].verify)
1284
              {
1285
                if (hw_table[i].alias)
1286
                  selected_options |= B (hw_table[i].alias);
1287
                else
1288
                  selected_options |= B (i);
1289
              }
1290
            else
1291
              {
1292
                int             def_answ = hw_table[i].default_answ;
1293
 
1294
                if (think_positively (questions[i], def_answ, help[i]))
1295
                  if (hw_table[i].alias)
1296
                    selected_options |= B (hw_table[i].alias);
1297
                  else
1298
                    selected_options |= B (i);
1299
              }
1300
        }
1301
  }
1302
 
1303
  if (selected_options & B (OPT_SB))
1304
    {
1305
      if (think_positively (
1306
                             "Support for the SG NX Pro mixer", 0,
1307
       "Enable this if you want to support the additional mixer functions\n"
1308
                          "provided on Sound Galaxy NX Pro sound cards.\n"))
1309
        printf ("#define __SGNXPRO__\n");
1310
    }
1311
 
1312
  if (selected_options & B (OPT_SB))
1313
    {
1314
      if (think_positively ("Support for the MV Jazz16 (ProSonic etc.)", 0,
1315
          "Enable this if you have an MV Jazz16 or ProSonic sound card.\n"))
1316
        {
1317
          if (think_positively ("Do you have SoundMan Wave", 0,
1318
                                "Enable this option of you have the Logitech SoundMan Wave sound card.\n"))
1319
            {
1320
              printf ("#define SM_WAVE\n");
1321
 
1322
            midi0001_again:
1323
              if (think_positively (
1324
                           "Do you have access to the MIDI0001.BIN file", 1,
1325
                                     "The Logitech SoundMan Wave has a microcontroller which must be\n"
1326
                                     "initialized before MIDI emulation works. This is possible only if the\n"
1327
                           "microcode file is compiled into the driver.\n"))
1328
                {
1329
                  char            path[512];
1330
 
1331
                  fprintf (stderr,
1332
                           "Enter full name of the MIDI0001.BIN file (pwd is sound): ");
1333
                  scanf ("%s", path);
1334
                  fprintf (stderr, "including microcode file %s\n", path);
1335
 
1336
                  if (!bin2hex (path, "smw-midi0001.h", "smw_ucode"))
1337
                    {
1338
                      fprintf (stderr, "Couldn't open file %s\n",
1339
                               path);
1340
                      if (think_positively ("Try again with correct path", 1,
1341
                                            "The specified file could not be opened. Enter the correct path to the\n"
1342
                                            "file.\n"))
1343
                        goto midi0001_again;
1344
                    }
1345
                  else
1346
                    {
1347
                      printf ("#define SMW_MIDI0001_INCLUDED\n");
1348
                      printf ("/*build bin2hex %s smw-midi0001.h smw_ucode */\n", path);
1349
                    }
1350
                }
1351
            }
1352
        }
1353
    }
1354
 
1355
  if (selected_options & B (OPT_SB))
1356
    {
1357
      if (think_positively ("Do you have a Logitech SoundMan Games", 0,
1358
         "The Logitech SoundMan Games supports 44 kHz in stereo while the\n"
1359
      "standard SB Pro supports just 22 kHz stereo. You have the option of\n"
1360
                            "enabling SM Games mode.  However, enable it only if you are sure that\n"
1361
      "your card is an SM Games. Enabling this feature with a plain old SB\n"
1362
                            "Pro will cause troubles with stereo mode.\n\n"
1363
                  "DANGER! Read the above once again before answering 'y'\n"
1364
                            "Answer 'n' if you are unsure what to do!\n"))
1365
        printf ("#define SM_GAMES\n");
1366
    }
1367
 
1368
  if (selected_options & B (OPT_AEDSP16))
1369
    {
1370
      int             sel1 = 0;
1371
 
1372
      if (selected_options & B (OPT_SB))
1373
        {
1374
 
1375
          if (think_positively (
1376
            "Do you want support for the Audio Excel Sound Blaster Pro mode",
1377
                                 1,
1378
                                 "Enable this option if you want the Audio Excel sound card to operate\n"
1379
                                 "in Sound Blaster Pro mode.\n"))
1380
            {
1381
              printf ("#define AEDSP16_SBPRO\n");
1382
              sel1 = 1;
1383
            }
1384
        }
1385
 
1386
      if ((selected_options & B (OPT_MSS)) && (sel1 == 0))
1387
        {
1388
 
1389
          if (think_positively (
1390
                                 "Do you want support for the Audio Excel Microsoft Sound System mode",
1391
                                 1,
1392
                                 "Enable this option if you want the Audio Excel sound card to operate\n"
1393
                                 "in Microsoft Sound System mode.\n"))
1394
            {
1395
              printf ("#define AEDSP16_MSS\n");
1396
              sel1 = 1;
1397
            }
1398
        }
1399
 
1400
      if (sel1 == 0)
1401
        {
1402
          printf ("invalid_configuration__run_make_config_again\n");
1403
          fprintf (stderr, "ERROR!!!!!\nYou must select at least one mode when using Audio Excel!\n");
1404
          exit (-1);
1405
        }
1406
      if (selected_options & B (OPT_MPU401))
1407
        printf ("#define AEDSP16_MPU401\n");
1408
    }
1409
 
1410
  if (selected_options & B (OPT_PSS))
1411
    {
1412
    genld_again:
1413
      if (think_positively ("Do you wish to include an LD file", 1,
1414
                            "If you want to emulate the Sound Blaster card and you have a DSPxxx.LD\n"
1415
                      "file then you must include the LD in the kernel.\n"))
1416
        {
1417
          char            path[512];
1418
 
1419
          fprintf (stderr,
1420
                   "Enter the path to your LD file (pwd is sound): ");
1421
          scanf ("%s", path);
1422
          fprintf (stderr, "including LD file %s\n", path);
1423
 
1424
          if (!bin2hex (path, "synth-ld.h", "pss_synth"))
1425
            {
1426
              fprintf (stderr, "couldn't open `%s' as the LD file\n", path);
1427
              if (think_positively ("try again with correct path", 1,
1428
                                    "The given LD file could not opened.\n"))
1429
                goto genld_again;
1430
            }
1431
          else
1432
            {
1433
              printf ("#define PSS_HAVE_LD\n");
1434
              printf ("/*build bin2hex %s synth-ld.h pss_synth */\n", path);
1435
            }
1436
        }
1437
      else
1438
        {
1439
          FILE           *sf = fopen ("synth-ld.h", "w");
1440
 
1441
          fprintf (sf, "/* automatically generated by configure */\n");
1442
          fprintf (sf, "unsigned char pss_synth[1];\n"
1443
                   "#define pss_synthLen 0\n");
1444
          fclose (sf);
1445
        }
1446
    }
1447
 
1448
  if (selected_options & B (OPT_TRIX))
1449
    {
1450
    hex2hex_again:
1451
 
1452
      if (think_positively ("Do you want to include TRXPRO.HEX in your kernel",
1453
                            1,
1454
        "The MediaTrix AudioTrix Pro has an on-board microcontroller which\n"
1455
                            "needs to be initialized by downloading the code from the file TRXPRO.HEX\n"
1456
                            "in the DOS driver directory. If you don't have the TRXPRO.HEX file handy\n"
1457
                            "you may skip this step. However, the SB and MPU-401 modes of AudioTrix\n"
1458
                            "Pro will not work without this file!\n"))
1459
        {
1460
          char            path[512];
1461
 
1462
          fprintf (stderr,
1463
                 "Enter the path to your TRXPRO.HEX file (pwd is sound): ");
1464
          scanf ("%s", path);
1465
          fprintf (stderr, "including HEX file `%s'\n", path);
1466
 
1467
          if (!hex2hex (path, "trix_boot.h", "trix_boot"))
1468
            goto hex2hex_again;
1469
          printf ("/*build hex2hex %s trix_boot.h trix_boot */\n", path);
1470
          printf ("#define INCLUDE_TRIX_BOOT\n");
1471
        }
1472
    }
1473
 
1474
  if (selected_options & B (OPT_MSS))
1475
    {
1476
      if (think_positively ("Support for builtin sound of Compaq Deskpro XL", 0,
1477
                            "Enable this if you have Compaq Deskpro XL.\n"))
1478
        {
1479
          printf ("#define DESKPROXL\n");
1480
        }
1481
    }
1482
 
1483
  if (selected_options & B (OPT_MAUI))
1484
    {
1485
    oswf_again:
1486
      if (think_positively (
1487
                             "Do you have access to the OSWF.MOT file", 1,
1488
                             "TB Maui and Tropez have a microcontroller which needs to be initialized\n"
1489
                             "prior use. OSWF.MOT is a file distributed with card's DOS/Windows drivers\n"
1490
                             "which is required during initialization\n"))
1491
        {
1492
          char            path[512];
1493
 
1494
          fprintf (stderr,
1495
                   "Enter full name of the OSWF.MOT file (pwd is sound): ");
1496
          scanf ("%s", path);
1497
          fprintf (stderr, "including microcode file %s\n", path);
1498
 
1499
          if (!bin2hex (path, "maui_boot.h", "maui_os"))
1500
            {
1501
              fprintf (stderr, "Couldn't open file %s\n",
1502
                       path);
1503
              if (think_positively ("Try again with correct path", 1,
1504
                                    "The specified file could not be opened. Enter the correct path to the\n"
1505
                                    "file.\n"))
1506
                goto oswf_again;
1507
            }
1508
          else
1509
            {
1510
              printf ("#define HAVE_MAUI_BOOT\n");
1511
              printf ("/*build bin2hex %s maui_boot.h maui_os */\n", path);
1512
            }
1513
        }
1514
    }
1515
 
1516
  if (!(selected_options & ANY_DEVS))
1517
    {
1518
      printf ("invalid_configuration__run_make_config_again\n");
1519
      fprintf (stderr, "\n*** This combination is useless. Sound driver disabled!!! ***\n*** You need to enable support for at least one device    ***\n\n");
1520
      exit (0);
1521
    }
1522
 
1523
  for (i = 0; i <= OPT_LAST; i++)
1524
    if (!hw_table[i].alias)
1525
      if (selected_options & B (i))
1526
        printf ("#define CONFIG_%s\n", hw_table[i].macro);
1527
      else
1528
        printf ("#undef  CONFIG_%s\n", hw_table[i].macro);
1529
 
1530
  printf ("\n");
1531
 
1532
  i = 0;
1533
 
1534
  while (extra_options[i].name != NULL)
1535
    {
1536
      if (selected_options & extra_options[i].mask)
1537
        printf ("#define CONFIG_%s\n", extra_options[i].name);
1538
      else
1539
        printf ("#undef  CONFIG_%s\n", extra_options[i].name);
1540
      i++;
1541
    }
1542
 
1543
  printf ("\n");
1544
 
1545
  ask_parameters ();
1546
 
1547
  printf ("#define SELECTED_SOUND_OPTIONS\t0x%08lx\n", selected_options);
1548
  fprintf (stderr, "\nThe sound driver is now configured.\n");
1549
 
1550
#if defined(SCO) || defined(ISC) || defined(SYSV)
1551
  fprintf (stderr, "Remember to update the System file\n");
1552
#endif
1553
 
1554
  if (!old_config_used)
1555
    {
1556
      char            str[255];
1557
 
1558
      sprintf (str, "Save copy of this configuration to `%s'", oldconf);
1559
      if (think_positively (str, 1,
1560
        "If you enable this option then the sound driver configuration is\n"
1561
      "saved to a file. If you later need to recompile the kernel you have\n"
1562
                          "the option of using the saved configuration.\n"))
1563
        {
1564
          char            cmd[200];
1565
 
1566
          sprintf (cmd, "cp local.h %s", oldconf);
1567
 
1568
          fclose (stdout);
1569
          if (system (cmd) != 0)
1570
            perror (cmd);
1571
        }
1572
    }
1573
  exit (0);
1574
}
1575
 
1576
int
1577
bin2hex (char *path, char *target, char *varname)
1578
{
1579
  int             fd;
1580
  int             count;
1581
  char            c;
1582
  int             i = 0;
1583
 
1584
  if ((fd = open (path, 0)) > 0)
1585
    {
1586
      FILE           *sf = fopen (target, "w");
1587
 
1588
      fprintf (sf, "/* automatically generated by configure */\n");
1589
      fprintf (sf, "static unsigned char %s[] = {\n", varname);
1590
      while (1)
1591
        {
1592
          count = read (fd, &c, 1);
1593
          if (count == 0)
1594
            break;
1595
          if (i != 0 && (i % 10) == 0)
1596
            fprintf (sf, "\n");
1597
          fprintf (sf, "0x%02lx,", c & 0xFFL);
1598
          i++;
1599
        }
1600
      fprintf (sf, "};\n"
1601
               "#define %sLen %d\n", varname, i);
1602
      fclose (sf);
1603
      close (fd);
1604
      return 1;
1605
    }
1606
 
1607
  return 0;
1608
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.