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


C++ BUS_ADD_CHILD函数代码示例

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


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


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