Esempio n. 1
0
long
attach_trix_wss (long mem_start, struct address_info *hw_config)
{
  static unsigned char interrupt_bits[12] =
  {-1, -1, -1, -1, -1, -1, -1, 0x08, -1, 0x10, 0x18, 0x20};
  char            bits;

  static unsigned char dma_bits[4] =
  {1, 2, 0, 3};

  int             config_port = hw_config->io_base + 0, version_port = hw_config->io_base + 3;

  if (!kilroy_was_here)
    return mem_start;

  /*
     * Set the IRQ and DMA addresses.
   */

  bits = interrupt_bits[hw_config->irq];
  if (bits == -1)
    return mem_start;

  OUTB (bits | 0x40, config_port);
  if ((INB (version_port) & 0x40) == 0)
    printk ("[IRQ Conflict?]");

  OUTB (bits | dma_bits[hw_config->dma], config_port);	/* Write IRQ+DMA setup */

  ad1848_init ("AudioTriX Pro", hw_config->io_base + 4,
	       hw_config->irq,
	       hw_config->dma,
	       hw_config->dma);
  return mem_start;
}
Esempio n. 2
0
void
attach_ss_mss(struct address_info * hw_config)
{
    /*
     * This routine configures the SoundScape card for use with the Win
     * Sound System driver. The AD1848 codec interface uses the CD-ROM
     * config registers of the "ODIE".
     */

    int             i, irq_bits = 0xff;

#ifndef CONFIG_NATIVE_PCM
    int             prev_devs = num_audiodevs;
#endif

    /*
     * Setup the DMA polarity.
     */
    sscape_write(devc, GA_DMACFG_REG, 0x50);

    /*
     * Take the gate-arry off of the DMA channel.
     */
    sscape_write(devc, GA_DMAB_REG, 0x20);

    /*
     * Init the AD1848 (CD-ROM) config reg.
     */

    for (i = 0; i < sizeof(valid_interrupts); i++)
	if (hw_config->irq == valid_interrupts[i]) {
	    irq_bits = i;
	    break;
	}
    sscape_write(devc, GA_CDCFG_REG, 0x89 | (hw_config->dma << 4) |
	     (irq_bits << 1));

    if (hw_config->irq == devc->irq)
	printf("SoundScape: Warning! WSS mode can't share IRQ with MIDI\n");

    ad1848_init("SoundScape", hw_config->io_base,
		    hw_config->irq,
		    hw_config->dma,
		    hw_config->dma,
		    0,
		    devc->osp);

#ifndef CONFIG_NATIVE_PCM
    /* Check if the AD1848 driver installed itself */
    if (num_audiodevs == (prev_devs + 1))
	audio_devs[prev_devs]->coproc = &sscape_coproc_operations;
#endif

    return;
}
static void __init attach_gus_db16(struct address_info *hw_config)
{
	gus_pcm_volume = 100;
	gus_wave_volume = 90;

	hw_config->slots[3] = ad1848_init("GUS 16 bit sampling", hw_config->io_base,
					  hw_config->irq,
					  hw_config->dma,
					  hw_config->dma, 0,
					  hw_config->osp,
					  THIS_MODULE);
}
Esempio n. 4
0
void
attach_gus_db16 (struct address_info *hw_config)
{
#ifdef CONFIG_GUS
  gus_pcm_volume = 100;
  gus_wave_volume = 90;
#endif

  ad1848_init ("GUS 16 bit sampling", hw_config->io_base,
	       hw_config->irq,
	       hw_config->dma,
	       hw_config->dma, 0,
	       hw_config->osp);
}
Esempio n. 5
0
void *wss_init()
{
        wss_t *wss = malloc(sizeof(wss_t));
        int c;
        double attenuation;

        memset(wss, 0, sizeof(wss_t));

        opl3_init(&wss->opl);
        ad1848_init(&wss->ad1848);
        
        ad1848_setirq(&wss->ad1848, 7);
        ad1848_setdma(&wss->ad1848, 3);

        io_sethandler(0x0388, 0x0004, opl3_read,   NULL, NULL, opl3_write,   NULL, NULL,  &wss->opl);
        io_sethandler(0x0530, 0x0004, wss_read,    NULL, NULL, wss_write,    NULL, NULL,  wss);
        io_sethandler(0x0534, 0x0004, ad1848_read, NULL, NULL, ad1848_write, NULL, NULL,  &wss->ad1848);
                
        sound_add_handler(wss_poll, wss_get_buffer, wss);
        
        return wss;
}
Esempio n. 6
0
void attach_mad16(struct address_info *hw_config)
{

	static char     interrupt_bits[12] = {
		-1, -1, -1, -1, -1, -1, -1, 0x08, -1, 0x10, 0x18, 0x20
	};
	char bits;

	static char     dma_bits[4] = {
		1, 2, 0, 3
	};

	int config_port = hw_config->io_base + 0, version_port = hw_config->io_base + 3;
	int ad_flags = 0, dma = hw_config->dma, dma2 = hw_config->dma2;
	unsigned char dma2_bit = 0;

	already_initialized = 1;

	if (!ad1848_detect(hw_config->io_base + 4, &ad_flags, mad16_osp))
		return;

	/*
	 * Set the IRQ and DMA addresses.
	 */
	
	if (board_type == C930)
		interrupt_bits[5] = 0x28;	/* Also IRQ5 is possible on C930 */

	bits = interrupt_bits[hw_config->irq];
	if (bits == -1)
		return;

	outb((bits | 0x40), config_port);
	if ((inb(version_port) & 0x40) == 0)
		printk(KERN_ERR "[IRQ Conflict?]\n");

	/*
	 * Handle the capture DMA channel
	 */

	if (ad_flags & AD_F_CS4231 && dma2 != -1 && dma2 != dma)
	{
		if (!((dma == 0 && dma2 == 1) ||
			(dma == 1 && dma2 == 0) ||
			(dma == 3 && dma2 == 0)))
		{		/* Unsupported combination. Try to swap channels */
			int tmp = dma;

			dma = dma2;
			dma2 = tmp;
		}
		if ((dma == 0 && dma2 == 1) || (dma == 1 && dma2 == 0) ||
			(dma == 3 && dma2 == 0))
		{
			dma2_bit = 0x04;	/* Enable capture DMA */
		}
		else
		{
			printk("MAD16: Invalid capture DMA\n");
			dma2 = dma;
		}
	}
	else dma2 = dma;

	outb((bits | dma_bits[dma] | dma2_bit), config_port);	/* Write IRQ+DMA setup */

	hw_config->slots[0] = ad1848_init("MAD16 WSS", hw_config->io_base + 4,
					  hw_config->irq,
					  dma,
					  dma2, 0,
					  hw_config->osp);
	request_region(hw_config->io_base, 4, "MAD16 WSS config");
}
Esempio n. 7
0
File: trix.c Progetto: 274914765/C
static int __init init_trix_wss(struct address_info *hw_config)
{
    static unsigned char dma_bits[4] = {
        1, 2, 0, 3
    };
    struct resource *ports;
    int config_port = hw_config->io_base + 0;
    int dma1 = hw_config->dma, dma2 = hw_config->dma2;
    int old_num_mixers = num_mixers;
    u8 config, bits;
    int ret;
 
    switch(hw_config->irq) {
    case 7:
        bits = 8;
        break;
    case 9:
        bits = 0x10;
        break;
    case 10:
        bits = 0x18;
        break;
    case 11:
        bits = 0x20;
        break;
    default:
        printk(KERN_ERR "AudioTrix: Bad WSS IRQ %d\n", hw_config->irq);
        return 0;
    }

    switch (dma1) {
    case 0:
    case 1:
    case 3:
        break;
    default:
        printk(KERN_ERR "AudioTrix: Bad WSS DMA %d\n", dma1);
        return 0;
    }

    switch (dma2) {
    case -1:
    case 0:
    case 1:
    case 3:
        break;
    default:
        printk(KERN_ERR "AudioTrix: Bad capture DMA %d\n", dma2);
        return 0;
    }

    /*
     * Check if the IO port returns valid signature. The original MS Sound
     * system returns 0x04 while some cards (AudioTrix Pro for example)
     * return 0x00.
     */
    ports = request_region(hw_config->io_base + 4, 4, "ad1848");
    if (!ports) {
        printk(KERN_ERR "AudioTrix: MSS I/O port conflict (%x)\n", hw_config->io_base);
        return 0;
    }

    if (!request_region(hw_config->io_base, 4, "MSS config")) {
        printk(KERN_ERR "AudioTrix: MSS I/O port conflict (%x)\n", hw_config->io_base);
        release_region(hw_config->io_base + 4, 4);
        return 0;
    }

    if (!trix_set_wss_port(hw_config))
        goto fail;

    config = inb(hw_config->io_base + 3);

    if ((config & 0x3f) != 0x00)
    {
        MDB(printk(KERN_ERR "No MSS signature detected on port 0x%x\n", hw_config->io_base));
        goto fail;
    }

    /*
     * Check that DMA0 is not in use with a 8 bit board.
     */

    if (dma1 == 0 && config & 0x80)
    {
        printk(KERN_ERR "AudioTrix: Can't use DMA0 with a 8 bit card slot\n");
        goto fail;
    }
    if (hw_config->irq > 9 && config & 0x80)
    {
        printk(KERN_ERR "AudioTrix: Can't use IRQ%d with a 8 bit card slot\n", hw_config->irq);
        goto fail;
    }

    ret = ad1848_detect(ports, NULL, hw_config->osp);
    if (!ret)
        goto fail;

    if (joystick==1)
        trix_write(0x15, 0x80);

    /*
     * Set the IRQ and DMA addresses.
     */

    outb((bits | 0x40), config_port);

    if (dma2 == -1 || dma2 == dma1)
    {
          bits |= dma_bits[dma1];
          dma2 = dma1;
    }
    else
    {
        unsigned char tmp;

        tmp = trix_read(0x13) & ~30;
        trix_write(0x13, tmp | 0x80 | (dma1 << 4));

        tmp = trix_read(0x14) & ~30;
        trix_write(0x14, tmp | 0x80 | (dma2 << 4));
    }

    outb((bits), config_port);    /* Write IRQ+DMA setup */

    hw_config->slots[0] = ad1848_init("AudioTrix Pro", ports,
                      hw_config->irq,
                      dma1,
                      dma2,
                      0,
                      hw_config->osp,
                      THIS_MODULE);

    if (num_mixers > old_num_mixers)    /* Mixer got installed */
    {
        AD1848_REROUTE(SOUND_MIXER_LINE1, SOUND_MIXER_LINE);    /* Line in */
        AD1848_REROUTE(SOUND_MIXER_LINE2, SOUND_MIXER_CD);
        AD1848_REROUTE(SOUND_MIXER_LINE3, SOUND_MIXER_SYNTH);        /* OPL4 */
        AD1848_REROUTE(SOUND_MIXER_SPEAKER, SOUND_MIXER_ALTPCM);    /* SB */
    }
    return 1;

fail:
    release_region(hw_config->io_base, 4);
    release_region(hw_config->io_base + 4, 4);
    return 0;
}
Esempio n. 8
0
static void __init attach_ss_ms_sound(struct address_info *hw_config)
{
	/*
	 * This routine configures the SoundScape card for use with the
	 * Win Sound System driver. The AD1848 codec interface uses the CD-ROM
	 * config registers of the "ODIE".
	 */

	int i, irq_bits = 0xff;

 		
 	if (!sscape_is_pnp)  /*pnp is already setup*/
 	{
 		/*
     		 * Setup the DMA polarity.
 	    	 */
 		sscape_write(devc, GA_DMACFG_REG, 0x50);
 	
 		/*
 		 * Take the gate-array off of the DMA channel.
 		 */
 		sscape_write(devc, GA_DMAB_REG, 0x20);
 	
 		/*
 		 * Init the AD1848 (CD-ROM) config reg.
 		 */
 		for (i = 0; i < sizeof(valid_interrupts); i++)
 		{
 			if (hw_config->irq == valid_interrupts[i])
 			{
 				irq_bits = i;
 				break;
 			}
 		}	
 		sscape_write(devc, GA_CDCFG_REG, 0x89 | (hw_config->dma << 4) | (irq_bits << 1));
 	}
 	
 	if (hw_config->irq == devc->irq)
 		printk(KERN_WARNING "soundscape: Warning! The WSS mode can't share IRQ with MIDI\n");
 				
	hw_config->slots[0] = ad1848_init(
			sscape_is_pnp ? "SoundScape" : "SoundScape PNP",
			hw_config->io_base,
			hw_config->irq,
			hw_config->dma,
			hw_config->dma,
			0,
			devc->osp,
			THIS_MODULE);

 					  
	if (hw_config->slots[0] != -1)	/* The AD1848 driver installed itself */
	{
		audio_devs[hw_config->slots[0]]->coproc = &sscape_coproc_operations;
		devc->codec_audiodev = hw_config->slots[0];
		devc->my_audiodev = hw_config->slots[0];

		/* Set proper routings here (what are they) */
		AD1848_REROUTE(SOUND_MIXER_LINE1, SOUND_MIXER_LINE);
	}
		
#ifdef SSCAPE_DEBUG5
	/*
	 * Temporary debugging aid. Print contents of the registers
	 * after the AD1848 device has been initialized.
	 */
	{
		int i;

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

}
Esempio n. 9
0
static int __init init_ss_ms_sound(struct address_info *hw_config)
{
    int i, irq_bits = 0xff;
    int ad_flags = 0;
    struct resource *ports;

    if (devc->failed)
    {
        printk(KERN_ERR "soundscape: Card not detected\n");
        return 0;
    }
    if (devc->ok == 0)
    {
        printk(KERN_ERR "soundscape: Invalid initialization order.\n");
        return 0;
    }
    for (i = 0; i < 4; i++)
    {
        if (hw_config->irq == valid_interrupts[i])
        {
            irq_bits = i;
            break;
        }
    }
    if (irq_bits == 0xff) {
        printk(KERN_ERR "soundscape: Invalid MSS IRQ%d\n", hw_config->irq);
        return 0;
    }

    if (old_hardware)
        ad_flags = 0x12345677;	/* Tell that we may have a CS4248 chip (Spea-V7 Media FX) */
    else if (sscape_is_pnp)
        ad_flags = 0x87654321;  /* Tell that we have a soundscape pnp with 1845 chip */

    ports = request_region(hw_config->io_base, 4, "ad1848");
    if (!ports) {
        printk(KERN_ERR "soundscape: ports busy\n");
        return 0;
    }

    if (!ad1848_detect(ports, &ad_flags, hw_config->osp)) {
        release_region(hw_config->io_base, 4);
        return 0;
    }

    if (!sscape_is_pnp)  /*pnp is already setup*/
    {
        /*
        	 * Setup the DMA polarity.
        	 */
        sscape_write(devc, GA_DMACFG_REG, 0x50);

        /*
         * Take the gate-array off of the DMA channel.
         */
        sscape_write(devc, GA_DMAB_REG, 0x20);

        /*
         * Init the AD1848 (CD-ROM) config reg.
         */
        sscape_write(devc, GA_CDCFG_REG, 0x89 | (hw_config->dma << 4) | (irq_bits << 1));
    }

    if (hw_config->irq == devc->irq)
        printk(KERN_WARNING "soundscape: Warning! The WSS mode can't share IRQ with MIDI\n");

    hw_config->slots[0] = ad1848_init(
                              sscape_is_pnp ? "SoundScape" : "SoundScape PNP",
                              ports,
                              hw_config->irq,
                              hw_config->dma,
                              hw_config->dma,
                              0,
                              devc->osp,
                              THIS_MODULE);


    if (hw_config->slots[0] != -1)	/* The AD1848 driver installed itself */
    {
        audio_devs[hw_config->slots[0]]->coproc = &sscape_coproc_operations;
        devc->codec_audiodev = hw_config->slots[0];
        devc->my_audiodev = hw_config->slots[0];

        /* Set proper routings here (what are they) */
        AD1848_REROUTE(SOUND_MIXER_LINE1, SOUND_MIXER_LINE);
    }

#ifdef SSCAPE_DEBUG5
    /*
     * Temporary debugging aid. Print contents of the registers
     * after the AD1848 device has been initialized.
     */
    {
        int i;

        for (i = 0; i < 13; i++)
            printk("I%d = %02x\n", i, sscape_read(devc, i));
    }
#endif
    return 1;
}
Esempio n. 10
0
void
attach_ss_ms_sound (struct address_info *hw_config)
{
  /*
     * This routine configures the SoundScape card for use with the
     * Win Sound System driver. The AD1848 codec interface uses the CD-ROM
     * config registers of the "ODIE".
   */

  int             i, irq_bits = 0xff;

  int             prev_devs = num_audiodevs;

  hw_config->dma = devc->dma;	/* Share the DMA with the ODIE/OPUS chip */

  /*
   * Setup the DMA polarity.
   */
  sscape_write (devc, GA_DMACFG_REG, 0x50);

  /*
     * Take the gate-array off of the DMA channel.
   */
  sscape_write (devc, GA_DMAB_REG, 0x20);

  /*
     * Init the AD1848 (CD-ROM) config reg.
   */

  for (i = 0; i < sizeof (valid_interrupts); i++)
    if (hw_config->irq == valid_interrupts[i])
      {
	irq_bits = i;
	break;
      }

  sscape_write (devc, GA_CDCFG_REG, 0x89 | (hw_config->dma << 4) |
		(irq_bits << 1));

  if (hw_config->irq == devc->irq)
    printk ("SoundScape: Warning! The WSS mode can't share IRQ with MIDI\n");

  ad1848_init ("SoundScape", hw_config->io_base,
	       hw_config->irq,
	       hw_config->dma,
	       hw_config->dma,
	       0,
	       devc->osp);

  if (num_audiodevs == (prev_devs + 1))		/* The AD1848 driver installed itself */
    audio_devs[prev_devs]->coproc = &sscape_coproc_operations;
  devc->my_audiodev = prev_devs;

#ifdef SSCAPE_DEBUG5
  /*
     * Temporary debugging aid. Print contents of the registers
     * after the AD1848 device has been initialized.
   */
  {
    int             i;

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

}