当前位置: 首页>>代码示例>>C++>>正文


C++ pnp_port_start函数代码示例

本文整理汇总了C++中pnp_port_start函数的典型用法代码示例。如果您正苦于以下问题:C++ pnp_port_start函数的具体用法?C++ pnp_port_start怎么用?C++ pnp_port_start使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了pnp_port_start函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: cmos_pnp_probe

static int cmos_pnp_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
{
	cmos_wake_setup(&pnp->dev);

	if (pnp_port_start(pnp, 0) == 0x70 && !pnp_irq_valid(pnp, 0))
		/* Some machines contain a PNP entry for the RTC, but
		 * don't define the IRQ. It should always be safe to
		 * hardcode it in these cases
		 */
		return cmos_do_probe(&pnp->dev,
				pnp_get_resource(pnp, IORESOURCE_IO, 0), 8);
	else
		return cmos_do_probe(&pnp->dev,
				pnp_get_resource(pnp, IORESOURCE_IO, 0),
				pnp_irq(pnp, 0));
}
开发者ID:RealJohnGalt,项目名称:linux,代码行数:16,代码来源:rtc-cmos.c

示例2: cmos_pnp_probe

static int __devinit
cmos_pnp_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
{
	/* REVISIT paranoia argues for a shutdown notifier, since PNP
	 * drivers can't provide shutdown() methods to disable IRQs.
	 * Or better yet, fix PNP to allow those methods...
	 */
	if (pnp_port_start(pnp,0) == 0x70 && !pnp_irq_valid(pnp,0))
		/* Some machines contain a PNP entry for the RTC, but
		 * don't define the IRQ. It should always be safe to
		 * hardcode it in these cases
		 */
		return cmos_do_probe(&pnp->dev, &pnp->res.port_resource[0], 8);
	else
		return cmos_do_probe(&pnp->dev,
				     &pnp->res.port_resource[0],
				     pnp->res.irq_resource[0].start);
}
开发者ID:mrtos,项目名称:Logitech-Revue,代码行数:18,代码来源:rtc-cmos.c

示例3: fmr2_pnp_probe

static int fmr2_pnp_probe(struct pnp_dev *pdev, const struct pnp_device_id *id)
{
    int ret;
    struct fmr2 *fmr2 = kzalloc(sizeof(*fmr2), GFP_KERNEL);
    if (!fmr2)
        return -ENOMEM;

    fmr2->is_fmd2 = true;
    ret = fmr2_probe(fmr2, &pdev->dev, pnp_port_start(pdev, 0));
    if (ret) {
        kfree(fmr2);
        return ret;
    }
    pnp_set_drvdata(pdev, fmr2);
    fmr2_cards[num_fmr2_cards++] = fmr2;

    return 0;
}
开发者ID:Niisp,项目名称:MT6795.kernel,代码行数:18,代码来源:radio-sf16fmr2.c

示例4: scl200wdt_pnp_probe

static int scl200wdt_pnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id)
{
	/* this driver only supports one card at a time */
	if (wdt_dev || !isapnp)
		return -EBUSY;

	wdt_dev = dev;
	io = pnp_port_start(wdt_dev, 0);
	io_len = pnp_port_len(wdt_dev, 0);

	if (!request_region(io, io_len, SC1200_MODULE_NAME)) {
		printk(KERN_ERR PFX "Unable to register IO port %#x\n", io);
		return -EBUSY;
	}

	printk(KERN_INFO "scl200wdt: PnP device found at io port %#x/%d\n", io, io_len);
	return 0;
}
开发者ID:cilynx,项目名称:dd-wrt,代码行数:18,代码来源:sc1200wdt.c

示例5: serial_pnp_probe

static int __devinit
serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
{
	struct uart_port port;
	int ret, line, flags = dev_id->driver_data;

	if (flags & UNKNOWN_DEV) {
		ret = serial_pnp_guess_board(dev, &flags);
		if (ret < 0)
			return ret;
	}

	memset(&port, 0, sizeof(struct uart_port));
	if (pnp_irq_valid(dev, 0))
		port.irq = pnp_irq(dev, 0);
	if (pnp_port_valid(dev, 0)) {
		port.iobase = pnp_port_start(dev, 0);
		port.iotype = UPIO_PORT;
	} else if (pnp_mem_valid(dev, 0)) {
		port.mapbase = pnp_mem_start(dev, 0);
		port.iotype = UPIO_MEM;
		port.flags = UPF_IOREMAP;
	} else
		return -ENODEV;

#ifdef SERIAL_DEBUG_PNP
	printk(KERN_DEBUG
		"Setup PNP port: port %x, mem 0x%lx, irq %d, type %d\n",
		       port.iobase, port.mapbase, port.irq, port.iotype);
#endif

	port.flags |= UPF_SKIP_TEST | UPF_BOOT_AUTOCONF;
	if (pnp_irq_flags(dev, 0) & IORESOURCE_IRQ_SHAREABLE)
		port.flags |= UPF_SHARE_IRQ;
	port.uartclk = 1843200;
	port.dev = &dev->dev;

	line = serial8250_register_port(&port);
	if (line < 0)
		return -ENODEV;

	pnp_set_drvdata(dev, (void *)((long)line + 1));
	return 0;
}
开发者ID:Medvedroid,项目名称:OT_903D-kernel-2.6.35.7,代码行数:44,代码来源:8250_pnp.c

示例6: radio_isa_pnp_probe

int radio_isa_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
{
	struct pnp_driver *pnp_drv = to_pnp_driver(dev->dev.driver);
	struct radio_isa_driver *drv = container_of(pnp_drv,
					struct radio_isa_driver, pnp_driver);
	struct radio_isa_card *isa;

	if (!pnp_port_valid(dev, 0))
		return -ENODEV;

	isa = radio_isa_alloc(drv, &dev->dev);
	if (!isa)
		return -ENOMEM;

	isa->io = pnp_port_start(dev, 0);

	return radio_isa_common_probe(isa, &dev->dev, drv->radio_nr_params[0],
					pnp_port_len(dev, 0));
}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:19,代码来源:radio-isa.c

示例7: fcpnp_probe

static int __devinit fcpnp_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id)
{
	struct fritz_adapter *adapter;
	int retval;

	if (!pdev)
		return(-ENODEV);

	retval = -ENOMEM;
	adapter = new_adapter();
	if (!adapter)
		goto err;

	pnp_set_drvdata(pdev, adapter);

	adapter->type = AVM_FRITZ_PNP;

	pnp_disable_dev(pdev);
	retval = pnp_activate_dev(pdev);
	if (retval < 0) {
		printk(KERN_WARNING "%s: pnp_activate_dev(%s) ret(%d)\n", __func__,
			(char *)dev_id->driver_data, retval);
		goto err_free;
	}
	adapter->io = pnp_port_start(pdev, 0);
	adapter->irq = pnp_irq(pdev, 0);

	printk(KERN_INFO "hisax_fcpcipnp: found adapter %s at IO %#x irq %d\n",
	       (char *) dev_id->driver_data, adapter->io, adapter->irq);

	retval = fcpcipnp_setup(adapter);
	if (retval)
		goto err_free;

	return 0;
	
 err_free:
	delete_adapter(adapter);
 err:
	return retval;
}
开发者ID:1703011,项目名称:asuswrt-merlin,代码行数:41,代码来源:hisax_fcpcipnp.c

示例8: c2_pnp_probe

/* it works in parport_pc's probe function, so why not here?  */
static int c2_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *id)
{
  if (pnp_port_valid(dev,0) &&
      !(pnp_port_flags(dev,0) & IORESOURCE_DISABLED)) {
    io_base = pnp_port_start(dev,0);
  }
  else {
    return -EINVAL;
  }
  if (pnp_irq_valid(dev,0) &&
      !(pnp_irq_flags(dev,0) & IORESOURCE_DISABLED)) {
    irq = pnp_irq(dev,0);
    if (request_irq(irq, c2_interrupt, SA_INTERRUPT, DEVICE_NAME, NULL)) {
      return -EINVAL;
    }
  }
  else {
    return -EINVAL;
  }

  return 0;
}
开发者ID:GBert,项目名称:misc,代码行数:23,代码来源:cygnal_c2.c

示例9: snd_card_es968_pnp

static int __devinit snd_card_es968_pnp(struct snd_card *card, unsigned int n,
					struct pnp_card_link *pcard,
					const struct pnp_card_device_id *pid)
{
	struct snd_es1688 *chip = card->private_data;
	struct pnp_dev *pdev;
	int error;

	pdev = pnp_request_card_device(pcard, pid->devs[0].id, NULL);
	if (pdev == NULL)
		return -ENODEV;

	error = pnp_activate_dev(pdev);
	if (error < 0) {
		snd_printk(KERN_ERR "ES968 pnp configure failure\n");
		return error;
	}
	port[n] = pnp_port_start(pdev, 0);
	dma8[n] = pnp_dma(pdev, 0);
	irq[n] = pnp_irq(pdev, 0);

	return snd_es1688_create(card, chip, port[n], mpu_port[n], irq[n],
				 mpu_irq[n], dma8[n], ES1688_HW_AUTO);
}
开发者ID:33d,项目名称:linux-2.6.21-hh20,代码行数:24,代码来源:es1688.c

示例10: snd_wavefront_pnp

static int
snd_wavefront_pnp (int dev, snd_wavefront_card_t *acard, struct pnp_card_link *card,
		   const struct pnp_card_device_id *id)
{
	struct pnp_dev *pdev;
	int err;

	/* Check for each logical device. */

	/* CS4232 chip (aka "windows sound system") is logical device 0 */

	acard->wss = pnp_request_card_device(card, id->devs[0].id, NULL);
	if (acard->wss == NULL)
		return -EBUSY;

	/* there is a game port at logical device 1, but we ignore it completely */

	/* the control interface is logical device 2, but we ignore it
	   completely. in fact, nobody even seems to know what it
	   does.
	*/

	/* Only configure the CS4232 MIDI interface if its been
	   specifically requested. It is logical device 3.
	*/

	if (use_cs4232_midi[dev]) {
		acard->mpu = pnp_request_card_device(card, id->devs[2].id, NULL);
		if (acard->mpu == NULL)
			return -EBUSY;
	}

	/* The ICS2115 synth is logical device 4 */

	acard->synth = pnp_request_card_device(card, id->devs[3].id, NULL);
	if (acard->synth == NULL)
		return -EBUSY;

	/* PCM/FM initialization */

	pdev = acard->wss;

	/* An interesting note from the Tropez+ FAQ:

	   Q. [Ports] Why is the base address of the WSS I/O ports off by 4?

	   A. WSS I/O requires a block of 8 I/O addresses ("ports"). Of these, the first
	   4 are used to identify and configure the board. With the advent of PnP,
	   these first 4 addresses have become obsolete, and software applications
	   only use the last 4 addresses to control the codec chip. Therefore, the
	   base address setting "skips past" the 4 unused addresses.

	*/

	err = pnp_activate_dev(pdev);
	if (err < 0) {
		snd_printk(KERN_ERR "PnP WSS pnp configure failure\n");
		return err;
	}

	cs4232_pcm_port[dev] = pnp_port_start(pdev, 0);
	fm_port[dev] = pnp_port_start(pdev, 1);
	dma1[dev] = pnp_dma(pdev, 0);
	dma2[dev] = pnp_dma(pdev, 1);
	cs4232_pcm_irq[dev] = pnp_irq(pdev, 0);

	/* Synth initialization */

	pdev = acard->synth;
	
	err = pnp_activate_dev(pdev);
	if (err < 0) {
		snd_printk(KERN_ERR "PnP ICS2115 pnp configure failure\n");
		return err;
	}

	ics2115_port[dev] = pnp_port_start(pdev, 0);
	ics2115_irq[dev] = pnp_irq(pdev, 0);

	/* CS4232 MPU initialization. Configure this only if
	   explicitly requested, since its physically inaccessible and
	   consumes another IRQ.
	*/

	if (use_cs4232_midi[dev]) {

		pdev = acard->mpu;

		err = pnp_activate_dev(pdev);
		if (err < 0) {
			snd_printk(KERN_ERR "PnP MPU401 pnp configure failure\n");
			cs4232_mpu_port[dev] = SNDRV_AUTO_PORT;
		} else {
			cs4232_mpu_port[dev] = pnp_port_start(pdev, 0);
			cs4232_mpu_irq[dev] = pnp_irq(pdev, 0);
		}

		snd_printk (KERN_INFO "CS4232 MPU: port=0x%lx, irq=%i\n", 
			    cs4232_mpu_port[dev], 
			    cs4232_mpu_irq[dev]);
//.........这里部分代码省略.........
开发者ID:AeroGirl,项目名称:VAR-SOM-AM33-SDK7-Kernel,代码行数:101,代码来源:wavefront.c

示例11: setup_niccy

int __init
setup_niccy(struct IsdnCard *card)
{
	struct IsdnCardState *cs = card->cs;
	char tmp[64];

	strcpy(tmp, niccy_revision);
	printk(KERN_INFO "HiSax: Niccy driver Rev. %s\n", HiSax_getrev(tmp));
	if (cs->typ != ISDN_CTYPE_NICCY)
		return (0);
#ifdef __ISAPNP__
	if (!card->para[1] && isapnp_present()) {
		struct pnp_dev *pnp_d = NULL;
		int err;

		if ((pnp_c = pnp_find_card(
			ISAPNP_VENDOR('S', 'D', 'A'),
			ISAPNP_FUNCTION(0x0150), pnp_c))) {
			if (!(pnp_d = pnp_find_dev(pnp_c,
				ISAPNP_VENDOR('S', 'D', 'A'),
				ISAPNP_FUNCTION(0x0150), pnp_d))) {
				printk(KERN_ERR "NiccyPnP: PnP error card found, no device\n");
				return (0);
			}
			pnp_disable_dev(pnp_d);
			err = pnp_activate_dev(pnp_d);
			if (err<0) {
				printk(KERN_WARNING "%s: pnp_activate_dev ret(%d)\n",
					__FUNCTION__, err);
				return(0);
			}
			card->para[1] = pnp_port_start(pnp_d, 0);
			card->para[2] = pnp_port_start(pnp_d, 1);
			card->para[0] = pnp_irq(pnp_d, 0);
			if (!card->para[0] || !card->para[1] || !card->para[2]) {
				printk(KERN_ERR "NiccyPnP:some resources are missing %ld/%lx/%lx\n",
					card->para[0], card->para[1], card->para[2]);
				pnp_disable_dev(pnp_d);
				return(0);
			}
		} else {
			printk(KERN_INFO "NiccyPnP: no ISAPnP card found\n");
		}
	}
#endif
	if (card->para[1]) {
		cs->hw.niccy.isac = card->para[1] + ISAC_PNP;
		cs->hw.niccy.hscx = card->para[1] + HSCX_PNP;
		cs->hw.niccy.isac_ale = card->para[2] + ISAC_PNP;
		cs->hw.niccy.hscx_ale = card->para[2] + HSCX_PNP;
		cs->hw.niccy.cfg_reg = 0;
		cs->subtyp = NICCY_PNP;
		cs->irq = card->para[0];
		if (!request_region(cs->hw.niccy.isac, 2, "niccy data")) {
			printk(KERN_WARNING
				"HiSax: %s data port %x-%x already in use\n",
				CardType[card->typ],
				cs->hw.niccy.isac,
				cs->hw.niccy.isac + 1);
			return (0);
		}
		if (!request_region(cs->hw.niccy.isac_ale, 2, "niccy addr")) {
			printk(KERN_WARNING
				"HiSax: %s address port %x-%x already in use\n",
				CardType[card->typ],
				cs->hw.niccy.isac_ale,
				cs->hw.niccy.isac_ale + 1);
			release_region(cs->hw.niccy.isac, 2);
			return (0);
		}
	} else {
#ifdef CONFIG_PCI
		u_int pci_ioaddr;
		cs->subtyp = 0;
		if ((niccy_dev = pci_find_device(PCI_VENDOR_ID_SATSAGEM,
			PCI_DEVICE_ID_SATSAGEM_NICCY, niccy_dev))) {
			if (pci_enable_device(niccy_dev))
				return(0);
			/* get IRQ */
			if (!niccy_dev->irq) {
				printk(KERN_WARNING "Niccy: No IRQ for PCI card found\n");
				return(0);
			}
			cs->irq = niccy_dev->irq;
			cs->hw.niccy.cfg_reg = pci_resource_start(niccy_dev, 0);
			if (!cs->hw.niccy.cfg_reg) {
				printk(KERN_WARNING "Niccy: No IO-Adr for PCI cfg found\n");
				return(0);
			}
			pci_ioaddr = pci_resource_start(niccy_dev, 1);
			if (!pci_ioaddr) {
				printk(KERN_WARNING "Niccy: No IO-Adr for PCI card found\n");
				return(0);
			}
			cs->subtyp = NICCY_PCI;
		} else {
			printk(KERN_WARNING "Niccy: No PCI card found\n");
			return(0);
		}
		cs->irq_flags |= SA_SHIRQ;
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:tew632-brp-svn,代码行数:101,代码来源:niccy.c

示例12: ite_probe

static int ite_probe(struct pnp_dev *pdev, const struct pnp_device_id
		     *dev_id)
{
	const struct ite_dev_params *dev_desc = NULL;
	struct ite_dev *itdev = NULL;
	struct rc_dev *rdev = NULL;
	int ret = -ENOMEM;
	int model_no;
	int io_rsrc_no;

	ite_dbg("%s called", __func__);

	itdev = kzalloc(sizeof(struct ite_dev), GFP_KERNEL);
	if (!itdev)
		return ret;

	
	rdev = rc_allocate_device();
	if (!rdev)
		goto failure;

	ret = -ENODEV;

	
	model_no = (int)dev_id->driver_data;
	ite_pr(KERN_NOTICE, "Auto-detected model: %s\n",
		ite_dev_descs[model_no].model);

	if (model_number >= 0 && model_number < ARRAY_SIZE(ite_dev_descs)) {
		model_no = model_number;
		ite_pr(KERN_NOTICE, "The model has been fixed by a module "
			"parameter.");
	}

	ite_pr(KERN_NOTICE, "Using model: %s\n", ite_dev_descs[model_no].model);

	
	dev_desc = &ite_dev_descs[model_no];
	io_rsrc_no = dev_desc->io_rsrc_no;

	
	if (!pnp_port_valid(pdev, io_rsrc_no) ||
	    pnp_port_len(pdev, io_rsrc_no) != dev_desc->io_region_size) {
		dev_err(&pdev->dev, "IR PNP Port not valid!\n");
		goto failure;
	}

	if (!pnp_irq_valid(pdev, 0)) {
		dev_err(&pdev->dev, "PNP IRQ not valid!\n");
		goto failure;
	}

	
	itdev->cir_addr = pnp_port_start(pdev, io_rsrc_no);
	itdev->cir_irq = pnp_irq(pdev, 0);

	
	spin_lock_init(&itdev->lock);

	
	init_ir_raw_event(&itdev->rawir);

	
	pnp_set_drvdata(pdev, itdev);
	itdev->pdev = pdev;

	
	init_waitqueue_head(&itdev->tx_queue);
	init_waitqueue_head(&itdev->tx_ended);

	
	itdev->params = *dev_desc;

	
	if (sample_period > 0)
		itdev->params.sample_period = sample_period;

	if (tx_carrier_freq > 0)
		itdev->params.tx_carrier_freq = tx_carrier_freq;

	if (tx_duty_cycle > 0 && tx_duty_cycle <= 100)
		itdev->params.tx_duty_cycle = tx_duty_cycle;

	if (rx_low_carrier_freq > 0)
		itdev->params.rx_low_carrier_freq = rx_low_carrier_freq;

	if (rx_high_carrier_freq > 0)
		itdev->params.rx_high_carrier_freq = rx_high_carrier_freq;

	
	ite_pr(KERN_NOTICE, "TX-capable: %d\n", (int)
			 itdev->params.hw_tx_capable);
	ite_pr(KERN_NOTICE, "Sample period (ns): %ld\n", (long)
		     itdev->params.sample_period);
	ite_pr(KERN_NOTICE, "TX carrier frequency (Hz): %d\n", (int)
		     itdev->params.tx_carrier_freq);
	ite_pr(KERN_NOTICE, "TX duty cycle (%%): %d\n", (int)
		     itdev->params.tx_duty_cycle);
	ite_pr(KERN_NOTICE, "RX low carrier frequency (Hz): %d\n", (int)
		     itdev->params.rx_low_carrier_freq);
//.........这里部分代码省略.........
开发者ID:DirtyDroidX,项目名称:android_kernel_htc_m8ul,代码行数:101,代码来源:ite-cir.c

示例13: sscape_pnp_detect

static int __devinit sscape_pnp_detect(struct pnp_card_link *pcard,
				       const struct pnp_card_device_id *pid)
{
	static int idx = 0;
	struct pnp_dev *dev;
	struct snd_card *card;
	int ret;

	/*
	 * Allow this function to fail *quietly* if all the ISA PnP
	 * devices were configured using module parameters instead.
	 */
	if ((idx = get_next_autoindex(idx)) >= SNDRV_CARDS)
		return -ENOSPC;

	/*
	 * We have found a candidate ISA PnP card. Now we
	 * have to check that it has the devices that we
	 * expect it to have.
	 *
	 * We will NOT try and autoconfigure all of the resources
	 * needed and then activate the card as we are assuming that
	 * has already been done at boot-time using /proc/isapnp.
	 * We shall simply try to give each active card the resources
	 * that it wants. This is a sensible strategy for a modular
	 * system where unused modules are unloaded regularly.
	 *
	 * This strategy is utterly useless if we compile the driver
	 * into the kernel, of course.
	 */
	// printk(KERN_INFO "sscape: %s\n", card->name);

	/*
	 * Check that we still have room for another sound card ...
	 */
	dev = pnp_request_card_device(pcard, pid->devs[0].id, NULL);
	if (! dev)
		return -ENODEV;

	if (!pnp_is_active(dev)) {
		if (pnp_activate_dev(dev) < 0) {
			printk(KERN_INFO "sscape: device is inactive\n");
			return -EBUSY;
		}
	}

	/*
	 * Read the correct parameters off the ISA PnP bus ...
	 */
	port[idx] = pnp_port_start(dev, 0);
	irq[idx] = pnp_irq(dev, 0);
	mpu_irq[idx] = pnp_irq(dev, 1);
	dma[idx] = pnp_dma(dev, 0) & 0x03;

	ret = create_sscape(idx, &card);
	if (ret < 0)
		return ret;
	snd_card_set_dev(card, &pcard->card->dev);
	if ((ret = snd_card_register(card)) < 0) {
		printk(KERN_ERR "sscape: Failed to register sound card\n");
		snd_card_free(card);
		return ret;
	}

	pnp_set_card_drvdata(pcard, card);
	++idx;

	return ret;
}
开发者ID:FatSunHYS,项目名称:OSCourseDesign,代码行数:69,代码来源:sscape.c

示例14: setup_diva

int __init
setup_diva(struct IsdnCard *card)
{
	int bytecnt = 8;
	u_char val;
	struct IsdnCardState *cs = card->cs;
	char tmp[64];

	strcpy(tmp, Diva_revision);
	printk(KERN_INFO "HiSax: Eicon.Diehl Diva driver Rev. %s\n", HiSax_getrev(tmp));
	if (cs->typ != ISDN_CTYPE_DIEHLDIVA)
		return(0);
	cs->hw.diva.status = 0;
	if (card->para[1]) {
		cs->hw.diva.ctrl_reg = 0;
		cs->hw.diva.cfg_reg = card->para[1];
		val = readreg(cs->hw.diva.cfg_reg + DIVA_IPAC_ADR,
			cs->hw.diva.cfg_reg + DIVA_IPAC_DATA, IPAC_ID);
		printk(KERN_INFO "Diva: IPAC version %x\n", val);
		if ((val == 1) || (val==2)) {
			cs->subtyp = DIVA_IPAC_ISA;
			cs->hw.diva.ctrl = 0;
			cs->hw.diva.isac = card->para[1] + DIVA_IPAC_DATA;
			cs->hw.diva.hscx = card->para[1] + DIVA_IPAC_DATA;
			cs->hw.diva.isac_adr = card->para[1] + DIVA_IPAC_ADR;
			cs->hw.diva.hscx_adr = card->para[1] + DIVA_IPAC_ADR;
			test_and_set_bit(HW_IPAC, &cs->HW_Flags);
		} else {
			cs->subtyp = DIVA_ISA;
			cs->hw.diva.ctrl = card->para[1] + DIVA_ISA_CTRL;
			cs->hw.diva.isac = card->para[1] + DIVA_ISA_ISAC_DATA;
			cs->hw.diva.hscx = card->para[1] + DIVA_HSCX_DATA;
			cs->hw.diva.isac_adr = card->para[1] + DIVA_ISA_ISAC_ADR;
			cs->hw.diva.hscx_adr = card->para[1] + DIVA_HSCX_ADR;
		}
		cs->irq = card->para[0];
	} else {
#ifdef __ISAPNP__
		if (isapnp_present()) {
			struct pnp_dev *pnp_d;
			while(ipid->card_vendor) {
				if ((pnp_c = pnp_find_card(ipid->card_vendor,
					ipid->card_device, pnp_c))) {
					pnp_d = NULL;
					if ((pnp_d = pnp_find_dev(pnp_c,
						ipid->vendor, ipid->function, pnp_d))) {
						int err;

						printk(KERN_INFO "HiSax: %s detected\n",
							(char *)ipid->driver_data);
						pnp_disable_dev(pnp_d);
						err = pnp_activate_dev(pnp_d);
						if (err<0) {
							printk(KERN_WARNING "%s: pnp_activate_dev ret(%d)\n",
								__FUNCTION__, err);
							return(0);
						}
						card->para[1] = pnp_port_start(pnp_d, 0);
						card->para[0] = pnp_irq(pnp_d, 0);
						if (!card->para[0] || !card->para[1]) {
							printk(KERN_ERR "Diva PnP:some resources are missing %ld/%lx\n",
								card->para[0], card->para[1]);
							pnp_disable_dev(pnp_d); 
							return(0);
						}
						cs->hw.diva.cfg_reg  = card->para[1];
						cs->irq = card->para[0];
						if (ipid->function == ISAPNP_FUNCTION(0xA1)) {
							cs->subtyp = DIVA_IPAC_ISA;
							cs->hw.diva.ctrl = 0;
							cs->hw.diva.isac =
								card->para[1] + DIVA_IPAC_DATA;
							cs->hw.diva.hscx =
								card->para[1] + DIVA_IPAC_DATA;
							cs->hw.diva.isac_adr =
								card->para[1] + DIVA_IPAC_ADR;
							cs->hw.diva.hscx_adr =
								card->para[1] + DIVA_IPAC_ADR;
							test_and_set_bit(HW_IPAC, &cs->HW_Flags);
						} else {
							cs->subtyp = DIVA_ISA;
							cs->hw.diva.ctrl =
								card->para[1] + DIVA_ISA_CTRL;
							cs->hw.diva.isac =
								card->para[1] + DIVA_ISA_ISAC_DATA;
							cs->hw.diva.hscx =
								card->para[1] + DIVA_HSCX_DATA;
							cs->hw.diva.isac_adr =
								card->para[1] + DIVA_ISA_ISAC_ADR;
							cs->hw.diva.hscx_adr =
								card->para[1] + DIVA_HSCX_ADR;
						}
						goto ready;
					} else {
						printk(KERN_ERR "Diva PnP: PnP error card found, no device\n");
						return(0);
					}
				}
				ipid++;
				pnp_c=NULL;
//.........这里部分代码省略.........
开发者ID:jameshilliard,项目名称:actiontec_opensrc_mi424wr-rev-e-f_fw-20-10-7-5,代码行数:101,代码来源:diva.c

示例15: setup_diva_isapnp

static int setup_diva_isapnp(struct IsdnCard *card)
{
	struct IsdnCardState *cs = card->cs;
	struct pnp_dev *pnp_d;

	if (!isapnp_present())
		return (-1);	/* card not found; continue search */

	while (ipid->card_vendor) {
		if ((pnp_c = pnp_find_card(ipid->card_vendor,
					   ipid->card_device, pnp_c))) {
			pnp_d = NULL;
			if ((pnp_d = pnp_find_dev(pnp_c,
						  ipid->vendor, ipid->function, pnp_d))) {
				int err;

				printk(KERN_INFO "HiSax: %s detected\n",
				       (char *)ipid->driver_data);
				pnp_disable_dev(pnp_d);
				err = pnp_activate_dev(pnp_d);
				if (err < 0) {
					printk(KERN_WARNING "%s: pnp_activate_dev ret(%d)\n",
					       __func__, err);
					return (0);
				}
				card->para[1] = pnp_port_start(pnp_d, 0);
				card->para[0] = pnp_irq(pnp_d, 0);
				if (!card->para[0] || !card->para[1]) {
					printk(KERN_ERR "Diva PnP:some resources are missing %ld/%lx\n",
					       card->para[0], card->para[1]);
					pnp_disable_dev(pnp_d);
					return (0);
				}
				cs->hw.diva.cfg_reg  = card->para[1];
				cs->irq = card->para[0];
				if (ipid->function == ISAPNP_FUNCTION(0xA1)) {
					cs->subtyp = DIVA_IPAC_ISA;
					cs->hw.diva.ctrl = 0;
					cs->hw.diva.isac =
						card->para[1] + DIVA_IPAC_DATA;
					cs->hw.diva.hscx =
						card->para[1] + DIVA_IPAC_DATA;
					cs->hw.diva.isac_adr =
						card->para[1] + DIVA_IPAC_ADR;
					cs->hw.diva.hscx_adr =
						card->para[1] + DIVA_IPAC_ADR;
					test_and_set_bit(HW_IPAC, &cs->HW_Flags);
				} else {
					cs->subtyp = DIVA_ISA;
					cs->hw.diva.ctrl =
						card->para[1] + DIVA_ISA_CTRL;
					cs->hw.diva.isac =
						card->para[1] + DIVA_ISA_ISAC_DATA;
					cs->hw.diva.hscx =
						card->para[1] + DIVA_HSCX_DATA;
					cs->hw.diva.isac_adr =
						card->para[1] + DIVA_ISA_ISAC_ADR;
					cs->hw.diva.hscx_adr =
						card->para[1] + DIVA_HSCX_ADR;
				}
				return (1);		/* card found */
			} else {
				printk(KERN_ERR "Diva PnP: PnP error card found, no device\n");
				return (0);
			}
		}
		ipid++;
		pnp_c = NULL;
	}

	return (-1);	/* card not found; continue search */
}
开发者ID:asmalldev,项目名称:linux,代码行数:72,代码来源:diva.c


注:本文中的pnp_port_start函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。