⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tree.c

📁 嵌入式系统设计与实例开发实验教材二源码 多线程应用程序设计 串行端口程序设计 AD接口实验 CAN总线通信实验 GPS通信实验 Linux内核移植与编译实验 IC卡读写实验 SD驱动使
💻 C
字号:
/* * This file is subject to the terms and conditions of the GNU General Public * License.  See the file "COPYING" in the main directory of this archive * for more details. * * PROM component device tree code. * * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com) * Copyright (C) 1999 Ralf Baechle (ralf@gnu.org) * Copyright (C) 1999 Silicon Graphics, Inc. */#include <linux/init.h>#include <asm/arc/types.h>#include <asm/sgialib.h>#undef DEBUG_PROM_TREEpcomponent * __initArcGetPeer(pcomponent *Current){	if (Current == PROM_NULL_COMPONENT)		return PROM_NULL_COMPONENT;	return (pcomponent *) ARC_CALL1(next_component, Current);}pcomponent * __initArcGetChild(pcomponent *Current){	return (pcomponent *) ARC_CALL1(child_component, Current);}pcomponent * __initArcGetParent(pcomponent *Current){	if (Current == PROM_NULL_COMPONENT)		return PROM_NULL_COMPONENT;	return (pcomponent *) ARC_CALL1(parent_component, Current);}LONG __initArcGetConfigurationData(VOID *Buffer, pcomponent *Current){	return ARC_CALL2(component_data, Buffer, Current);}pcomponent * __initArcAddChild(pcomponent *Current, pcomponent *Template, VOID *ConfigurationData){	return (pcomponent *)	       ARC_CALL3(child_add, Current, Template, ConfigurationData);}LONG __initArcDeleteComponent(pcomponent *ComponentToDelete){	return ARC_CALL1(comp_del, ComponentToDelete);}pcomponent * __initArcGetComponent(CHAR *Path){	return (pcomponent *)ARC_CALL1(component_by_path, Path);}#ifdef DEBUG_PROM_TREEstatic char *classes[] = {	"system", "processor", "cache", "adapter", "controller", "peripheral",	"memory"};static char *types[] = {	"arc", "cpu", "fpu", "picache", "pdcache", "sicache", "sdcache",	"sccache", "memdev", "eisa adapter", "tc adapter", "scsi adapter",	"dti adapter", "multi-func adapter", "disk controller",	"tp controller", "cdrom controller", "worm controller",	"serial controller", "net controller", "display controller",	"parallel controller", "pointer controller", "keyboard controller",	"audio controller", "misc controller", "disk peripheral",	"floppy peripheral", "tp peripheral", "modem peripheral",	"monitor peripheral", "printer peripheral", "pointer peripheral",	"keyboard peripheral", "terminal peripheral", "line peripheral",	"net peripheral", "misc peripheral", "anonymous"};static char *iflags[] = {	"bogus", "read only", "removable", "console in", "console out",	"input", "output"};static void __initdump_component(pcomponent *p){	prom_printf("[%p]:class<%s>type<%s>flags<%s>ver<%d>rev<%d>",		    p, classes[p->class], types[p->type],		    iflags[p->iflags], p->vers, p->rev);	prom_printf("key<%08lx>\n\tamask<%08lx>cdsize<%d>ilen<%d>iname<%s>\n",		    p->key, p->amask, (int)p->cdsize, (int)p->ilen, p->iname);}static void __inittraverse(pcomponent *p, int op){	dump_component(p);	if(ArcGetChild(p))		traverse(ArcGetChild(p), 1);	if(ArcGetPeer(p) && op)		traverse(ArcGetPeer(p), 1);}void __initprom_testtree(void){	pcomponent *p;	p = ArcGetChild(PROM_NULL_COMPONENT);	dump_component(p);	p = ArcGetChild(p);	while(p) {		dump_component(p);		p = ArcGetPeer(p);	}}#endif /* DEBUG_PROM_TREE  */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -