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

📄 isapnp.txt

📁 mgcp协议源代码。支持多种编码:g711
💻 TXT
字号:
ISA Plug & Play support by Jaroslav Kysela <perex@suse.cz>=========================================================Modified by Ed Okerson <eokerson@quicknet.net> to work with the 2.2.xseries of Linux kernels. 11/17/99=====================================================================Interface /proc/isapnp======================Read commands:--------------No comment..Write commands:---------------With the write interface you can simply activate or modify the configurationfor ISA Plug & Play devices. It is mainly useable for drivers which don'tuse the ISA Plug & Play kernel support yet.card <idx> <vendor>	- select PnP device by vendor identificationcsn <CSN>		- select PnP device by CSNdev <idx> <logdev>	- select logical deviceauto			- run autoconfigureactivate		- activate logical devicedeactivate		- deactivate logical deviceport <idx> <value>	- set port 0-7 to valueirq <idx> <value>	- set IRQ 0-1 to valuedma <idx> <value>	- set DMA 0-1 to valuememory <idx> <value>	- set memory 0-3 to valuepoke <reg> <value>	- poke configuration byte to selected registerpokew <reg> <value>	- poke configuration word to selected registerpoked <reg> <value>	- poke configuration dword to selected registerExplanation:	- variable <idx> begins with zero	- variable <CSN> begins with one	- <vendor> is in form 'PNP0000'	- <logdev> is in form 'PNP0000'Example:cat > /proc/isapnp <<EOFcard 0 CSC7537dev 0 CSC0000port 0 0x534port 1 0x388port 2 0x220irq 0 5dma 0 1dma 1 3poke 0x70 9activatelogdev 0 CSC0001port 0 0x240activateEOFInformation for developers==========================Finding appropriate device--------------------------extern struct pnp_bus *isapnp_find_card(unsigned short vendor,                                        unsigned short device,                                        struct pnp_bus *from);The above function finds a ISA PnP card. For the vendor device shouldbe used ISAPNP_VENDOR(a,b,c) where a,b,c are characters or integers.For the device number should be used ISAPNP_DEVICE(x) macro where x isinteger value. Both vendor and device numbers can be get from contentsof the /proc/isapnp file.extern struct pnp_dev *isapnp_find_dev(struct pnp_bus *card,                                       unsigned short vendor,                                       unsigned short function,                                       struct pnp_dev *from);The above function finds the ISA PnP device. If card is NULL, thenthe global search mode is used (all devices are used for the searching).Otherwise only devices which belongs to the specified card are verified.For the function number can be used ISAPNP_FUNCTION(x) macro which workssimilarly as the ISAPNP_DEVICE(x) macro.ISA PnP configuration=====================There are two ways how can be ISA PnP interface used.First way is lowlevel---------------------All ISA PNP configuration registers are accessible via lowlevelisapnp_(read|write)_(byte|word|dword) functions.The function isapnp_cfg_begin() must be called before any lowlevel function.The function isapnp_cfg_end() must be always called after configurationotherwise the access to the ISA PnP configuration functions will be blocked.Second way is auto-configuration--------------------------------These two functions gives to the driver the real power of the ISA PnPfeature. First function dev->prepare() only initialize the resourcemembers in the device structure. This structure contains all resourcesset to auto configuration values after the initialization. The driver forISA PnP device may modify (or not) some resources to skip auto configurationfor the given resource.The function isapnp_configure does:	- resources which have the auto configuration value are configured	- the auto configuration is created using ISA PnP resource map	- the function writes configuration to ISA PnP configuration registers	- the function returns to the caller actual used resourcesExample (game port initialization)==================================/*** initialization ***/	struct pnp_dev *dev;	/* find the first game port, use standard PnP IDs */	dev = isapnp_find_dev(NULL,			      ISAPNP_VENDOR('P','N','P'),			      ISAPNP_FUNCTION(0xb02f),			      NULL);	if (!dev)		return -ENODEV;	if (dev->prepare(dev)<0)		return -EAGAIN;	if (!(dev->resource[0].flags & IORESOURCE_IO))		return -ENODEV;	if (!dev->ro) {		/* override resource */		if (user_port != USER_PORT_AUTO_VALUE)			isapnp_resource_change(&dev->resource[0], user_port, 1);	}	if (dev->activate(dev)<0) {		printk("isapnp configure failed (out of resources?)\n");		return -ENOMEM;	}	user_port = dev->resource[0].start;		/* get real port *//*** deactivation ***/	/* to deactivate use: */ 	if (dev) 		dev->deactivate(dev);

⌨️ 快捷键说明

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