⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 configure.c

📁 arm平台上的uclinux系统全部源代码
💻 C
📖 第 1 页 / 共 3 页
字号:
/* *     PnP soundcard support is not included in this version. * *       AEDSP16 will not work without significant changes. */#define DISABLED_OPTIONS 	(B(OPT_SPNP)|B(OPT_AEDSP16)|B(OPT_UNUSED1)|B(OPT_UNUSED2))/* * sound/configure.c  - Configuration program for the Linux Sound Driver *//* * Copyright (C) by Hannu Savolainen 1993-1996 * * USS/Lite for Linux is distributed under the GNU GENERAL PUBLIC LICENSE (GPL) * Version 2 (June 1991). See the "COPYING" file distributed with this software * for more info. */#include <stdio.h>#include <unistd.h>#include <stdlib.h>#include <fcntl.h>#include <string.h>#define B(x)	(1 << (x))/* * Option numbers */#define OPT_PAS		0#define OPT_SB		1#define OPT_ADLIB	2#define OPT_LAST_MUTUAL	2#define OPT_GUS		3#define OPT_MPU401	4#define OPT_UART6850	5#define OPT_PSS		6#define OPT_GUS16	7#define OPT_GUSMAX	8#define OPT_MSS		9#define OPT_SSCAPE	10#define OPT_TRIX	11#define OPT_MAD16	12#define OPT_CS4232	13#define OPT_MAUI	14#define OPT_SPNP	15#define OPT_VIDC	16#define OPT_HIGHLEVEL   17	/* This must be same than the next one */#define OPT_UNUSED1	17#define OPT_UNUSED2	18#define OPT_AEDSP16     19#define OPT_AUDIO	20#define OPT_MIDI_AUTO	21#define OPT_MIDI	22#define OPT_YM3812_AUTO	23#define OPT_YM3812	24#define OPT_LAST	24	/* Last defined OPT number */#define DUMMY_OPTS (B(OPT_MIDI_AUTO)|B(OPT_YM3812_AUTO))#define ANY_DEVS (B(OPT_AUDIO)|B(OPT_MIDI)|B(OPT_GUS)| \		  B(OPT_MPU401)|B(OPT_PSS)|B(OPT_GUS16)|B(OPT_GUSMAX)| \		  B(OPT_MSS)|B(OPT_SSCAPE)|B(OPT_UART6850)|B(OPT_TRIX)| \		  B(OPT_MAD16)|B(OPT_CS4232)|B(OPT_MAUI)|B(OPT_ADLIB)| \		  B(OPT_VIDC))#define AUDIO_CARDS (B (OPT_PSS) | B (OPT_SB) | B (OPT_PAS) | B (OPT_GUS) | \		B (OPT_MSS) | B (OPT_GUS16) | B (OPT_GUSMAX) | B (OPT_TRIX) | \		B (OPT_SSCAPE)| B(OPT_MAD16) | B(OPT_CS4232) | B (OPT_VIDC))#define MPU_DEVS (B(OPT_PSS)|\		  B(OPT_CS4232)|B(OPT_SPNP)|B(OPT_MAUI)|B(OPT_SSCAPE))#define UART401_DEVS (SBDSP_DEVS|B(OPT_TRIX)|B(OPT_MAD16))#define MIDI_CARDS (MPU_DEVS | UART401_DEVS | \		    B (OPT_PSS) | B (OPT_SB) | B (OPT_PAS) | B (OPT_MPU401) | \		    B (OPT_GUS) | B (OPT_TRIX) | B (OPT_SSCAPE)|B(OPT_MAD16) | \		    B (OPT_CS4232)|B(OPT_MAUI))#define AD1848_DEVS (B(OPT_GUS16)|B(OPT_MSS)|B(OPT_PSS)|B(OPT_GUSMAX)|\		     B(OPT_SSCAPE)|B(OPT_TRIX)|B(OPT_MAD16)|B(OPT_CS4232)|\		     B(OPT_SPNP))#define SBDSP_DEVS (B(OPT_SB)|B(OPT_SPNP)|B(OPT_MAD16)|B(OPT_TRIX))#define SEQUENCER_DEVS (B(OPT_MIDI)|B(OPT_YM3812)|B(OPT_ADLIB)|B(OPT_GUS)|B(OPT_MAUI)|MIDI_CARDS|B(OPT_VIDC))/* * Options that have been disabled for some reason (incompletely implemented * and/or tested). Don't remove from this list before looking at file * experimental.txt for further info. */typedef struct  {    unsigned long   conditions;    unsigned long   exclusive_options;    char            macro[20];    int             verify;    int             alias;    int             default_answ;  }hw_entry;/* * The rule table for the driver options. The first field defines a set of * options which must be selected before this entry can be selected. The * second field is a set of options which are not allowed with this one. If * the fourth field is zero, the option is selected without asking * confirmation from the user. * * With this version of the rule table it is possible to select just one type of * hardware. * * NOTE!        Keep the following table and the questions array in sync with the * option numbering! */hw_entry        hw_table[] ={/* * 0 */  {0, 0, "PAS", 1, 0, 0},  {0, 0, "SB", 1, 0, 0},  {0, B (OPT_PAS) | B (OPT_SB), "ADLIB", 1, 0, 0},  {0, 0, "GUS", 1, 0, 0},  {0, 0, "MPU401", 1, 0, 0},  {0, 0, "UART6850", 1, 0, 0},  {0, 0, "PSS", 1, 0, 0},  {B (OPT_GUS), 0, "GUS16", 1, 0, 0},  {B (OPT_GUS), B (OPT_GUS16), "GUSMAX", 1, 0, 0},  {0, 0, "MSS", 1, 0, 0},  {0, 0, "SSCAPE", 1, 0, 0},  {0, 0, "TRIX", 1, 0, 0},  {0, 0, "MAD16", 1, 0, 0},  {0, 0, "CS4232", 1, 0, 0},  {0, 0, "MAUI", 1, 0, 0},  {0, 0, "SPNP", 1, 0, 0},  {0, 0, "VIDC", 1, 0, 0},  {B (OPT_SB), B (OPT_PAS), "UNUSED1", 1, 0, 1},  {B (OPT_SB) | B (OPT_UNUSED1), B (OPT_PAS), "UNUSED2", 1, 0, 1},  {B (OPT_UNUSED1) | B (OPT_MSS) | B (OPT_MPU401), 0, "AEDSP16", 1, 0, 0},  {AUDIO_CARDS, 0, "AUDIO", 1, 0, 1},  {B (OPT_MPU401) | B (OPT_MAUI), 0, "MIDI_AUTO", 0, OPT_MIDI, 0},  {MIDI_CARDS, 0, "MIDI", 1, 0, 1},  {B (OPT_ADLIB), 0, "YM3812_AUTO", 0, OPT_YM3812, 0},  {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}};char           *questions[] ={  "ProAudioSpectrum 16 support",  "Sound Blaster (SB, SBPro, SB16, clones) support",  "Generic OPL2/OPL3 FM synthesizer support",  "Gravis Ultrasound support",  "MPU-401 support (NOT for SB16)",  "6850 UART Midi support",  "PSS (ECHO-ADI2111) support",  "16 bit sampling option of GUS (_NOT_ GUS MAX)",  "GUS MAX support",  "Microsoft Sound System support",  "Ensoniq SoundScape support",  "MediaTrix AudioTrix Pro support",  "Support for MAD16 and/or Mozart based cards",  "Support for Crystal CS4232 based (PnP) cards",  "Support for Turtle Beach Wave Front (Maui, Tropez) synthesizers",  "Support for PnP sound cards (_EXPERIMENTAL_)",  "Support VIDC20 sound system",  "*** Unused option 1 ***",  "*** Unused option 2 ***",  "Audio Excel DSP 16 initialization support",  "/dev/dsp and /dev/audio support",  "This should not be asked",  "MIDI interface support",  "This should not be asked",  "FM synthesizer (YM3812/OPL-3) support",  "Is the sky really falling"};/* help text for each option */char           *help[] ={  "Enable this option only if you have a Pro Audio Spectrum 16,\n"  "Pro Audio Studio 16, or Logitech SoundMan 16. Don't enable this if\n"  "you have some other card made by MediaVision or Logitech as\n"  "they are not PAS16 compatible.\n",  "Enable this if you have an original Sound Blaster card made by\n"  "Creative Labs or a 100%% hardware compatible clone. For an\n"  "unknown card you may want to try this if it claims to be\n"  "Sound Blaster compatible.\n",  "Enable this option if your sound card has a Yamaha OPL2 or OPL3\n"  "FM synthesizer chip.\n",  "Enable this option for any type of Gravis Ultrasound card\n"  "including the GUS or GUS MAX.\n",  "The MPU401 interface is supported by almost all sound cards. However,\n"  "some natively supported cards have their own driver for\n"  "MPU401. Enabling the MPU401 option with these cards will cause a\n"  "conflict. Also enabling MPU401 on a system that doesn't really have a\n"  "MPU401 could cause some trouble. It's safe to enable this if you have a\n"  "true MPU401 MIDI interface card.\n",  "This option enables support for MIDI interfaces based on the 6850\n"  "UART chip. This interface is rarely found on sound cards.\n",  "Enable this option if you have an Orchid SW32, Cardinal DSP16 or other\n"  "sound card based on the PSS chipset (AD1848 codec, ADSP-2115 DSP chip,\n"  "and Echo ESC614 ASIC CHIP).\n",  "Enable this if you have installed the 16-bit sampling daughtercard on\n"  "your GUS card. Do not use if you have a GUS MAX as enabling this option\n"  "disables GUS MAX support.\n",  "Enable this option if you have a Gravis Ultrasound MAX sound\n"  "card\n",  "Enable this option if you have the original Windows Sound System\n"  "card made by Microsoft or the Aztech SG 16 Pro or NX16 Pro.\n",  "Enable this if you have a sound card based on the Ensoniq\n"  "SoundScape chipset. Such cards are being manufactured by Ensoniq,\n"  "Spea and Reveal (Reveal makes other cards as well).\n",  "Enable this option if you have the AudioTrix Pro sound card\n"  "manufactured by MediaTrix.\n",  "Enable this if your card has a Mozart (OAK OTI-601) or MAD16 (OPTi\n"  "82C928 or 82C929) audio interface chip. These chips are currently\n"  "quite common so it's possible that many no-name cards have one of\n"  "them. In addition the MAD16 chip is used in some cards made by known\n"  "manufacturers such as Turtle Beach (Tropez), Reveal (some models) and\n"  "Diamond (latest ones).\n",  "Enable this if you have a card based on the Crystal CS4232 chip set.\n",  "Enable this option if you have a Turtle Beach Wave Front, Maui,\n"  "or Tropez sound card.\n",  "Use this option to enable experimental support for cards that\n"  "use the Plug and Play protocol.\n",  "Enable this if you have a RiscPC\n",  "Enable this option if your card is a Sound Blaster Pro or\n"  "Sound Blaster 16. It also works with many Sound Blaster Pro clones.\n",  "Enable this if you have a Sound Blaster 16, including the AWE32.\n",  "Enable this if you have an Audio Excel DSP16 card. See the file\n"  "Readme.aedsp16 for more information.\n",  "This option enables the A/D and D/A converter (PCM) devices\n"  "supported by almost all sound cards.\n",  "This should not be asked",  "This enables the dev/midixx devices and access to any MIDI ports\n"  "using /dev/sequencer and /dev/music. This option also affects any\n"  "MPU401 and/or General MIDI compatible devices.\n",  "This should not be asked",  "This enables the Yamaha FM synthesizer chip used on many sound\n"  "cards.\n",  "Is the sky really falling"};struct kludge  {    char           *name;    int             mask;  }extra_options[] ={  {    "MPU_EMU", MPU_DEVS  }  ,  {    "AD1848", AD1848_DEVS  }  ,  {    "SBDSP", SBDSP_DEVS  }  ,  {    "UART401", UART401_DEVS  }  ,  {    "SEQUENCER", SEQUENCER_DEVS  }  ,  {    NULL, 0  }};char           *oldconf = "/etc/soundconf";int             old_config_used = 0;int             def_size, sb_base = 0;unsigned long   selected_options = 0;int             sb_dma = 0;int             dump_only = 0;void            build_defines (void);#include "hex2hex.h"int             bin2hex (char *path, char *target, char *varname);intcan_select_option (int nr){  if (hw_table[nr].conditions)    if (!(hw_table[nr].conditions & selected_options))      return 0;  if (hw_table[nr].exclusive_options)    if (hw_table[nr].exclusive_options & selected_options)      return 0;  if (DISABLED_OPTIONS & B (nr))    return 0;  return 1;}intthink_positively (char *prompt, int def_answ, char *help){  char            answ[512];  int             len;response:  fprintf (stderr, prompt);  if (def_answ)    fprintf (stderr, " [Y/n/?] ");  else    fprintf (stderr, " [N/y/?] ");  if ((len = read (0, answ, sizeof (answ))) < 1)    {      fprintf (stderr, "\n\nERROR! Cannot read stdin\n");      perror ("stdin");      printf ("invalid_configuration__run_make_config_again\n");      exit (-1);    }  if (len < 2)			/*				 * There is an additional LF at the end				 */    return def_answ;  if (answ[0] == '?')    {				/* display help message */      fprintf (stderr, "\n");      fprintf (stderr, help);      fprintf (stderr, "\n");      goto response;    }  answ[len - 1] = 0;  if (!strcmp (answ, "y") || !strcmp (answ, "Y"))    return 1;  return 0;}intask_value (char *format, int default_answer){  char            answ[512];  int             len, num;play_it_again_Sam:  if ((len = read (0, answ, sizeof (answ))) < 1)    {      fprintf (stderr, "\n\nERROR! Cannot read stdin\n");      perror ("stdin");      printf ("invalid_configuration__run_make_config_again\n");      exit (-1);    }  if (len < 2)			/*				 * There is an additional LF at the end				 */    return default_answer;  answ[len - 1] = 0;  if (sscanf (answ, format, &num) != 1)    {      fprintf (stderr, "Illegal format. Try again: ");      goto play_it_again_Sam;    }  return num;}#define FMT_HEX 1#define FMT_INT 2voidask_int_choice (int mask, char *macro,		char *question,		int format,		int defa,		char *choices){  int             num, i;  if (dump_only)    {      for (i = 0; i < OPT_LAST; i++)	if (mask == B (i))	  {	    unsigned int    j;	    for (j = 0; j < strlen (choices); j++)	      if (choices[j] == '\'')		choices[j] = '_';	    printf ("\nif [ \"$CONFIG_%s\" = \"y\" ]; then\n",		    hw_table[i].macro);	    if (format == FMT_INT)	      printf ("int '%s %s' %s %d\n", question, choices, macro, defa);	    else	      printf ("hex '%s %s' %s %x\n", question, choices, macro, defa);	    printf ("fi\n");	  }    }  else    {      if (!(mask & selected_options))	return;      fprintf (stderr, "\n%s\n", question);      if (strcmp (choices, ""))	fprintf (stderr, "Possible values are: %s\n", choices);      if (format == FMT_INT)	{	  if (defa == -1)	    fprintf (stderr, "\t(-1 disables this feature)\n");	  fprintf (stderr, "The default value is %d\n", defa);	  fprintf (stderr, "Enter the value: ");	  num = ask_value ("%d", defa);	  if (num == -1)	    return;	  fprintf (stderr, "%s set to %d.\n", question, num);	  printf ("#define %s %d\n", macro, num);	}      else	{	  if (defa == 0)	    fprintf (stderr, "\t(0 disables this feature)\n");	  fprintf (stderr, "The default value is %x\n", defa);	  fprintf (stderr, "Enter the value: ");	  num = ask_value ("%x", defa);	  if (num == 0)	    return;	  fprintf (stderr, "%s set to %x.\n", question, num);	  printf ("#define %s 0x%x\n", macro, num);	}    }}voidrebuild_file (char *line){  char           *method, *next, *old, *var, *p;  method = p = line;  while (*p && *p != ' ')    p++;  *p++ = 0;  old = p;  while (*p && *p != ' ')    p++;  *p++ = 0;  next = p;  while (*p && *p != ' ')    p++;  *p++ = 0;  var = p;  while (*p && *p != ' ')    p++;  *p++ = 0;  fprintf (stderr, "Rebuilding file `%s' (%s %s)\n", next, method, old);  if (strcmp (method, "bin2hex") == 0)    {      if (!bin2hex (old, next, var))	{	  fprintf (stderr, "Rebuild failed\n");	  exit (-1);	}    }  else if (strcmp (method, "hex2hex") == 0)    {      if (!hex2hex (old, next, var))	{	  fprintf (stderr, "Rebuild failed\n");	  exit (-1);	}    }  else    {      fprintf (stderr, "Failed to build `%s' - unknown method %s\n",	       next, method);      exit (-1);    }}intuse_old_config (char *filename)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -