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


C++ OF_getprop函数代码示例

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


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


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