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

📄 sb_card.c

📁 iis s3c2410-uda1341语音系统的 开发
💻 C
📖 第 1 页 / 共 3 页
字号:
/* * sound/sb_card.c * * Detection routine for the Sound Blaster cards. * * * Copyright (C) by Hannu Savolainen 1993-1997 * * OSS/Free 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. * * 26-11-1999 Patched to compile without ISA PnP support in the * kernel - Daniel Stone (tamriel@ductape.net)  * * 06-01-2000 Refined and bugfixed ISA PnP support, added *  CMI 8330 support - Alessandro Zummo <azummo@ita.flashnet.it> * * 18-01-2000 Separated sb_card and sb_common *  Jeff Garzik <jgarzik@mandrakesoft.com> * * 04-02-2000 Added Soundblaster AWE 64 PnP support, isapnpjump *  Alessandro Zummo <azummo@ita.flashnet.it> * * 11-02-2000 Added Soundblaster AWE 32 PnP support, refined PnP code *  Alessandro Zummo <azummo@ita.flashnet.it> * * 13-02-2000 Hopefully fixed awe/sb16 related bugs, code cleanup *  Alessandro Zummo <azummo@ita.flashnet.it> * * 13-03-2000 Added some more cards, thanks to Torsten Werner. *  Removed joystick and wavetable code, there are better places for them. *  Code cleanup plus some fixes.  *  Alessandro Zummo <azummo@ita.flashnet.it> *  * 26-03-2000 Fixed acer, esstype and sm_games module options. *  Alessandro Zummo <azummo@ita.flashnet.it> * * 12-04-2000 ISAPnP cleanup, reorg, fixes, and multiple card support. *  Thanks to Ga雔 Qu閞i and Alessandro Zummo for testing and fixes. *  Paul E. Laufer <pelaufer@csupomona.edu> * * 06-05-2000 added another card. Daniel M. Newman <dmnewman@pobox.com> * * 25-05-2000 Added Creative SB AWE64 Gold (CTL00B2).  * 	P錶-Kristian Engstad <engstad@att.net> * * 12-08-2000 Added Creative SB32 PnP (CTL009F). * 	Kasatenko Ivan Alex. <skywriter@rnc.ru> * * 21-09-2000 Got rid of attach_sbmpu * 	Arnaldo Carvalho de Melo <acme@conectiva.com.br> * * 28-10-2000 Added pnplegacy support * 	Daniel Church <dchurch@mbhs.edu> * * 01-10-2001 Added a new flavor of Creative SB AWE64 PnP (CTL00E9). *      Jerome Cornet <jcornet@free.fr> */#include <linux/config.h>#include <linux/mca.h>#include <linux/module.h>#include <linux/init.h>#include <linux/isapnp.h>#include "sound_config.h"#include "sb_mixer.h"#include "sb.h"#if defined CONFIG_ISAPNP || defined CONFIG_ISAPNP_MODULE#define SB_CARDS_MAX 5#else#define SB_CARDS_MAX 1#endifstatic int sbmpu[SB_CARDS_MAX] = {0};static int sb_cards_num = 0;extern void *smw_free;/* *    Note DMA2 of -1 has the right meaning in the SB16 driver as well *    as here. It will cause either an error if it is needed or a fallback *    to the 8bit channel. */static int __initdata mpu_io	= 0;static int __initdata io	= -1;static int __initdata irq	= -1;static int __initdata dma	= -1;static int __initdata dma16	= -1;   /* Set this for modules that need it */static int __initdata type	= 0;    /* Can set this to a specific card type */static int __initdata esstype   = 0;	/* ESS chip type */static int __initdata acer 	= 0;	/* Do acer notebook init? */static int __initdata sm_games 	= 0;	/* Logitech soundman games? */static void __init attach_sb_card(struct address_info *hw_config){	if(!sb_dsp_init(hw_config, THIS_MODULE))		hw_config->slots[0] = -1;}static int __init probe_sb(struct address_info *hw_config){	struct sb_module_options sbmo;	if (hw_config->io_base == -1 || hw_config->dma == -1 || hw_config->irq == -1)	{		printk(KERN_ERR "sb: I/O, IRQ, and DMA are mandatory\n");		return -EINVAL;	}#ifdef CONFIG_MCA	/* MCA code added by ZP Gu (zpg@castle.net) */	if (MCA_bus) {               /* no multiple REPLY card probing */		int slot;		u8 pos2, pos3, pos4;		slot = mca_find_adapter( 0x5138, 0 );		if( slot == MCA_NOTFOUND ) 		{			slot = mca_find_adapter( 0x5137, 0 );			if (slot != MCA_NOTFOUND)				mca_set_adapter_name( slot, "REPLY SB16 & SCSI Adapter" );		}		else		{			mca_set_adapter_name( slot, "REPLY SB16 Adapter" );		}		if (slot != MCA_NOTFOUND) 		{			mca_mark_as_used(slot);			pos2 = mca_read_stored_pos( slot, 2 );			pos3 = mca_read_stored_pos( slot, 3 );			pos4 = mca_read_stored_pos( slot, 4 );			if (pos2 & 0x4) 			{				/* enabled? */				static unsigned short irq[] = { 0, 5, 7, 10 };				/*				static unsigned short midiaddr[] = {0, 0x330, 0, 0x300 };       				*/				hw_config->io_base = 0x220 + 0x20 * (pos2 >> 6);				hw_config->irq = irq[(pos4 >> 5) & 0x3];				hw_config->dma = pos3 & 0xf;				/* Reply ADF wrong on High DMA, pos[1] should start w/ 00 */				hw_config->dma2 = (pos3 >> 4) & 0x3;				if (hw_config->dma2 == 0)					hw_config->dma2 = hw_config->dma;				else					hw_config->dma2 += 4;				/*					hw_config->driver_use_2 = midiaddr[(pos2 >> 3) & 0x3];				*/					printk(KERN_INFO "sb: Reply MCA SB at slot=%d \iobase=0x%x irq=%d lo_dma=%d hi_dma=%d\n",						slot+1,				        	hw_config->io_base, hw_config->irq,	        				hw_config->dma, hw_config->dma2);			}			else			{				printk (KERN_INFO "sb: Reply SB Base I/O address disabled\n");			}		}	}#endif	/* Setup extra module options */	sbmo.acer 	= acer;	sbmo.sm_games	= sm_games;	sbmo.esstype	= esstype;	return sb_dsp_detect(hw_config, 0, 0, &sbmo);}static void __exit unload_sb(struct address_info *hw_config, int card){	if(hw_config->slots[0]!=-1)		sb_dsp_unload(hw_config, sbmpu[card]);}static struct address_info cfg[SB_CARDS_MAX];static struct address_info cfg_mpu[SB_CARDS_MAX];struct pci_dev 	*sb_dev[SB_CARDS_MAX] 	= {NULL}, 		*mpu_dev[SB_CARDS_MAX]	= {NULL},		*opl_dev[SB_CARDS_MAX]	= {NULL};#if defined CONFIG_ISAPNP || defined CONFIG_ISAPNP_MODULEstatic int isapnp	= 1;static int isapnpjump	= 0;static int multiple	= 1;static int pnplegacy	= 0;static int reverse	= 0;static int uart401	= 0;static int audio_activated[SB_CARDS_MAX] = {0};static int mpu_activated[SB_CARDS_MAX]   = {0};static int opl_activated[SB_CARDS_MAX]   = {0};#elsestatic int isapnp	= 0;static int multiple	= 0;static int pnplegacy	= 0;#endifMODULE_DESCRIPTION("Soundblaster driver");MODULE_LICENSE("GPL");MODULE_PARM(io,		"i");MODULE_PARM(irq,	"i");MODULE_PARM(dma,	"i");MODULE_PARM(dma16,	"i");MODULE_PARM(mpu_io,	"i");MODULE_PARM(type,	"i");MODULE_PARM(sm_games,	"i");MODULE_PARM(esstype,	"i");MODULE_PARM(acer,	"i");#if defined CONFIG_ISAPNP || defined CONFIG_ISAPNP_MODULEMODULE_PARM(isapnp,	"i");MODULE_PARM(isapnpjump,	"i");MODULE_PARM(multiple,	"i");MODULE_PARM(pnplegacy,	"i");MODULE_PARM(reverse,	"i");MODULE_PARM(uart401,	"i");MODULE_PARM_DESC(isapnp,	"When set to 0, Plug & Play support will be disabled");MODULE_PARM_DESC(isapnpjump,	"Jumps to a specific slot in the driver's PnP table. Use the source, Luke.");MODULE_PARM_DESC(multiple,	"When set to 0, will not search for multiple cards");MODULE_PARM_DESC(pnplegacy,	"When set to 1, will search for a legacy SB card along with any PnP cards.");MODULE_PARM_DESC(reverse,	"When set to 1, will reverse ISAPnP search order");MODULE_PARM_DESC(uart401,	"When set to 1, will attempt to detect and enable the mpu on some clones");#endifMODULE_PARM_DESC(io,		"Soundblaster i/o base address (0x220,0x240,0x260,0x280)");MODULE_PARM_DESC(irq,		"IRQ (5,7,9,10)");MODULE_PARM_DESC(dma,		"8-bit DMA channel (0,1,3)");MODULE_PARM_DESC(dma16,		"16-bit DMA channel (5,6,7)");MODULE_PARM_DESC(mpu_io,	"Mpu base address");MODULE_PARM_DESC(type,		"You can set this to specific card type");MODULE_PARM_DESC(sm_games,	"Enable support for Logitech soundman games");MODULE_PARM_DESC(esstype,	"ESS chip type");MODULE_PARM_DESC(acer,		"Set this to detect cards in some ACER notebooks");#if defined CONFIG_ISAPNP || defined CONFIG_ISAPNP_MODULE/* Please add new entries at the end of the table */static struct {	char *name; 	unsigned short	card_vendor, card_device, 			audio_vendor, audio_function,			mpu_vendor, mpu_function,			opl_vendor, opl_function;	short dma, dma2, mpu_io, mpu_irq; /* see sb_init() */} sb_isapnp_list[] __initdata = {	{"Sound Blaster 16", 		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0024),		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031),		0,0,0,0,		0,1,1,-1},	{"Sound Blaster 16",		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0025),		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031),		0,0,0,0,		0,1,1,-1},	{"Sound Blaster 16", 		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0026), 		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031),		0,0,0,0,		0,1,1,-1},	{"Sound Blaster 16", 		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0027), 		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031),		0,0,0,0,		0,1,1,-1},	{"Sound Blaster 16", 		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0028), 		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031),		0,0,0,0,		0,1,1,-1},	{"Sound Blaster 16", 		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0029), 		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031),		0,0,0,0,		0,1,1,-1},	{"Sound Blaster 16",		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x002a),		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031),		0,0,0,0,		0,1,1,-1},	{"Sound Blaster 16", 		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x002b), 		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031),		0,0,0,0,		0,1,1,-1},	{"Sound Blaster 16", 		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x002c), 		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031),		0,0,0,0,		0,1,1,-1},	{"Sound Blaster 16", 		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x002c), 		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0031),		0,0,0,0,		0,1,1,-1},	{"Sound Blaster 16", 		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x00ed), 		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0041),		0,0,0,0,		0,1,1,-1},	{"Sound Blaster 16", 		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0086), 		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0041),		0,0,0,0,		0,1,1,-1},	{"Sound Blaster 16", 		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0086), 		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0041),		0,0,0,0,		0,1,1,-1},	{"Sound Blaster Vibra16S", 		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0051), 		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0001),		0,0,0,0,		0,1,1,-1},	{"Sound Blaster Vibra16C", 		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0070), 		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0001),		0,0,0,0,		0,1,1,-1},	{"Sound Blaster Vibra16CL", 		ISAPNP_VENDOR('C','T','L'), ISAPNP_DEVICE(0x0080), 		ISAPNP_VENDOR('C','T','L'), ISAPNP_FUNCTION(0x0041),		0,0,0,0,		0,1,1,-1},

⌨️ 快捷键说明

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