[Previous] [Contents] [Next]

Caution: This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs.

pmd_attach()

Register driver with the power manager

Synopsis:

#include <sys/pm.h>

int pmd_attach(const char *name, 
               pmd_attr_t *attr, 
               const struct sigevent *event, 
               mode_t mode);

Arguments:

name
Name of the power managed object the driver is responsible for.
pmd
The pmd_attr_t structure used to manage the device power attributes.
event
The event the power manager should use to communicate with the driver.
mode
The type and access permission to use if name doesn't yet exist.

Library:

libpm

Description:

The pmd_attach() is used by a device driver to register with the power manager.

Before calling pmd_attach(), the driver must initialize the following:

On return from pmd_attach(), pmd is updated with initialization information from the power manager:

The power manager delivers the specified event to initiate power mode changes. This is typically a pulse, and the driver's pulse handler should use pmd_handler() to perform the necessary interaction with the Power Manager to co-ordinate the power mode change. pmd_handler() will call the driver's setpower() function to perform the requested power mode change.

pmd_attach() doesn't return an error if there's no power manager running, in order to allow drivers to run as normal (except that there will be no system wide power management policy applied to them). In this case:

Returns:

0
Success.
-1
An error occurred (errno is set)

Errors:

EINVAL
pmd hasn't been correctly initialized.
EINVAL
event is not a valid sigevent.
ENOMEM
insufficient memory to allocate power manager resources.

Examples:

For more information, see the device driver chapter.

Classification:

Neutrino

Safety:
Cancellation point Yes
Interrupt handler No
Signal handler No
Thread Yes

See also:

pmd_attr_t, pmd_attr_init(), pmd_attr_setmodes(), pmd_attr_setpower()


[Previous] [Contents] [Next]