eCos Reference Manual
Prev |  | Next

# Attached and Detached Controllers

## Name

Attached and Detached Controllers -- control which power controllers are affected by global changes

## Synopsis

    #include <cyg/power/power.h>

``cyg_bool power_get_controller_attached` ( PowerController* controller );`

``void power_set_controller_attached` ( PowerController* controller , cyg_bool new_state );`

## Detaching Power Controllers

By default the global operation `power_set_mode` affects all power controllers. There may be circumstances when this is not desirable. For example if a particular device is not currently being used then it can be left switched off: the rest of the system could be moving between active, idle and sleep modes, but there is no point in invoking the power controller for the unused device. To support this the power management package supports the concept of attached and detached controllers. By default all controllers are attached, and hence will be affected by global mode changes. A specific controller can be detached using the function `power_set_controller_attached`. This function takes two arguments, one to specify a particular controller and another to specify the desired new state. `power_get_controller_attached` can be used to determine whether or not a specific controller is currently attached.

The attached or detached state of a controller only affects what happens during a global mode change, in other words following a call to `power_set_mode`. It is still possible to manipulate a detached controller using `power_set_controller_mode` or `power_set_controller_mode_now`.

Prev | Home | Next
Support for Policy Modules | Up | Implementing a Power Controller