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

C++ prom_getproperty函数代码示例

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

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



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

示例1: prom_getint

/* Acquire an integer property and return its value.  Returns -1
 * on failure.
 */
inline int prom_getint(int node, const char *prop)
{
	int intprop;

	if (prom_getproperty(node, prop, (char *) &intprop, sizeof(int)) != -1)
		return intprop;

	return -1;
}
开发者ID:12rafael,项目名称:jellytimekernel,代码行数:12,代码来源:tree_64.c


示例2: prom_getstring

/* Acquire a property whose value is a string, returns a null
 * string on error.  The char pointer is the user supplied string
 * buffer.
 */
void prom_getstring(int node, const char *prop, char *user_buf, int ubuf_size)
{
	int len;

	len = prom_getproperty(node, prop, user_buf, ubuf_size);
	if (len != -1)
		return;
	user_buf[0] = 0;
}
开发者ID:12rafael,项目名称:jellytimekernel,代码行数:13,代码来源:tree_64.c


示例3: prom_getint

/* Acquire an integer property and return its value.  Returns -1
 * on failure.
 */
int prom_getint(int node, char *prop)
{
    static int intprop;

    if(prom_getproperty(node, prop, (char *) &intprop, sizeof(int)) != -1)
        return intprop;

    return -1;
}
开发者ID:b3rnik,项目名称:dsl-n55u-bender,代码行数:12,代码来源:tree.c


示例4: prom_nodematch

/* Does the device at node 'node' have name 'name'?
 * YES = 1   NO = 0
 */
int prom_nodematch(int node, char *name)
{
    int error;

    static char namebuf[128];
    error = prom_getproperty(node, "name", namebuf, sizeof(namebuf));
    if (error == -1) return 0;
    if(strcmp(namebuf, name) == 0) return 1;
    return 0;
}
开发者ID:acassis,项目名称:emlinux-ssd1935,代码行数:13,代码来源:tree.c


示例5: ebus_ranges_init

static void __init ebus_ranges_init(struct linux_ebus *ebus)
{
	int success;

	ebus->num_ebus_ranges = 0;
	success = prom_getproperty(ebus->prom_node, "ranges",
				   (char *)ebus->ebus_ranges,
				   sizeof(ebus->ebus_ranges));
	if (success != -1)
		ebus->num_ebus_ranges = (success/sizeof(struct linux_prom_ebus_ranges));
}
开发者ID:dmgerman,项目名称:linux-pre-history,代码行数:11,代码来源:ebus.c


示例6: build_one_prop

static struct property * __init build_one_prop(phandle node, char *prev,
					       char *special_name,
					       void *special_val,
					       int special_len)
{
	static struct property *tmp = NULL;
	struct property *p;
	const char *name;

	if (tmp) {
		p = tmp;
		memset(p, 0, sizeof(*p) + 32);
		tmp = NULL;
	} else {
		p = prom_early_alloc(sizeof(struct property) + 32);
		p->unique_id = prom_unique_id++;
	}

	p->name = (char *) (p + 1);
	if (special_name) {
		strcpy(p->name, special_name);
		p->length = special_len;
		p->value = prom_early_alloc(special_len);
		memcpy(p->value, special_val, special_len);
	} else {
		if (prev == NULL) {
			name = prom_firstprop(node, p->name);
		} else {
			name = prom_nextprop(node, prev, p->name);
		}

		if (!name || strlen(name) == 0) {
			tmp = p;
			return NULL;
		}
#ifdef CONFIG_SPARC32
		strcpy(p->name, name);
#endif
		p->length = prom_getproplen(node, p->name);
		if (p->length <= 0) {
			p->length = 0;
		} else {
			int len;

			p->value = prom_early_alloc(p->length + 1);
			len = prom_getproperty(node, p->name, p->value,
					       p->length);
			if (len <= 0)
				p->length = 0;
			((unsigned char *)p->value)[p->length] = '\0';
		}
	}
	return p;
}
开发者ID:1703011,项目名称:asuswrt-merlin,代码行数:54,代码来源:prom_common.c


示例7: prom_query_output_device

enum prom_output_device
prom_query_output_device(void)
{
	int st_p;
	char propb[64];
	int propl;

	st_p = prom_inst2pkg(prom_stdout);
	propl = prom_getproperty(st_p, "device_type", propb, sizeof(propb));
	if (propl >= 0 && propl == sizeof("display") &&
	    strncmp("display", propb, sizeof("display")) == 0)
		return PROMDEV_OSCREEN;
	if(strncmp("serial", propb, 6))
		return PROMDEV_O_UNK;
	/* FIXME: Is there any better way how to find out? */	
	memset(propb, 0, sizeof(propb));
	st_p = prom_finddevice ("/options");
	prom_getproperty(st_p, "output-device", propb, sizeof(propb));

	/*
	 * If we get here with propb == 'screen', we are on ttya, as
	 * the PROM defaulted to this due to 'no input device'.
	 */
	if (!strncmp(propb, "screen", 6))
		return PROMDEV_OTTYA;

	if (!strncmp (propb, "rsc", 3))
		return PROMDEV_ORSC;

	if (!strncmp (propb, "virtual-console", 3))
		return PROMDEV_OVCONS;

	if (strncmp (propb, "tty", 3) || !propb[3])
		return PROMDEV_O_UNK;

	switch (propb[3]) {
		case 'a': return PROMDEV_OTTYA;
		case 'b': return PROMDEV_OTTYB;
		default: return PROMDEV_O_UNK;
	}
}
开发者ID:maliyu,项目名称:SOM2416,代码行数:41,代码来源:console.c


示例8: ebus_intmap_init

static void __init ebus_intmap_init(struct linux_ebus *ebus)
{
	int success;

	ebus->num_ebus_intmap = 0;
	success = prom_getproperty(ebus->prom_node, "interrupt-map",
				   (char *)ebus->ebus_intmap,
				   sizeof(ebus->ebus_intmap));
	if (success == -1)
		return;

	ebus->num_ebus_intmap = (success/sizeof(struct linux_prom_ebus_intmap));

	success = prom_getproperty(ebus->prom_node, "interrupt-map-mask",
				   (char *)&ebus->ebus_intmask,
				   sizeof(ebus->ebus_intmask));
	if (success == -1) {
		prom_printf("%s: can't get interrupt-map-mask\n", __FUNCTION__);
		prom_halt();
	}
}
开发者ID:dmgerman,项目名称:linux-pre-history,代码行数:21,代码来源:ebus.c


示例9: prom_get_idprom

/* Get the idprom and stuff it into buffer 'idbuf'.  Returns the
 * format type.  'num_bytes' is the number of bytes that your idbuf
 * has space for.  Returns 0xff on error.
 */
unsigned char
prom_get_idprom(char *idbuf, int num_bytes)
{
	int len;

	len = prom_getproplen(prom_root_node, "idprom");
	if((len>num_bytes) || (len==-1)) return 0xff;
	if(!prom_getproperty(prom_root_node, "idprom", idbuf, num_bytes))
		return idbuf[0];

	return 0xff;
}
开发者ID:johnny,项目名称:CobraDroidBeta,代码行数:16,代码来源:misc_32.c


示例10: prom_ranges_init

void
prom_ranges_init(void)
{
	int node, obio_node, sbus_node;
	int success;

	num_obio_ranges = 0;
	num_sbus_ranges = 0;

	/* Check for obio and sbus ranges. */
	node = prom_getchild(prom_root_node);
	obio_node = prom_searchsiblings(node, "obio");
	sbus_node = prom_searchsiblings(node, "iommu");
	if(sbus_node) {
		sbus_node = prom_getchild(sbus_node);
		sbus_node = prom_searchsiblings(sbus_node, "sbus");
	}

	if(obio_node) {
		success = prom_getproperty(obio_node, "ranges",
					   (char *) promlib_obio_ranges,
					   sizeof(promlib_obio_ranges));
		if(success != -1)
			num_obio_ranges = (success/sizeof(struct linux_prom_ranges));
	}

	if(sbus_node) {
		success = prom_getproperty(sbus_node, "ranges",
					   (char *) promlib_sbus_ranges,
					   sizeof(promlib_sbus_ranges));
		if(success != -1)
			num_sbus_ranges = (success/sizeof(struct linux_prom_ranges));
	}

	if(num_obio_ranges || num_sbus_ranges)
		prom_printf("PROMLIB: obio_ranges %d sbus_ranges %d\n",
			    num_obio_ranges, num_sbus_ranges);

	return;
}
开发者ID:andreiw,项目名称:mkunity,代码行数:40,代码来源:ranges.c


示例11: get_one_property

static char * __init get_one_property(phandle node, const char *name)
{
	char *buf = "<NULL>";
	int len;

	len = prom_getproplen(node, name);
	if (len > 0) {
		buf = prom_early_alloc(len);
		len = prom_getproperty(node, name, buf, len);
	}

	return buf;
}
开发者ID:1703011,项目名称:asuswrt-merlin,代码行数:13,代码来源:prom_common.c


示例12: prom_query_input_device

/* Query for input device type */
enum prom_input_device
prom_query_input_device(void)
{
	int st_p;
	char propb[64];

	st_p = prom_inst2pkg(prom_stdin);
	if(prom_node_has_property(st_p, "keyboard"))
		return PROMDEV_IKBD;
	prom_getproperty(st_p, "device_type", propb, sizeof(propb));
	if(strncmp(propb, "serial", 6))
		return PROMDEV_I_UNK;
	/* FIXME: Is there any better way how to find out? */	
	memset(propb, 0, sizeof(propb));
	st_p = prom_finddevice ("/options");
	prom_getproperty(st_p, "input-device", propb, sizeof(propb));

	/*
	 * If we get here with propb == 'keyboard', we are on ttya, as
	 * the PROM defaulted to this due to 'no input device'.
	 */
	if (!strncmp(propb, "keyboard", 8))
		return PROMDEV_ITTYA;

	if (!strncmp (propb, "rsc", 3))
		return PROMDEV_IRSC;

	if (!strncmp (propb, "virtual-console", 3))
		return PROMDEV_IVCONS;

	if (strncmp (propb, "tty", 3) || !propb[3])
		return PROMDEV_I_UNK;

	switch (propb[3]) {
		case 'a': return PROMDEV_ITTYA;
		case 'b': return PROMDEV_ITTYB;
		default: return PROMDEV_I_UNK;
	}
}
开发者ID:maliyu,项目名称:SOM2416,代码行数:40,代码来源:console.c


示例13: auxio_probe

void __init auxio_probe(void)
{
	int node, auxio_nd;
	struct linux_prom_registers auxregs[1];
	struct resource r;

	switch (sparc_cpu_model) {
	case sun4d:
	case sun4:
		auxio_register = 0;
		return;
	default:
		break;
	}
	node = prom_getchild(prom_root_node);
	auxio_nd = prom_searchsiblings(node, "auxiliary-io");
	if(!auxio_nd) {
		node = prom_searchsiblings(node, "obio");
		node = prom_getchild(node);
		auxio_nd = prom_searchsiblings(node, "auxio");
		if(!auxio_nd) {
#ifdef CONFIG_PCI
			/* There may be auxio on Ebus */
			auxio_register = 0;
			return;
#else
			if(prom_searchsiblings(node, "leds")) {
				/* VME chassis sun4m machine, no auxio exists. */
				auxio_register = 0;
				return;
			}
			prom_printf("Cannot find auxio node, cannot continue...\n");
			prom_halt();
#endif
		}
	}
	prom_getproperty(auxio_nd, "reg", (char *) auxregs, sizeof(auxregs));
	prom_apply_obio_ranges(auxregs, 0x1);
	/* Map the register both read and write */
	r.flags = auxregs[0].which_io & 0xF;
	r.start = auxregs[0].phys_addr;
	r.end = auxregs[0].phys_addr + auxregs[0].reg_size - 1;
	auxio_register = (unsigned char *) sbus_ioremap(&r, 0,
	    auxregs[0].reg_size, "auxio");
	/* Fix the address on sun4m and sun4c. */
	if((((unsigned long) auxregs[0].phys_addr) & 3) == 3 ||
	   sparc_cpu_model == sun4c)
		auxio_register = (unsigned char *) ((int)auxio_register | 3);

	TURN_ON_LED;
}
开发者ID:TitaniumBoy,项目名称:lin,代码行数:51,代码来源:auxio.c


示例14: prom_getchild

const char *promcon_startup(void)
{
	const char *display_desc = "PROM";
	int node;
	char buf[40];
	
	node = prom_getchild(prom_root_node);
	node = prom_searchsiblings(node, "options");
	if (prom_getproperty(node,  "screen-#columns", buf, 40) != -1) {
		pw = simple_strtoul(buf, NULL, 0);
		if (pw < 10 || pw > 256)
			pw = 80;
		pw--;
	}
	if (prom_getproperty(node,  "screen-#rows", buf, 40) != -1) {
		ph = simple_strtoul(buf, NULL, 0);
		if (ph < 10 || ph > 256)
			ph = 34;
		ph--;
	}
	promcon_puts("\033[H\033[J", 6);
	return display_desc;
}
开发者ID:WiseMan787,项目名称:ralink_sdk,代码行数:23,代码来源:promcon.c


示例15: prom_getint

/* Acquire an integer property and return its value.  Returns -1
 * on failure.
 */
int
prom_getint(int node, char *prop)
{
	static int intprop;

#if CONFIG_AP1000
        printk("prom_getint(%s) -> -1\n",prop);
        return -1;
#endif
	if(prom_getproperty(node, prop, (char *) &intprop, sizeof(int)) != -1)
		return intprop;

	return -1;
}
开发者ID:andreiw,项目名称:mkunity,代码行数:17,代码来源:tree.c


示例16: prom_getstring

/* Acquire a property whose value is a string, returns a null
 * string on error.  The char pointer is the user supplied string
 * buffer.
 */
void
prom_getstring(int node, char *prop, char *user_buf, int ubuf_size)
{
	int len;

#if CONFIG_AP1000
        printk("prom_getstring(%s) -> .\n",prop);
        return;
#endif
	len = prom_getproperty(node, prop, user_buf, ubuf_size);
	if(len != -1) return;
	user_buf[0] = 0;
	return;
}
开发者ID:andreiw,项目名称:mkunity,代码行数:18,代码来源:tree.c


示例17: auxio_probe

void __init auxio_probe(void)
{
	phandle node, auxio_nd;
	struct linux_prom_registers auxregs[1];
	struct resource r;

	switch (sparc_cpu_model) {
	case sparc_leon:
	case sun4d:
	case sun4:
		return;
	default:
		break;
	}
	node = prom_getchild(prom_root_node);
	auxio_nd = prom_searchsiblings(node, "auxiliary-io");
	if(!auxio_nd) {
		node = prom_searchsiblings(node, "obio");
		node = prom_getchild(node);
		auxio_nd = prom_searchsiblings(node, "auxio");
		if(!auxio_nd) {
#ifdef CONFIG_PCI
			
			return;
#else
			if(prom_searchsiblings(node, "leds")) {
				
				return;
			}
			prom_printf("Cannot find auxio node, cannot continue...\n");
			prom_halt();
#endif
		}
	}
	if(prom_getproperty(auxio_nd, "reg", (char *) auxregs, sizeof(auxregs)) <= 0)
		return;
	prom_apply_obio_ranges(auxregs, 0x1);
	
	r.flags = auxregs[0].which_io & 0xF;
	r.start = auxregs[0].phys_addr;
	r.end = auxregs[0].phys_addr + auxregs[0].reg_size - 1;
	auxio_register = of_ioremap(&r, 0, auxregs[0].reg_size, "auxio");
	
	if((((unsigned long) auxregs[0].phys_addr) & 3) == 3 ||
	   sparc_cpu_model == sun4c)
		auxio_register += (3 - ((unsigned long)auxio_register & 3));

	set_auxio(AUXIO_LED, 0);
}
开发者ID:DirtyDroidX,项目名称:android_kernel_htc_m8ul,代码行数:49,代码来源:auxio_32.c


示例18: prom_getchild

static char *serial(char *buffer)
{
	int node = prom_getchild(prom_root_node);
	int len;

	node = prom_searchsiblings(node, "options");
	*buffer = 0;
	len = prom_getproperty(node, "system-board-serial#", buffer, 256);
	if(len > 0)
		buffer[len] = 0;
	if (!*buffer)
		return "4512348717234";
	else
		return buffer;
}
开发者ID:TitaniumBoy,项目名称:lin,代码行数:15,代码来源:misc.c


示例19: envctrl_init_adc

/* Function Description: Initialize monitor channel with channel desc,
 *                       decoding tables, monitor type, optional properties.
 * Return: None.
 */
static void envctrl_init_adc(struct i2c_child_t *pchild, int node)
{
	char chnls_desc[CHANNEL_DESC_SZ];
	int i = 0, len;
	char *pos = chnls_desc;

	/* Firmware describe channels into a stream separated by a '\0'. */
	len = prom_getproperty(node, "channels-description", chnls_desc,
			       CHANNEL_DESC_SZ);
	chnls_desc[CHANNEL_DESC_SZ - 1] = '\0';

	while (len > 0) {
		int l = strlen(pos) + 1;
		envctrl_set_mon(pchild, pos, i++);
		len -= l;
		pos += l;
	}

	/* Get optional properties. */
        len = prom_getproperty(node, "warning-temp", (char *)&warning_temperature,
			       sizeof(warning_temperature));
        len = prom_getproperty(node, "shutdown-temp", (char *)&shutdown_temperature,
			       sizeof(shutdown_temperature));
}
开发者ID:jhbsz,项目名称:actiontec_opensource_mi424wr-rev-acd-56-0-10-14-4,代码行数:28,代码来源:envctrl.c


示例20: read_obp_memory

static void __init read_obp_memory(const char *property,
				   struct linux_prom64_registers *regs,
				   int *num_ents)
{
	int node = prom_finddevice("/memory");
	int prop_size = prom_getproplen(node, property);
	int ents, ret, i;

	ents = prop_size / sizeof(struct linux_prom64_registers);
	if (ents > MAX_BANKS) {
		prom_printf("The machine has more %s property entries than "
			    "this kernel can support (%d).\n",
			    property, MAX_BANKS);
		prom_halt();
	}

	ret = prom_getproperty(node, property, (char *) regs, prop_size);
	if (ret == -1) {
		prom_printf("Couldn't get %s property from /memory.\n");
		prom_halt();
	}

	*num_ents = ents;

	/* Sanitize what we got from the firmware, by page aligning
	 * everything.
	 */
	for (i = 0; i < ents; i++) {
		unsigned long base, size;

		base = regs[i].phys_addr;
		size = regs[i].reg_size;

		size &= PAGE_MASK;
		if (base & ~PAGE_MASK) {
			unsigned long new_base = PAGE_ALIGN(base);

			size -= new_base - base;
			if ((long) size < 0L)
				size = 0UL;
			base = new_base;
		}
		regs[i].phys_addr = base;
		regs[i].reg_size = size;
	}
	sort(regs, ents, sizeof(struct linux_prom64_registers),
	     cmp_p64, NULL);
}
开发者ID:me-oss,项目名称:me-linux,代码行数:48,代码来源:init.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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