This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs. |
Specify driver's setpower() function
#include <sys/pm.h> void pmd_attr_setpower(pmd_attr_t *pmd, pmd_setpower_t func, void *data);
libpm
The pmd_attr_setpower() initializes the pmd_attr_t's setpower and data fields to the specified driver specific values.
The func() is the driver specific function to set the device power mode:
int (*func)(pmd_attr_t *pmd, unsigned flags);
Where:
pmd->cur_attr points to the pmd_mode_attr_t for the current device mode.
pmd->new_attr points to the pmd_mode_attr_t for the mode to be set.
pmd->new_flags contains the mode flags that apply to the new power mode.
This function is responsible for performing all necessary actions to set the new mode:
If this draining operation will complete some time later, the function should return at this point with EINPROGRESS to indicate that the mode change has been started, but will complete later. The driver is responsible for calling pmd->setpower() itself when this occurs to complete processing of the power mode change.
pmd->setpower() is called by the following library helper functions:
These functions call setpower() with the pmd exclusive lock held to serialize power mode changes. If the driver needs to call pmd->setpower() itself, for example, when a draining operation completes, it should acquire this lock using pmd_lock_exclusive() first.
For more information, see the device driver chapter.
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |
pmd_attr_t, pmd_attr_init(), pmd_confirm(), pmd_activate(), pmd_handler(), pmd_power(), pmd_lock_exclusive()