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

C++ OF_getprop函数代码示例

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

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



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

示例1: pccbb_attach_hook

void
pccbb_attach_hook(struct device *parent, struct device *self,
    struct pci_attach_args *pa)
{
	pci_chipset_tag_t pc = pa->pa_pc;
	int node = PCITAG_NODE(pa->pa_tag);
	int bus, busrange[2];

	if (OF_getprop(OF_parent(node), "bus-range", &busrange,
	    sizeof(busrange)) != sizeof(busrange))
		return;

	bus = busrange[0] + 1;
	while (bus < 256 && pc->busnode[bus])
		bus++;
	if (bus == 256)
		return;
	pc->busnode[bus] = node;
}
开发者ID:ajinkya93,项目名称:OpenBSD,代码行数:19,代码来源:rbus_machdep.c


示例2: ofw_bus_lookup_imap

int
ofw_bus_lookup_imap(phandle_t node, struct ofw_bus_iinfo *ii, void *reg,
    int regsz, void *pintr, int pintrsz, void *mintr, int mintrsz,
    phandle_t *iparent, void *maskbuf)
{
	int rv;

	if (ii->opi_imapsz <= 0)
		return (0);
	KASSERT(regsz >= ii->opi_addrc,
	    ("ofw_bus_lookup_imap: register size too small: %d < %d",
		regsz, ii->opi_addrc));
	rv = OF_getprop(node, "reg", reg, regsz);
	if (rv < regsz)
		panic("ofw_bus_lookup_imap: could not get reg property");
	return (ofw_bus_search_intrmap(pintr, pintrsz, reg, ii->opi_addrc,
	    ii->opi_imap, ii->opi_imapsz, ii->opi_imapmsk, maskbuf, mintr,
	    mintrsz, iparent));
}
开发者ID:edgar-pek,项目名称:PerspicuOS,代码行数:19,代码来源:ofw_bus_subr.c


示例3: powermac_smp_next_cpu

static int
powermac_smp_next_cpu(platform_t plat, struct cpuref *cpuref)
{
	char buf[8];
	phandle_t cpu;
	int res;

	cpu = OF_peer(cpuref->cr_hwref);
	while (cpu != 0) {
		res = OF_getprop(cpu, "device_type", buf, sizeof(buf));
		if (res > 0 && strcmp(buf, "cpu") == 0)
			break;
		cpu = OF_peer(cpu);
	}
	if (cpu == 0)
		return (ENOENT);

	return (powermac_smp_fill_cpuref(cpuref, cpu));
}
开发者ID:AhmadTux,项目名称:freebsd,代码行数:19,代码来源:platform_powermac.c


示例4: powermac_smp_fill_cpuref

static int
powermac_smp_fill_cpuref(struct cpuref *cpuref, phandle_t cpu)
{
	cell_t cpuid, res;

	cpuref->cr_hwref = cpu;
	res = OF_getprop(cpu, "reg", &cpuid, sizeof(cpuid));

	/*
	 * psim doesn't have a reg property, so assume 0 as for the
	 * uniprocessor case in the CHRP spec. 
	 */
	if (res < 0) {
		cpuid = 0;
	}

	cpuref->cr_cpuid = cpuid & 0xff;
	return (0);
}
开发者ID:AhmadTux,项目名称:freebsd,代码行数:19,代码来源:platform_powermac.c


示例5: ofnet_attach

static void
ofnet_attach(struct device *parent, struct device *self, void *aux)
{
	struct ofnet_softc *of = device_private(self);
	struct ifnet *ifp = &of->sc_ethercom.ec_if;
	struct ofbus_attach_args *oba = aux;
	char path[256];
	int l;
	u_int8_t myaddr[ETHER_ADDR_LEN];

	of->sc_phandle = oba->oba_phandle;
#if NIPKDB_OFN > 0
	if (kifp &&
	    kifp->unit - 1 == device_unit(&of->sc_dev) &&
	    OF_instance_to_package(kifp->port) == oba->oba_phandle)  {
		ipkdb_of = of;
		of->sc_ihandle = kifp->port;
	} else
#endif
	if ((l = OF_package_to_path(oba->oba_phandle, path,
	    sizeof path - 1)) < 0 ||
	    l >= sizeof path ||
	    (path[l] = 0, !(of->sc_ihandle = OF_open(path))))
		panic("ofnet_attach: unable to open");
	if (OF_getprop(oba->oba_phandle, "mac-address", myaddr,
	    sizeof myaddr) < 0)
		panic("ofnet_attach: no mac-address");
	printf(": address %s\n", ether_sprintf(myaddr));

	callout_init(&of->sc_callout, 0);

	strlcpy(ifp->if_xname, device_xname(&of->sc_dev), IFNAMSIZ);
	ifp->if_softc = of;
	ifp->if_start = ofnet_start;
	ifp->if_ioctl = ofnet_ioctl;
	ifp->if_watchdog = ofnet_watchdog;
	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS;
	IFQ_SET_READY(&ifp->if_snd);

	if_attach(ifp);
	ether_ifattach(ifp, myaddr);
}
开发者ID:Tommmster,项目名称:netbsd-avr32,代码行数:42,代码来源:ofnet.c


示例6: openpicbus_mambo_attach

static int
openpicbus_mambo_attach(device_t dev)
{
	uint64_t picaddr;
	phandle_t nexus;
	struct openpicbus_softc *sc;

	sc = device_get_softc(dev);

	nexus = OF_parent(ofw_bus_get_node(dev));

	OF_getprop(nexus,"platform-open-pic",
	    &picaddr,sizeof(picaddr));

	sc->picaddr = picaddr;

	device_add_child(dev,"openpic",-1);

	return (bus_generic_attach(dev));
}
开发者ID:JabirTech,项目名称:Source,代码行数:20,代码来源:mambo_openpic.c


示例7: prtc_gettime

int
prtc_gettime(todr_chip_handle_t handle, struct timeval *tv)
{
	u_int32_t tod = 0;
	char buf[32];

	if (OF_getprop(findroot(), "name", buf, sizeof(buf)) > 0 &&
	    strcmp(buf, "SUNW,SPARC-Enterprise") == 0) {
		tv->tv_sec = prom_opl_get_tod();
		tv->tv_usec = 0;
		return (0);
	}

	snprintf(buf, sizeof(buf), "h# %08lx unix-gettod", (long)&tod);
	OF_interpret(buf, 0);

	tv->tv_sec = tod;
	tv->tv_usec = 0;
	return (0);
}
开发者ID:ajinkya93,项目名称:OpenBSD,代码行数:20,代码来源:prtc.c


示例8: oskit_linux_ofw_nodedump

/*
 * Debugging code to print the entire OFW device tree.
 */
void
oskit_linux_ofw_nodedump(int phandle, int level)
{
	int	child, i;
	char	name[32];

	for (i = 0; i < level; i++)
		printk(" ");

	if (OF_getprop(phandle, "name", name, sizeof(name)) > 0) {
		printk("0x%x:%s\n", phandle, name);
	}
	else {
		printk("0x%x:????", phandle);
	}

	for (child = OF_child(phandle); child; child = OF_peer(child)) {
		oskit_linux_ofw_nodedump(child, level + 1);
	}
}
开发者ID:dzavalishin,项目名称:oskit,代码行数:23,代码来源:ofw.c


示例9: ofw_getcleaninfo

oskit_addr_t
ofw_getcleaninfo(void)
{
	int		cpu;
	oskit_addr_t	vclean, pclean;

	if ((cpu = OF_finddevice("/cpu")) == -1)
		panic("ofw_getcleaninfo: OF_finddevice(/cpu)");
	
	if ((OF_getprop(cpu, "d-cache-flush-address", &vclean,
			sizeof(vclean))) != sizeof(vclean))
		return -1;

	vclean = OF_decode_int((unsigned char *)&vclean);

	if ((pclean = ofw_gettranslation(vclean)) == -1)
		panic("ofw_getcleaninfo: ofw_gettranslation(0x%x)", vclean);

	return pclean;
}
开发者ID:dzavalishin,项目名称:oskit,代码行数:20,代码来源:ofw_cache.c


示例10: fman_get_clock

uint32_t
fman_get_clock(struct fman_softc *sc)
{
	device_t dev;
	phandle_t node;
	pcell_t fman_clock;

	dev = sc->sc_base.dev;
	node = ofw_bus_get_node(dev);

	if ((OF_getprop(node, "clock-frequency", &fman_clock,
	    sizeof(fman_clock)) <= 0) || (fman_clock == 0)) {
		device_printf(dev, "could not acquire correct frequency "
		    "from DTS\n");

		return (0);
	}

	return ((uint32_t)fman_clock);
}
开发者ID:jaredmcneill,项目名称:freebsd,代码行数:20,代码来源:fman_fdt.c


示例11: hfs_open

int
hfs_open(char *path, struct open_file *f)
{
	int chosen;
	char bootpath[128], *cp;

	if ((chosen = OF_finddevice("/chosen")) == -1)
		return ENXIO;
	bzero(bootpath, sizeof bootpath);
	OF_getprop(chosen, "bootpath", bootpath, sizeof bootpath);

	cp = strrchr(bootpath, ',');
	if (cp == NULL)
		return ENXIO;

	strlcpy(cp + 1, path, bootpath + sizeof bootpath - (cp + 1));
	OF_fd = OF_open(bootpath);
	if (OF_fd == -1)
		return ENOENT;
	return 0;
}
开发者ID:bradla,项目名称:OpenBSD-Hammer2,代码行数:21,代码来源:hfs.c


示例12: uart_cpu_channel

/*
 * Determine which channel of a SCC a device referenced by a full device
 * path or as an alias is (in the latter case we try to look up the device
 * path via the /aliases node).
 * Only the device paths of devices which are used for TTYs really allow
 * to do this as they look like these (taken from /aliases nodes):
 * ttya:  '/central/fhc/[email protected],902000:a'
 * ttyc:  '/[email protected],0/[email protected],1/[email protected]/[email protected],400000:a'
 * Additionally, for device paths of SCCs which are connected to a RSC
 * (Remote System Control) device we can hardcode the appropriate channel.
 * Such device paths look like these:
 * rsc:   '/[email protected],4000/[email protected]/[email protected],200000:ssp'
 * ttyc:  '/[email protected],4000/[email protected]/[email protected],200000:ssp'
 */
static int
uart_cpu_channel(char *dev)
{
	char alias[64];
	phandle_t aliases;
	int len;
	const char *p;

	strcpy(alias, dev);
	if ((aliases = OF_finddevice("/aliases")) != -1)
		(void)OF_getprop(aliases, dev, alias, sizeof(alias));
	len = strlen(alias);
	if ((p = strrchr(alias, ':')) == NULL)
		return (0);
	p++;
	if (p - alias == len - 1 && (*p == 'a' || *p == 'b'))
		return (*p - 'a' + 1);
	if (strcmp(p, "ssp") == 0)
		return (1);
	return (0);
}
开发者ID:ele7enxxh,项目名称:dtrace-pf,代码行数:35,代码来源:uart_cpu_sparc64.c


示例13: get_ncpus

static void
get_ncpus(void)
{
#ifdef MULTIPROCESSOR
	int node;
	char sbuf[32];

	node = findroot();

	sparc_ncpus = 0;
	for (node = OF_child(node); node; node = OF_peer(node)) {
		if (OF_getprop(node, "device_type", sbuf, sizeof(sbuf)) <= 0)
			continue;
		if (strcmp(sbuf, "cpu") != 0)
			continue;
		sparc_ncpus++;
	}
#else
	sparc_ncpus = 1;
#endif
}
开发者ID:lacombar,项目名称:netbsd-alc,代码行数:21,代码来源:autoconf.c


示例14: uart_cpu_getdev_console

/*
 * Get the package handle of the UART that is selected as the console, if
 * the console is an UART of course. Note that we enforce that both input
 * and output are selected.
 * Note that the currently active console (i.e. /chosen/stdout and
 * /chosen/stdin) may not be the same as the device selected in the
 * environment (ie /options/output-device and /options/input-device) because
 * keyboard and screen were selected but the keyboard was unplugged or the
 * user has changed the environment. In the latter case I would assume that
 * the user expects that FreeBSD uses the new console setting.
 * For weirder configurations, use ofw_console(4).
 */
static phandle_t
uart_cpu_getdev_console(phandle_t options, char *dev, size_t devsz)
{
	char buf[sizeof("serial")];
	ihandle_t inst;
	phandle_t chosen, input, output;

	if (OF_getprop(options, "input-device", dev, devsz) == -1)
		return (-1);
	input = OF_finddevice(dev);
	if (OF_getprop(options, "output-device", dev, devsz) == -1)
		return (-1);
	output = OF_finddevice(dev);
	if (input == -1 || output == -1 ||
	    OF_getproplen(input, "keyboard") >= 0) {
		if ((chosen = OF_finddevice("/chosen")) == -1)
			return (-1);
		if (OF_getprop(chosen, "stdin", &inst, sizeof(inst)) == -1)
			return (-1);
		if ((input = OF_instance_to_package(inst)) == -1)
			return (-1);
		if (OF_getprop(chosen, "stdout", &inst, sizeof(inst)) == -1)
			return (-1);
		if ((output = OF_instance_to_package(inst)) == -1)
			return (-1);
		snprintf(dev, devsz, "ttya");
	}
	if (input != output)
		return (-1);
	if (OF_getprop(input, "device_type", buf, sizeof(buf)) == -1)
		return (-1);
	if (strcmp(buf, "serial") != 0)
		return (-1);
	/* For a Serengeti console device point to the bootbus controller. */
	if (OF_getprop(input, "name", buf, sizeof(buf)) > 0 &&
	    !strcmp(buf, "sgcn")) {
		if ((chosen = OF_finddevice("/chosen")) == -1)
			return (-1);
		if (OF_getprop(chosen, "iosram", &input, sizeof(input)) == -1)
			return (-1);
	}
	return (input);
}
开发者ID:ele7enxxh,项目名称:dtrace-pf,代码行数:55,代码来源:uart_cpu_sparc64.c


示例15: nvbl_probe

static int
nvbl_probe(device_t dev)
{
	char		control[8];
	phandle_t	handle;

	handle = OF_finddevice("mac-io/backlight");

	if (handle == -1)
		return (ENXIO);

	if (OF_getprop(handle, "backlight-control", &control, sizeof(control)) < 0)
		return (ENXIO);

	if (strcmp(control, "mnca") != 0)
		return (ENXIO);

	device_set_desc(dev, "PowerBook backlight for nVidia graphics");

	return (0);
}
开发者ID:dcui,项目名称:FreeBSD-9.3_kernel,代码行数:21,代码来源:nvbl.c


示例16: cpu_reset

void
cpu_reset(void)
{
	phandle_t src;
	uint32_t addr, paddr;
	bus_addr_t vaddr;

	if (src_swreset() == 0)
		goto end;

	src = OF_finddevice("src");
	if ((src != 0) && (OF_getprop(src, "reg", &paddr, sizeof(paddr))) > 0) {
		addr = fdt32_to_cpu(paddr);
		if (bus_space_map(fdtbus_bs_tag, addr, 0x10, 0, &vaddr) == 0) {
			bus_space_write_4(fdtbus_bs_tag, vaddr, 0x00, SW_RST);
		}
	}

end:
	while (1);
}
开发者ID:RichardsonAlex,项目名称:cheribsd,代码行数:21,代码来源:vf_common.c


示例17: fix_cardbus_bridge

static void
fix_cardbus_bridge(int node, pci_chipset_tag_t pc, pcitag_t tag)
{
	uint32_t bus_number = 0xffffffff;
	pcireg_t bi;
	int bus, dev, fn, ih, len;
	char path[256];

#if PB3400_CARDBUS_HACK
	int root_node;

	root_node = OF_finddevice("/");
	if (of_compatible(root_node, pb3400_compat) != -1) {

		bus_number = cardbus_number;
		cardbus_number++;
	} else {
#endif		
		ih = OF_open(path);
		OF_call_method("load-ata", ih, 0, 0);
		OF_close(ih);

		OF_getprop(node, "AAPL,bus-id", &bus_number,
		    sizeof(bus_number));
#if PB3400_CARDBUS_HACK
	}
#endif
	if (bus_number != 0xffffffff) {

		len = OF_package_to_path(node, path, sizeof(path));
		path[len] = 0;
		aprint_verbose("\n%s: fixing bus number to %d", path, bus_number);
		pci_decompose_tag(pc, tag, &bus, &dev, &fn);
		bi = pci_conf_read(pc, tag, PPB_REG_BUSINFO);
		bi &= 0xff000000;
		/* XXX subordinate is always 32 here */
		bi |= (bus & 0xff) | (bus_number << 8) | 0x200000;
		pci_conf_write(pc, tag, PPB_REG_BUSINFO, bi);
	}
}
开发者ID:ryo,项目名称:netbsd-src,代码行数:40,代码来源:pci_machdep.c


示例18: copy_disp_props

void
copy_disp_props(struct device *dev, int node, prop_dictionary_t dict)
{
	uint32_t temp;
	char typestr[32];

	memset(typestr, 0, sizeof(typestr));
	OF_getprop(console_node, "device_type", typestr, sizeof(typestr));
	if (strcmp(typestr, "serial") != 0) {
		/* this is our console, when we don't have a serial console */
		prop_dictionary_set_bool(dict, "is_console", 1);
	}

	if (!of_to_uint32_prop(dict, node, "width", "width")) {

		OF_interpret("screen-width", 0, 1, &temp);
		prop_dictionary_set_uint32(dict, "width", temp);
	}
	if (!of_to_uint32_prop(dict, node, "height", "height")) {

		OF_interpret("screen-height", 0, 1, &temp);
		prop_dictionary_set_uint32(dict, "height", temp);
	}
	of_to_uint32_prop(dict, node, "linebytes", "linebytes");
	if (!of_to_uint32_prop(dict, node, "depth", "depth")) {
		/*
		 * XXX we should check linebytes vs. width but those
		 * FBs that don't have a depth property ( /chaos/control... )
		 * won't have linebytes either
		 */
		prop_dictionary_set_uint32(dict, "depth", 8);
	}
	if (!of_to_uint32_prop(dict, node, "address", "address")) {
		uint32_t fbaddr = 0;
			OF_interpret("frame-buffer-adr", 0, 1, &fbaddr);
		if (fbaddr != 0)
			prop_dictionary_set_uint32(dict, "address", fbaddr);
	}
}
开发者ID:lacombar,项目名称:netbsd-alc,代码行数:39,代码来源:machdep.c


示例19: socpcic_mainbus_attach

void
socpcic_mainbus_attach(struct device *parent, struct device *self, void *aux)
{
	struct socpcic_softc *sc = (void *)self;
	struct mainbus_attach_args *ma = aux;
	int reg[4];

	if (OF_getprop(ma->ma_node, "reg", &reg, sizeof(reg)) < sizeof(reg)) {
		printf(": missing registers\n");
		return;
	}

	sc->sc_iot = ma->ma_iot;
	if (bus_space_map(sc->sc_iot, reg[2], 16, 0, &sc->sc_cfg_ioh)) {
		printf(": can't map configuration registers\n");
		return;
	}

	sc->sc_node = ma->ma_node;
	sc->sc_dmat = ma->ma_dmat;
	socpcic_attach(sc);
}
开发者ID:alenichev,项目名称:openbsd-kernel,代码行数:22,代码来源:socpcic.c


示例20: com_mainbus_attach

void
com_mainbus_attach(device_t parent, device_t self, void *aux)
{
    struct com_mainbus_softc *msc = device_private(self);
    struct com_softc *sc = &msc->sc_com;
    int serial, interrupt_length;
    int interrupts[8];
    bus_space_tag_t iot;
    bus_space_handle_t ioh;
    bus_addr_t iobase;

    sc->sc_dev = self;

    serial = OF_finddevice("/[email protected]/[email protected]/[email protected]");
    if (serial != -1) {
        interrupt_length =
            OF_getprop(serial, "interrupts", interrupts, sizeof(interrupts));
    }


    iot = (bus_space_tag_t)0xf4000000;
    iobase = 0x3f8;
    comcnattach(iot, iobase, 9600, 1843200, COM_TYPE_NORMAL, (CREAD | CS8));
    bus_space_map(iot, iobase, COM_NPORTS, 0, &ioh);
    COM_INIT_REGS(sc->sc_regs, iot, ioh, iobase);

    sc->sc_frequency = 1843200;

    com_attach_subr(sc);
#if 1
    msc->sc_ih =
        intr_establish(interrupts[0], IST_LEVEL, IPL_SERIAL, comintr, sc);

    if (msc->sc_ih == NULL)
        panic("failed to establish int handler");
#endif


}
开发者ID:krytarowski,项目名称:netbsd-current-src-sys,代码行数:39,代码来源:com_mainbus.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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