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


C++ ISA_PNP_PROBE函数代码示例

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


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

示例1: ata_isa_probe

static int
ata_isa_probe(device_t dev)
{
    struct ata_channel *ch = device_get_softc(dev);
    struct resource *io;
    u_long tmp;
    int rid;

    /* check isapnp ids */
    if (ISA_PNP_PROBE(device_get_parent(dev), dev, ata_ids) == ENXIO)
	return ENXIO;
    
    /* allocate the io port range to get the start address */
    rid = ATA_IOADDR_RID;
    io = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0,
			    ATA_IOSIZE, RF_ACTIVE);
    if (!io)
	return ENOMEM;

    /* set the altport range */
    if (bus_get_resource(dev, SYS_RES_IOPORT, ATA_ALTADDR_RID, &tmp, &tmp)) {
	bus_set_resource(dev, SYS_RES_IOPORT, ATA_ALTADDR_RID,
			 rman_get_start(io) + ATA_ALTOFFSET, ATA_ALTIOSIZE);
    }

    bus_release_resource(dev, SYS_RES_IOPORT, rid, io);
    ch->unit = 0;
    ch->flags |= ATA_USE_16BIT;
    return ata_probe(dev);
}
开发者ID:UnitedMarsupials,项目名称:kame,代码行数:30,代码来源:ata-isa.c

示例2: sbni_probe_isa

static int
sbni_probe_isa(device_t dev)
{
    struct sbni_softc *sc;
    int error;

    error = ISA_PNP_PROBE(device_get_parent(dev), dev, sbni_ids);
    if (error && error != ENOENT)
        return (error);

    sc = device_get_softc(dev);

    sc->io_res = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->io_rid,
                                    0ul, ~0ul, SBNI_PORTS, RF_ACTIVE);
    if (!sc->io_res) {
        printf("sbni: cannot allocate io ports!\n");
        return (ENOENT);
    }

    if (sbni_probe(sc) != 0) {
        sbni_release_resources(sc);
        return (ENXIO);
    }

    device_set_desc(dev, "Granch SBNI12/ISA adapter");
    return (0);
}
开发者ID:DangerDexter,项目名称:FreeBSD-8.0-dyntick,代码行数:27,代码来源:if_sbni_isa.c

示例3: sbni_probe_isa

static int
sbni_probe_isa(device_t dev)
{
	struct sbni_softc *sc;
	int error;

	error = ISA_PNP_PROBE(device_get_parent(dev), dev, sbni_ids);
	if (error && error != ENOENT)
		return (error);

	sc = device_get_softc(dev);
	bzero(sc, sizeof(struct sbni_softc));

 	sc->io_res = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->io_rid,
					0ul, ~0ul, SBNI_PORTS, RF_ACTIVE);
	if (!sc->io_res) {
		printf("sbni: cannot allocate io ports!\n");
		return (ENOENT);
	}

	sc->base_addr = rman_get_start(sc->io_res);
	if (sbni_probe(sc) != 0) {
		bus_release_resource(dev, SYS_RES_IOPORT,
				     sc->io_rid, sc->io_res);
		return (ENXIO);
	}

	device_quiet(dev);
	return (0);
}
开发者ID:UnitedMarsupials,项目名称:kame,代码行数:30,代码来源:if_sbni_isa.c

示例4: cs_isa_probe

/*
 * Determine if the device is present
 */
static int
cs_isa_probe(device_t dev)
{
	int error = 0;

	/* Check isapnp ids */
	error = ISA_PNP_PROBE(device_get_parent(dev), dev, cs_ids);

	/* If the card had a PnP ID that didn't match any we know about */
	if (error == ENXIO)
                goto end;

        /* If we had some other problem. */
        if (!(error == 0 || error == ENOENT))
                goto end;

	error = cs_cs89x0_probe(dev);
end:
	/* Make sure IRQ is assigned for probe message and available */
	if (error == 0)
                error = cs_alloc_irq(dev, 0, 0);

        cs_release_resources(dev);
        return (error);
}
开发者ID:UnitedMarsupials,项目名称:kame,代码行数:28,代码来源:if_cs_isa.c

示例5: sbc_probe

static int
sbc_probe(device_t dev)
{
	char *s = NULL;
	u_int32_t lid, vid;

	lid = isa_get_logicalid(dev);
	vid = isa_get_vendorid(dev);
	if (lid) {
		if (lid == 0x01000000 && vid != 0x01009305) /* ALS0001 */
			return ENXIO;
		/* Check pnp ids */
		return ISA_PNP_PROBE(device_get_parent(dev), dev, sbc_ids);
	} else {
		int rid = 0, ver;
	    	struct resource *io;

#ifdef PC98
		io = isa_alloc_resourcev(dev, SYS_RES_IOPORT, &rid,
					 pcm_iat, 16, RF_ACTIVE);
#else
		io = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
		  		    	0, ~0, 16, RF_ACTIVE);
#endif
		if (!io) goto bad;
#ifdef PC98
		isa_load_resourcev(io, pcm_iat, 16);
#endif
    		if (sb_reset_dsp(io)) goto bad2;
		ver = sb_identify_board(io);
		if (ver == 0) goto bad2;
		switch ((ver & 0x00000f00) >> 8) {
		case 1:
			device_set_desc(dev, "SoundBlaster 1.0 (not supported)");
			s = NULL;
			break;

		case 2:
			s = "SoundBlaster 2.0";
			break;

		case 3:
			s = (ver & 0x0000f000)? "ESS 488" : "SoundBlaster Pro";
			break;

		case 4:
			s = "SoundBlaster 16";
			break;

		case 5:
			s = (ver & 0x00000008)? "ESS 688" : "ESS 1688";
			break;
	     	}
		if (s) device_set_desc(dev, s);
bad2:		bus_release_resource(dev, SYS_RES_IOPORT, rid, io);
bad:		return s? 0 : ENXIO;
	}
}
开发者ID:edgar-pek,项目名称:PerspicuOS,代码行数:58,代码来源:sbc.c

示例6: rtc_isa_probe

static int
rtc_isa_probe(device_t dev)
{

	if (ISA_PNP_PROBE(device_get_parent(dev), dev, rtc_isa_ids) == 0)
		return (0);

	return (ENXIO);
}
开发者ID:dcui,项目名称:FreeBSD-9.3_kernel,代码行数:9,代码来源:rtc.c

示例7: gusc_probe

static int
gusc_probe(device_t dev)
{
	device_t child;
	u_int32_t logical_id;
	char *s;
	struct sndcard_func *func;
	int ret;

	logical_id = isa_get_logicalid(dev);
	s = NULL;

	/* Check isapnp ids */
	if (logical_id != 0 && (ret = ISA_PNP_PROBE(device_get_parent(dev), dev, gusc_ids)) != 0)
		return (ret);
	else {
		if (logical_id == 0)
			return gusisa_probe(dev);
	}

	switch (logical_id) {
	case LOGICALID_PCM:
		s = "Gravis UltraSound Plug & Play PCM";
		func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT | M_ZERO);
		if (func == NULL)
			return (ENOMEM);
		func->func = SCF_PCM;
		child = device_add_child(dev, "pcm", -1);
		device_set_ivars(child, func);
		break;
	case LOGICALID_OPL:
		s = "Gravis UltraSound Plug & Play OPL";
		func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT | M_ZERO);
		if (func == NULL)
			return (ENOMEM);
		func->func = SCF_SYNTH;
		child = device_add_child(dev, "midi", -1);
		device_set_ivars(child, func);
		break;
	case LOGICALID_MIDI:
		s = "Gravis UltraSound Plug & Play MIDI";
		func = malloc(sizeof(struct sndcard_func), M_DEVBUF, M_NOWAIT | M_ZERO);
		if (func == NULL)
			return (ENOMEM);
		func->func = SCF_MIDI;
		child = device_add_child(dev, "midi", -1);
		device_set_ivars(child, func);
		break;
	}

	if (s != NULL) {
		device_set_desc(dev, s);
		return (0);
	}

	return (ENXIO);
}
开发者ID:ele7enxxh,项目名称:dtrace-pf,代码行数:57,代码来源:gusc.c

示例8: sysresource_probe

static int
sysresource_probe(device_t dev)
{
	int	result;
	
	if ((result = ISA_PNP_PROBE(device_get_parent(dev), dev, sysresource_ids)) <= 0) {
		device_quiet(dev);
	}
	return(result);
}
开发者ID:MarginC,项目名称:kame,代码行数:10,代码来源:nexus.c

示例9: pmtimer_probe

static int
pmtimer_probe(device_t dev)
{

	if (ISA_PNP_PROBE(device_get_parent(dev), dev, pmtimer_ids) == ENXIO)
		return (ENXIO);

	/* only one instance always */
	return (device_get_unit(dev));
}
开发者ID:JabirTech,项目名称:Source,代码行数:10,代码来源:pmtimer.c

示例10: atrtc_probe

static int
atrtc_probe(device_t dev)
{
	int result;
	
	device_set_desc(dev, "AT Real Time Clock");
	result = ISA_PNP_PROBE(device_get_parent(dev), dev, atrtc_ids);
	/* ENXIO if wrong PnP-ID, ENOENT ifno PnP-ID, zero if good PnP-iD */
	if (result != ENOENT)
		return(result);
	/* All PC's have an RTC, and we're hosed without it, so... */
	return (BUS_PROBE_LOW_PRIORITY);
}
开发者ID:DangerDexter,项目名称:FreeBSD-8.0-dyntick,代码行数:13,代码来源:atrtc.c

示例11: aic_isa_probe

static int
aic_isa_probe(device_t dev)
{
	struct aic_isa_softc *sc = device_get_softc(dev);
	struct aic_softc *aic = &sc->sc_aic;
	int numports, i;
	u_int port, *ports;
	u_int8_t porta;

	if (ISA_PNP_PROBE(device_get_parent(dev), dev, aic_ids) == ENXIO)
		return (ENXIO);

	port = isa_get_port(dev);
	if (port != -1) {
		ports = &port;
		numports = 1;
	} else {
		ports = aic_isa_ports;
		numports = AIC_ISA_NUMPORTS;
	}

	for (i = 0; i < numports; i++) {
		if (bus_set_resource(dev, SYS_RES_IOPORT, 0, ports[i],
				     AIC_ISA_PORTSIZE, -1))
			continue;
		if (aic_isa_alloc_resources(dev))
			continue;
		if (!aic_probe(aic)) {
			aic_isa_release_resources(dev);
			break;
		}
		aic_isa_release_resources(dev);
	}

	if (i == numports)
		return (ENXIO);

	porta = aic_inb(aic, PORTA);
	if (isa_get_irq(dev) == -1) {
		int irq = PORTA_IRQ(porta);

		bus_set_resource(dev, SYS_RES_IRQ, 0, irq, 1,
		    machintr_intr_cpuid(irq));
	}
	if ((aic->flags & AIC_DMA_ENABLE) && isa_get_drq(dev) == -1)
		bus_set_resource(dev, SYS_RES_DRQ, 0, PORTA_DRQ(porta), 1, -1);
	device_set_desc(dev, "Adaptec 6260/6360 SCSI controller");
	return (0);
}
开发者ID:juanfra684,项目名称:DragonFlyBSD,代码行数:49,代码来源:aic_isa.c

示例12: ata_isa_probe

static int
ata_isa_probe(device_t dev)
{
    struct ata_channel *ch = device_get_softc(dev);
    struct resource *io = NULL, *ctlio = NULL;
    u_long tmp;
    int i, rid;

    /* check isapnp ids */
    if (ISA_PNP_PROBE(device_get_parent(dev), dev, ata_ids) == ENXIO)
	return ENXIO;
    
    /* allocate the io port range */
    rid = ATA_IOADDR_RID;
    if (!(io = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0,
				  ATA_IOSIZE, RF_ACTIVE)))
	return ENXIO;

    /* set the altport range */
    if (bus_get_resource(dev, SYS_RES_IOPORT, ATA_CTLADDR_RID, &tmp, &tmp)) {
	bus_set_resource(dev, SYS_RES_IOPORT, ATA_CTLADDR_RID,
			 rman_get_start(io) + ATA_CTLOFFSET, ATA_CTLIOSIZE, -1);
    }

    /* allocate the altport range */
    rid = ATA_CTLADDR_RID; 
    if (!(ctlio = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, 0, ~0,
				     ATA_CTLIOSIZE, RF_ACTIVE))) {
	bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, io);
	return ENXIO;
    }

    /* setup the resource vectors */
    for (i = ATA_DATA; i <= ATA_COMMAND; i++) {
	ch->r_io[i].res = io;
	ch->r_io[i].offset = i;
    }
    ch->r_io[ATA_CONTROL].res = ctlio;
    ch->r_io[ATA_CONTROL].offset = 0;
    ch->r_io[ATA_IDX_ADDR].res = io;
    ata_default_registers(dev);
 
    /* initialize softc for this channel */
    ch->unit = 0;
    ch->flags |= ATA_USE_16BIT;
    ata_generic_hw(dev);
    return ata_probe(dev);
}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:48,代码来源:ata-isa.c

示例13: ppc_isa_probe

static int
ppc_isa_probe(device_t dev)
{
	device_t parent;
	int error;

	parent = device_get_parent(dev);

	error = ISA_PNP_PROBE(parent, dev, lpc_ids);
	if (error == ENXIO)
		return (ENXIO);
	else if (error != 0)	/* XXX shall be set after detection */
		device_set_desc(dev, "Parallel port");

	return(ppc_probe(dev));
}
开发者ID:MarginC,项目名称:kame,代码行数:16,代码来源:ppc.c

示例14: uart_acpi_probe

static int
uart_acpi_probe(device_t dev)
{
	struct uart_softc *sc;
	device_t parent;

	parent = device_get_parent(dev);
	sc = device_get_softc(dev);

	if (!ISA_PNP_PROBE(parent, dev, acpi_ns8250_ids)) {
		sc->sc_class = &uart_ns8250_class;
		return (uart_bus_probe(dev, 0, 0, 0, 0));
	}

	/* Add checks for non-ns8250 IDs here. */
	return (ENXIO);
}
开发者ID:edgar-pek,项目名称:PerspicuOS,代码行数:17,代码来源:uart_bus_acpi.c

示例15: cs_isa_probe

/*
 * Determine if the device is present
 */
static int
cs_isa_probe(device_t dev)
{
	int error = 0;

	/* Check isapnp ids */
	error = ISA_PNP_PROBE(device_get_parent(dev), dev, cs_ids);

	/* If the card had a PnP ID that didn't match any we know about */
        if (!(error == 0 || error == ENOENT))
		return error;

	error = cs_cs89x0_probe(dev);
	if (error == 0)
                error = cs_alloc_irq(dev, 0, 0);

        cs_release_resources(dev);
        return (error);
}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:22,代码来源:if_cs_isa.c


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