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

Request to power up a device from a non-active power mode

Synopsis:

#include <sys/pm.h>

int pmd_activate(pmd_attr_t *pmd, unsigned flags);

Arguments:

pmd
Pointer to the driver's pmd_attr_t structure for the device.
flags
Specify the reason for requesting the power mode change.

Library:

libpm

Description:

A driver can use pmd_activate() to request that the device be powered up from a non-active power mode. This requests a change to the mode specified by pmd->last_active (the last PM_MODE_ACTIVE mode the driver was set to).

This is typically required when the driver must perform some I/O operation and determines that the device is in a low power mode.

The pmd_attr_t structure must be locked using pmd_lock_shared() to ensure the pmd_attr_t power mode isn't subject to modification while it's performing these checks.

flags indicate the reason why the driver wants the device to be powered up:

PM_MODE_HWEVENT
The request is in response to some hardware generated event that can't be serviced until the device is fully powered.

If flags is 0, it indicates that the device must be powered up to service a driver client request.

Returns:

EOK
The device is already in a PM_MODE_ACTIVE mode. The driver can proceed with the I/O operation.
EAGAIN
The power mode change is not allowed. The driver must block the I/O operation until the power mode is later changed to an active mode. If the request is in response to a client request where the client used O_NONBLOCK to open the device, the operation should not block, and should instead fail with an EAGAIN error.
EINPROGRESS
The power mode change has been initiated and will complete later. The driver must block the I/O operation until the power mode change has completed.

Note: The driver code responsible for performing power mode changes must arrange to unblock these blocked requests.

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_t, pmd_lock_shared(), pmd_setmode()


[Previous] [Contents] [Next]