示例#1
0
void
attach_gus_card (struct address_info *hw_config)
{
  int             io_addr;

  gus_osp = hw_config->osp;
  snd_set_irq_handler (hw_config->irq, gusintr, "Gravis Ultrasound", hw_config->osp);

  if (gus_wave_detect (hw_config->io_base))	/*
						 * Try first the default
						 */
    {
      gus_wave_init (hw_config);

      request_region (hw_config->io_base, 16, "GUS");
      request_region (hw_config->io_base + 0x100, 12, "GUS");	/* 0x10c-> is MAX */

      if (sound_alloc_dma (hw_config->dma, "GUS"))
	printk ("gus_card.c: Can't allocate DMA channel\n");
      if (hw_config->dma2 != -1 && hw_config->dma2 != hw_config->dma)
	if (sound_alloc_dma (hw_config->dma2, "GUS(2)"))
	  printk ("gus_card.c: Can't allocate DMA channel2\n");
#ifdef CONFIG_MIDI
      gus_midi_init ();
#endif
      return;
    }

#ifndef EXCLUDE_GUS_IODETECT

  /*
   * Look at the possible base addresses (0x2X0, X=1, 2, 3, 4, 5, 6)
   */

  for (io_addr = 0x210; io_addr <= 0x260; io_addr += 0x10)
    if (io_addr != hw_config->io_base)	/*
					 * Already tested
					 */
      if (gus_wave_detect (io_addr))
	{
	  hw_config->io_base = io_addr;

	  printk (" WARNING! GUS found at %x, config was %x ", io_addr, hw_config->io_base);
	  gus_wave_init (hw_config);
	  request_region (io_addr, 16, "GUS");
	  request_region (io_addr + 0x100, 12, "GUS");	/* 0x10c-> is MAX */
	  if (sound_alloc_dma (hw_config->dma, "GUS"))
	    printk ("gus_card.c: Can't allocate DMA channel\n");
	  if (hw_config->dma2 != -1 && hw_config->dma2 != hw_config->dma)
	    if (sound_alloc_dma (hw_config->dma2, "GUS"))
	      printk ("gus_card.c: Can't allocate DMA channel2\n");
#ifdef CONFIG_MIDI
	  gus_midi_init ();
#endif
	  return;
	}

#endif

}
示例#2
0
文件: uart6850.c 项目: metacore/spin
int
probe_uart6850 (struct address_info *hw_config)
{
  int             ok = 0;

  uart6850_base = hw_config->io_base;
  uart6850_irq = hw_config->irq;

  if (snd_set_irq_handler (uart6850_irq, m6850intr, "MIDI6850") < 0)
    return 0;

  ok = reset_uart6850 ();

  uart6850_detected = ok;
  return ok;
}
示例#3
0
long
attach_gus_card (long mem_start, struct address_info *hw_config)
{
  int             io_addr;

  snd_set_irq_handler (hw_config->irq, gusintr);

  if (gus_wave_detect (hw_config->io_base))	/* Try first the default */
    {
      mem_start = gus_wave_init (mem_start, hw_config->irq, hw_config->dma);
#ifndef EXCLUDE_MIDI
      mem_start = gus_midi_init (mem_start);
#endif
      return mem_start;
    }

#ifndef EXCLUDE_GUS_IODETECT

  /*
   * Look at the possible base addresses (0x2X0, X=1, 2, 3, 4, 5, 6)
   */

  for (io_addr = 0x210; io_addr <= 0x260; io_addr += 0x10)
    if (io_addr != hw_config->io_base)	/* Already tested */
      if (gus_wave_detect (io_addr))
	{
	  printk (" WARNING! GUS found at %x, config was %x ", io_addr, hw_config->io_base);
	  mem_start = gus_wave_init (mem_start, hw_config->irq, hw_config->dma);
#ifndef EXCLUDE_MIDI
	  mem_start = gus_midi_init (mem_start);
#endif
	  return mem_start;
	}

#endif

  return mem_start;		/* Not detected */
}
示例#4
0
void
attach_sscape(struct address_info * hw_config)
{
#ifndef SSCAPE_REGS
    /*
     * Config register values for Spea/V7 Media FX and Ensoniq S-2000.
     * These values are card dependent. If you have another SoundScape
     * based card, you have to find the correct values. Do the following:
     * - Compile this driver with SSCAPE_DEBUG1 defined. - Shut down and
     * power off your machine. - Boot with DOS so that the SSINIT.EXE
     * program is run. - Warm boot to {Linux|SYSV|BSD} and write down the
     * lines displayed when detecting the SoundScape. - Modify the
     * following list to use the values printed during boot. Undefine the
     * SSCAPE_DEBUG1
     */
#define SSCAPE_REGS { \
/* I0 */	0x00, \
		0xf0, /* Note! Ignored. Set always to 0xf0 */ \
		0x20, /* Note! Ignored. Set always to 0x20 */ \
		0x20, /* Note! Ignored. Set always to 0x20 */ \
		0xf5, /* Ignored */ \
		0x10, \
		0x00, \
		0x2e, /* I7 MEM config A. Likely to vary between models */ \
		0x00, /* I8 MEM config B. Likely to vary between models */ \
/* I9 */	0x40 /* Ignored */ \
	}
#endif

    u_long   flags;
    static u_char regs[10] = SSCAPE_REGS;

    int             i, irq_bits = 0xff;

    if (sscape_detected != hw_config->io_base)
	return;

    if (old_hardware) {
	valid_interrupts = valid_interrupts_old;
	conf_printf("Ensoniq Soundscape (old)", hw_config);
    } else
	conf_printf("Ensoniq Soundscape", hw_config);

    for (i = 0; i < sizeof(valid_interrupts); i++)
	if (hw_config->irq == valid_interrupts[i]) {
	    irq_bits = i;
	    break;
	}
    if (hw_config->irq > 15 || (regs[4] = irq_bits == 0xff)) {
	printf("Invalid IRQ%d\n", hw_config->irq);
	return;
    }
    flags = splhigh();

    for (i = 1; i < 10; i++)
	switch (i) {
	case 1:	/* Host interrupt enable */
	    sscape_write(devc, i, 0xf0);	/* All interrupts enabled */
	    break;

	case 2:	/* DMA A status/trigger register */
	case 3:	/* DMA B status/trigger register */
	    sscape_write(devc, i, 0x20);	/* DMA channel disabled */
	    break;

	case 4:	/* Host interrupt config reg */
	    sscape_write(devc, i, 0xf0 | (irq_bits << 2) | irq_bits);
	    break;

	case 5:	/* Don't destroy CD-ROM DMA config bits (0xc0) */
	    sscape_write(devc, i, (regs[i] & 0x3f) |
			 (sscape_read(devc, i) & 0xc0));
	    break;

	case 6:	/* CD-ROM config. Don't touch. */
	    break;

	case 9:	/* Master control reg. Don't modify CR-ROM
		 * bits. Disable SB emul */
	    sscape_write(devc, i, (sscape_read(devc, i) & 0xf0) | 0x00);
	    break;

	default:
	    sscape_write(devc, i, regs[i]);
	}

    splx(flags);

#ifdef SSCAPE_DEBUG2
    /*
     * Temporary debugging aid. Print contents of the registers after
     * changing them.
     */
    {
	int             i;

	for (i = 0; i < 13; i++)
	    printf("I%d = %02x (new value)\n", i, sscape_read(devc, i));
    }
#endif

#if defined(CONFIG_MIDI) && defined(CONFIG_MPU_EMU)
    if (probe_mpu401(hw_config))
	hw_config->always_detect = 1;
    {
	int             prev_devs;

	prev_devs = num_midis;
	attach_mpu401(hw_config);

	if (num_midis == (prev_devs + 1))	/* The MPU driver
						 * installed itself */
	    midi_devs[prev_devs]->coproc = &sscape_coproc_operations;
    }
#endif

#ifndef EXCLUDE_NATIVE_PCM
    /* Not supported yet */

#ifdef CONFIG_AUDIO
    if (num_audiodevs < MAX_AUDIO_DEV) {
	int my_dev;

	audio_devs[my_dev = num_audiodevs++] = &sscape_audio_operations;
	audio_devs[my_dev]->dmachan1 = hw_config->dma;
	audio_devs[my_dev]->buffsize = DSP_BUFFSIZE;
	audio_devs[my_dev]->devc = devc;
	devc->my_audiodev = my_dev;
	devc->opened = 0;
	audio_devs[my_dev]->coproc = &sscape_coproc_operations;
	if (snd_set_irq_handler(hw_config->irq, sscapeintr, devc->osp) < 0)
	    printf("Error: Can't allocate IRQ for SoundScape\n");
	sscape_write(devc, GA_INTENA_REG, 0x80);	/* Master IRQ enable */
    } else
	printf("SoundScape: More than enough audio devices detected\n");
#endif
#endif
    devc->ok = 1;
    devc->failed = 0;
    return;
}
示例#5
0
static int
config_pas_hw(struct address_info * hw_config)
{
	char            ok = 1;
	u_int        int_ptrs;	/* scsi/sound interrupt pointers */

	pas_irq = hw_config->irq;

	pas_write(0x00, INTERRUPT_MASK);

	pas_write(0x36, SAMPLE_COUNTER_CONTROL);	/* Local timer control *
							 * register */

	pas_write(0x36, SAMPLE_RATE_TIMER);	/* Sample rate timer (16 bit) */
	pas_write(0, SAMPLE_RATE_TIMER);

	pas_write(0x74, SAMPLE_COUNTER_CONTROL);	/* Local timer control *
							 * register */

	pas_write(0x74, SAMPLE_BUFFER_COUNTER);	/* Sample count register (16 *
						 * bit) */
	pas_write(0, SAMPLE_BUFFER_COUNTER);

	pas_write(F_F_PCM_BUFFER_COUNTER | F_F_PCM_RATE_COUNTER | F_F_MIXER_UNMUTE | 1, FILTER_FREQUENCY);
	pas_write(P_C_PCM_DMA_ENABLE | P_C_PCM_MONO | P_C_PCM_DAC_MODE | P_C_MIXER_CROSS_L_TO_L | P_C_MIXER_CROSS_R_TO_R, PCM_CONTROL);
	pas_write(S_M_PCM_RESET | S_M_FM_RESET | S_M_SB_RESET | S_M_MIXER_RESET /* | S_M_OPL3_DUAL_MONO */ , SERIAL_MIXER);

	pas_write(I_C_1_BOOT_RESET_ENABLE
#ifdef PAS_JOYSTICK_ENABLE
		  | I_C_1_JOYSTICK_ENABLE
#endif
		  ,IO_CONFIGURATION_1);

	if (pas_irq < 0 || pas_irq > 15) {
		printf("PAS2: Invalid IRQ %d", pas_irq);
		ok = 0;
	} else {
		int_ptrs = pas_read(IO_CONFIGURATION_3);
		int_ptrs |= I_C_3_PCM_IRQ_translate[pas_irq] & 0xf;
		pas_write(int_ptrs, IO_CONFIGURATION_3);
		if (!I_C_3_PCM_IRQ_translate[pas_irq]) {
		    printf("PAS2: Invalid IRQ %d", pas_irq);
		    ok = 0;
		} else {
		    if (snd_set_irq_handler(pas_irq, pasintr, hw_config->osp) < 0)
			ok = 0;
		}
	}

	if (hw_config->dma < 0 || hw_config->dma > 7) {
		printf("PAS2: Invalid DMA selection %d", hw_config->dma);
		ok = 0;
	} else {
		pas_write(I_C_2_PCM_DMA_translate[hw_config->dma], IO_CONFIGURATION_2);
		if (!I_C_2_PCM_DMA_translate[hw_config->dma]) {
			printf("PAS2: Invalid DMA selection %d", hw_config->dma);
			ok = 0;
		} else {
			if (0) {
				printf("pas2_card.c: Can't allocate DMA channel\n");
				ok = 0;
			}
		}
	}

	/*
	 * This fixes the timing problems of the PAS due to the Symphony
	 * chipset as per Media Vision.  Only define this if your PAS doesn't
	 * work correctly.
	 */
#ifdef SYMPHONY_PAS
	outb(0xa8, 0x05);
	outb(0xa9, 0x60);
#endif

#ifdef BROKEN_BUS_CLOCK
	pas_write(S_C_1_PCS_ENABLE | S_C_1_PCS_STEREO | S_C_1_PCS_REALSOUND | S_C_1_FM_EMULATE_CLOCK, SYSTEM_CONFIGURATION_1);
#else
	/*
	 * pas_write(S_C_1_PCS_ENABLE, SYSTEM_CONFIGURATION_1);
	 */
	pas_write(S_C_1_PCS_ENABLE | S_C_1_PCS_STEREO | S_C_1_PCS_REALSOUND, SYSTEM_CONFIGURATION_1);
#endif
	pas_write(0x18, SYSTEM_CONFIGURATION_3);	/* ??? */

	pas_write(F_F_MIXER_UNMUTE | 0x01, FILTER_FREQUENCY);	/* Sets mute off and *
								 * selects filter rate *
								 * of 17.897 kHz */
	pas_write(8, PRESCALE_DIVIDER);

	mix_write(P_M_MV508_ADDRESS | 5, PARALLEL_MIXER);
	mix_write(5, PARALLEL_MIXER);

#if defined(CONFIG_SB_EMULATION) && defined(CONFIG_SB)

	{
		struct address_info *sb_config;

		if ((sb_config = sound_getconf(SNDCARD_SB))) {
			u_char   irq_dma;

			/*
			 * Turn on Sound Blaster compatibility
			 */
			/*
			 * bit 1 = SB emulation
			 */
			/*
			 * bit 0 = MPU401 emulation (CDPC only :-( )
			 */
			pas_write(0x02, COMPATIBILITY_ENABLE);

			/*
			 * "Emulation address"
			 */
			pas_write((sb_config->io_base >> 4) & 0x0f, EMULATION_ADDRESS);

			if (!E_C_SB_DMA_translate[sb_config->dma])
				printf("\n\nPAS16 Warning: Invalid SB DMA %d\n\n",
				       sb_config->dma);

			if (!E_C_SB_IRQ_translate[sb_config->irq])
				printf("\n\nPAS16 Warning: Invalid SB IRQ %d\n\n",
				       sb_config->irq);

			irq_dma = E_C_SB_DMA_translate[sb_config->dma] |
				E_C_SB_IRQ_translate[sb_config->irq];

			pas_write(irq_dma, EMULATION_CONFIGURATION);
		}
	}