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


C++ device_add_child_ordered函数代码示例

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


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


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