2 * (c) 2013 Alexander Warg <warg@os.inf.tu-dresden.de>
3 * economic rights: Technische Universität Dresden (Germany)
5 * This file is part of TUD:OS and distributed under the terms of the
6 * GNU General Public License 2.
7 * Please see the COPYING-GPL-2 file for details.
11 #include <l4/cxx/hlist>
13 struct Pm : public cxx::H_list_item_t<Pm>
23 Pm() : _state(Pm_disabled) {}
25 Pm_state pm_power_state() const { return _state; }
26 bool pm_is_disabled() const { return _state == Pm_disabled; }
27 bool pm_is_suspended() const { return _state == Pm_suspended; }
28 bool pm_is_online() const { return _state == Pm_online; }
29 bool pm_is_failed() const { return _state == Pm_failed; }
31 virtual int pm_init() = 0;
32 virtual int pm_suspend() = 0;
33 virtual int pm_resume() = 0;
36 static int pm_suspend_all();
37 static int pm_resume_all();
40 void pm_set_state(Pm_state state)
42 Pm_state old = _state;
51 case Pm_suspended: _suspended.remove(this); break;
52 case Pm_online: _online.remove(this); break;
58 case Pm_suspended: _suspended.push_front(this); break;
59 case Pm_online: _online.push_front(this); break;
64 typedef cxx::H_list_t<Pm> Pm_list;
66 static Pm_list _online;
67 static Pm_list _suspended;