1 | /* |
2 | * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved. |
3 | * |
4 | * @APPLE_OSREFERENCE_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. The rights granted to you under the License |
10 | * may not be used to create, or enable the creation or redistribution of, |
11 | * unlawful or unlicensed copies of an Apple operating system, or to |
12 | * circumvent, violate, or enable the circumvention or violation of, any |
13 | * terms of an Apple operating system software license agreement. |
14 | * |
15 | * Please obtain a copy of the License at |
16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. |
17 | * |
18 | * The Original Code and all software distributed under the License are |
19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, |
22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
23 | * Please see the License for the specific language governing rights and |
24 | * limitations under the License. |
25 | * |
26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ |
27 | */ |
28 | |
29 | #include <IOKit/pwr_mgt/IOPowerConnection.h> |
30 | |
31 | #define super IOService |
32 | OSDefineMetaClassAndStructors(IOPowerConnection,IOService) |
33 | |
34 | |
35 | // ********************************************************************************** |
36 | // setDesiredDomainState |
37 | // |
38 | // Parent of the connection calls here to save the childs desire |
39 | // ********************************************************************************** |
40 | void IOPowerConnection::setDesiredDomainState (unsigned long stateNumber ) |
41 | { |
42 | desiredDomainState = stateNumber; |
43 | } |
44 | |
45 | |
46 | // ********************************************************************************** |
47 | // getDesiredDomainState |
48 | // |
49 | // ********************************************************************************** |
50 | unsigned long IOPowerConnection::getDesiredDomainState ( void ) |
51 | { |
52 | return desiredDomainState; |
53 | } |
54 | |
55 | |
56 | // ********************************************************************************** |
57 | // setChildHasRequestedPower |
58 | // |
59 | // Parent of the connection calls here when the child requests power |
60 | // ********************************************************************************** |
61 | void IOPowerConnection::setChildHasRequestedPower ( void ) |
62 | { |
63 | requestFlag = true; |
64 | } |
65 | |
66 | // ********************************************************************************** |
67 | // childHasRequestedPower |
68 | // |
69 | // Parent of the connection calls here when the child requests power |
70 | // ********************************************************************************** |
71 | bool IOPowerConnection::childHasRequestedPower ( void ) |
72 | { |
73 | return requestFlag; |
74 | } |
75 | |
76 | |
77 | // ********************************************************************************** |
78 | // setPreventIdleSleepFlag |
79 | // |
80 | // ********************************************************************************** |
81 | void IOPowerConnection::setPreventIdleSleepFlag ( unsigned long flag ) |
82 | { |
83 | preventIdleSleepFlag = (flag != 0); |
84 | } |
85 | |
86 | |
87 | // ********************************************************************************** |
88 | // getPreventIdleSleepFlag |
89 | // |
90 | // ********************************************************************************** |
91 | bool IOPowerConnection::getPreventIdleSleepFlag ( void ) |
92 | { |
93 | return preventIdleSleepFlag; |
94 | } |
95 | |
96 | |
97 | // ********************************************************************************** |
98 | // setPreventSystemSleepFlag |
99 | // |
100 | // ********************************************************************************** |
101 | void IOPowerConnection::setPreventSystemSleepFlag ( unsigned long flag ) |
102 | { |
103 | preventSystemSleepFlag = (flag != 0); |
104 | } |
105 | |
106 | |
107 | // ********************************************************************************** |
108 | // getPreventSystemSleepFlag |
109 | // |
110 | // ********************************************************************************** |
111 | bool IOPowerConnection::getPreventSystemSleepFlag ( void ) |
112 | { |
113 | return preventSystemSleepFlag; |
114 | } |
115 | |
116 | |
117 | // ********************************************************************************** |
118 | // setParentKnowsState |
119 | // |
120 | // Child of the connection calls here to set its reminder that the parent does |
121 | // or does not yet know the state if its domain. |
122 | // ********************************************************************************** |
123 | void IOPowerConnection::setParentKnowsState (bool flag ) |
124 | { |
125 | stateKnown = flag; |
126 | } |
127 | |
128 | |
129 | // ********************************************************************************** |
130 | // setParentCurrentPowerFlags |
131 | // |
132 | // Child of the connection calls here to save what the parent says |
133 | // is the state if its domain. |
134 | // ********************************************************************************** |
135 | void IOPowerConnection::setParentCurrentPowerFlags (IOPMPowerFlags flags ) |
136 | { |
137 | currentPowerFlags = flags; |
138 | } |
139 | |
140 | |
141 | // ********************************************************************************** |
142 | // parentKnowsState |
143 | // |
144 | // ********************************************************************************** |
145 | bool IOPowerConnection::parentKnowsState (void ) |
146 | { |
147 | return stateKnown; |
148 | } |
149 | |
150 | |
151 | // ********************************************************************************** |
152 | // parentCurrentPowerFlags |
153 | // |
154 | // ********************************************************************************** |
155 | IOPMPowerFlags IOPowerConnection::parentCurrentPowerFlags (void ) |
156 | { |
157 | return currentPowerFlags; |
158 | } |
159 | |
160 | |
161 | // ********************************************************************************** |
162 | // setAwaitingAck |
163 | // |
164 | // ********************************************************************************** |
165 | void IOPowerConnection::setAwaitingAck ( bool value ) |
166 | { |
167 | awaitingAck = value; |
168 | } |
169 | |
170 | |
171 | // ********************************************************************************** |
172 | // getAwaitingAck |
173 | // |
174 | // ********************************************************************************** |
175 | bool IOPowerConnection::getAwaitingAck ( void ) |
176 | { |
177 | return awaitingAck; |
178 | } |
179 | |
180 | |
181 | // ********************************************************************************** |
182 | // setReadyFlag |
183 | // |
184 | // ********************************************************************************** |
185 | void IOPowerConnection::setReadyFlag( bool flag ) |
186 | { |
187 | readyFlag = flag; |
188 | } |
189 | |
190 | |
191 | // ********************************************************************************** |
192 | // getReadyFlag |
193 | // |
194 | // ********************************************************************************** |
195 | bool IOPowerConnection::getReadyFlag( void ) const |
196 | { |
197 | return readyFlag; |
198 | } |
199 | |