xref: /freebsd/share/man/man9/OF_child.9 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
1*ac32b99cSOleksandr Tymoshenko.\"
2*ac32b99cSOleksandr Tymoshenko.\" Copyright (c) 2018 Oleksandr Tymoshenko <gonzo@FreeBSD.org>
3*ac32b99cSOleksandr Tymoshenko.\"
4*ac32b99cSOleksandr Tymoshenko.\" All rights reserved.
5*ac32b99cSOleksandr Tymoshenko.\"
6*ac32b99cSOleksandr Tymoshenko.\" Redistribution and use in source and binary forms, with or without
7*ac32b99cSOleksandr Tymoshenko.\" modification, are permitted provided that the following conditions
8*ac32b99cSOleksandr Tymoshenko.\" are met:
9*ac32b99cSOleksandr Tymoshenko.\" 1. Redistributions of source code must retain the above copyright
10*ac32b99cSOleksandr Tymoshenko.\"    notice, this list of conditions and the following disclaimer.
11*ac32b99cSOleksandr Tymoshenko.\" 2. Redistributions in binary form must reproduce the above copyright
12*ac32b99cSOleksandr Tymoshenko.\"    notice, this list of conditions and the following disclaimer in the
13*ac32b99cSOleksandr Tymoshenko.\"    documentation and/or other materials provided with the distribution.
14*ac32b99cSOleksandr Tymoshenko.\"
15*ac32b99cSOleksandr Tymoshenko.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
16*ac32b99cSOleksandr Tymoshenko.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17*ac32b99cSOleksandr Tymoshenko.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18*ac32b99cSOleksandr Tymoshenko.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
19*ac32b99cSOleksandr Tymoshenko.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20*ac32b99cSOleksandr Tymoshenko.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21*ac32b99cSOleksandr Tymoshenko.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22*ac32b99cSOleksandr Tymoshenko.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23*ac32b99cSOleksandr Tymoshenko.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24*ac32b99cSOleksandr Tymoshenko.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*ac32b99cSOleksandr Tymoshenko.\"
26*ac32b99cSOleksandr Tymoshenko.Dd April 9, 2018
27*ac32b99cSOleksandr Tymoshenko.Dt OF_CHILD 9
28*ac32b99cSOleksandr Tymoshenko.Os
29*ac32b99cSOleksandr Tymoshenko.Sh NAME
30*ac32b99cSOleksandr Tymoshenko.Nm OF_child ,
31*ac32b99cSOleksandr Tymoshenko.Nm OF_parent ,
32*ac32b99cSOleksandr Tymoshenko.Nm OF_peer
33*ac32b99cSOleksandr Tymoshenko.Nd navigate device tree
34*ac32b99cSOleksandr Tymoshenko.Sh SYNOPSIS
35*ac32b99cSOleksandr Tymoshenko.In dev/ofw/ofw_bus.h
36*ac32b99cSOleksandr Tymoshenko.In dev/ofw/ofw_bus_subr.h
37*ac32b99cSOleksandr Tymoshenko.Ft phandle_t
38*ac32b99cSOleksandr Tymoshenko.Fn OF_child "phandle_t node"
39*ac32b99cSOleksandr Tymoshenko.Ft phandle_t
40*ac32b99cSOleksandr Tymoshenko.Fn OF_parent "phandle_t node"
41*ac32b99cSOleksandr Tymoshenko.Ft phandle_t
42*ac32b99cSOleksandr Tymoshenko.Fn OF_peer "phandle_t node"
43*ac32b99cSOleksandr Tymoshenko.Sh DESCRIPTION
44*ac32b99cSOleksandr Tymoshenko.Fn OF_child
45*ac32b99cSOleksandr Tymoshenkoreturns the phandle value of the first child of the
46*ac32b99cSOleksandr Tymoshenko.Fa node .
47*ac32b99cSOleksandr TymoshenkoZero is returned if there are no child nodes.
48*ac32b99cSOleksandr Tymoshenko.Pp
49*ac32b99cSOleksandr Tymoshenko.Fn OF_parent
50*ac32b99cSOleksandr Tymoshenkoreturns the phandle for the parent of the
51*ac32b99cSOleksandr Tymoshenko.Fa node .
52*ac32b99cSOleksandr TymoshenkoZero is returned if
53*ac32b99cSOleksandr Tymoshenko.Fa node
54*ac32b99cSOleksandr Tymoshenkois the root node.
55*ac32b99cSOleksandr Tymoshenko.Pp
56*ac32b99cSOleksandr Tymoshenko.Fn OF_peer
57*ac32b99cSOleksandr Tymoshenkoreturns the phandle value of the next sibling of the
58*ac32b99cSOleksandr Tymoshenko.Fa node .
59*ac32b99cSOleksandr TymoshenkoZero is returned if there is no sibling node.
60*ac32b99cSOleksandr Tymoshenko.Sh EXAMPLES
61*ac32b99cSOleksandr Tymoshenko.Bd -literal
62*ac32b99cSOleksandr Tymoshenkophandle_t node, child;
63*ac32b99cSOleksandr Tymoshenko ...
64*ac32b99cSOleksandr Tymoshenkofor (child = OF_child(node); child != 0; child = OF_peer(child) {
65*ac32b99cSOleksandr Tymoshenko	...
66*ac32b99cSOleksandr Tymoshenko}
67*ac32b99cSOleksandr Tymoshenko.Ed
68*ac32b99cSOleksandr Tymoshenko.Sh SEE ALSO
69*ac32b99cSOleksandr Tymoshenko.Xr OF_finddevice 9
70*ac32b99cSOleksandr Tymoshenko.Sh AUTHORS
71*ac32b99cSOleksandr Tymoshenko.An -nosplit
72*ac32b99cSOleksandr TymoshenkoThis manual page was written by
73*ac32b99cSOleksandr Tymoshenko.An Oleksandr Tymoshenko Aq Mt gonzo@FreeBSD.org .
74