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 41 IOPowerConnection::setDesiredDomainState(unsigned long stateNumber ) 42 { 43 desiredDomainState = stateNumber; 44 } 45 46 47 // ********************************************************************************** 48 // getDesiredDomainState 49 // 50 // ********************************************************************************** 51 unsigned long 52 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 64 IOPowerConnection::setChildHasRequestedPower( void ) 65 { 66 requestFlag = true; 67 } 68 69 // ********************************************************************************** 70 // childHasRequestedPower 71 // 72 // Parent of the connection calls here when the child requests power 73 // ********************************************************************************** 74 bool 75 IOPowerConnection::childHasRequestedPower( void ) 76 { 77 return requestFlag; 78 } 79 80 81 // ********************************************************************************** 82 // setPreventIdleSleepFlag 83 // 84 // ********************************************************************************** 85 void 86 IOPowerConnection::setPreventIdleSleepFlag( unsigned long flag ) 87 { 88 preventIdleSleepFlag = (flag != 0); 89 } 90 91 92 // ********************************************************************************** 93 // getPreventIdleSleepFlag 94 // 95 // ********************************************************************************** 96 bool 97 IOPowerConnection::getPreventIdleSleepFlag( void ) 98 { 99 return preventIdleSleepFlag; 100 } 101 102 103 // ********************************************************************************** 104 // setPreventSystemSleepFlag 105 // 106 // ********************************************************************************** 107 void 108 IOPowerConnection::setPreventSystemSleepFlag( unsigned long flag ) 109 { 110 preventSystemSleepFlag = (flag != 0); 111 } 112 113 114 // ********************************************************************************** 115 // getPreventSystemSleepFlag 116 // 117 // ********************************************************************************** 118 bool 119 IOPowerConnection::getPreventSystemSleepFlag( void ) 120 { 121 return preventSystemSleepFlag; 122 } 123 124 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 // ********************************************************************************** 131 void 132 IOPowerConnection::setParentKnowsState(bool flag ) 133 { 134 stateKnown = flag; 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 // ********************************************************************************** 144 void 145 IOPowerConnection::setParentCurrentPowerFlags(IOPMPowerFlags flags ) 146 { 147 currentPowerFlags = flags; 148 } 149 150 151 // ********************************************************************************** 152 // parentKnowsState 153 // 154 // ********************************************************************************** 155 bool 156 IOPowerConnection::parentKnowsState(void ) 157 { 158 return stateKnown; 159 } 160 161 162 // ********************************************************************************** 163 // parentCurrentPowerFlags 164 // 165 // ********************************************************************************** 166 IOPMPowerFlags 167 IOPowerConnection::parentCurrentPowerFlags(void ) 168 { 169 return currentPowerFlags; 170 } 171 172 173 // ********************************************************************************** 174 // setAwaitingAck 175 // 176 // ********************************************************************************** 177 void 178 IOPowerConnection::setAwaitingAck( bool value ) 179 { 180 awaitingAck = value; 181 } 182 183 184 // ********************************************************************************** 185 // getAwaitingAck 186 // 187 // ********************************************************************************** 188 bool 189 IOPowerConnection::getAwaitingAck( void ) 190 { 191 return awaitingAck; 192 } 193 194 195 // ********************************************************************************** 196 // setReadyFlag 197 // 198 // ********************************************************************************** 199 void 200 IOPowerConnection::setReadyFlag( bool flag ) 201 { 202 readyFlag = flag; 203 } 204 205 206 // ********************************************************************************** 207 // getReadyFlag 208 // 209 // ********************************************************************************** 210 bool 211 IOPowerConnection::getReadyFlag( void ) const 212 { 213 return readyFlag; 214 } 215