[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_setmode()

Change device power mode

Synopsis:

#include <sys/pm.h>

int pmd_setmode(pmd_attr_t *pmd, 
                pm_power_mode_t mode, 
                unsigned flags);

Arguments:

pmd
Pointer to the driver pmd_attr_t's structure for the device.
mode
Power mode to set.
flags
Control the behavior of power mode change.

Library:

libpm

Description:

The pmd_setmode() function is used to synchronously change the power mode within device driver code.

The pmd_attr_t must be locked using pmd_lock_shared() before calling pmd_setmode().

The pmd_setmode() essentially performs the following steps:

  1. Convert the shared lock to an exclusive lock using pmd_lock_upgrade(). This blocks until all other existing shared locks are released.
  2. Request permission from the power manager to change to the new mode. If this request is denied, the mode change is aborted with an error.
  3. Call pmd->setpower() to change the device power mode.
  4. Convert the exclusive lock to a shared lock using pmd_lock_downgrade().

Returns:

EOK
Power mode has been changed.
EINPROGRESS
Power mode change was initiated, but will complete later.
EAGAIN
the Power mode was denied by the power manager policy.
EINVAL
mode is not a valid power mode or flags contains invalid flags.

Examples:

For more information, see the device driver chapter.

Classification:

Neutrino

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

See also:

pmd_attr_setmodes(), pmd_lock_shared(), pmd_lock_upgrade(), pmd_lock_downgrade()


[Previous] [Contents] [Next]