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


C++ device_get_flags函数代码示例

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


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

示例1: isic_isa_probe

/*---------------------------------------------------------------------------*
 *	probe for ISA non-PnP cards
 *---------------------------------------------------------------------------*/
static int
isic_isa_probe(device_t dev)
{
	int ret = ENXIO;

	if(isa_get_vendorid(dev))	/* no PnP probes here */
		return ENXIO;

	switch(device_get_flags(dev))
	{
#ifdef TEL_S0_16
		case CARD_TYPEP_16:
			ret = isic_probe_s016(dev);
			break;
#endif

#ifdef TEL_S0_8
		case CARD_TYPEP_8:
			ret = isic_probe_s08(dev);
			break;
#endif

#ifdef ELSA_PCC16
		case CARD_TYPEP_PCC16:
			ret = isic_probe_Epcc16(dev);
			break;
#endif

#ifdef TEL_S0_16_3
		case CARD_TYPEP_16_3:
			ret = isic_probe_s0163(dev);		
			break;
#endif

#ifdef AVM_A1
		case CARD_TYPEP_AVMA1:
			ret = isic_probe_avma1(dev);
			break;
#endif

#ifdef USR_STI
		case CARD_TYPEP_USRTA:
			ret = isic_probe_usrtai(dev);		
			break;
#endif

#ifdef ITKIX1
		case CARD_TYPEP_ITKIX1:
			ret = isic_probe_itkix1(dev);
			break;
#endif

		default:
			kprintf("isic%d: probe, unknown flag: %d\n",
				device_get_unit(dev), device_get_flags(dev));
			break;
	}
	return(ret);
}
开发者ID:juanfra684,项目名称:DragonFlyBSD,代码行数:62,代码来源:i4b_isic_isa.c

示例2: nexus_print_child

static int
nexus_print_child(device_t bus, device_t child)
{
	int retval = 0;

	retval += bus_print_child_header(bus, child);
	retval += nexus_print_all_resources(child);
	if (device_get_flags(child))
		retval += printf(" flags %#x", device_get_flags(child));
	retval += printf(" on motherboard\n");	/* XXX "motherboard", ick */

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

示例3: apb_print_child

static int
apb_print_child(device_t bus, device_t child)
{
	int retval = 0;

	retval += bus_print_child_header(bus, child);
	retval += apb_print_all_resources(child);
	if (device_get_flags(child))
		retval += printf(" flags %#x", device_get_flags(child));
	retval += printf(" on %s\n", device_get_nameunit(bus));

	return (retval);
}
开发者ID:vocho,项目名称:freebsd-base-graphics,代码行数:13,代码来源:apb.c

示例4: wiifb_scattach

static int
wiifb_scattach(device_t dev)
{

	return (sc_attach_unit(device_get_unit(dev),
	    device_get_flags(dev) | SC_AUTODETECT_KBD));
}
开发者ID:MattDooner,项目名称:freebsd-west,代码行数:7,代码来源:wii_fb.c

示例5: an_attach_isa

static int
an_attach_isa(device_t dev)
{
	struct an_softc *sc = device_get_softc(dev);
	struct ifnet *ifp = &sc->arpcom.ac_if;
	int flags = device_get_flags(dev);
	int error;

	an_alloc_port(dev, sc->port_rid, 1);
	an_alloc_irq(dev, sc->irq_rid, 0);

	sc->an_bhandle = rman_get_bushandle(sc->port_res);
	sc->an_btag = rman_get_bustag(sc->port_res);

	error = an_attach(sc, dev, flags);
	if (error)
		goto fail;

	error = bus_setup_intr(dev, sc->irq_res, INTR_MPSAFE,
			       an_intr, sc, &sc->irq_handle, 
			       sc->arpcom.ac_if.if_serializer);
	if (error) {
		ether_ifdetach(&sc->arpcom.ac_if);
		ifmedia_removeall(&sc->an_ifmedia);
		goto fail;
	}

	ifq_set_cpuid(&ifp->if_snd, rman_get_cpuid(sc->irq_res));

	return (0);

fail:
	an_release_resources(dev);
	return(error);
}
开发者ID:Gwenio,项目名称:DragonFlyBSD,代码行数:35,代码来源:if_an_isa.c

示例6: enter_rfmon_mac80211

void enter_rfmon_mac80211(const char *device, char **mondev)
{
	int ret;
	short flags;
	uint32_t n;
	char phydev_path[256];
	struct nl80211_state nlstate;

	/* XXX: is this already a monN device? */
	get_mac80211_phydev(device, phydev_path, sizeof(phydev_path));
	nl80211_init(&nlstate, device);

	for (n = 0; n < UINT_MAX; n++) {
		char mondevice[32];

		slprintf(mondevice, sizeof(mondevice), "mon%u", n);
		ret = nl80211_add_mon_if(&nlstate, device, mondevice);
		if (ret == 0) {
			*mondev = xstrdup(mondevice);

			flags = device_get_flags(*mondev);
			flags |= IFF_UP | IFF_RUNNING;
			device_set_flags(*mondev, flags);

			nl80211_cleanup(&nlstate);
			return;
		}
	}

	panic("No free monN interfaces!\n");
}
开发者ID:Bracksun,项目名称:netsniff-ng,代码行数:31,代码来源:mac80211.c

示例7: sc_attach

static int
sc_attach(device_t dev)
{

	return (sc_attach_unit(device_get_unit(dev),
	    device_get_flags(dev) | SC_MD_FLAGS));
}
开发者ID:JabirTech,项目名称:Source,代码行数:7,代码来源:sc_machdep.c

示例8: gdc_attach

static int
gdc_attach(device_t dev)
{
	gdc_softc_t *sc;
	int error;

	error = gdc_alloc_resource(dev);
	if (error)
		return (error);

	sc = device_get_softc(dev);
	error = gdc_attach_unit(device_get_unit(dev),
				sc,
				device_get_flags(dev));
	if (error) {
		gdc_release_resource(dev);
		return error;
	}

#ifdef FB_INSTALL_CDEV
	/* attach a virtual frame buffer device */
	error = fb_attach(makedev(0, GDC_MKMINOR(unit)), sc->adp, &gdc_cdevsw);
	if (error) {
		gdc_release_resource(dev);
		return error;
	}
#endif /* FB_INSTALL_CDEV */

	if (bootverbose)
		(*vidsw[sc->adp->va_index]->diag)(sc->adp, bootverbose);

	return 0;
}
开发者ID:MarginC,项目名称:kame,代码行数:33,代码来源:pc98gdc.c

示例9: stg_attach

int
stg_attach(device_t dev)
{
	struct stg_softc *sc;
	struct scsi_low_softc *slp;
	u_int32_t flags = device_get_flags(dev);
	intrmask_t s;
	char	dvname[16];

	sc = device_get_softc(dev);

	strcpy(dvname,"stg");

	slp = &sc->sc_sclow;
	slp->sl_dev = dev;
	sc->sc_iot = rman_get_bustag(sc->port_res);
	sc->sc_ioh = rman_get_bushandle(sc->port_res);

	slp->sl_hostid = STG_HOSTID;
	slp->sl_cfgflags = flags;

	s = splcam();
	stgattachsubr(sc);
	splx(s);

	return(STGIOSZ);
}
开发者ID:Alkzndr,项目名称:freebsd,代码行数:27,代码来源:tmc18c30_subr.c

示例10: atkbdattach

static int
atkbdattach(device_t dev)
{
	atkbd_softc_t *sc;
	keyboard_t *kbd;
	u_long irq;
	int flags;
	int rid;
	int error;

	sc = device_get_softc(dev);

	rid = KBDC_RID_KBD;
	irq = bus_get_resource_start(dev, SYS_RES_IRQ, rid);
	flags = device_get_flags(dev);
	error = atkbd_attach_unit(dev, &kbd, irq, flags);
	if (error)
		return error;

	/* declare our interrupt handler */
	sc->intr = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE);
	if (sc->intr == NULL)
		return ENXIO;
	error = bus_setup_intr(dev, sc->intr, INTR_TYPE_TTY, NULL, atkbdintr,
			       kbd, &sc->ih);
	if (error)
		bus_release_resource(dev, SYS_RES_IRQ, rid, sc->intr);

	return error;
}
开发者ID:ele7enxxh,项目名称:dtrace-pf,代码行数:30,代码来源:atkbd_atkbdc.c

示例11: mse_common_attach

int
mse_common_attach(device_t dev)
{
	mse_softc_t *sc;
	int unit, flags, rid;

	sc = device_get_softc(dev);
	unit = device_get_unit(dev);

	rid = 0;
	sc->sc_intr = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
					     RF_ACTIVE);
	if (sc->sc_intr == NULL) {
		bus_release_resource(dev, SYS_RES_IOPORT, rid, sc->sc_port);
		return ENXIO;
	}

	if (bus_setup_intr(dev, sc->sc_intr,
	    INTR_TYPE_TTY, NULL, mseintr, sc, &sc->sc_ih)) {
		bus_release_resource(dev, SYS_RES_IOPORT, rid, sc->sc_port);
		bus_release_resource(dev, SYS_RES_IRQ, rid, sc->sc_intr);
		return ENXIO;
	}
	flags = device_get_flags(dev);
	sc->mode.accelfactor = (flags & MSE_CONFIG_ACCEL) >> 4;
	callout_handle_init(&sc->sc_callout);

	sc->sc_dev = make_dev(&mse_cdevsw, 0, 0, 0, 0600, "mse%d", unit);
	sc->sc_dev->si_drv1 = sc;
	sc->sc_ndev = make_dev(&mse_cdevsw, 1, 0, 0, 0600, "nmse%d", unit);
	sc->sc_ndev->si_drv1 = sc;
	return 0;
}
开发者ID:JabirTech,项目名称:Source,代码行数:33,代码来源:mse.c

示例12: an_attach_isa

static int
an_attach_isa(device_t dev)
{
	struct an_softc *sc = device_get_softc(dev);
	int flags = device_get_flags(dev);
	int error;

	an_alloc_port(dev, sc->port_rid, 1);
	an_alloc_irq(dev, sc->irq_rid, 0);

	sc->an_dev = dev;

	error = an_attach(sc, flags);
	if (error) {
		an_release_resources(dev);
		return (error);
	}

	error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET,
			       NULL, an_intr, sc, &sc->irq_handle);
	if (error) {
		an_release_resources(dev);
		return (error);
	}
	return (0);
}
开发者ID:dcui,项目名称:FreeBSD-9.3_kernel,代码行数:26,代码来源:if_an_isa.c

示例13: tun_open_or_die

int tun_open_or_die(char *name, int type)
{
	int fd, ret;
	short flags;
	struct ifreq ifr;

	if (!name)
		panic("No name provided for tundev!\n");

	fd = open_or_die("/dev/net/tun", O_RDWR);

	memset(&ifr, 0, sizeof(ifr));
	ifr.ifr_flags = type;
	strlcpy(ifr.ifr_name, name, IFNAMSIZ);

	ret = ioctl(fd, TUNSETIFF, &ifr);
	if (ret < 0)
		panic("ioctl screwed up! %s.\n", strerror(errno));

	ret = fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK);
	if (ret < 0)
		panic("fctnl screwed up! %s.\n", strerror(errno));

	flags = device_get_flags(name);
	flags |= IFF_UP | IFF_RUNNING;
	device_set_flags(name, flags);

	return fd;
}
开发者ID:hhatto,项目名称:netsniff-ng,代码行数:29,代码来源:ioops.c

示例14: atkbdprobe

static int
atkbdprobe(device_t dev)
{
	struct resource *res;
	u_long irq;
	int flags;
	int rid;

	device_set_desc(dev, "AT Keyboard");

	/* obtain parameters */
	flags = device_get_flags(dev);

	/* see if IRQ is available */
	rid = KBDC_RID_KBD;
	res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE);
	if (res == NULL) {
		if (bootverbose)
			device_printf(dev, "unable to allocate IRQ\n");
		return ENXIO;
	}
	irq = rman_get_start(res);
	bus_release_resource(dev, SYS_RES_IRQ, rid, res);

	/* probe the device */
	return atkbd_probe_unit(dev, irq, flags);
}
开发者ID:ele7enxxh,项目名称:dtrace-pf,代码行数:27,代码来源:atkbd_atkbdc.c

示例15: an_pccard_attach

static int
an_pccard_attach(device_t dev)
{
	struct an_softc *sc = device_get_softc(dev);
	int flags = device_get_flags(dev);
	int     error;

	error = an_probe(dev); /* 0 is failure for now */
	if (error == 0) {
		error = ENXIO;
		goto fail;
	}
	error = an_alloc_irq(dev, 0, 0);
	if (error != 0)
		goto fail;

	an_alloc_irq(dev, sc->irq_rid, 0);

	error = an_attach(sc, flags);
	if (error)
		goto fail;
	
	/*
	 * Must setup the interrupt after the an_attach to prevent racing.
	 */
	error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET,
			       NULL, an_intr, sc, &sc->irq_handle);
fail:
	if (error)
		an_release_resources(dev);
	return (error);
}
开发者ID:skarmiglione,项目名称:haiku,代码行数:32,代码来源:if_an_pccard.c


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