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