本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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));
}
示例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);
}
示例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");
}
示例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));
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}