]> git.saurik.com Git - apple/xnu.git/blob - iokit/Kernel/IOPowerConnection.cpp
b8c7c21dfdbedc2dbdf164a3785f0ce326f507c1
[apple/xnu.git] / iokit / Kernel / IOPowerConnection.cpp
1 /*
2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24 #include <IOKit/pwr_mgt/IOPowerConnection.h>
25
26 #define super IOService
27 OSDefineMetaClassAndStructors(IOPowerConnection,IOService)
28
29
30 // **********************************************************************************
31 // setDesiredDomainState
32 //
33 // Parent of the connection calls here to save the childs desire
34 // **********************************************************************************
35 void IOPowerConnection::setDesiredDomainState (unsigned long stateNumber )
36 {
37 desiredDomainState = stateNumber;
38 }
39
40
41 // **********************************************************************************
42 // getDesiredDomainState
43 //
44 // **********************************************************************************
45 unsigned long IOPowerConnection::getDesiredDomainState ( void )
46 {
47 return desiredDomainState;
48 }
49
50
51 // **********************************************************************************
52 // setChildHasRequestedPower
53 //
54 // Parent of the connection calls here when the child requests power
55 // **********************************************************************************
56 void IOPowerConnection::setChildHasRequestedPower ( void )
57 {
58 requestFlag = true;
59 }
60
61 // **********************************************************************************
62 // childHasRequestedPower
63 //
64 // Parent of the connection calls here when the child requests power
65 // **********************************************************************************
66 bool IOPowerConnection::childHasRequestedPower ( void )
67 {
68 return requestFlag;
69 }
70
71
72 // **********************************************************************************
73 // setPreventIdleSleepFlag
74 //
75 // **********************************************************************************
76 void IOPowerConnection::setPreventIdleSleepFlag ( unsigned long flag )
77 {
78 preventIdleSleepFlag = (flag != 0);
79 }
80
81
82 // **********************************************************************************
83 // getPreventIdleSleepFlag
84 //
85 // **********************************************************************************
86 bool IOPowerConnection::getPreventIdleSleepFlag ( void )
87 {
88 return preventIdleSleepFlag;
89 }
90
91
92 // **********************************************************************************
93 // setPreventSystemSleepFlag
94 //
95 // **********************************************************************************
96 void IOPowerConnection::setPreventSystemSleepFlag ( unsigned long flag )
97 {
98 preventSystemSleepFlag = (flag != 0);
99 }
100
101
102 // **********************************************************************************
103 // getPreventSystemSleepFlag
104 //
105 // **********************************************************************************
106 bool IOPowerConnection::getPreventSystemSleepFlag ( void )
107 {
108 return preventSystemSleepFlag;
109 }
110
111
112 // **********************************************************************************
113 // setParentKnowsState
114 //
115 // Child of the connection calls here to set its reminder that the parent does
116 // or does not yet know the state if its domain.
117 // **********************************************************************************
118 void IOPowerConnection::setParentKnowsState (bool flag )
119 {
120 stateKnown = flag;
121 }
122
123
124 // **********************************************************************************
125 // setParentCurrentPowerFlags
126 //
127 // Child of the connection calls here to save what the parent says
128 // is the state if its domain.
129 // **********************************************************************************
130 void IOPowerConnection::setParentCurrentPowerFlags (IOPMPowerFlags flags )
131 {
132 currentPowerFlags = flags;
133 }
134
135
136 // **********************************************************************************
137 // parentKnowsState
138 //
139 // **********************************************************************************
140 bool IOPowerConnection::parentKnowsState (void )
141 {
142 return stateKnown;
143 }
144
145
146 // **********************************************************************************
147 // parentCurrentPowerFlags
148 //
149 // **********************************************************************************
150 IOPMPowerFlags IOPowerConnection::parentCurrentPowerFlags (void )
151 {
152 return currentPowerFlags;
153 }
154
155
156 // **********************************************************************************
157 // setAwaitingAck
158 //
159 // **********************************************************************************
160 void IOPowerConnection::setAwaitingAck ( bool value )
161 {
162 awaitingAck = value;
163 }
164
165
166 // **********************************************************************************
167 // getAwaitingAck
168 //
169 // **********************************************************************************
170 bool IOPowerConnection::getAwaitingAck ( void )
171 {
172 return awaitingAck;
173 }