• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ pnp_irq函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: setup_asuscom

int __init
setup_asuscom(struct IsdnCard *card)
{
	char tmp[64];

	strcpy(tmp, Asuscom_revision);
	printk(KERN_INFO "HiSax: Asuscom ISDNLink driver Rev. %s\n", HiSax_getrev(tmp));
#ifdef __ISAPNP__
	if (!card->para[1] && isapnp_present()) {
		struct pnp_card *pb;
		struct pnp_dev *pd;

		while(adev->card_vendor) {
			if ((pb = pnp_find_card(adev->card_vendor,
						adev->card_device,
						pnp_c))) {
				pnp_c = pb;
				pd = NULL;
				if ((pd = pnp_find_dev(pnp_c,
						       adev->vendor,
						       adev->function,
						       pd))) {
					printk(KERN_INFO "HiSax: %s detected\n",
						(char *)adev->driver_data);
					if (pnp_device_attach(pd) < 0) {
						printk(KERN_ERR "AsusPnP: attach failed\n");
						return 0;
					}
					if (pnp_activate_dev(pd) < 0) {
						printk(KERN_ERR "AsusPnP: activate failed\n");
						pnp_device_detach(pd);
						return 0;
					}
					if (!pnp_irq_valid(pd, 0) || !pnp_port_valid(pd, 0)) {
						printk(KERN_ERR "AsusPnP:some resources are missing %ld/%lx\n",
							pnp_irq(pd, 0), pnp_port_start(pd, 0));
						pnp_device_detach(pd);
						return(0);
					}
					card->para[1] = pnp_port_start(pd, 0);
					card->para[0] = pnp_irq(pd, 0);
					break;
				} else {
					printk(KERN_ERR "AsusPnP: PnP error card found, no device\n");
				}
			}
			adev++;
			pnp_c=NULL;
		} 
		if (!adev->card_vendor) {
			printk(KERN_INFO "AsusPnP: no ISAPnP card found\n");
			return(0);
		}
	}
#endif
	if (asuscom_probe(card->cs, card) < 0)
		return 0;
	return 1;
}
开发者ID:sarnobat,项目名称:knoppix,代码行数:59,代码来源:asuscom.c


示例2: snd_mpu401_pnp

static int __devinit snd_mpu401_pnp(int dev, struct pnp_dev *device,
				 const struct pnp_device_id *id)
{
	if (!pnp_port_valid(device, 0) ||
	    pnp_port_flags(device, 0) & IORESOURCE_DISABLED) {
		snd_printk(KERN_ERR "no PnP port\n");
		return -ENODEV;
	}
	if (pnp_port_len(device, 0) < IO_EXTENT) {
		snd_printk(KERN_ERR "PnP port length is %llu, expected %d\n",
			   (unsigned long long)pnp_port_len(device, 0),
			   IO_EXTENT);
		return -ENODEV;
	}
	port[dev] = pnp_port_start(device, 0);

	if (!pnp_irq_valid(device, 0) ||
	    pnp_irq_flags(device, 0) & IORESOURCE_DISABLED) {
		snd_printk(KERN_WARNING "no PnP irq, using polling\n");
		irq[dev] = -1;
	} else {
		irq[dev] = pnp_irq(device, 0);
	}
	return 0;
}
开发者ID:StephenMacras,项目名称:dsl-n55u-bender,代码行数:25,代码来源:mpu401.c


示例3: idepnp_probe

static int idepnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id)
{
	hw_regs_t hw;
	ide_hwif_t *hwif;
	int index;

	if (!(pnp_port_valid(dev, 0) && pnp_port_valid(dev, 1) && pnp_irq_valid(dev, 0)))
		return -1;

	memset(&hw, 0, sizeof(hw));
	ide_std_init_ports(&hw, pnp_port_start(dev, 0),
				pnp_port_start(dev, 1));
	hw.irq = pnp_irq(dev, 0);
	hw.dma = NO_DMA;

	index = ide_register_hw(&hw, &hwif);

	if (index != -1) {
	    	printk(KERN_INFO "ide%d: generic PnP IDE interface\n", index);
		pnp_set_drvdata(dev,hwif);
		return 0;
	}

	return -1;
}
开发者ID:Antonio-Zhou,项目名称:Linux-2.6.11,代码行数:25,代码来源:ide-pnp.c


示例4: idepnp_probe

static int idepnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id)
{
	hw_regs_t hw;
	ide_hwif_t *hwif;
	int index;

	if (!(pnp_port_valid(dev, 0) && pnp_port_valid(dev, 1) && pnp_irq_valid(dev, 0)))
		return -1;

	ide_setup_ports(&hw, (unsigned long) pnp_port_start(dev, 0),
			generic_ide_offsets,
			(unsigned long) pnp_port_start(dev, 1),
			0, NULL,
//			generic_pnp_ide_iops,
			pnp_irq(dev, 0));

	index = ide_register_hw(&hw, &hwif);

	if (index != -1) {
	    	printk(KERN_INFO "ide%d: generic PnP IDE interface\n", index);
		pnp_set_drvdata(dev,hwif);
		return 0;
	}

	return -1;
}
开发者ID:wxlong,项目名称:Test,代码行数:26,代码来源:ide-pnp.c


示例5: setup_sedlbauer_isapnp

static int __devinit
setup_sedlbauer_isapnp(struct IsdnCard *card, int *bytecnt)
{
	struct IsdnCardState *cs = card->cs;
	struct pnp_dev *pnp_d;

	if (!isapnp_present())
		return -1;

	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 "Sedlbauer PnP:some resources are missing %ld/%lx\n",
						card->para[0], card->para[1]);
					pnp_disable_dev(pnp_d);
					return(0);
				}
				cs->hw.sedl.cfg_reg = card->para[1];
				cs->irq = card->para[0];
				if (ipid->function == ISAPNP_FUNCTION(0x2)) {
					cs->subtyp = SEDL_SPEED_FAX;
					cs->hw.sedl.chip = SEDL_CHIP_ISAC_ISAR;
					*bytecnt = 16;
				} else {
					cs->subtyp = SEDL_SPEED_CARD_WIN;
					cs->hw.sedl.chip = SEDL_CHIP_TEST;
				}

				return (1);
			} else {
				printk(KERN_ERR "Sedlbauer PnP: PnP error card found, no device\n");
				return(0);
			}
		}
		ipid++;
		pnp_c = NULL;
	} 

	printk(KERN_INFO "Sedlbauer PnP: no ISAPnP card found\n");
	return -1;
}
开发者ID:458941968,项目名称:mini2440-kernel-2.6.29,代码行数:59,代码来源:sedlbauer.c


示例6: pnp_is_active

/**
 * pnp_is_active - Determines if a device is active based on its current
 *	resources
 * @dev: pointer to the desired PnP device
 */
int pnp_is_active(struct pnp_dev *dev)
{
	if (!pnp_port_start(dev, 0) && pnp_port_len(dev, 0) <= 1 &&
	    !pnp_mem_start(dev, 0) && pnp_mem_len(dev, 0) <= 1 &&
	    pnp_irq(dev, 0) == -1 && pnp_dma(dev, 0) == -1)
		return 0;
	else
		return 1;
}
开发者ID:PennPanda,项目名称:linux-repo,代码行数:14,代码来源:support.c


示例7: serial_pnp_probe

static int
serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
{
	struct uart_8250_port uart;
	int ret, line, flags = dev_id->driver_data;
	struct resource *res = NULL;

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

	memset(&uart, 0, sizeof(uart));
	if (pnp_irq_valid(dev, 0))
		uart.port.irq = pnp_irq(dev, 0);
	if ((flags & CIR_PORT) && pnp_port_valid(dev, 2))
		res = pnp_get_resource(dev, IORESOURCE_IO, 2);
	else if (pnp_port_valid(dev, 0))
		res = pnp_get_resource(dev, IORESOURCE_IO, 0);
	if (pnp_resource_enabled(res)) {
		uart.port.iobase = res->start;
		uart.port.iotype = UPIO_PORT;
	} else if (pnp_mem_valid(dev, 0)) {
		uart.port.mapbase = pnp_mem_start(dev, 0);
		uart.port.iotype = UPIO_MEM;
		uart.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",
		       uart.port.iobase, uart.port.mapbase, uart.port.irq, uart.port.iotype);
#endif
	if (flags & CIR_PORT) {
		uart.port.flags |= UPF_FIXED_PORT | UPF_FIXED_TYPE;
		uart.port.type = PORT_8250_CIR;
	}

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

	line = serial8250_register_8250_port(&uart);
	if (line < 0 || (flags & CIR_PORT))
		return -ENODEV;

	pnp_set_drvdata(dev, (void *)((long)line + 1));
	return 0;
}
开发者ID:Babel-builder,项目名称:linux,代码行数:53,代码来源:8250_pnp.c


示例8: snd_card_ad1816a_pnp

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

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

	err = pnp_activate_dev(pdev);
	if (err < 0) {
		printk(KERN_ERR PFX "AUDIO PnP configure failure\n");
		return -EBUSY;
	}

	port[dev] = pnp_port_start(pdev, 2);
	fm_port[dev] = pnp_port_start(pdev, 1);
	dma1[dev] = pnp_dma(pdev, 0);
	dma2[dev] = pnp_dma(pdev, 1);
	irq[dev] = pnp_irq(pdev, 0);

	pdev = pnp_request_card_device(card, id->devs[1].id, NULL);
	if (pdev == NULL) {
		mpu_port[dev] = -1;
		snd_printk(KERN_WARNING PFX "MPU401 device busy, skipping.\n");
		return 0;
	}

	err = pnp_activate_dev(pdev);
	if (err < 0) {
		printk(KERN_ERR PFX "MPU401 PnP configure failure\n");
		mpu_port[dev] = -1;
	} else {
		mpu_port[dev] = pnp_port_start(pdev, 0);
		mpu_irq[dev] = pnp_irq(pdev, 0);
	}

	return 0;
}
开发者ID:AD5GB,项目名称:kernel_n5_3.10-experimental,代码行数:40,代码来源:ad1816a.c


示例9: isapnp_init_one

static int isapnp_init_one(struct pnp_dev *idev, const struct pnp_device_id *dev_id)
{
	struct ata_host *host;
	struct ata_port *ap;
	void __iomem *cmd_addr, *ctl_addr;
	int irq = 0;
	irq_handler_t handler = NULL;

	if (pnp_port_valid(idev, 0) == 0)
		return -ENODEV;

	if (pnp_irq_valid(idev, 0)) {
		irq = pnp_irq(idev, 0);
		handler = ata_sff_interrupt;
	}

	/* allocate host */
	host = ata_host_alloc(&idev->dev, 1);
	if (!host)
		return -ENOMEM;

	/* acquire resources and fill host */
	cmd_addr = devm_ioport_map(&idev->dev, pnp_port_start(idev, 0), 8);
	if (!cmd_addr)
		return -ENOMEM;

	ap = host->ports[0];

	ap->ops = &isapnp_noalt_port_ops;
	ap->pio_mask = ATA_PIO0;
	ap->flags |= ATA_FLAG_SLAVE_POSS;

	ap->ioaddr.cmd_addr = cmd_addr;

	if (pnp_port_valid(idev, 1)) {
		ctl_addr = devm_ioport_map(&idev->dev,
					   pnp_port_start(idev, 1), 1);
		ap->ioaddr.altstatus_addr = ctl_addr;
		ap->ioaddr.ctl_addr = ctl_addr;
		ap->ops = &isapnp_port_ops;
	}

	ata_sff_std_ports(&ap->ioaddr);

	ata_port_desc(ap, "cmd 0x%llx ctl 0x%llx",
		      (unsigned long long)pnp_port_start(idev, 0),
		      (unsigned long long)pnp_port_start(idev, 1));

	/* activate */
	return ata_host_activate(host, irq, handler, 0,
				 &isapnp_sht);
}
开发者ID:168519,项目名称:linux,代码行数:52,代码来源:pata_isapnp.c


示例10: cmos_pnp_probe

static int __devinit
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))
		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:DirtyDroidX,项目名称:android_kernel_htc_m8ul,代码行数:13,代码来源:rtc-cmos.c


示例11: idepnp_probe

static int idepnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
{
    hw_regs_t hw;
    ide_hwif_t *hwif;
    unsigned long base, ctl;

    if (!(pnp_port_valid(dev, 0) && pnp_port_valid(dev, 1) && pnp_irq_valid(dev, 0)))
        return -1;

    base = pnp_port_start(dev, 0);
    ctl = pnp_port_start(dev, 1);

    if (!request_region(base, 8, DRV_NAME)) {
        printk(KERN_ERR "%s: I/O resource 0x%lX-0x%lX not free.\n",
                DRV_NAME, base, base + 7);
        return -EBUSY;
    }

    if (!request_region(ctl, 1, DRV_NAME)) {
        printk(KERN_ERR "%s: I/O resource 0x%lX not free.\n",
                DRV_NAME, ctl);
        release_region(base, 8);
        return -EBUSY;
    }

    memset(&hw, 0, sizeof(hw));
    ide_std_init_ports(&hw, base, ctl);
    hw.irq = pnp_irq(dev, 0);
    hw.chipset = ide_generic;

    hwif = ide_find_port();
    if (hwif) {
        u8 index = hwif->index;
        u8 idx[4] = { index, 0xff, 0xff, 0xff };

        ide_init_port_data(hwif, index);
        ide_init_port_hw(hwif, &hw);

        printk(KERN_INFO "ide%d: generic PnP IDE interface\n", index);
        pnp_set_drvdata(dev, hwif);

        ide_device_add(idx, NULL);

        return 0;
    }

    release_region(ctl, 1);
    release_region(base, 8);

    return -1;
}
开发者ID:274914765,项目名称:C,代码行数:51,代码来源:ide-pnp.c


示例12: generic_NCR5380_pnp_probe

static int generic_NCR5380_pnp_probe(struct pnp_dev *pdev,
			       const struct pnp_device_id *id)
{
	int base, irq;

	if (pnp_activate_dev(pdev) < 0)
		return -EBUSY;

	base = pnp_port_start(pdev, 0);
	irq = pnp_irq(pdev, 0);

	return generic_NCR5380_init_one(&driver_template, &pdev->dev, base, irq,
				       id->driver_data);
}
开发者ID:forgivemyheart,项目名称:linux,代码行数:14,代码来源:g_NCR5380.c


示例13: idepnp_probe

static int idepnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
{
    struct ide_host *host;
    unsigned long base, ctl;
    int rc;
    struct ide_hw hw, *hws[] = { &hw };

#ifdef CONFIG_DEBUG_PRINTK
    printk(KERN_INFO DRV_NAME ": generic PnP IDE interface\n");
#else
    ;
#endif

    if (!(pnp_port_valid(dev, 0) && pnp_port_valid(dev, 1) && pnp_irq_valid(dev, 0)))
        return -1;

    base = pnp_port_start(dev, 0);
    ctl = pnp_port_start(dev, 1);

    if (!request_region(base, 8, DRV_NAME)) {
        printk(KERN_ERR "%s: I/O resource 0x%lX-0x%lX not free.\n",
               DRV_NAME, base, base + 7);
        return -EBUSY;
    }

    if (!request_region(ctl, 1, DRV_NAME)) {
        printk(KERN_ERR "%s: I/O resource 0x%lX not free.\n",
               DRV_NAME, ctl);
        release_region(base, 8);
        return -EBUSY;
    }

    memset(&hw, 0, sizeof(hw));
    ide_std_init_ports(&hw, base, ctl);
    hw.irq = pnp_irq(dev, 0);

    rc = ide_host_add(&ide_pnp_port_info, hws, 1, &host);
    if (rc)
        goto out;

    pnp_set_drvdata(dev, host);

    return 0;
out:
    release_region(ctl, 1);
    release_region(base, 8);

    return rc;
}
开发者ID:nos1609,项目名称:Chrono_Kernel-1,代码行数:49,代码来源:ide-pnp.c


示例14: cmos_pnp_probe

static int __devinit
cmos_pnp_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
{
	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:LouZiffer,项目名称:m900_kernel_cupcake-SDX,代码行数:15,代码来源:rtc-cmos.c


示例15: parport_pc_pnp_probe

static int parport_pc_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *id)
{
    struct parport *pdata;
    unsigned long io_lo, io_hi;
    int dma, irq;

    if (pnp_port_valid(dev, 0) && !(pnp_port_flags(dev, 0) & IORESOURCE_DISABLED))
    {
        io_lo = pnp_port_start(dev, 0);
    }
    else
        return -EINVAL;

#if 0
        if (pnp_port_valid(dev,1) &&
                !(pnp_port_flags(dev,1) & IORESOURCE_DISABLED)) {
                io_hi = pnp_port_start(dev,1);
        } else
                io_hi = 0;
#endif

#if 0
        if (pnp_irq_valid(dev,0) &&
                !(pnp_irq_flags(dev,0) & IORESOURCE_DISABLED)) {
                irq = pnp_irq(dev,0);
        } else
                irq = PARPORT_IRQ_NONE;
#endif

#if 0
        if (pnp_dma_valid(dev,0) &&
                !(pnp_dma_flags(dev,0) & IORESOURCE_DISABLED)) {
                dma = pnp_dma(dev,0);
        } else
                dma = PARPORT_DMA_NONE;
#endif

#if 0
        printk(KERN_INFO "parport: PnPBIOS parport detected.\n");
        if (!(pdata = parport_pc_probe_port (io_lo, io_hi, irq, dma, NULL)))
                return -ENODEV;

        pnp_set_drvdata(dev,pdata);
#endif
    return 0;
}
开发者ID:nixz,项目名称:covise,代码行数:46,代码来源:genlock.c


示例16: 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


示例17: 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


示例18: 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


示例19: 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


示例20: ni_atmio_attach

static int ni_atmio_attach(struct comedi_device *dev,
			   struct comedi_devconfig *it)
{
	struct pnp_dev *isapnp_dev;
	int ret;
	unsigned long iobase;
	int board;
	unsigned int irq;

	/* allocate private area */
	ret = ni_alloc_private(dev);
	if (ret < 0)
		return ret;

	devpriv->stc_writew = &ni_atmio_win_out;
	devpriv->stc_readw = &ni_atmio_win_in;
	devpriv->stc_writel = &win_out2;
	devpriv->stc_readl = &win_in2;

	iobase = it->options[0];
	irq = it->options[1];
	isapnp_dev = NULL;
	if (iobase == 0) {
		ret = ni_isapnp_find_board(&isapnp_dev);
		if (ret < 0)
			return ret;

		iobase = pnp_port_start(isapnp_dev, 0);
		irq = pnp_irq(isapnp_dev, 0);
		devpriv->isapnp_dev = isapnp_dev;
	}

	/* reserve our I/O region */

	printk("comedi%d: ni_atmio: 0x%04lx", dev->minor, iobase);
	if (!request_region(iobase, NI_SIZE, "ni_atmio")) {
		printk(" I/O port conflict\n");
		return -EIO;
	}

	dev->iobase = iobase;

#ifdef DEBUG
	/* board existence sanity check */
	{
		int i;

		printk(" board fingerprint:");
		for (i = 0; i < 16; i += 2) {
			printk(" %04x %02x", inw(dev->iobase + i),
			       inb(dev->iobase + i + 1));
		}
	}
#endif

	/* get board type */

	board = ni_getboardtype(dev);
	if (board < 0)
		return -EIO;

	dev->board_ptr = ni_boards + board;

	printk(" %s", boardtype.name);
	dev->board_name = boardtype.name;

	/* irq stuff */

	if (irq != 0) {
		if (irq > 15 || ni_irqpin[irq] == -1) {
			printk(" invalid irq %u\n", irq);
			return -EINVAL;
		}
		printk(" ( irq = %u )", irq);
		ret = request_irq(irq, ni_E_interrupt, NI_E_IRQ_FLAGS,
				  "ni_atmio", dev);

		if (ret < 0) {
			printk(" irq not available\n");
			return -EINVAL;
		}
		dev->irq = irq;
	}

	/* generic E series stuff in ni_mio_common.c */

	ret = ni_E_init(dev, it);
	if (ret < 0)
		return ret;


	return 0;
}
开发者ID:0xroot,项目名称:Blackphone-BP1-Kernel,代码行数:93,代码来源:ni_atmio.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ pnp_port_start函数代码示例发布时间:2022-05-30
下一篇:
C++ pnp_hdr函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap