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

C++ BUS_ADD_CHILD函数代码示例

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

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



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

示例1: privcmd_identify

/*------------------ Private Device Attachment Functions  --------------------*/
static void
privcmd_identify(driver_t *driver, device_t parent)
{

	KASSERT(xen_domain(),
	    ("Trying to attach privcmd device on non Xen domain"));

	if (BUS_ADD_CHILD(parent, 0, "privcmd", 0) == NULL)
		panic("unable to attach privcmd user-space device");
}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:11,代码来源:privcmd.c


示例2: vpo_identify

static void
vpo_identify(driver_t *driver, device_t parent)
{

	device_t dev;

	dev = device_find_child(parent, "vpo", -1);
	if (!dev)
		BUS_ADD_CHILD(parent, 0, "vpo", -1);
}
开发者ID:edgar-pek,项目名称:PerspicuOS,代码行数:10,代码来源:vpo.c


示例3: wiibus_identify

static void
wiibus_identify(driver_t *driver, device_t parent)
{

	if (strcmp(installed_platform(), "wii") != 0)
		return;

	if (device_find_child(parent, "wiibus", -1) == NULL)
		BUS_ADD_CHILD(parent, 0, "wiibus", 0);
}
开发者ID:coyizumi,项目名称:cs111,代码行数:10,代码来源:wii_bus.c


示例4: spibus_hinted_child

static void
spibus_hinted_child(device_t bus, const char *dname, int dunit)
{
	device_t child;
	struct spibus_ivar *devi;

	child = BUS_ADD_CHILD(bus, 0, dname, dunit);
	devi = SPIBUS_IVAR(child);
	resource_int_value(dname, dunit, "cs", &devi->cs);
}
开发者ID:coyizumi,项目名称:cs111,代码行数:10,代码来源:spibus.c


示例5: vmbus_identify

static void
vmbus_identify(driver_t *driver, device_t parent)
{
	if (!hv_vmbus_query_hypervisor_presence())
		return;

	vm_guest = VM_GUEST_HV;

	BUS_ADD_CHILD(parent, 0, "vmbus", 0);
}
开发者ID:ChaosJohn,项目名称:freebsd,代码行数:10,代码来源:hv_vmbus_drv_freebsd.c


示例6: iicbus_hinted_child

static void
iicbus_hinted_child(device_t bus, const char *dname, int dunit)
{
	device_t child;
	struct iicbus_ivar *devi;

	child = BUS_ADD_CHILD(bus, 0, dname, dunit);
	devi = IICBUS_IVAR(child);
	resource_int_value(dname, dunit, "addr", &devi->addr);
}
开发者ID:JabirTech,项目名称:Source,代码行数:10,代码来源:iicbus.c


示例7: sc_identify

static void
sc_identify(driver_t *driver, device_t parent)
{

	/*
	 * Add with a priority guaranteed to make it last on
	 * the device list.
	 */
	BUS_ADD_CHILD(parent, INT_MAX, SC_DRIVER_NAME, 0);
}
开发者ID:JabirTech,项目名称:Source,代码行数:10,代码来源:sc_machdep.c


示例8: bcm2835_cpufreq_identify

static void
bcm2835_cpufreq_identify(driver_t *driver, device_t parent)
{

	DPRINTF("driver=%p, parent=%p\n", driver, parent);
	if (device_find_child(parent, "bcm2835_cpufreq", -1) != NULL)
		return;
	if (BUS_ADD_CHILD(parent, 0, "bcm2835_cpufreq", -1) == NULL)
		device_printf(parent, "add child failed\n");
}
开发者ID:fengsi,项目名称:freebsd,代码行数:10,代码来源:bcm2835_cpufreq.c


示例9: acpi_hpet_identify

/*
 * Locate the ACPI timer using the FADT, set up and allocate the I/O resources
 * we will be using.
 */
static int
acpi_hpet_identify(driver_t *driver, device_t parent)
{
	ACPI_TABLE_HPET *hpet;
	ACPI_TABLE_HEADER *hdr;
	ACPI_STATUS status;
	device_t child;

	/*
	 * Just try once, do nothing if the 'acpi' bus is rescanned.
	 */
	if (device_get_state(parent) == DS_ATTACHED)
		return 0;

	ACPI_FUNCTION_TRACE((char *)(uintptr_t) __func__);

	/* Only one HPET device can be added. */
	if (devclass_get_device(acpi_hpet_devclass, 0))
		return ENXIO;

	/* Currently, ID and minimum clock tick info is unused. */

	status = AcpiGetTable(ACPI_SIG_HPET, 1, &hdr);
	if (ACPI_FAILURE(status))
		return ENXIO;

	/*
	 * The unit number could be derived from hdr->Sequence but we only
	 * support one HPET device.
	 */
	hpet = (ACPI_TABLE_HPET *)hdr;
	if (hpet->Sequence != 0) {
		kprintf("ACPI HPET table warning: Sequence is non-zero (%d)\n",
			hpet->Sequence);
	}

	child = BUS_ADD_CHILD(parent, parent, 0, "acpi_hpet", 0);
	if (child == NULL) {
		device_printf(parent, "%s: can't add acpi_hpet0\n", __func__);
		return ENXIO;
	}

	/* Record a magic value so we can detect this device later. */
	acpi_set_magic(child, (uintptr_t)&acpi_hpet_devclass);

	acpi_hpet_res_start = hpet->Address.Address;
	if (bus_set_resource(child, SYS_RES_MEMORY, 0,
			     hpet->Address.Address, HPET_MEM_WIDTH, -1)) {
		device_printf(child, "could not set iomem resources: "
			      "0x%jx, %d\n", (uintmax_t)hpet->Address.Address,
			      HPET_MEM_WIDTH);
		return ENOMEM;
	}
	return 0;
}
开发者ID:alexandermerritt,项目名称:dragonfly,代码行数:59,代码来源:acpi_hpet.c


示例10: nexus_acpi_attach

static int
nexus_acpi_attach(device_t dev)
{

	nexus_init_resources();
	bus_generic_probe(dev);
	if (BUS_ADD_CHILD(dev, 10, "acpi", 0) == NULL)
		panic("failed to add acpi0 device");

	return (bus_generic_attach(dev));
}
开发者ID:AhmadTux,项目名称:freebsd,代码行数:11,代码来源:acpi_machdep.c


示例11: ofwfb_scidentify

/*
 * Define the syscons nexus device attachment
 */
static void
ofwfb_scidentify(driver_t *driver, device_t parent)
{
	device_t child;

	/*
	 * Add with a priority guaranteed to make it last on
	 * the device list
	 */
	child = BUS_ADD_CHILD(parent, INT_MAX, SC_DRIVER_NAME, 0);
}
开发者ID:cyrilmagsuci,项目名称:freebsd,代码行数:14,代码来源:ofw_syscons.c


示例12: ixp425_hinted_child

static void
ixp425_hinted_child(device_t bus, const char *dname, int dunit)
{
	device_t child;
	struct ixp425_ivar *ivar;

	child = BUS_ADD_CHILD(bus, 0, dname, dunit);
	ivar = IXP425_IVAR(child);
	resource_int_value(dname, dunit, "addr", &ivar->addr);
	resource_int_value(dname, dunit, "irq", &ivar->irq);
}
开发者ID:coolgoose85,项目名称:FreeBSD,代码行数:11,代码来源:ixp425.c


示例13: octm_identify

static void
octm_identify(driver_t *drv, device_t parent)
{
	unsigned i;

	if (!octeon_has_feature(OCTEON_FEATURE_MGMT_PORT))
		return;

	for (i = 0; i < CVMX_MGMT_PORT_NUM_PORTS; i++)
		BUS_ADD_CHILD(parent, 0, "octm", i);
}
开发者ID:AhmadTux,项目名称:freebsd,代码行数:11,代码来源:if_octm.c


示例14: xc_identify

static void
xc_identify(driver_t *driver, device_t parent)
{
	device_t child;

	if (!xen_pv_domain())
		return;

	child = BUS_ADD_CHILD(parent, 0, driver_name, 0);
	device_set_driver(child, driver);
	device_set_desc(child, "Xen Console");
}
开发者ID:Alkzndr,项目名称:freebsd,代码行数:12,代码来源:console.c


示例15: gic_v3_acpi_identify

static void
gic_v3_acpi_identify(driver_t *driver, device_t parent)
{
	struct madt_table_data madt_data;
	ACPI_TABLE_MADT *madt;
	vm_paddr_t physaddr;
	device_t dev;

	physaddr = acpi_find_table(ACPI_SIG_MADT);
	if (physaddr == 0)
		return;

	madt = acpi_map_table(physaddr, ACPI_SIG_MADT);
	if (madt == NULL) {
		device_printf(parent, "gic: Unable to map the MADT\n");
		return;
	}

	madt_data.parent = parent;
	madt_data.dist = NULL;
	madt_data.count = 0;

	acpi_walk_subtables(madt + 1, (char *)madt + madt->Header.Length,
	    madt_handler, &madt_data);
	if (madt_data.dist == NULL) {
		device_printf(parent,
		    "No gic interrupt or distributor table\n");
		goto out;
	}
	/* This is for the wrong GIC version */
	if (madt_data.dist->Version != ACPI_MADT_GIC_VERSION_V3)
		goto out;

	dev = BUS_ADD_CHILD(parent, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE,
	    "gic", -1);
	if (dev == NULL) {
		device_printf(parent, "add gic child failed\n");
		goto out;
	}

	/* Add the MADT data */
	BUS_SET_RESOURCE(parent, dev, SYS_RES_MEMORY, 0,
	    madt_data.dist->BaseAddress, 128 * 1024);

	madt_data.dev = dev;
	acpi_walk_subtables(madt + 1, (char *)madt + madt->Header.Length,
	    rdist_map, &madt_data);

	acpi_set_private(dev, (void *)(uintptr_t)madt_data.dist->Version);

out:
	acpi_unmap_table(madt);
}
开发者ID:derekmarcotte,项目名称:freebsd,代码行数:53,代码来源:gic_v3_acpi.c


示例16: efirtc_identify

static void
efirtc_identify(driver_t *driver, device_t parent)
{

	/* Don't add the driver unless we have working runtime services. */
	if (efi_rt_ok() != 0)
		return;
	if (device_find_child(parent, "efirtc", -1) != NULL)
		return;
	if (BUS_ADD_CHILD(parent, 0, "efirtc", -1) == NULL)
		device_printf(parent, "add child failed\n");
}
开发者ID:derekmarcotte,项目名称:freebsd,代码行数:12,代码来源:efirtc.c


示例17: xendebug_identify

static void
xendebug_identify(driver_t *driver, device_t parent)
{

	KASSERT(xen_domain(),
	    ("Trying to add Xen debug device to non-xen guest"));

	if (xen_hvm_domain() && !xen_vector_callback_enabled)
		return;

	if (BUS_ADD_CHILD(parent, 0, "debug", 0) == NULL)
		panic("Unable to add Xen debug device.");
}
开发者ID:2asoft,项目名称:freebsd,代码行数:13,代码来源:debug.c


示例18: cferes_identify

static void
cferes_identify(driver_t* driver, device_t parent)
{
	device_t		 child;
	int			 i;
	struct resource		*res;
	int			 result;
	int			 rid;
	struct cferes_softc	*sc;
	uint64_t		 addr, len, type;

	child = BUS_ADD_CHILD(parent, 100, "cferes", -1);
	device_set_driver(child, driver);
	sc = device_get_softc(child);

	sc->rnum = 0;
	for (i = 0; i < ~0U; i++) {
		result = cfe_enummem(i, CFE_FLG_FULL_ARENA, &addr, &len, &type);
		if (result < 0)
			break;
		if (type != CFE_MI_RESERVED) {
			if (bootverbose)
			printf("%s: skipping non reserved range 0x%0jx(%jd)\n",
			    device_getnameunit(child),
			    (uintmax_t)addr, (uintmax_t)len);
			continue;
		}

		bus_set_resource(child, SYS_RES_MEMORY, sc->rnum, addr, len);
		rid = sc->rnum;
		res = bus_alloc_resource_any(child, SYS_RES_MEMORY, &rid, 0);
		if (res == NULL) {
			bus_delete_resource(child, SYS_RES_MEMORY, sc->rnum);
			continue;
		}
		sc->rid[sc->rnum] = rid;
		sc->res[sc->rnum] = res;

		sc->rnum++;
		if (sc->rnum == MAX_CFE_RESERVATIONS)
			break;
	}

	if (sc->rnum == 0) {
		device_delete_child(parent, child);
		return;
	}

	device_set_desc(child, "CFE reserved memory");
}
开发者ID:DangerDexter,项目名称:FreeBSD-8.0-dyntick,代码行数:50,代码来源:cfe_resource.c


示例19: isahint_add_device

static void
isahint_add_device(device_t parent, const char *name, int unit)
{
	device_t	child;
	int		sensitive, start, count, t;
	int		order;

	/* device-specific flag overrides any wildcard */
	sensitive = 0;
	if (resource_int_value(name, unit, "sensitive", &sensitive) != 0)
		resource_int_value(name, -1, "sensitive", &sensitive);

	if (sensitive)
		order = ISA_ORDER_SENSITIVE;
	else
		order = ISA_ORDER_SPECULATIVE;

	child = BUS_ADD_CHILD(parent, parent, order, name, unit);
	if (child == 0)
		return;

	start = 0;
	count = 0;
	resource_int_value(name, unit, "port", &start);
	resource_int_value(name, unit, "portsize", &count);
	if (start > 0 || count > 0)
		bus_set_resource(child, SYS_RES_IOPORT, 0, start, count, -1);

	start = 0;
	count = 0;
	resource_int_value(name, unit, "maddr", &start);
	resource_int_value(name, unit, "msize", &count);
	if (start > 0 || count > 0)
		bus_set_resource(child, SYS_RES_MEMORY, 0, start, count, -1);

	if (resource_int_value(name, unit, "irq", &start) == 0 && start > 0) {
		bus_set_resource(child, SYS_RES_IRQ, 0, start, 1,
		    machintr_legacy_intr_cpuid(start));
	}

	if (resource_int_value(name, unit, "drq", &start) == 0 && start >= 0)
		bus_set_resource(child, SYS_RES_DRQ, 0, start, 1, -1);

	if (resource_int_value(name, unit, "flags", &t) == 0)
		device_set_flags(child, t);

	if (resource_int_value(name, unit, "disabled", &t) == 0 && t != 0)
		device_disable(child);
}
开发者ID:Gwenio,项目名称:DragonFlyBSD,代码行数:49,代码来源:isahint.c


示例20: uart_chipc_identify

static void
uart_chipc_identify(driver_t *driver, device_t parent)
{
	struct chipc_capabilities	*caps;

	caps = BHND_CHIPC_GET_CAPABILITIES(parent);

	if (caps->num_uarts == 0)
		return;

	/*
	 * TODO: add more than one UART
	 */
	BUS_ADD_CHILD(parent, 0, "uart", -1);
}
开发者ID:tomtor,项目名称:freebsd,代码行数:15,代码来源:uart_bus_chipc.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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