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


C++ DEVTONX函数代码示例

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


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

示例1: nexus_get_reslist

static struct resource_list *
nexus_get_reslist(device_t dev, device_t child)
{
	struct nexus_device *ndev = DEVTONX(child);

	return (&ndev->nx_resources);
}
开发者ID:dcui,项目名称:FreeBSD-9.3_kernel,代码行数:7,代码来源:nexus.c

示例2: nexus_delete_resource

static void
nexus_delete_resource(device_t dev, device_t child, int type, int rid)
{
	struct nexus_device	*ndev = DEVTONX(child);
	struct resource_list	*rl = &ndev->nx_resources;

	resource_list_delete(rl, type, rid);
}
开发者ID:MarginC,项目名称:kame,代码行数:8,代码来源:nexus.c

示例3: nexus_alloc_resource

/*
 * Allocate a resource on behalf of child.  NB: child is usually going to be a
 * child of one of our descendants, not a direct child of nexus0.
 * (Exceptions include footbridge.)
 */
static struct resource *
nexus_alloc_resource(device_t bus, device_t child, int type, int *rid,
    rman_res_t start, rman_res_t end, rman_res_t count, u_int flags)
{
	struct nexus_device *ndev = DEVTONX(child);
	struct resource *rv;
	struct resource_list_entry *rle;
	struct rman *rm;
	int needactivate = flags & RF_ACTIVE;

	/*
	 * If this is an allocation of the "default" range for a given
	 * RID, and we know what the resources for this device are
	 * (ie. they aren't maintained by a child bus), then work out
	 * the start/end values.
	 */
	if (RMAN_IS_DEFAULT_RANGE(start, end) && (count == 1)) {
		if (device_get_parent(child) != bus || ndev == NULL)
			return(NULL);
		rle = resource_list_find(&ndev->nx_resources, type, *rid);
		if (rle == NULL)
			return(NULL);
		start = rle->start;
		end = rle->end;
		count = rle->count;
	}

	switch (type) {
	case SYS_RES_IRQ:
		rm = &irq_rman;
		break;

	case SYS_RES_MEMORY:
	case SYS_RES_IOPORT:
		rm = &mem_rman;
		break;

	default:
		return (NULL);
	}

	rv = rman_reserve_resource(rm, start, end, count, flags, child);
	if (rv == NULL)
		return (NULL);

	rman_set_rid(rv, *rid);
	rman_set_bushandle(rv, rman_get_start(rv));

	if (needactivate) {
		if (bus_activate_resource(child, type, *rid, rv)) {
			rman_release_resource(rv);
			return (NULL);
		}
	}

	return (rv);
}
开发者ID:nomadlogic,项目名称:freebsd-base-graphics,代码行数:62,代码来源:nexus.c

示例4: nexus_set_resource

static int
nexus_set_resource(device_t dev, device_t child, int type, int rid, u_long start, u_long count)
{
	struct nexus_device	*ndev = DEVTONX(child);
	struct resource_list	*rl = &ndev->nx_resources;

	/* XXX this should return a success/failure indicator */
	resource_list_add(rl, type, rid, start, start + count - 1, count);
	return(0);
}
开发者ID:MarginC,项目名称:kame,代码行数:10,代码来源:nexus.c

示例5: nexus_write_ivar

static int
nexus_write_ivar(device_t dev, device_t child, int which, uintptr_t value)
{
	struct nexus_device *ndev = DEVTONX(child);
	
	switch (which) {
	case NEXUS_IVAR_PCIBUS:
		ndev->nx_pcibus = value;
		break;
	default:
		return ENOENT;
	}
	return 0;
}
开发者ID:madhavsuresh,项目名称:DragonFlyBSD,代码行数:14,代码来源:nexus.c

示例6: nexus_read_ivar

static int
nexus_read_ivar(device_t dev, device_t child, int which, uintptr_t *result)
{
	struct nexus_device *ndev = DEVTONX(child);
	
	switch (which) {
	case NEXUS_IVAR_PCIBUS:
		*result = ndev->nx_pcibus;
		break;
	default:
		return ENOENT;
	}
	return 0;
}
开发者ID:madhavsuresh,项目名称:DragonFlyBSD,代码行数:14,代码来源:nexus.c

示例7: nexus_print_child

static int
nexus_print_child(device_t bus, device_t child)
{
	struct	nexus_device *ndev = DEVTONX(child);
	int retval = 0;

	retval += bus_print_child_header(bus, child);
	retval += nexus_print_all_resources(child);
	if (ndev->nx_pcibus != -1)
		retval += kprintf(" pcibus %d", ndev->nx_pcibus);
	retval += kprintf(" on motherboard\n");

	return (retval);
}
开发者ID:madhavsuresh,项目名称:DragonFlyBSD,代码行数:14,代码来源:nexus.c

示例8: nexus_print_all_resources

static int
nexus_print_all_resources(device_t dev)
{
	struct	nexus_device *ndev = DEVTONX(dev);
	struct resource_list *rl = &ndev->nx_resources;
	int retval = 0;

	if (SLIST_FIRST(rl) || ndev->nx_pcibus != -1)
		retval += kprintf(" at");
	
	retval += resource_list_print_type(rl, "port", SYS_RES_IOPORT, "%#lx");
	retval += resource_list_print_type(rl, "iomem", SYS_RES_MEMORY, "%#lx");
	retval += resource_list_print_type(rl, "irq", SYS_RES_IRQ, "%ld");

	return retval;
}
开发者ID:madhavsuresh,项目名称:DragonFlyBSD,代码行数:16,代码来源:nexus.c

示例9: nexus_get_resource

static int
nexus_get_resource(device_t dev, device_t child, int type, int rid, u_long *startp, u_long *countp)
{
	struct nexus_device	*ndev = DEVTONX(child);
	struct resource_list	*rl = &ndev->nx_resources;
	struct resource_list_entry *rle;

	rle = resource_list_find(rl, type, rid);
	if (!rle)
		return(ENOENT);
	if (startp)
		*startp = rle->start;
	if (countp)
		*countp = rle->count;
	return(0);
}
开发者ID:dcui,项目名称:FreeBSD-9.3_kernel,代码行数:16,代码来源:nexus.c

示例10: nexus_alloc_resource

/*
 * Allocate a resource on behalf of child.  NB: child is usually going to be a
 * child of one of our descendants, not a direct child of nexus0.
 * (Exceptions include npx.)
 */
static struct resource *
nexus_alloc_resource(device_t bus, device_t child, int type, int *rid,
		     rman_res_t start, rman_res_t end, rman_res_t count,
		     u_int flags)
{
	struct nexus_device *ndev = DEVTONX(child);
	struct	resource *rv;
	struct resource_list_entry *rle;
	struct	rman *rm;
	int needactivate = flags & RF_ACTIVE;

	/*
	 * If this is an allocation of the "default" range for a given
	 * RID, and we know what the resources for this device are
	 * (ie. they aren't maintained by a child bus), then work out
	 * the start/end values.
	 */
	if ((start == 0UL) && (end == ~0UL) && (count == 1)) {
		if (device_get_parent(child) != bus || ndev == NULL)
			return(NULL);
		rle = resource_list_find(&ndev->nx_resources, type, *rid);
		if (rle == NULL)
			return(NULL);
		start = rle->start;
		end = rle->end;
		count = rle->count;
	}

	flags &= ~RF_ACTIVE;
	rm = nexus_rman(type);
	if (rm == NULL)
		return (NULL);

	rv = rman_reserve_resource(rm, start, end, count, flags, child);
	if (rv == 0)
		return 0;
	rman_set_rid(rv, *rid);

	if (needactivate) {
		if (bus_activate_resource(child, type, *rid, rv)) {
			rman_release_resource(rv);
			return 0;
		}
	}

	return rv;
}
开发者ID:outbackdingo,项目名称:uBSD,代码行数:52,代码来源:nexus.c

示例11: nexus_print_child

static int
nexus_print_child(device_t bus, device_t child)
{
	struct nexus_device *ndev = DEVTONX(child);
	struct resource_list *rl = &ndev->nx_resources;
	int retval = 0;

	retval += bus_print_child_header(bus, child);
	retval += resource_list_print_type(rl, "port", SYS_RES_IOPORT, "%#lx");
	retval += resource_list_print_type(rl, "iomem", SYS_RES_MEMORY, "%#lx");
	retval += resource_list_print_type(rl, "irq", SYS_RES_IRQ, "%ld");
	if (ndev->nx_pcibus != -1)
		retval += printf(" pcibus %d", ndev->nx_pcibus);
	if (device_get_flags(child))
		retval += printf(" flags %#x", device_get_flags(child));
	retval += printf(" on motherboard\n");	/* XXX "motherboard", ick */

	return (retval);
}
开发者ID:DangerDexter,项目名称:FreeBSD-8.0-dyntick,代码行数:19,代码来源:nexus.c

示例12: nexus_alloc_resource

/*
 * Allocate a resource on behalf of child.  NB: child is usually going to be a
 * child of one of our descendants, not a direct child of nexus0.
 * (Exceptions include npx.)
 */
static struct resource *
nexus_alloc_resource(device_t bus, device_t child, int type, int *rid,
    u_long start, u_long end, u_long count, u_int flags, int cpuid)
{
	struct nexus_device *ndev = DEVTONX(child);
	struct	resource *rv;
	struct resource_list_entry *rle;
	struct	rman *rm;
	int needactivate = flags & RF_ACTIVE;

	/*
	 * If this is an allocation of the "default" range for a given RID, and
	 * we know what the resources for this device are (ie. they aren't maintained
	 * by a child bus), then work out the start/end values.
	 */
	if ((start == 0UL) && (end == ~0UL) && (count == 1)) {
		if (ndev == NULL)
			return(NULL);
		rle = resource_list_find(&ndev->nx_resources, type, *rid);
		if (rle == NULL)
			return(NULL);
		start = rle->start;
		end = rle->end;
		count = rle->count;
		cpuid = rle->cpuid;
	}

	flags &= ~RF_ACTIVE;

	switch (type) {
	case SYS_RES_IRQ:
		KASSERT(cpuid >= 0 && cpuid < ncpus,
		    ("nexus invalid cpuid %d:\n", cpuid));
		rm = &irq_rman[cpuid];
		break;

	case SYS_RES_DRQ:
		rm = &drq_rman;
		break;

	case SYS_RES_IOPORT:
		rm = &port_rman;
		break;

	case SYS_RES_MEMORY:
		rm = &mem_rman;
		break;

	default:
		return 0;
	}

	rv = rman_reserve_resource(rm, start, end, count, flags, child);
	if (rv == 0)
		return 0;
	rman_set_rid(rv, *rid);

	if (type == SYS_RES_MEMORY) {
		rman_set_bustag(rv, I386_BUS_SPACE_MEM);
	} else if (type == SYS_RES_IOPORT) {
		rman_set_bustag(rv, I386_BUS_SPACE_IO);
		rman_set_bushandle(rv, rv->r_start);
	}

	if (needactivate) {
		if (bus_activate_resource(child, type, *rid, rv)) {
			rman_release_resource(rv);
			return 0;
		}
	}
	
	return rv;
}
开发者ID:madhavsuresh,项目名称:DragonFlyBSD,代码行数:78,代码来源:nexus.c

示例13: nexus_alloc_resource

/*
 * Allocate a resource on behalf of child.  NB: child is usually going to be a
 * child of one of our descendants, not a direct child of nexus0.
 * (Exceptions include npx.)
 */
static struct resource *
nexus_alloc_resource(device_t bus, device_t child, int type, int *rid,
		     u_long start, u_long end, u_long count, u_int flags)
{
	struct nexus_device *ndev = DEVTONX(child);
	struct	resource *rv;
	struct resource_list_entry *rle;
	struct	rman *rm;
	int needactivate = flags & RF_ACTIVE;

	/*
	 * If this is an allocation of the "default" range for a given RID, and
	 * we know what the resources for this device are (ie. they aren't maintained
	 * by a child bus), then work out the start/end values.
	 */
	if ((start == 0UL) && (end == ~0UL) && (count == 1)) {
		if (ndev == NULL)
			return(NULL);
		rle = resource_list_find(&ndev->nx_resources, type, *rid);
		if (rle == NULL)
			return(NULL);
		start = rle->start;
		end = rle->end;
		count = rle->count;
	}

	flags &= ~RF_ACTIVE;

	switch (type) {
	case SYS_RES_IRQ:
		rm = &irq_rman;
		break;

	case SYS_RES_DRQ:
		rm = &drq_rman;
		break;

	case SYS_RES_IOPORT:
		rm = &port_rman;
		break;

	case SYS_RES_MEMORY:
		rm = &mem_rman;
		break;

	default:
		return 0;
	}

	rv = rman_reserve_resource(rm, start, end, count, flags, child);
	if (rv == 0)
		return 0;

	if (type == SYS_RES_MEMORY) {
		rman_set_bustag(rv, I386_BUS_SPACE_MEM);
	} else if (type == SYS_RES_IOPORT) {
		rman_set_bustag(rv, I386_BUS_SPACE_IO);
#ifndef PC98
		rman_set_bushandle(rv, rv->r_start);
#endif
	}

#ifdef PC98
	if ((type == SYS_RES_MEMORY || type == SYS_RES_IOPORT) &&
	    i386_bus_space_handle_alloc(rv->r_bustag, rv->r_start, count,
					&rv->r_bushandle) != 0) {
		rman_release_resource(rv);
		return 0;
	}
#endif

	if (needactivate) {
		if (bus_activate_resource(child, type, *rid, rv)) {
#ifdef PC98
			if (type == SYS_RES_MEMORY || type == SYS_RES_IOPORT) {
				i386_bus_space_handle_free(rv->r_bustag,
				    rv->r_bushandle, rv->r_bushandle->bsh_sz);
			}
#endif
			rman_release_resource(rv);
			return 0;
		}
	}
	
	return rv;
}
开发者ID:MarginC,项目名称:kame,代码行数:91,代码来源:nexus.c


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