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

C++ device_add_child_ordered函数代码示例

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

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



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

示例1: at91_add_child

static void
at91_add_child(device_t dev, int prio, const char *name, int unit,
    bus_addr_t addr, bus_size_t size, int irq0, int irq1, int irq2)
{
	device_t kid;
	struct at91_ivar *ivar;

	kid = device_add_child_ordered(dev, prio, name, unit);
	if (kid == NULL) {
	    printf("Can't add child %s%d ordered\n", name, unit);
	    return;
	}
	ivar = malloc(sizeof(*ivar), M_DEVBUF, M_NOWAIT | M_ZERO);
	if (ivar == NULL) {
		device_delete_child(dev, kid);
		printf("Can't add alloc ivar\n");
		return;
	}
	device_set_ivars(kid, ivar);
	resource_list_init(&ivar->resources);
	if (irq0 != -1)
		bus_set_resource(kid, SYS_RES_IRQ, 0, irq0, 1);
	if (irq1 != 0)
		bus_set_resource(kid, SYS_RES_IRQ, 1, irq1, 1);
	if (irq2 != 0)
		bus_set_resource(kid, SYS_RES_IRQ, 2, irq2, 1);
	if (addr != 0)
		bus_set_resource(kid, SYS_RES_MEMORY, 0, addr, size);
}
开发者ID:oza,项目名称:FreeBSD-7.3-dyntick,代码行数:29,代码来源:at91.c


示例2: cpu_add_child

static device_t
cpu_add_child(device_t bus, u_int order, const char *name, int unit)
{
    struct cpu_device *cd;
    device_t child;
#ifndef __rtems__
    struct pcpu *pc;
#endif /* __rtems__ */

    if ((cd = malloc(sizeof(*cd), M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL)
        return (NULL);

    resource_list_init(&cd->cd_rl);
#ifndef __rtems__
    pc = pcpu_find(device_get_unit(bus));
    cd->cd_pcpu = pc;
#endif /* __rtems__ */

    child = device_add_child_ordered(bus, order, name, unit);
    if (child != NULL) {
#ifndef __rtems__
        pc->pc_device = child;
#endif /* __rtems__ */
        device_set_ivars(child, cd);
    } else
        free(cd, M_DEVBUF);
    return (child);
}
开发者ID:asuol,项目名称:rtems-libbsd,代码行数:28,代码来源:legacy.c


示例3: atkbdc_isa_add_child

static device_t
atkbdc_isa_add_child(device_t bus, u_int order, const char *name, int unit)
{
	atkbdc_device_t	*ivar;
	atkbdc_softc_t	*sc;
	device_t	child;
	int		t;

	sc = *(atkbdc_softc_t **)device_get_softc(bus);
	ivar = malloc(sizeof(struct atkbdc_device), M_ATKBDDEV,
		M_NOWAIT | M_ZERO);
	if (!ivar)
		return NULL;

	child = device_add_child_ordered(bus, order, name, unit);
	if (child == NULL) {
		free(ivar, M_ATKBDDEV);
		return child;
	}

	resource_list_init(&ivar->resources);
	ivar->rid = order;

	/*
	 * If the device is not created by the PnP BIOS or ACPI, refer
	 * to device hints for IRQ.  We always populate the resource
	 * list entry so we can use a standard bus_get_resource()
	 * method.
	 */
	if (order == KBDC_RID_KBD) {
		if (sc->irq == NULL) {
			if (resource_int_value(name, unit, "irq", &t) != 0)
				t = -1;
		} else
			t = rman_get_start(sc->irq);
		if (t > 0)
			resource_list_add(&ivar->resources, SYS_RES_IRQ,
			    ivar->rid, t, t, 1);
	}

	if (resource_disabled(name, unit))
		device_disable(child);

	device_set_ivars(child, ivar);

	return child;
}
开发者ID:Alkzndr,项目名称:freebsd,代码行数:47,代码来源:atkbdc_isa.c


示例4: simplebus_add_child

static device_t
simplebus_add_child(device_t dev, u_int order, const char *name, int unit)
{
	device_t cdev;
	struct simplebus_devinfo *ndi;

	cdev = device_add_child_ordered(dev, order, name, unit);
	if (cdev == NULL)
		return (NULL);

	ndi = malloc(sizeof(*ndi), M_DEVBUF, M_WAITOK | M_ZERO);
	ndi->obdinfo.obd_node = -1;
	resource_list_init(&ndi->rl);
	device_set_ivars(cdev, ndi);

	return (cdev);
}
开发者ID:derekmarcotte,项目名称:freebsd,代码行数:17,代码来源:simplebus.c


示例5: smbus_add_child

static device_t
smbus_add_child(device_t dev, u_int order, const char *name, int unit)
{
	struct smbus_ivar *devi;
	device_t child;

	child = device_add_child_ordered(dev, order, name, unit);
	if (child == NULL)
		return (child);
	devi = malloc(sizeof(struct smbus_ivar), M_DEVBUF, M_NOWAIT | M_ZERO);
	if (devi == NULL) {
		device_delete_child(dev, child);
		return (NULL);
	}
	device_set_ivars(child, devi);
	return (child);
}
开发者ID:2trill2spill,项目名称:freebsd,代码行数:17,代码来源:smbus.c


示例6: mv_pcib_ctrl_add_child

static device_t
mv_pcib_ctrl_add_child(device_t dev, u_int order, const char *name, int unit)
{
	device_t cdev;
	struct mv_pcib_ctrl_devinfo *di;

	cdev = device_add_child_ordered(dev, order, name, unit);
	if (cdev == NULL)
		return (NULL);

	di = malloc(sizeof(*di), M_DEVBUF, M_WAITOK | M_ZERO);
	di->di_dinfo.obd_node = -1;
	resource_list_init(&di->di_rl);
	device_set_ivars(cdev, di);

	return (cdev);
}
开发者ID:derekmarcotte,项目名称:freebsd,代码行数:17,代码来源:mv_pci_ctrl.c


示例7: canbus_add_child

static device_t
canbus_add_child(device_t bus, u_int order, const char *name, int unit)
{
	device_t child;
	struct canbus_device *cbdev;

	child = device_add_child_ordered(bus, order, name, unit);

	cbdev = malloc(
	    sizeof(struct canbus_device), M_CANBUSDEV, M_NOWAIT | M_ZERO);
	if (!cbdev)
		return (0);

	resource_list_init(&cbdev->cbdev_resources);
	device_set_ivars(child, cbdev);

	return (child);
}
开发者ID:JabirTech,项目名称:Source,代码行数:18,代码来源:canbus.c


示例8: iicbus_add_child

static device_t
iicbus_add_child(device_t dev, u_int order, const char *name, int unit)
{
	device_t child;
	struct iicbus_ivar *devi;

	child = device_add_child_ordered(dev, order, name, unit);
	if (child == NULL)
		return (child);
	devi = malloc(sizeof(struct iicbus_ivar), M_DEVBUF, M_NOWAIT | M_ZERO);
	if (devi == NULL) {
		device_delete_child(dev, child);
		return (0);
	}
	resource_list_init(&devi->rl);
	device_set_ivars(child, devi);
	return (child);
}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:18,代码来源:iicbus.c


示例9: nexus_add_child

static device_t
nexus_add_child(device_t bus, int order, const char *name, int unit)
{
	device_t		child;
	struct nexus_device	*ndev;

	ndev = malloc(sizeof(struct nexus_device), M_NEXUSDEV, M_NOWAIT|M_ZERO);
	if (!ndev)
		return(0);
	resource_list_init(&ndev->nx_resources);

	child = device_add_child_ordered(bus, order, name, unit); 

	/* should we free this in nexus_child_detached? */
	device_set_ivars(child, ndev);

	return(child);
}
开发者ID:MarginC,项目名称:kame,代码行数:18,代码来源:nexus.c


示例10: acpi_cpu_add_child

static device_t
acpi_cpu_add_child(device_t dev, int order, const char *name, int unit)
{
    struct acpi_cpu_device *ad;
    device_t child;

    if ((ad = malloc(sizeof(*ad), M_TEMP, M_NOWAIT | M_ZERO)) == NULL)
	return (NULL);

    resource_list_init(&ad->ad_rl);
    
    child = device_add_child_ordered(dev, order, name, unit);
    if (child != NULL)
	device_set_ivars(child, ad);
    else
	free(ad, M_TEMP);
    return (child);
}
开发者ID:DangerDexter,项目名称:FreeBSD-8.0-dyntick,代码行数:18,代码来源:acpi_cpu.c


示例11: ixp425_add_child

static device_t
ixp425_add_child(device_t dev, int order, const char *name, int unit)
{
	device_t child;
	struct ixp425_ivar *ivar;

	child = device_add_child_ordered(dev, order, name, unit);
	if (child == NULL)
		return NULL;
	ivar = malloc(sizeof(struct ixp425_ivar), M_DEVBUF, M_NOWAIT);
	if (ivar == NULL) {
		device_delete_child(dev, child);
		return NULL;
	}
	ivar->addr = 0;
	ivar->irq = -1;
	device_set_ivars(child, ivar);
	return child;
}
开发者ID:coolgoose85,项目名称:FreeBSD,代码行数:19,代码来源:ixp425.c


示例12: apb_add_child

static device_t
apb_add_child(device_t bus, u_int order, const char *name, int unit)
{
	device_t		child;
	struct apb_ivar	*ivar;

	ivar = malloc(sizeof(struct apb_ivar), M_DEVBUF, M_WAITOK | M_ZERO);
	resource_list_init(&ivar->resources);

	child = device_add_child_ordered(bus, order, name, unit);
	if (child == NULL) {
		printf("Can't add child %s%d ordered\n", name, unit);
		return (0);
	}

	device_set_ivars(child, ivar);

	return (child);
}
开发者ID:2asoft,项目名称:freebsd,代码行数:19,代码来源:apb.c


示例13: atkbdc_isa_add_child

static device_t
atkbdc_isa_add_child(device_t bus, int order, char *name, int unit)
{
	atkbdc_device_t	*ivar;
	device_t	child;
	int		t;

	ivar = malloc(sizeof(struct atkbdc_device), M_ATKBDDEV,
		M_NOWAIT | M_ZERO);
	if (!ivar)
		return NULL;

	child = device_add_child_ordered(bus, order, name, unit);
	if (child == NULL) {
		free(ivar, M_ATKBDDEV);
		return child;
	}

	resource_list_init(&ivar->resources);
	ivar->rid = order;

	/*
	 * If the device is not created by the PnP BIOS or ACPI,
	 * refer to device hints for IRQ.
	 */
	if (ISA_PNP_PROBE(device_get_parent(bus), bus, atkbdc_ids) != 0) {
		if (resource_int_value(name, unit, "irq", &t) != 0)
			t = -1;
	} else {
		t = bus_get_resource_start(bus, SYS_RES_IRQ, ivar->rid);
	}
	if (t > 0)
		resource_list_add(&ivar->resources, SYS_RES_IRQ, ivar->rid,
				  t, t, 1);

	if (resource_disabled(name, unit))
		device_disable(child);

	device_set_ivars(child, ivar);

	return child;
}
开发者ID:syedzubairahmed,项目名称:FreeBSD-7.3-dyntick,代码行数:42,代码来源:atkbdc_isa.c


示例14: nexus_add_child

static device_t
nexus_add_child(device_t dev, u_int order, const char *name, int unit)
{
	device_t child;
	struct nexus_devinfo *dinfo;

	child = device_add_child_ordered(dev, order, name, unit);
	if (child == NULL)
		return (NULL);

	dinfo = malloc(sizeof(struct nexus_devinfo), M_NEXUS, M_NOWAIT|M_ZERO);
	if (dinfo == NULL)
		return (NULL);

	dinfo->ndi_node = -1;
	dinfo->ndi_name = name;
	device_set_ivars(child, dinfo);

        return (child);
}
开发者ID:edgar-pek,项目名称:PerspicuOS,代码行数:20,代码来源:nexus.c


示例15: s3c24x0_add_child

static device_t
s3c24x0_add_child(device_t bus, int prio, const char *name, int unit)
{
	device_t child;
	struct s3c2xx0_ivar *ivar;

	child = device_add_child_ordered(bus, prio, name, unit);
	if (child == NULL)
		return (NULL);

	ivar = malloc(sizeof(*ivar), M_DEVBUF, M_NOWAIT | M_ZERO);
	if (ivar == NULL) {
		device_delete_child(bus, child);
		printf("Can't add alloc ivar\n");
		return (NULL);
	}
	device_set_ivars(child, ivar);
	resource_list_init(&ivar->resources);

	return (child);
}
开发者ID:fengsi,项目名称:freebsd,代码行数:21,代码来源:s3c24x0.c


示例16: at91_add_child

void
at91_add_child(device_t dev, int prio, const char *name, int unit,
               bus_addr_t addr, bus_size_t size, int irq0, int irq1, int irq2)
{
    device_t kid;
    struct at91_ivar *ivar;

    kid = device_add_child_ordered(dev, prio, name, unit);
    if (kid == NULL) {
        printf("Can't add child %s%d ordered\n", name, unit);
        return;
    }
    ivar = malloc(sizeof(*ivar), M_DEVBUF, M_NOWAIT | M_ZERO);
    if (ivar == NULL) {
        device_delete_child(dev, kid);
        printf("Can't add alloc ivar\n");
        return;
    }
    device_set_ivars(kid, ivar);
    resource_list_init(&ivar->resources);
    if (irq0 != -1) {
        bus_set_resource(kid, SYS_RES_IRQ, 0, irq0, 1);
        if (irq0 != AT91_IRQ_SYSTEM)
            at91_pmc_clock_add(device_get_nameunit(kid), irq0, 0);
    }
    if (irq1 != 0)
        bus_set_resource(kid, SYS_RES_IRQ, 1, irq1, 1);
    if (irq2 != 0)
        bus_set_resource(kid, SYS_RES_IRQ, 2, irq2, 1);
    /*
     * Special case for on-board devices. These have their address
     * defined relative to AT91_PA_BASE in all the register files we
     * have. We could change this, but that's a lot of effort which
     * will be obsoleted when FDT arrives.
     */
    if (addr != 0 && addr < 0x10000000 && addr >= 0x0f000000)
        addr += AT91_PA_BASE;
    if (addr != 0)
        bus_set_resource(kid, SYS_RES_MEMORY, 0, addr, size);
}
开发者ID:jamesbjackson,项目名称:src,代码行数:40,代码来源:at91.c


示例17: omap_add_child

static device_t
omap_add_child(device_t bus, u_int order, const char *name, int unit)
{
	device_t	child;
	struct omap_ivar *ivar;

	ivar = malloc(sizeof(struct omap_ivar), M_DEVBUF, M_NOWAIT|M_ZERO);
	if (!ivar)
		return (0);
	resource_list_init(&ivar->resources);

	child = device_add_child_ordered(bus, order, name, unit);
	if (child == NULL) {
		device_printf(bus, "failed to add child: %s%d\n", name, unit);
		return (0);
	}

	/* should we free this in nexus_child_detached? */
	device_set_ivars(child, ivar);

	return (child);
}
开发者ID:christianrodher,项目名称:freebsd-armv6,代码行数:22,代码来源:omap.c


示例18: simplebus_add_device

device_t
simplebus_add_device(device_t dev, phandle_t node, u_int order,
    const char *name, int unit, struct simplebus_devinfo *di)
{
	struct simplebus_devinfo *ndi;
	device_t cdev;

	if ((ndi = simplebus_setup_dinfo(dev, node, di)) == NULL)
		return (NULL);
	cdev = device_add_child_ordered(dev, order, name, unit);
	if (cdev == NULL) {
		device_printf(dev, "<%s>: device_add_child failed\n",
		    ndi->obdinfo.obd_name);
		resource_list_free(&ndi->rl);
		ofw_bus_gen_destroy_devinfo(&ndi->obdinfo);
		if (di == NULL)
			free(ndi, M_DEVBUF);
		return (NULL);
	}
	device_set_ivars(cdev, ndi);

	return(cdev);
}
开发者ID:derekmarcotte,项目名称:freebsd,代码行数:23,代码来源:simplebus.c


示例19: chipc_add_child

static device_t
chipc_add_child(device_t dev, u_int order, const char *name, int unit)
{
	struct chipc_softc	*sc;
	struct chipc_devinfo	*dinfo;
	device_t		 child;

	sc = device_get_softc(dev);

	child = device_add_child_ordered(dev, order, name, unit);
	if (child == NULL)
		return (NULL);

	dinfo = malloc(sizeof(struct chipc_devinfo), M_BHND, M_NOWAIT);
	if (dinfo == NULL) {
		device_delete_child(dev, child);
		return (NULL);
	}

	resource_list_init(&dinfo->resources);
	device_set_ivars(child, dinfo);

	return (child);
}
开发者ID:wulf7,项目名称:freebsd,代码行数:24,代码来源:chipc.c


示例20: nexus_add_child

static device_t
nexus_add_child(device_t bus, int order, const char *name, int unit)
{
	return device_add_child_ordered(bus, order, name, unit);
}
开发者ID:UnitedMarsupials,项目名称:kame,代码行数:5,代码来源:nexus.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ device_attach函数代码示例发布时间:2022-05-30
下一篇:
C++ device_add_child函数代码示例发布时间: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