]> git.saurik.com Git - apple/xnu.git/blame - iokit/Kernel/IOPowerConnection.cpp
xnu-6153.41.3.tar.gz
[apple/xnu.git] / iokit / Kernel / IOPowerConnection.cpp
CommitLineData
1c79356b
A
1/*
2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
3 *
2d21ac55 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
0a7de745 5 *
2d21ac55
A
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.
0a7de745 14 *
2d21ac55
A
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
0a7de745 17 *
2d21ac55
A
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
8f6c56a5
A
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
2d21ac55
A
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.
0a7de745 25 *
2d21ac55 26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
1c79356b
A
27 */
28
29#include <IOKit/pwr_mgt/IOPowerConnection.h>
30
31#define super IOService
0a7de745 32OSDefineMetaClassAndStructors(IOPowerConnection, IOService)
1c79356b
A
33
34
35// **********************************************************************************
36// setDesiredDomainState
37//
38// Parent of the connection calls here to save the childs desire
39// **********************************************************************************
0a7de745
A
40void
41IOPowerConnection::setDesiredDomainState(unsigned long stateNumber )
1c79356b 42{
0a7de745 43 desiredDomainState = stateNumber;
1c79356b
A
44}
45
46
47// **********************************************************************************
48// getDesiredDomainState
49//
50// **********************************************************************************
0a7de745
A
51unsigned long
52IOPowerConnection::getDesiredDomainState( void )
1c79356b 53{
0a7de745 54 return desiredDomainState;
1c79356b
A
55}
56
57
0b4e3aa0
A
58// **********************************************************************************
59// setChildHasRequestedPower
60//
61// Parent of the connection calls here when the child requests power
62// **********************************************************************************
0a7de745
A
63void
64IOPowerConnection::setChildHasRequestedPower( void )
0b4e3aa0 65{
0a7de745 66 requestFlag = true;
0b4e3aa0
A
67}
68
69// **********************************************************************************
70// childHasRequestedPower
71//
72// Parent of the connection calls here when the child requests power
73// **********************************************************************************
0a7de745
A
74bool
75IOPowerConnection::childHasRequestedPower( void )
0b4e3aa0 76{
0a7de745 77 return requestFlag;
0b4e3aa0
A
78}
79
80
81// **********************************************************************************
82// setPreventIdleSleepFlag
83//
84// **********************************************************************************
0a7de745
A
85void
86IOPowerConnection::setPreventIdleSleepFlag( unsigned long flag )
0b4e3aa0 87{
0a7de745 88 preventIdleSleepFlag = (flag != 0);
0b4e3aa0
A
89}
90
91
92// **********************************************************************************
93// getPreventIdleSleepFlag
94//
95// **********************************************************************************
0a7de745
A
96bool
97IOPowerConnection::getPreventIdleSleepFlag( void )
0b4e3aa0 98{
0a7de745 99 return preventIdleSleepFlag;
0b4e3aa0
A
100}
101
102
103// **********************************************************************************
104// setPreventSystemSleepFlag
105//
106// **********************************************************************************
0a7de745
A
107void
108IOPowerConnection::setPreventSystemSleepFlag( unsigned long flag )
0b4e3aa0 109{
0a7de745 110 preventSystemSleepFlag = (flag != 0);
0b4e3aa0
A
111}
112
113
114// **********************************************************************************
115// getPreventSystemSleepFlag
116//
117// **********************************************************************************
0a7de745
A
118bool
119IOPowerConnection::getPreventSystemSleepFlag( void )
0b4e3aa0 120{
0a7de745 121 return preventSystemSleepFlag;
0b4e3aa0
A
122}
123
124
1c79356b
A
125// **********************************************************************************
126// setParentKnowsState
127//
128// Child of the connection calls here to set its reminder that the parent does
129// or does not yet know the state if its domain.
130// **********************************************************************************
0a7de745
A
131void
132IOPowerConnection::setParentKnowsState(bool flag )
1c79356b 133{
0a7de745 134 stateKnown = flag;
1c79356b
A
135}
136
137
138// **********************************************************************************
139// setParentCurrentPowerFlags
140//
141// Child of the connection calls here to save what the parent says
142// is the state if its domain.
143// **********************************************************************************
0a7de745
A
144void
145IOPowerConnection::setParentCurrentPowerFlags(IOPMPowerFlags flags )
1c79356b 146{
0a7de745 147 currentPowerFlags = flags;
1c79356b
A
148}
149
150
151// **********************************************************************************
152// parentKnowsState
153//
154// **********************************************************************************
0a7de745
A
155bool
156IOPowerConnection::parentKnowsState(void )
1c79356b 157{
0a7de745 158 return stateKnown;
1c79356b
A
159}
160
161
162// **********************************************************************************
163// parentCurrentPowerFlags
164//
165// **********************************************************************************
0a7de745
A
166IOPMPowerFlags
167IOPowerConnection::parentCurrentPowerFlags(void )
1c79356b 168{
0a7de745 169 return currentPowerFlags;
1c79356b
A
170}
171
172
0b4e3aa0
A
173// **********************************************************************************
174// setAwaitingAck
175//
176// **********************************************************************************
0a7de745
A
177void
178IOPowerConnection::setAwaitingAck( bool value )
0b4e3aa0 179{
0a7de745 180 awaitingAck = value;
0b4e3aa0
A
181}
182
183
184// **********************************************************************************
185// getAwaitingAck
186//
187// **********************************************************************************
0a7de745
A
188bool
189IOPowerConnection::getAwaitingAck( void )
0b4e3aa0 190{
0a7de745 191 return awaitingAck;
0b4e3aa0 192}
2d21ac55
A
193
194
195// **********************************************************************************
196// setReadyFlag
197//
198// **********************************************************************************
0a7de745
A
199void
200IOPowerConnection::setReadyFlag( bool flag )
2d21ac55
A
201{
202 readyFlag = flag;
203}
204
205
206// **********************************************************************************
207// getReadyFlag
208//
209// **********************************************************************************
0a7de745
A
210bool
211IOPowerConnection::getReadyFlag( void ) const
2d21ac55
A
212{
213 return readyFlag;
214}