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