1c1dac77fSApple OSS Distributions /*
2c1dac77fSApple OSS Distributions * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
3c1dac77fSApple OSS Distributions *
4e13b1fa5SApple OSS Distributions * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5c1dac77fSApple OSS Distributions *
6e13b1fa5SApple OSS Distributions * This file contains Original Code and/or Modifications of Original Code
7e13b1fa5SApple OSS Distributions * as defined in and that are subject to the Apple Public Source License
8e13b1fa5SApple OSS Distributions * Version 2.0 (the 'License'). You may not use this file except in
9e13b1fa5SApple OSS Distributions * compliance with the License. The rights granted to you under the License
10e13b1fa5SApple OSS Distributions * may not be used to create, or enable the creation or redistribution of,
11e13b1fa5SApple OSS Distributions * unlawful or unlicensed copies of an Apple operating system, or to
12e13b1fa5SApple OSS Distributions * circumvent, violate, or enable the circumvention or violation of, any
13e13b1fa5SApple OSS Distributions * terms of an Apple operating system software license agreement.
14c1dac77fSApple OSS Distributions *
15e13b1fa5SApple OSS Distributions * Please obtain a copy of the License at
16e13b1fa5SApple OSS Distributions * http://www.opensource.apple.com/apsl/ and read it before using this file.
17e13b1fa5SApple OSS Distributions *
18e13b1fa5SApple OSS Distributions * The Original Code and all software distributed under the License are
19e13b1fa5SApple OSS Distributions * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20c1dac77fSApple OSS Distributions * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21c1dac77fSApple OSS Distributions * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22e13b1fa5SApple OSS Distributions * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23e13b1fa5SApple OSS Distributions * Please see the License for the specific language governing rights and
24e13b1fa5SApple OSS Distributions * limitations under the License.
25c1dac77fSApple OSS Distributions *
26e13b1fa5SApple OSS Distributions * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27c1dac77fSApple OSS Distributions */
28c1dac77fSApple OSS Distributions
29c1dac77fSApple OSS Distributions #include <IOKit/pwr_mgt/IOPowerConnection.h>
30c1dac77fSApple OSS Distributions
31c1dac77fSApple OSS Distributions #define super IOService
OSDefineMetaClassAndStructors(IOPowerConnection,IOService)32c1dac77fSApple OSS Distributions OSDefineMetaClassAndStructors(IOPowerConnection, IOService)
33c1dac77fSApple OSS Distributions
34c1dac77fSApple OSS Distributions
35c1dac77fSApple OSS Distributions // **********************************************************************************
36c1dac77fSApple OSS Distributions // setDesiredDomainState
37c1dac77fSApple OSS Distributions //
38c1dac77fSApple OSS Distributions // Parent of the connection calls here to save the childs desire
39c1dac77fSApple OSS Distributions // **********************************************************************************
40*a5e72196SApple OSS Distributions void
41*a5e72196SApple OSS Distributions IOPowerConnection::setDesiredDomainState(unsigned long stateNumber )
42c1dac77fSApple OSS Distributions {
43c1dac77fSApple OSS Distributions desiredDomainState = stateNumber;
44c1dac77fSApple OSS Distributions }
45c1dac77fSApple OSS Distributions
46c1dac77fSApple OSS Distributions
47c1dac77fSApple OSS Distributions // **********************************************************************************
48c1dac77fSApple OSS Distributions // getDesiredDomainState
49c1dac77fSApple OSS Distributions //
50c1dac77fSApple OSS Distributions // **********************************************************************************
51*a5e72196SApple OSS Distributions unsigned long
getDesiredDomainState(void)52*a5e72196SApple OSS Distributions IOPowerConnection::getDesiredDomainState( void )
53c1dac77fSApple OSS Distributions {
54c1dac77fSApple OSS Distributions return desiredDomainState;
55c1dac77fSApple OSS Distributions }
56c1dac77fSApple OSS Distributions
57c1dac77fSApple OSS Distributions
58c1dac77fSApple OSS Distributions // **********************************************************************************
598149afccSApple OSS Distributions // setChildHasRequestedPower
608149afccSApple OSS Distributions //
618149afccSApple OSS Distributions // Parent of the connection calls here when the child requests power
628149afccSApple OSS Distributions // **********************************************************************************
63*a5e72196SApple OSS Distributions void
setChildHasRequestedPower(void)64*a5e72196SApple OSS Distributions IOPowerConnection::setChildHasRequestedPower( void )
658149afccSApple OSS Distributions {
668149afccSApple OSS Distributions requestFlag = true;
678149afccSApple OSS Distributions }
688149afccSApple OSS Distributions
698149afccSApple OSS Distributions // **********************************************************************************
708149afccSApple OSS Distributions // childHasRequestedPower
718149afccSApple OSS Distributions //
728149afccSApple OSS Distributions // Parent of the connection calls here when the child requests power
738149afccSApple OSS Distributions // **********************************************************************************
74*a5e72196SApple OSS Distributions bool
childHasRequestedPower(void)75*a5e72196SApple OSS Distributions IOPowerConnection::childHasRequestedPower( void )
768149afccSApple OSS Distributions {
778149afccSApple OSS Distributions return requestFlag;
788149afccSApple OSS Distributions }
798149afccSApple OSS Distributions
808149afccSApple OSS Distributions
818149afccSApple OSS Distributions // **********************************************************************************
828149afccSApple OSS Distributions // setPreventIdleSleepFlag
838149afccSApple OSS Distributions //
848149afccSApple OSS Distributions // **********************************************************************************
85*a5e72196SApple OSS Distributions void
setPreventIdleSleepFlag(unsigned long flag)86*a5e72196SApple OSS Distributions IOPowerConnection::setPreventIdleSleepFlag( unsigned long flag )
878149afccSApple OSS Distributions {
888149afccSApple OSS Distributions preventIdleSleepFlag = (flag != 0);
898149afccSApple OSS Distributions }
908149afccSApple OSS Distributions
918149afccSApple OSS Distributions
928149afccSApple OSS Distributions // **********************************************************************************
938149afccSApple OSS Distributions // getPreventIdleSleepFlag
948149afccSApple OSS Distributions //
958149afccSApple OSS Distributions // **********************************************************************************
96*a5e72196SApple OSS Distributions bool
getPreventIdleSleepFlag(void)97*a5e72196SApple OSS Distributions IOPowerConnection::getPreventIdleSleepFlag( void )
988149afccSApple OSS Distributions {
998149afccSApple OSS Distributions return preventIdleSleepFlag;
1008149afccSApple OSS Distributions }
1018149afccSApple OSS Distributions
1028149afccSApple OSS Distributions
1038149afccSApple OSS Distributions // **********************************************************************************
1048149afccSApple OSS Distributions // setPreventSystemSleepFlag
1058149afccSApple OSS Distributions //
1068149afccSApple OSS Distributions // **********************************************************************************
107*a5e72196SApple OSS Distributions void
setPreventSystemSleepFlag(unsigned long flag)108*a5e72196SApple OSS Distributions IOPowerConnection::setPreventSystemSleepFlag( unsigned long flag )
1098149afccSApple OSS Distributions {
1108149afccSApple OSS Distributions preventSystemSleepFlag = (flag != 0);
1118149afccSApple OSS Distributions }
1128149afccSApple OSS Distributions
1138149afccSApple OSS Distributions
1148149afccSApple OSS Distributions // **********************************************************************************
1158149afccSApple OSS Distributions // getPreventSystemSleepFlag
1168149afccSApple OSS Distributions //
1178149afccSApple OSS Distributions // **********************************************************************************
118*a5e72196SApple OSS Distributions bool
getPreventSystemSleepFlag(void)119*a5e72196SApple OSS Distributions IOPowerConnection::getPreventSystemSleepFlag( void )
1208149afccSApple OSS Distributions {
1218149afccSApple OSS Distributions return preventSystemSleepFlag;
1228149afccSApple OSS Distributions }
1238149afccSApple OSS Distributions
1248149afccSApple OSS Distributions
1258149afccSApple OSS Distributions // **********************************************************************************
126c1dac77fSApple OSS Distributions // setParentKnowsState
127c1dac77fSApple OSS Distributions //
128c1dac77fSApple OSS Distributions // Child of the connection calls here to set its reminder that the parent does
129c1dac77fSApple OSS Distributions // or does not yet know the state if its domain.
130c1dac77fSApple OSS Distributions // **********************************************************************************
131*a5e72196SApple OSS Distributions void
setParentKnowsState(bool flag)132*a5e72196SApple OSS Distributions IOPowerConnection::setParentKnowsState(bool flag )
133c1dac77fSApple OSS Distributions {
134c1dac77fSApple OSS Distributions stateKnown = flag;
135c1dac77fSApple OSS Distributions }
136c1dac77fSApple OSS Distributions
137c1dac77fSApple OSS Distributions
138c1dac77fSApple OSS Distributions // **********************************************************************************
139c1dac77fSApple OSS Distributions // setParentCurrentPowerFlags
140c1dac77fSApple OSS Distributions //
141c1dac77fSApple OSS Distributions // Child of the connection calls here to save what the parent says
142c1dac77fSApple OSS Distributions // is the state if its domain.
143c1dac77fSApple OSS Distributions // **********************************************************************************
144*a5e72196SApple OSS Distributions void
setParentCurrentPowerFlags(IOPMPowerFlags flags)145*a5e72196SApple OSS Distributions IOPowerConnection::setParentCurrentPowerFlags(IOPMPowerFlags flags )
146c1dac77fSApple OSS Distributions {
147c1dac77fSApple OSS Distributions currentPowerFlags = flags;
148c1dac77fSApple OSS Distributions }
149c1dac77fSApple OSS Distributions
150c1dac77fSApple OSS Distributions
151c1dac77fSApple OSS Distributions // **********************************************************************************
152c1dac77fSApple OSS Distributions // parentKnowsState
153c1dac77fSApple OSS Distributions //
154c1dac77fSApple OSS Distributions // **********************************************************************************
155*a5e72196SApple OSS Distributions bool
parentKnowsState(void)156*a5e72196SApple OSS Distributions IOPowerConnection::parentKnowsState(void )
157c1dac77fSApple OSS Distributions {
158c1dac77fSApple OSS Distributions return stateKnown;
159c1dac77fSApple OSS Distributions }
160c1dac77fSApple OSS Distributions
161c1dac77fSApple OSS Distributions
162c1dac77fSApple OSS Distributions // **********************************************************************************
163c1dac77fSApple OSS Distributions // parentCurrentPowerFlags
164c1dac77fSApple OSS Distributions //
165c1dac77fSApple OSS Distributions // **********************************************************************************
166*a5e72196SApple OSS Distributions IOPMPowerFlags
parentCurrentPowerFlags(void)167*a5e72196SApple OSS Distributions IOPowerConnection::parentCurrentPowerFlags(void )
168c1dac77fSApple OSS Distributions {
169c1dac77fSApple OSS Distributions return currentPowerFlags;
170c1dac77fSApple OSS Distributions }
171c1dac77fSApple OSS Distributions
172c1dac77fSApple OSS Distributions
1738149afccSApple OSS Distributions // **********************************************************************************
1748149afccSApple OSS Distributions // setAwaitingAck
1758149afccSApple OSS Distributions //
1768149afccSApple OSS Distributions // **********************************************************************************
177*a5e72196SApple OSS Distributions void
setAwaitingAck(bool value)178*a5e72196SApple OSS Distributions IOPowerConnection::setAwaitingAck( bool value )
1798149afccSApple OSS Distributions {
1808149afccSApple OSS Distributions awaitingAck = value;
1818149afccSApple OSS Distributions }
1828149afccSApple OSS Distributions
1838149afccSApple OSS Distributions
1848149afccSApple OSS Distributions // **********************************************************************************
1858149afccSApple OSS Distributions // getAwaitingAck
1868149afccSApple OSS Distributions //
1878149afccSApple OSS Distributions // **********************************************************************************
188*a5e72196SApple OSS Distributions bool
getAwaitingAck(void)189*a5e72196SApple OSS Distributions IOPowerConnection::getAwaitingAck( void )
1908149afccSApple OSS Distributions {
1918149afccSApple OSS Distributions return awaitingAck;
1928149afccSApple OSS Distributions }
193e13b1fa5SApple OSS Distributions
194e13b1fa5SApple OSS Distributions
195e13b1fa5SApple OSS Distributions // **********************************************************************************
196e13b1fa5SApple OSS Distributions // setReadyFlag
197e13b1fa5SApple OSS Distributions //
198e13b1fa5SApple OSS Distributions // **********************************************************************************
199*a5e72196SApple OSS Distributions void
setReadyFlag(bool flag)200*a5e72196SApple OSS Distributions IOPowerConnection::setReadyFlag( bool flag )
201e13b1fa5SApple OSS Distributions {
202e13b1fa5SApple OSS Distributions readyFlag = flag;
203e13b1fa5SApple OSS Distributions }
204e13b1fa5SApple OSS Distributions
205e13b1fa5SApple OSS Distributions
206e13b1fa5SApple OSS Distributions // **********************************************************************************
207e13b1fa5SApple OSS Distributions // getReadyFlag
208e13b1fa5SApple OSS Distributions //
209e13b1fa5SApple OSS Distributions // **********************************************************************************
210*a5e72196SApple OSS Distributions bool
getReadyFlag(void) const211*a5e72196SApple OSS Distributions IOPowerConnection::getReadyFlag( void ) const
212e13b1fa5SApple OSS Distributions {
213e13b1fa5SApple OSS Distributions return readyFlag;
214e13b1fa5SApple OSS Distributions }
215