PWRM_registerNotify
Application Program Interface
2-327
Note:
Snooze mode is currently not implemented.
The eventMask parameter is an event-specific mask. Currently
eventMask is relevant only to setpoint changes, but it may be used in the
future for other power events. For V/F setpoint registrations, this mask
defines the setpoints the client supports. For example, if the client
supports only one setpoint, it should set only the single corresponding bit
in eventMask. Using the eventMask allows PWRM_changeSetpoint to
immediately determine whether to begin the notification process or return
PWRM_ENOTSUPPORTED.
The notifyFxn parameter specifies the function to call when the specified
power event occurs. The notifyFunction must behave as described in the
pwrmNotifyFxn section.
The clientArg parameter is an arbitrary argument to be passed to the
client upon notification. This argument may allow one notify function to be
used by multiple instances of a driver (that is, the clientArg can be used
to identify the instance of the driver that is being notified).
The notifyHandle parameter should point to the location where
PWRM_registerNotify should write a notification handle. If the application
later needs to unregister the notification function, the application should
pass this handle to PWRM_unregisterNotify.
The delayedCompletionFxn is a pointer to a function provided by the
PWRM module to the client at registration time. If a client cannot act
immediately upon notification, its notify function should return
PWRM_NOTIFYNOTDONE. Later, when the action is complete, the
client should call the delayedCompletionFxn to signal PWRM that it has
finished. The delayedCompletionFxn is a void function, taking no
arguments, and having no return value. If a client can and does act
immediately on the notification, it should return PWRM_NOTIFYDONE in
response to notification, and should not call the delayedCompletionFxn.
For example, if a DMA driver is to prepare for a setpoint change, it may
need to wait for the current DMA transfer to complete. When the driver
finishes processing the event (for example, on the next hardware
interrupt), it calls the delayedCompletionFxn function provided when it
registered for notification. This completion function tells the PWRM
module that the driver is finished. Meanwhile, the PWRM module was
able to continue notifying other clients, and was waiting for all clients to
signal completion.