Kernel Functions for Drivers ddipropgetint(9F)
NAME
ddipropgetint, ddipropgetint64 - lookup integer pro-
perty
SYNOPSIS
#include
#include
int ddipropgetint(devt matchdev, devinfot *dip, uintt flags,
char *name, int defvalue);
int64t ddipropgetint64(devt matchdev, devinfot *dip, uintt flags,
char *name, int64t defvalue);
PARAMETERS
matchdev Device number associated with property or
DIDEVTANY.
dip Pointer to the device info node of device whose
property list should be searched.
flags Possible flag values are some combination of:
DIPROPDONTPAS Do not pass request to
parent device information
node if property not
found.
DIPROPNOTPROM Do not look at PROM pro-
perties (ignored on plat-
forms that do not support
PROM properties).
name String containing the name of the property.
defvalue An integer value that is returned if the pro-
perty cannot be found.
INTERFACE LEVEL
Solaris DI specific (Solaris DI).
SunOS 5.11 Last change: 25 Aug 2001 1
Kernel Functions for Drivers ddipropgetint(9F)
DESCRIPTION
The ddipropgetint() and ddipropgetint64() functions
search for an integer property and, if found, returns the
value of the property.
Properties are searched for based on the dip, name,
matchdev, and the type of the data (integer). The property
search order is as follows:
1. Search software properties created by the driver.
2. Search the software properties created by the sys-
tem (or nexus nodes in the device info tree).
3. Search the driver global properties list.
4. If DIPROPNOTPROM is not set, search the PROM
properties (if they exist).
5. If DIPROPDONTPAS is not set, pass this request
to the parent device information node.
6. Return defvalue.
Usually, the matchdev argument should be set to the actual
device number that this property is associated with. How-
ever, if the matchdev argument is DIDEVTANY, then
ddipropgetint() and ddipropgetint() will match the
request regardless of the matchdev the property was created
with. If a property was created with matchdev set to
DIDEVTNONE, then the only way to look up this property
is with a matchdev set to DIDEVTANY. PROM properties
are always created with matchdev set to DIDEVTNONE.
name must always be set to the name of the property being
looked up.
The return value of the routine is the value of the pro-
perty. If the property is not found, the argument defvalue
is returned as the value of the property.
ddipropgetint64() will not search the PROM for 64-bit
property values.
RETURN VALUES
ddipropgetint() and ddipropgetint64() return the value
of the property. If the property is not found, the argument
SunOS 5.11 Last change: 25 Aug 2001 2
Kernel Functions for Drivers ddipropgetint(9F)
defvalue is returned. If the property is found, but cannot
be decoded into an int or an int64, then DIPROPNOTFOUND
is returned.
CONTEXT
ddipropgetint() and ddipropgetint64() can be called
from user or kernel context.
EXAMPLES
Example 1 Using ddipropgetint()
The following example demonstrates the use of
ddipropgetint().
/*
* Get the value of the integer "width" property, using
* our own default if no such property exists
*/
width = ddipropgetint(xxdev, xxdip, 0, "width",
XDEFAULTWIDTH);
SEE ALSO
ddipropexists(9F), ddiproplookup(9F),
ddipropremove(9F), ddipropupdate(9F)
Writing Device Drivers
SunOS 5.11 Last change: 25 Aug 2001 3
|