Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1958 lines
65 KiB

  1. /*
  2. File: Power.h
  3. Contains: Power Manager Interfaces.
  4. Version: QuickTime 7.3
  5. Copyright: (c) 2007 (c) 1990-2001 by Apple Computer, Inc. All rights reserved
  6. Bugs?: For bug reports, consult the following page on
  7. the World Wide Web:
  8. http://developer.apple.com/bugreporter/
  9. */
  10. #ifndef __POWER__
  11. #define __POWER__
  12. #ifndef __MACTYPES__
  13. #include <MacTypes.h>
  14. #endif
  15. #ifndef __MIXEDMODE__
  16. #include <MixedMode.h>
  17. #endif
  18. #ifndef __MULTIPROCESSING__
  19. #include <Multiprocessing.h>
  20. #endif
  21. #ifndef __NAMEREGISTRY__
  22. #include <NameRegistry.h>
  23. #endif
  24. #ifndef __MACERRORS__
  25. #include <MacErrors.h>
  26. #endif
  27. #if PRAGMA_ONCE
  28. #pragma once
  29. #endif
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. #if PRAGMA_IMPORT
  34. #pragma import on
  35. #endif
  36. #if PRAGMA_STRUCT_ALIGN
  37. #pragma options align=mac68k
  38. #elif PRAGMA_STRUCT_PACKPUSH
  39. #pragma pack(push, 2)
  40. #elif PRAGMA_STRUCT_PACK
  41. #pragma pack(2)
  42. #endif
  43. enum {
  44. /* Bit positions for ModemByte */
  45. modemOnBit = 0,
  46. ringWakeUpBit = 2,
  47. modemInstalledBit = 3,
  48. ringDetectBit = 4,
  49. modemOnHookBit = 5
  50. };
  51. enum {
  52. /* masks for ModemByte */
  53. modemOnMask = 0x01,
  54. ringWakeUpMask = 0x04,
  55. modemInstalledMask = 0x08,
  56. ringDetectMask = 0x10,
  57. modemOnHookMask = 0x20
  58. };
  59. enum {
  60. /* bit positions for BatteryByte */
  61. chargerConnBit = 0,
  62. hiChargeBit = 1,
  63. chargeOverFlowBit = 2,
  64. batteryDeadBit = 3,
  65. batteryLowBit = 4,
  66. connChangedBit = 5
  67. };
  68. enum {
  69. /* masks for BatteryByte */
  70. chargerConnMask = 0x01,
  71. hiChargeMask = 0x02,
  72. chargeOverFlowMask = 0x04,
  73. batteryDeadMask = 0x08,
  74. batteryLowMask = 0x10,
  75. connChangedMask = 0x20
  76. };
  77. enum {
  78. /* bit positions for SoundMixerByte */
  79. MediaBaySndEnBit = 0,
  80. PCISndEnBit = 1,
  81. ZVSndEnBit = 2,
  82. PCCardSndEnBit = 3
  83. };
  84. enum {
  85. /* masks for SoundMixerByte */
  86. MediaBaySndEnMask = 0x01,
  87. PCISndEnMask = 0x02,
  88. ZVSndEnMask = 0x04,
  89. PCCardSndEnMask = 0x08
  90. };
  91. enum {
  92. /* commands to SleepQRec sleepQProc */
  93. kSleepRequest = 1,
  94. kSleepDemand = 2,
  95. kSleepWakeUp = 3,
  96. kSleepRevoke = 4,
  97. kSleepUnlock = 4,
  98. kSleepDeny = 5, /* A non-zero value clients can use to deny requests*/
  99. kSleepNow = 6,
  100. kDozeDemand = 7,
  101. kDozeWakeUp = 8,
  102. kDozeRequest = 9, /* additional messages for Power Mgr 2.0*/
  103. kEnterStandby = 10, /* Idle Queue Only*/
  104. kEnterRun = 11, /* Idle Queue Only*/
  105. kSuspendRequest = 12,
  106. kSuspendDemand = 13,
  107. kSuspendRevoke = 14,
  108. kSuspendWakeUp = 15,
  109. kGetPowerLevel = 16,
  110. kSetPowerLevel = 17,
  111. kDeviceInitiatedWake = 18,
  112. kWakeToDoze = 19,
  113. kDozeToFullWakeUp = 20,
  114. kGetPowerInfo = 21,
  115. kGetWakeOnNetInfo = 22,
  116. kSuspendWakeToDoze = 23,
  117. kEnterIdle = 24, /* Idle Queue Only*/
  118. kStillIdle = 25, /* Idle Queue Only*/
  119. kExitIdle = 26 /* Idle Queue Only*/
  120. };
  121. enum {
  122. /* depreciated commands to SleepQRec sleepQProc */
  123. sleepRequest = kSleepRequest,
  124. sleepDemand = kSleepDemand,
  125. sleepWakeUp = kSleepWakeUp,
  126. sleepRevoke = kSleepRevoke,
  127. sleepUnlock = kSleepUnlock,
  128. sleepDeny = kSleepDeny,
  129. sleepNow = kSleepNow,
  130. dozeDemand = kDozeDemand,
  131. dozeWakeUp = kDozeWakeUp,
  132. dozeRequest = kDozeRequest,
  133. enterStandby = kEnterStandby,
  134. enterRun = kEnterRun,
  135. suspendRequestMsg = kSuspendRequest,
  136. suspendDemandMsg = kSuspendDemand,
  137. suspendRevokeMsg = kSuspendRevoke,
  138. suspendWakeUpMsg = kSuspendWakeUp,
  139. getPowerLevel = kGetPowerLevel,
  140. setPowerLevel = kSetPowerLevel
  141. };
  142. /* Power Handler func messages */
  143. typedef UInt32 PowerLevel;
  144. /* Power levels corresponding to PCI Bus Power Management Interface Spec (PMIS) */
  145. enum {
  146. kPMDevicePowerLevel_On = 0, /* fully-powered 'On' state (D0 state) */
  147. kPMDevicePowerLevel_D1 = 1, /* not used by Apple system SW */
  148. kPMDevicePowerLevel_D2 = 2, /* not used by Apple system SW */
  149. kPMDevicePowerLevel_Off = 3 /* main PCI bus power 'Off', but PCI standby power available (D3cold state) */
  150. };
  151. /* PowerHandlerProc definition */
  152. typedef CALLBACK_API( OSStatus , PowerHandlerProcPtr )(UInt32 message, void *param, UInt32 refCon, RegEntryID *regEntryID);
  153. typedef STACK_UPP_TYPE(PowerHandlerProcPtr) PowerHandlerUPP;
  154. #if CALL_NOT_IN_CARBON
  155. /*
  156. * NewPowerHandlerUPP()
  157. *
  158. * Availability:
  159. * Non-Carbon CFM: available as macro/inline
  160. * CarbonLib: not available
  161. * Mac OS X: not available
  162. */
  163. EXTERN_API_C( PowerHandlerUPP )
  164. NewPowerHandlerUPP(PowerHandlerProcPtr userRoutine);
  165. #if !OPAQUE_UPP_TYPES
  166. enum { uppPowerHandlerProcInfo = 0x00003FF0 }; /* pascal 4_bytes Func(4_bytes, 4_bytes, 4_bytes, 4_bytes) */
  167. #ifdef __cplusplus
  168. inline DEFINE_API_C(PowerHandlerUPP) NewPowerHandlerUPP(PowerHandlerProcPtr userRoutine) { return (PowerHandlerUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppPowerHandlerProcInfo, GetCurrentArchitecture()); }
  169. #else
  170. #define NewPowerHandlerUPP(userRoutine) (PowerHandlerUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppPowerHandlerProcInfo, GetCurrentArchitecture())
  171. #endif
  172. #endif
  173. /*
  174. * DisposePowerHandlerUPP()
  175. *
  176. * Availability:
  177. * Non-Carbon CFM: available as macro/inline
  178. * CarbonLib: not available
  179. * Mac OS X: not available
  180. */
  181. EXTERN_API_C( void )
  182. DisposePowerHandlerUPP(PowerHandlerUPP userUPP);
  183. #if !OPAQUE_UPP_TYPES
  184. #ifdef __cplusplus
  185. inline DEFINE_API_C(void) DisposePowerHandlerUPP(PowerHandlerUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
  186. #else
  187. #define DisposePowerHandlerUPP(userUPP) DisposeRoutineDescriptor(userUPP)
  188. #endif
  189. #endif
  190. /*
  191. * InvokePowerHandlerUPP()
  192. *
  193. * Availability:
  194. * Non-Carbon CFM: available as macro/inline
  195. * CarbonLib: not available
  196. * Mac OS X: not available
  197. */
  198. EXTERN_API_C( OSStatus )
  199. InvokePowerHandlerUPP(
  200. UInt32 message,
  201. void * param,
  202. UInt32 refCon,
  203. RegEntryID * regEntryID,
  204. PowerHandlerUPP userUPP);
  205. #if !OPAQUE_UPP_TYPES
  206. #ifdef __cplusplus
  207. inline DEFINE_API_C(OSStatus) InvokePowerHandlerUPP(UInt32 message, void * param, UInt32 refCon, RegEntryID * regEntryID, PowerHandlerUPP userUPP) { return (OSStatus)CALL_FOUR_PARAMETER_UPP(userUPP, uppPowerHandlerProcInfo, message, param, refCon, regEntryID); }
  208. #else
  209. #define InvokePowerHandlerUPP(message, param, refCon, regEntryID, userUPP) (OSStatus)CALL_FOUR_PARAMETER_UPP((userUPP), uppPowerHandlerProcInfo, (message), (param), (refCon), (regEntryID))
  210. #endif
  211. #endif
  212. #endif /* CALL_NOT_IN_CARBON */
  213. #if CALL_NOT_IN_CARBON || OLDROUTINENAMES
  214. /* support for pre-Carbon UPP routines: New...Proc and Call...Proc */
  215. #define NewPowerHandlerProc(userRoutine) NewPowerHandlerUPP(userRoutine)
  216. #define CallPowerHandlerProc(userRoutine, message, param, refCon, regEntryID) InvokePowerHandlerUPP(message, param, refCon, regEntryID, userRoutine)
  217. #endif /* CALL_NOT_IN_CARBON */
  218. /*
  219. Use kIdleQueueDeviceType as the deviceType argument to AddDevicePowerHandler() to get the
  220. handler into the idle queue instead of the device sleep queue.
  221. */
  222. #define kIdleQueueDeviceType "idle-queue"
  223. /* PCI power management support*/
  224. enum {
  225. kUseDefaultMinimumWakeTime = 0, /* Defaults to 5 minutes*/
  226. kPowerSummaryVersion = 1, /* Version of PowerSummary structure.*/
  227. kDevicePowerInfoVersion = 1 /* Version of DevicePowerInfo structure.*/
  228. };
  229. enum {
  230. /* PowerSummary flags*/
  231. kPCIPowerOffAllowed = (1L << 0) /* PCI power off is allowed.*/
  232. };
  233. enum {
  234. /* DevicePowerInfo flags*/
  235. kDevicePCIPowerOffAllowed = (1L << 0), /* PCI power off is allowed for device.*/
  236. kDeviceSupportsPMIS = (1L << 1), /* Device supports Power Mgt Interface Spec.*/
  237. kDeviceCanAssertPMEDuringSleep = (1L << 2), /* Device can assert PME# during sleep.*/
  238. kDeviceUsesCommonLogicPower = (1L << 3), /* Device uses common-logic power*/
  239. kDeviceDriverPresent = (1L << 4), /* Driver present for device.*/
  240. kDeviceDriverSupportsPowerMgt = (1L << 5) /* Driver installed a power handler.*/
  241. };
  242. struct DevicePowerInfo {
  243. UInt32 version; /* Version of this structure.*/
  244. RegEntryID regID; /* RegEntryID for device.*/
  245. OptionBits flags; /* Flags*/
  246. UInt32 minimumWakeTime; /* Minimum seconds before sleeping again.*/
  247. UInt32 sleepPowerNeeded; /* Milliwatts needed in the sleep state.*/
  248. };
  249. typedef struct DevicePowerInfo DevicePowerInfo;
  250. struct PowerSummary {
  251. UInt32 version; /* Version of this structure.*/
  252. OptionBits flags; /* Flags*/
  253. UInt32 sleepPowerAvailable; /* Milliwatts available during sleep.*/
  254. UInt32 sleepPowerNeeded; /* Milliwatts needed during sleep.*/
  255. UInt32 minimumWakeTime; /* Minimum seconds before sleeping again.*/
  256. ItemCount deviceCount; /* Number of device power info records.*/
  257. DevicePowerInfo devices[1]; /* Array of device power info records.*/
  258. };
  259. typedef struct PowerSummary PowerSummary;
  260. enum {
  261. /* SleepQRec.sleepQFlags */
  262. noCalls = 1,
  263. noRequest = 2,
  264. slpQType = 16,
  265. sleepQType = 16
  266. };
  267. /* Power Mgt Apple Event types and errors */
  268. enum {
  269. /* power mgt class*/
  270. kAEMacPowerMgtEvt = FOUR_CHAR_CODE('pmgt'), /* event ids*/
  271. kAEMacToWake = FOUR_CHAR_CODE('wake'),
  272. kAEMacLowPowerSaveData = FOUR_CHAR_CODE('pmsd'),
  273. kAEMacEmergencySleep = FOUR_CHAR_CODE('emsl'),
  274. kAEMacEmergencyShutdown = FOUR_CHAR_CODE('emsd')
  275. };
  276. /*
  277. These are result values returned by a Power Handler when queries
  278. by the Power Mgr if the device which that Power Handler represents
  279. woke the machine.
  280. */
  281. enum {
  282. kDeviceDidNotWakeMachine = 0, /* device did NOT wake machine*/
  283. kDeviceRequestsFullWake = 1, /* device did wake machine and requests full wakeup*/
  284. kDeviceRequestsWakeToDoze = 2 /* device did wake machine and requests partial wakeup*/
  285. };
  286. /* bits in bitfield returned by PMFeatures */
  287. enum {
  288. hasWakeupTimer = 0, /* 1=wakeup timer is supported */
  289. hasSharedModemPort = 1, /* 1=modem port shared by SCC and internal modem */
  290. hasProcessorCycling = 2, /* 1=processor cycling is supported */
  291. mustProcessorCycle = 3, /* 1=processor cycling should not be turned off */
  292. hasReducedSpeed = 4, /* 1=processor can be started up at reduced speed */
  293. dynamicSpeedChange = 5, /* 1=processor speed can be switched dynamically */
  294. hasSCSIDiskMode = 6, /* 1=SCSI Disk Mode is supported */
  295. canGetBatteryTime = 7, /* 1=battery time can be calculated */
  296. canWakeupOnRing = 8, /* 1=can wakeup when the modem detects a ring */
  297. hasDimmingSupport = 9, /* 1=has dimming support built in (DPMS standby by default) */
  298. hasStartupTimer = 10, /* 1=startup timer is supported */
  299. hasChargeNotification = 11, /* 1=client can determine of charge connect status change notifications available */
  300. hasDimSuspendSupport = 12, /* 1=supports dimming LCD and CRT to DPMS suspend state */
  301. hasWakeOnNetActivity = 13, /* 1=hardware supports wake on network activity */
  302. hasWakeOnLid = 14, /* 1=hardware can wake when opened */
  303. canPowerOffPCIBus = 15, /* 1=hardware can power off PCI bus during sleep if cards allow */
  304. hasDeepSleep = 16, /* 1=hardware supports deep sleep (hibernation) mode */
  305. hasSleep = 17, /* 1=hardware supports normal (PowerBook-like) sleep */
  306. supportsServerModeAPIs = 18, /* 1=hardware supports server mode API routines */
  307. supportsUPSIntegration = 19, /* 1=hardware support UPS integration and reporting */
  308. hasAggressiveIdling = 20, /* 1=Power Manager only resets OverallAct on UsrActvity */
  309. supportsIdleQueue = 21 /* 1=Power Manager supports the idle queue */
  310. };
  311. /* bits in bitfield returned by GetIntModemInfo and set by SetIntModemState */
  312. enum {
  313. hasInternalModem = 0, /* 1=internal modem installed */
  314. intModemRingDetect = 1, /* 1=internal modem has detected a ring */
  315. intModemOffHook = 2, /* 1=internal modem is off hook */
  316. intModemRingWakeEnb = 3, /* 1=wakeup on ring is enabled */
  317. extModemSelected = 4, /* 1=external modem selected */
  318. modemSetBit = 15 /* 1=set bit, 0=clear bit (SetIntModemState) */
  319. };
  320. /* bits in BatteryInfo.flags */
  321. /* ("chargerConnected" doesn't mean the charger is plugged in) */
  322. enum {
  323. batteryInstalled = 7, /* 1=battery is currently connected */
  324. batteryCharging = 6, /* 1=battery is being charged */
  325. chargerConnected = 5, /* 1=charger is connected to the PowerBook */
  326. upsConnected = 4, /* 1=there is a UPS connected */
  327. upsIsPowerSource = 3 /* 1=UPS is source of power */
  328. };
  329. enum {
  330. HDPwrQType = 0x4844, /* 'HD' hard disk spindown queue element type */
  331. PMgrStateQType = 0x504D /* 'PM' Power Manager state queue element type */
  332. };
  333. /* client notification bits in PMgrQueueElement.pmNotifyBits */
  334. enum {
  335. pmSleepTimeoutChanged = 0,
  336. pmSleepEnableChanged = 1,
  337. pmHardDiskTimeoutChanged = 2,
  338. pmHardDiskSpindownChanged = 3,
  339. pmDimmingTimeoutChanged = 4,
  340. pmDimmingEnableChanged = 5,
  341. pmDiskModeAddressChanged = 6,
  342. pmProcessorCyclingChanged = 7,
  343. pmProcessorSpeedChanged = 8,
  344. pmWakeupTimerChanged = 9,
  345. pmStartupTimerChanged = 10,
  346. pmHardDiskPowerRemovedbyUser = 11,
  347. pmChargeStatusChanged = 12,
  348. pmPowerLevelChanged = 13,
  349. pmWakeOnNetActivityChanged = 14
  350. };
  351. enum {
  352. pmSleepTimeoutChangedMask = (1 << pmSleepTimeoutChanged),
  353. pmSleepEnableChangedMask = (1 << pmSleepEnableChanged),
  354. pmHardDiskTimeoutChangedMask = (1 << pmHardDiskTimeoutChanged),
  355. pmHardDiskSpindownChangedMask = (1 << pmHardDiskSpindownChanged),
  356. pmDimmingTimeoutChangedMask = (1 << pmDimmingTimeoutChanged),
  357. pmDimmingEnableChangedMask = (1 << pmDimmingEnableChanged),
  358. pmDiskModeAddressChangedMask = (1 << pmDiskModeAddressChanged),
  359. pmProcessorCyclingChangedMask = (1 << pmProcessorCyclingChanged),
  360. pmProcessorSpeedChangedMask = (1 << pmProcessorSpeedChanged),
  361. pmWakeupTimerChangedMask = (1 << pmWakeupTimerChanged),
  362. pmStartupTimerChangedMask = (1 << pmStartupTimerChanged),
  363. pmHardDiskPowerRemovedbyUserMask = (1 << pmHardDiskPowerRemovedbyUser),
  364. pmChargeStatusChangedMask = (1 << pmChargeStatusChanged),
  365. pmPowerLevelChangedMask = (1 << pmPowerLevelChanged),
  366. pmWakeOnNetActivityChangedMask = (1 << pmWakeOnNetActivityChanged)
  367. };
  368. /* System Activity Selectors */
  369. /* Notes: The IdleActivity selector is not available unless the hasAggressiveIdling PMFeatures bit is set. */
  370. /* Use IdleActivity where you used to use OverallAct if necessary. OverallAct will only */
  371. /* delay power cycling if it's enabled, and will delay sleep by a small amount when */
  372. /* hasAggressiveIdling is set. Don't use IdleActivity unless hasAggressiveIdling is set; when */
  373. /* hasAggressiveIdling is not set, the use of IdleActivity is undefined, and well do different */
  374. /* things depending on which Power Manager is currently running. */
  375. enum {
  376. OverallAct = 0, /* Delays idle sleep by small amount */
  377. UsrActivity = 1, /* Delays idle sleep and dimming by timeout time */
  378. NetActivity = 2, /* Delays idle sleep and power cycling by small amount */
  379. HDActivity = 3, /* Delays hard drive spindown and idle sleep by small amount */
  380. IdleActivity = 4 /* Delays idle sleep by timeout time */
  381. };
  382. /* Storage Media sleep mode defines */
  383. enum {
  384. kMediaModeOn = 0, /* Media active (Drive spinning and at full power) */
  385. kMediaModeStandBy = 1, /* Media standby (not implemented) */
  386. kMediaModeSuspend = 2, /* Media Idle (not implemented) */
  387. kMediaModeOff = 3 /* Media Sleep (Drive not spinning and at min power, max recovery time) */
  388. };
  389. enum {
  390. kMediaPowerCSCode = 70
  391. };
  392. /* definitions for HDQueueElement.hdFlags */
  393. enum {
  394. kHDQueuePostBit = 0, /* 1 = call this routine on the second pass */
  395. kHDQueuePostMask = (1 << kHDQueuePostBit)
  396. };
  397. struct ActivityInfo {
  398. short ActivityType; /* Type of activity to be fetched. Same as UpdateSystemActivity Selectors */
  399. unsigned long ActivityTime; /* Time of last activity (in ticks) of specified type. */
  400. };
  401. typedef struct ActivityInfo ActivityInfo;
  402. /* information returned by GetScaledBatteryInfo */
  403. struct BatteryInfo {
  404. UInt8 flags; /* misc flags (see below) */
  405. UInt8 warningLevel; /* scaled warning level (0-255) */
  406. UInt8 reserved; /* reserved for internal use */
  407. UInt8 batteryLevel; /* scaled battery level (0-255) */
  408. };
  409. typedef struct BatteryInfo BatteryInfo;
  410. typedef SInt8 ModemByte;
  411. typedef SInt8 BatteryByte;
  412. typedef SInt8 SoundMixerByte;
  413. typedef long PMResultCode;
  414. typedef struct SleepQRec SleepQRec;
  415. typedef SleepQRec * SleepQRecPtr;
  416. typedef struct HDQueueElement HDQueueElement;
  417. typedef struct PMgrQueueElement PMgrQueueElement;
  418. typedef CALLBACK_API_REGISTER68K( long , SleepQProcPtr, (long message, SleepQRecPtr qRecPtr) );
  419. typedef CALLBACK_API( void , HDSpindownProcPtr )(HDQueueElement * theElement);
  420. typedef CALLBACK_API( void , PMgrStateChangeProcPtr )(PMgrQueueElement *theElement, long stateBits);
  421. typedef REGISTER_UPP_TYPE(SleepQProcPtr) SleepQUPP;
  422. typedef STACK_UPP_TYPE(HDSpindownProcPtr) HDSpindownUPP;
  423. typedef STACK_UPP_TYPE(PMgrStateChangeProcPtr) PMgrStateChangeUPP;
  424. struct SleepQRec {
  425. SleepQRecPtr sleepQLink; /* pointer to next queue element */
  426. short sleepQType; /* queue element type (must be SleepQType) */
  427. SleepQUPP sleepQProc; /* pointer to sleep universal proc ptr */
  428. short sleepQFlags; /* flags */
  429. };
  430. struct HDQueueElement {
  431. struct HDQueueElement * hdQLink; /* pointer to next queue element */
  432. short hdQType; /* queue element type (must be HDPwrQType) */
  433. short hdFlags; /* miscellaneous flags */
  434. HDSpindownUPP hdProc; /* pointer to routine to call */
  435. long hdUser; /* user-defined (variable storage, etc.) */
  436. };
  437. struct PMgrQueueElement {
  438. struct PMgrQueueElement * pmQLink; /* pointer to next queue element */
  439. short pmQType; /* queue element type (must be PMgrStateQType) */
  440. short pmFlags; /* miscellaneous flags */
  441. long pmNotifyBits; /* bitmap of which changes to be notified for */
  442. PMgrStateChangeUPP pmProc; /* pointer to routine to call */
  443. long pmUser; /* user-defined (variable storage, etc.) */
  444. };
  445. struct BatteryTimeRec {
  446. unsigned long expectedBatteryTime; /* estimated battery time remaining (seconds) */
  447. unsigned long minimumBatteryTime; /* minimum battery time remaining (seconds) */
  448. unsigned long maximumBatteryTime; /* maximum battery time remaining (seconds) */
  449. unsigned long timeUntilCharged; /* time until battery is fully charged (seconds)*/
  450. };
  451. typedef struct BatteryTimeRec BatteryTimeRec;
  452. struct WakeupTime {
  453. unsigned long wakeTime; /* wakeup time (same format as current time) */
  454. Boolean wakeEnabled; /* 1=enable wakeup timer, 0=disable wakeup timer */
  455. SInt8 filler;
  456. };
  457. typedef struct WakeupTime WakeupTime;
  458. struct StartupTime {
  459. unsigned long startTime; /* startup time (same format as current time) */
  460. Boolean startEnabled; /* 1=enable startup timer, 0=disable startup timer */
  461. SInt8 filler;
  462. };
  463. typedef struct StartupTime StartupTime;
  464. /* PowerSource version*/
  465. enum {
  466. kVersionOnePowerSource = 1,
  467. kVersionTwoPowerSource = 2,
  468. kCurrentPowerSourceVersion = kVersionTwoPowerSource
  469. };
  470. /* PowerSourceAttrs bits*/
  471. enum {
  472. bSourceIsBattery = 0, /* power source is battery*/
  473. bSourceIsAC = 1, /* power source is AC*/
  474. bSourceCanBeCharged = 2, /* power source can be charged*/
  475. bSourceIsUPS = 3, /* power source is UPS. NOTE: software should set bSourceIsBattery and bSourceIsAC also, as appropriate*/
  476. bSourceProvidesWarnLevels = 4, /* power source provides low power and dead battery warning levels*/
  477. kSourceIsBatteryMask = (1 << bSourceIsBattery),
  478. kSourceIsACMask = (1 << bSourceIsAC),
  479. kSourceCanBeChargedMask = (1 << bSourceCanBeCharged),
  480. kSourceIsUPSMask = (1 << bSourceIsUPS),
  481. kSourceProvidesWarnLevelsMask = (1 << bSourceProvidesWarnLevels)
  482. };
  483. /* PowerSourceFlags bits*/
  484. enum {
  485. bSourceIsAvailable = 0, /* power source is installed*/
  486. bSourceIsCharging = 1, /* power source being charged*/
  487. bChargerIsAttached = 2, /* a charger is connected*/
  488. kSourceIsAvailableMask = (1 << bSourceIsAvailable),
  489. kSourceIsChargingMask = (1 << bSourceIsCharging),
  490. kChargerIsAttachedMask = (1 << bChargerIsAttached)
  491. };
  492. /* Power Capacity Types*/
  493. enum {
  494. kCapacityIsActual = 0, /* current capacity is expessed as actual capacity in same units as max*/
  495. kCapacityIsPercentOfMax = 1 /* current capacity is expressed as a percentage of maximumCapacity*/
  496. };
  497. /* Net Activity Wake Options*/
  498. enum {
  499. kConfigSupportsWakeOnNetBit = 0,
  500. kWakeOnNetAdminAccessesBit = 1,
  501. kWakeOnAllNetAccessesBit = 2,
  502. kUnmountServersBeforeSleepingBit = 3,
  503. kConfigSupportsWakeOnNetMask = (1 << kConfigSupportsWakeOnNetBit),
  504. kWakeOnNetAdminAccessesMask = (1 << kWakeOnNetAdminAccessesBit),
  505. kWakeOnAllNetAccessesMask = (1 << kWakeOnAllNetAccessesBit),
  506. kUnmountServersBeforeSleepingMask = (1 << kUnmountServersBeforeSleepingBit)
  507. };
  508. /* Power Source capacity usage types*/
  509. enum {
  510. kCurrentCapacityIsActualValue = 0, /* currentCapacity is a real value in same units as maxCapacity*/
  511. kCurrentCapacityIsPercentOfMax = 1 /* currentCapacity is expressed as a percentage of maxCapacity.*/
  512. };
  513. typedef SInt16 PowerSourceID;
  514. struct PowerSourceParamBlock {
  515. PowerSourceID sourceID; /* unique id assigned by Power Mgr*/
  516. UInt16 sourceCapacityUsage; /* how currentCapacity is used*/
  517. UInt32 sourceVersion; /* version of this record*/
  518. OptionBits sourceAttr; /* attribute flags (see below)*/
  519. OptionBits sourceState; /* state flags (see below)*/
  520. UInt32 currentCapacity; /* current capacity, in*/
  521. /* milliwatts or %*/
  522. UInt32 maxCapacity; /* full capacity, in milliwatts*/
  523. UInt32 timeRemaining; /* time left to deplete, */
  524. /* in milliwatt-hours*/
  525. UInt32 timeToFullCharge; /* time to charge, */
  526. /* in milliwatt-hours*/
  527. UInt32 voltage; /* voltage in millivolts*/
  528. SInt32 current; /* current in milliamperes */
  529. /* (negative if consuming, */
  530. /* positive if charging)*/
  531. UInt32 lowWarnLevel; /* low warning level in milliwatts (or % if sourceCapacityUsage is %)*/
  532. UInt32 deadWarnLevel; /* dead warning level in milliwatts (or % if sourceCapacityUsage is %)*/
  533. UInt32 reserved[16]; /* for future expansion*/
  534. };
  535. typedef struct PowerSourceParamBlock PowerSourceParamBlock;
  536. typedef PowerSourceParamBlock * PowerSourceParamBlockPtr;
  537. /*
  538. * DisableWUTime()
  539. *
  540. * Availability:
  541. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  542. * CarbonLib: in CarbonLib 1.0 and later
  543. * Mac OS X: in version 10.0 and later
  544. */
  545. EXTERN_API( OSErr )
  546. DisableWUTime(void);
  547. /*
  548. * SetWUTime()
  549. *
  550. * Availability:
  551. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  552. * CarbonLib: in CarbonLib 1.0 and later
  553. * Mac OS X: in version 10.0 and later
  554. */
  555. EXTERN_API( OSErr )
  556. SetWUTime(long wuTime);
  557. /*
  558. * GetWUTime()
  559. *
  560. * Availability:
  561. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  562. * CarbonLib: in CarbonLib 1.0 and later
  563. * Mac OS X: in version 10.0 and later
  564. */
  565. EXTERN_API( OSErr )
  566. GetWUTime(
  567. long * wuTime,
  568. Byte * wuFlag);
  569. /*
  570. * BatteryStatus()
  571. *
  572. * Availability:
  573. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  574. * CarbonLib: in CarbonLib 1.0 and later
  575. * Mac OS X: in version 10.0 and later
  576. */
  577. EXTERN_API( OSErr )
  578. BatteryStatus(
  579. Byte * status,
  580. Byte * power);
  581. /*
  582. * ModemStatus()
  583. *
  584. * Availability:
  585. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  586. * CarbonLib: in CarbonLib 1.0 and later
  587. * Mac OS X: in version 10.0 and later
  588. */
  589. EXTERN_API( OSErr )
  590. ModemStatus(Byte * status);
  591. /*
  592. * IdleUpdate()
  593. *
  594. * Availability:
  595. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  596. * CarbonLib: in CarbonLib 1.0 and later
  597. * Mac OS X: in version 10.0 and later
  598. */
  599. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  600. #pragma parameter __D0 IdleUpdate
  601. #endif
  602. EXTERN_API( long )
  603. IdleUpdate(void) ONEWORDINLINE(0xA285);
  604. /*
  605. * GetCPUSpeed()
  606. *
  607. * Availability:
  608. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  609. * CarbonLib: in CarbonLib 1.0 and later
  610. * Mac OS X: in version 10.0 and later
  611. */
  612. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  613. #pragma parameter __D0 GetCPUSpeed
  614. #endif
  615. EXTERN_API( long )
  616. GetCPUSpeed(void) TWOWORDINLINE(0x70FF, 0xA485);
  617. /*
  618. * EnableIdle()
  619. *
  620. * Availability:
  621. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  622. * CarbonLib: in CarbonLib 1.0 and later
  623. * Mac OS X: in version 10.0 and later
  624. */
  625. EXTERN_API( void )
  626. EnableIdle(void) TWOWORDINLINE(0x7000, 0xA485);
  627. /*
  628. * DisableIdle()
  629. *
  630. * Availability:
  631. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  632. * CarbonLib: in CarbonLib 1.0 and later
  633. * Mac OS X: in version 10.0 and later
  634. */
  635. EXTERN_API( void )
  636. DisableIdle(void) TWOWORDINLINE(0x7001, 0xA485);
  637. /*
  638. * SleepQInstall()
  639. *
  640. * Availability:
  641. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  642. * CarbonLib: in CarbonLib 1.0 and later
  643. * Mac OS X: in version 10.0 and later
  644. */
  645. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  646. #pragma parameter SleepQInstall(__A0)
  647. #endif
  648. EXTERN_API( void )
  649. SleepQInstall(SleepQRecPtr qRecPtr) ONEWORDINLINE(0xA28A);
  650. /*
  651. * SleepQRemove()
  652. *
  653. * Availability:
  654. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  655. * CarbonLib: in CarbonLib 1.0 and later
  656. * Mac OS X: in version 10.0 and later
  657. */
  658. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  659. #pragma parameter SleepQRemove(__A0)
  660. #endif
  661. EXTERN_API( void )
  662. SleepQRemove(SleepQRecPtr qRecPtr) ONEWORDINLINE(0xA48A);
  663. /*
  664. * AOn()
  665. *
  666. * Availability:
  667. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  668. * CarbonLib: in CarbonLib 1.0 and later
  669. * Mac OS X: in version 10.0 and later
  670. */
  671. EXTERN_API( void )
  672. AOn(void) TWOWORDINLINE(0x7004, 0xA685);
  673. /*
  674. * AOnIgnoreModem()
  675. *
  676. * Availability:
  677. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  678. * CarbonLib: in CarbonLib 1.0 and later
  679. * Mac OS X: in version 10.0 and later
  680. */
  681. EXTERN_API( void )
  682. AOnIgnoreModem(void) TWOWORDINLINE(0x7005, 0xA685);
  683. /*
  684. * BOn()
  685. *
  686. * Availability:
  687. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  688. * CarbonLib: in CarbonLib 1.0 and later
  689. * Mac OS X: in version 10.0 and later
  690. */
  691. EXTERN_API( void )
  692. BOn(void) TWOWORDINLINE(0x7000, 0xA685);
  693. /*
  694. * AOff()
  695. *
  696. * Availability:
  697. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  698. * CarbonLib: in CarbonLib 1.0 and later
  699. * Mac OS X: in version 10.0 and later
  700. */
  701. EXTERN_API( void )
  702. AOff(void) TWOWORDINLINE(0x7084, 0xA685);
  703. /*
  704. * BOff()
  705. *
  706. * Availability:
  707. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  708. * CarbonLib: in CarbonLib 1.0 and later
  709. * Mac OS X: in version 10.0 and later
  710. */
  711. EXTERN_API( void )
  712. BOff(void) TWOWORDINLINE(0x7080, 0xA685);
  713. /* Public Power Management API */
  714. /*
  715. * PMSelectorCount()
  716. *
  717. * Availability:
  718. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  719. * CarbonLib: in CarbonLib 1.0 and later
  720. * Mac OS X: in version 10.0 and later
  721. */
  722. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  723. #pragma parameter __D0 PMSelectorCount
  724. #endif
  725. EXTERN_API( short )
  726. PMSelectorCount(void) TWOWORDINLINE(0x7000, 0xA09E);
  727. /*
  728. * PMFeatures()
  729. *
  730. * Availability:
  731. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  732. * CarbonLib: in CarbonLib 1.0 and later
  733. * Mac OS X: in version 10.0 and later
  734. */
  735. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  736. #pragma parameter __D0 PMFeatures
  737. #endif
  738. EXTERN_API( UInt32 )
  739. PMFeatures(void) TWOWORDINLINE(0x7001, 0xA09E);
  740. /*
  741. * GetSleepTimeout()
  742. *
  743. * Availability:
  744. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  745. * CarbonLib: in CarbonLib 1.0 and later
  746. * Mac OS X: in version 10.0 and later
  747. */
  748. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  749. #pragma parameter __D0 GetSleepTimeout
  750. #endif
  751. EXTERN_API( UInt8 )
  752. GetSleepTimeout(void) TWOWORDINLINE(0x7002, 0xA09E);
  753. /*
  754. * SetSleepTimeout()
  755. *
  756. * Availability:
  757. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  758. * CarbonLib: in CarbonLib 1.0 and later
  759. * Mac OS X: in version 10.0 and later
  760. */
  761. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  762. #pragma parameter SetSleepTimeout(__D0)
  763. #endif
  764. EXTERN_API( void )
  765. SetSleepTimeout(UInt8 timeout) FOURWORDINLINE(0x4840, 0x303C, 0x0003, 0xA09E);
  766. /*
  767. * GetHardDiskTimeout()
  768. *
  769. * Availability:
  770. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  771. * CarbonLib: in CarbonLib 1.0 and later
  772. * Mac OS X: in version 10.0 and later
  773. */
  774. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  775. #pragma parameter __D0 GetHardDiskTimeout
  776. #endif
  777. EXTERN_API( UInt8 )
  778. GetHardDiskTimeout(void) TWOWORDINLINE(0x7004, 0xA09E);
  779. /*
  780. * SetHardDiskTimeout()
  781. *
  782. * Availability:
  783. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  784. * CarbonLib: in CarbonLib 1.0 and later
  785. * Mac OS X: in version 10.0 and later
  786. */
  787. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  788. #pragma parameter SetHardDiskTimeout(__D0)
  789. #endif
  790. EXTERN_API( void )
  791. SetHardDiskTimeout(UInt8 timeout) FOURWORDINLINE(0x4840, 0x303C, 0x0005, 0xA09E);
  792. /*
  793. * HardDiskPowered()
  794. *
  795. * Availability:
  796. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  797. * CarbonLib: in CarbonLib 1.0 and later
  798. * Mac OS X: in version 10.0 and later
  799. */
  800. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  801. #pragma parameter __D0 HardDiskPowered
  802. #endif
  803. EXTERN_API( Boolean )
  804. HardDiskPowered(void) TWOWORDINLINE(0x7006, 0xA09E);
  805. /*
  806. * SpinDownHardDisk()
  807. *
  808. * Availability:
  809. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  810. * CarbonLib: in CarbonLib 1.0 and later
  811. * Mac OS X: in version 10.0 and later
  812. */
  813. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  814. #pragma parameter SpinDownHardDisk
  815. #endif
  816. EXTERN_API( void )
  817. SpinDownHardDisk(void) TWOWORDINLINE(0x7007, 0xA09E);
  818. /*
  819. * IsSpindownDisabled()
  820. *
  821. * Availability:
  822. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  823. * CarbonLib: in CarbonLib 1.0 and later
  824. * Mac OS X: in version 10.0 and later
  825. */
  826. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  827. #pragma parameter __D0 IsSpindownDisabled
  828. #endif
  829. EXTERN_API( Boolean )
  830. IsSpindownDisabled(void) TWOWORDINLINE(0x7008, 0xA09E);
  831. /*
  832. * SetSpindownDisable()
  833. *
  834. * Availability:
  835. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  836. * CarbonLib: in CarbonLib 1.0 and later
  837. * Mac OS X: in version 10.0 and later
  838. */
  839. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  840. #pragma parameter SetSpindownDisable(__D0)
  841. #endif
  842. EXTERN_API( void )
  843. SetSpindownDisable(Boolean setDisable) FOURWORDINLINE(0x4840, 0x303C, 0x0009, 0xA09E);
  844. /*
  845. * HardDiskQInstall()
  846. *
  847. * Availability:
  848. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  849. * CarbonLib: in CarbonLib 1.0 and later
  850. * Mac OS X: in version 10.0 and later
  851. */
  852. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  853. #pragma parameter __D0 HardDiskQInstall(__A0)
  854. #endif
  855. EXTERN_API( OSErr )
  856. HardDiskQInstall(HDQueueElement * theElement) TWOWORDINLINE(0x700A, 0xA09E);
  857. /*
  858. * HardDiskQRemove()
  859. *
  860. * Availability:
  861. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  862. * CarbonLib: in CarbonLib 1.0 and later
  863. * Mac OS X: in version 10.0 and later
  864. */
  865. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  866. #pragma parameter __D0 HardDiskQRemove(__A0)
  867. #endif
  868. EXTERN_API( OSErr )
  869. HardDiskQRemove(HDQueueElement * theElement) TWOWORDINLINE(0x700B, 0xA09E);
  870. /*
  871. * GetScaledBatteryInfo()
  872. *
  873. * Availability:
  874. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  875. * CarbonLib: in CarbonLib 1.0 and later
  876. * Mac OS X: in version 10.0 and later
  877. */
  878. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  879. #pragma parameter GetScaledBatteryInfo(__D0, __A0)
  880. #endif
  881. EXTERN_API( void )
  882. GetScaledBatteryInfo(
  883. short whichBattery,
  884. BatteryInfo * theInfo) FIVEWORDINLINE(0x4840, 0x303C, 0x000C, 0xA09E, 0x2080);
  885. /*
  886. * AutoSleepControl()
  887. *
  888. * Availability:
  889. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  890. * CarbonLib: in CarbonLib 1.0 and later
  891. * Mac OS X: in version 10.0 and later
  892. */
  893. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  894. #pragma parameter AutoSleepControl(__D0)
  895. #endif
  896. EXTERN_API( void )
  897. AutoSleepControl(Boolean enableSleep) FOURWORDINLINE(0x4840, 0x303C, 0x000D, 0xA09E);
  898. /*
  899. * GetIntModemInfo()
  900. *
  901. * Availability:
  902. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  903. * CarbonLib: in CarbonLib 1.0 and later
  904. * Mac OS X: in version 10.0 and later
  905. */
  906. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  907. #pragma parameter __D0 GetIntModemInfo
  908. #endif
  909. EXTERN_API( UInt32 )
  910. GetIntModemInfo(void) TWOWORDINLINE(0x700E, 0xA09E);
  911. /*
  912. * SetIntModemState()
  913. *
  914. * Availability:
  915. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  916. * CarbonLib: in CarbonLib 1.0 and later
  917. * Mac OS X: in version 10.0 and later
  918. */
  919. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  920. #pragma parameter SetIntModemState(__D0)
  921. #endif
  922. EXTERN_API( void )
  923. SetIntModemState(short theState) FOURWORDINLINE(0x4840, 0x303C, 0x000F, 0xA09E);
  924. /*
  925. * MaximumProcessorSpeed()
  926. *
  927. * Availability:
  928. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  929. * CarbonLib: in CarbonLib 1.0 and later
  930. * Mac OS X: in version 10.0 and later
  931. */
  932. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  933. #pragma parameter __D0 MaximumProcessorSpeed
  934. #endif
  935. EXTERN_API( short )
  936. MaximumProcessorSpeed(void) TWOWORDINLINE(0x7010, 0xA09E);
  937. /*
  938. * MinimumProcessorSpeed()
  939. *
  940. * Availability:
  941. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  942. * CarbonLib: in CarbonLib 1.0 and later
  943. * Mac OS X: in version 10.1 and later
  944. */
  945. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  946. #pragma parameter __D0 MinimumProcessorSpeed
  947. #endif
  948. EXTERN_API( short )
  949. MinimumProcessorSpeed(void) TWOWORDINLINE(0x7036, 0xA09E);
  950. /*
  951. * CurrentProcessorSpeed()
  952. *
  953. * Availability:
  954. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  955. * CarbonLib: in CarbonLib 1.0 and later
  956. * Mac OS X: in version 10.0 and later
  957. */
  958. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  959. #pragma parameter __D0 CurrentProcessorSpeed
  960. #endif
  961. EXTERN_API( short )
  962. CurrentProcessorSpeed(void) TWOWORDINLINE(0x7011, 0xA09E);
  963. /*
  964. * FullProcessorSpeed()
  965. *
  966. * Availability:
  967. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  968. * CarbonLib: in CarbonLib 1.0 and later
  969. * Mac OS X: in version 10.0 and later
  970. */
  971. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  972. #pragma parameter __D0 FullProcessorSpeed
  973. #endif
  974. EXTERN_API( Boolean )
  975. FullProcessorSpeed(void) TWOWORDINLINE(0x7012, 0xA09E);
  976. /*
  977. * SetProcessorSpeed()
  978. *
  979. * Availability:
  980. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  981. * CarbonLib: in CarbonLib 1.0 and later
  982. * Mac OS X: in version 10.0 and later
  983. */
  984. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  985. #pragma parameter __D0 SetProcessorSpeed(__D0)
  986. #endif
  987. EXTERN_API( Boolean )
  988. SetProcessorSpeed(Boolean fullSpeed) FOURWORDINLINE(0x4840, 0x303C, 0x0013, 0xA09E);
  989. /*
  990. * GetSCSIDiskModeAddress()
  991. *
  992. * Availability:
  993. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  994. * CarbonLib: in CarbonLib 1.0 and later
  995. * Mac OS X: in version 10.0 and later
  996. */
  997. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  998. #pragma parameter __D0 GetSCSIDiskModeAddress
  999. #endif
  1000. EXTERN_API( short )
  1001. GetSCSIDiskModeAddress(void) TWOWORDINLINE(0x7014, 0xA09E);
  1002. /*
  1003. * SetSCSIDiskModeAddress()
  1004. *
  1005. * Availability:
  1006. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  1007. * CarbonLib: in CarbonLib 1.0 and later
  1008. * Mac OS X: in version 10.0 and later
  1009. */
  1010. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1011. #pragma parameter SetSCSIDiskModeAddress(__D0)
  1012. #endif
  1013. EXTERN_API( void )
  1014. SetSCSIDiskModeAddress(short scsiAddress) FOURWORDINLINE(0x4840, 0x303C, 0x0015, 0xA09E);
  1015. /*
  1016. * GetWakeupTimer()
  1017. *
  1018. * Availability:
  1019. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  1020. * CarbonLib: in CarbonLib 1.0 and later
  1021. * Mac OS X: in version 10.0 and later
  1022. */
  1023. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1024. #pragma parameter GetWakeupTimer(__A0)
  1025. #endif
  1026. EXTERN_API( void )
  1027. GetWakeupTimer(WakeupTime * theTime) TWOWORDINLINE(0x7016, 0xA09E);
  1028. /*
  1029. * SetWakeupTimer()
  1030. *
  1031. * Availability:
  1032. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  1033. * CarbonLib: in CarbonLib 1.0 and later
  1034. * Mac OS X: in version 10.0 and later
  1035. */
  1036. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1037. #pragma parameter SetWakeupTimer(__A0)
  1038. #endif
  1039. EXTERN_API( void )
  1040. SetWakeupTimer(WakeupTime * theTime) TWOWORDINLINE(0x7017, 0xA09E);
  1041. /*
  1042. * IsProcessorCyclingEnabled()
  1043. *
  1044. * Availability:
  1045. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  1046. * CarbonLib: in CarbonLib 1.0 and later
  1047. * Mac OS X: in version 10.0 and later
  1048. */
  1049. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1050. #pragma parameter __D0 IsProcessorCyclingEnabled
  1051. #endif
  1052. EXTERN_API( Boolean )
  1053. IsProcessorCyclingEnabled(void) TWOWORDINLINE(0x7018, 0xA09E);
  1054. /*
  1055. * EnableProcessorCycling()
  1056. *
  1057. * Availability:
  1058. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  1059. * CarbonLib: in CarbonLib 1.0 and later
  1060. * Mac OS X: in version 10.0 and later
  1061. */
  1062. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1063. #pragma parameter EnableProcessorCycling(__D0)
  1064. #endif
  1065. EXTERN_API( void )
  1066. EnableProcessorCycling(Boolean enable) FOURWORDINLINE(0x4840, 0x303C, 0x0019, 0xA09E);
  1067. /*
  1068. * BatteryCount()
  1069. *
  1070. * Availability:
  1071. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  1072. * CarbonLib: in CarbonLib 1.0 and later
  1073. * Mac OS X: in version 10.0 and later
  1074. */
  1075. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1076. #pragma parameter __D0 BatteryCount
  1077. #endif
  1078. EXTERN_API( short )
  1079. BatteryCount(void) TWOWORDINLINE(0x701A, 0xA09E);
  1080. /*
  1081. * GetBatteryVoltage()
  1082. *
  1083. * Availability:
  1084. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  1085. * CarbonLib: in CarbonLib 1.0 and later
  1086. * Mac OS X: in version 10.0 and later
  1087. */
  1088. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1089. #pragma parameter __D0 GetBatteryVoltage(__D0)
  1090. #endif
  1091. EXTERN_API( Fixed )
  1092. GetBatteryVoltage(short whichBattery) FOURWORDINLINE(0x4840, 0x303C, 0x001B, 0xA09E);
  1093. /*
  1094. * GetBatteryTimes()
  1095. *
  1096. * Availability:
  1097. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  1098. * CarbonLib: in CarbonLib 1.0 and later
  1099. * Mac OS X: in version 10.0 and later
  1100. */
  1101. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1102. #pragma parameter GetBatteryTimes(__D0, __A0)
  1103. #endif
  1104. EXTERN_API( void )
  1105. GetBatteryTimes(
  1106. short whichBattery,
  1107. BatteryTimeRec * theTimes) FOURWORDINLINE(0x4840, 0x303C, 0x001C, 0xA09E);
  1108. /*
  1109. * GetDimmingTimeout()
  1110. *
  1111. * Availability:
  1112. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  1113. * CarbonLib: in CarbonLib 1.0 and later
  1114. * Mac OS X: in version 10.0 and later
  1115. */
  1116. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1117. #pragma parameter __D0 GetDimmingTimeout
  1118. #endif
  1119. EXTERN_API( UInt8 )
  1120. GetDimmingTimeout(void) TWOWORDINLINE(0x701D, 0xA09E);
  1121. /*
  1122. * SetDimmingTimeout()
  1123. *
  1124. * Availability:
  1125. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  1126. * CarbonLib: in CarbonLib 1.0 and later
  1127. * Mac OS X: in version 10.0 and later
  1128. */
  1129. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1130. #pragma parameter SetDimmingTimeout(__D0)
  1131. #endif
  1132. EXTERN_API( void )
  1133. SetDimmingTimeout(UInt8 timeout) FOURWORDINLINE(0x4840, 0x303C, 0x001E, 0xA09E);
  1134. /*
  1135. * DimmingControl()
  1136. *
  1137. * Availability:
  1138. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  1139. * CarbonLib: in CarbonLib 1.0 and later
  1140. * Mac OS X: in version 10.0 and later
  1141. */
  1142. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1143. #pragma parameter DimmingControl(__D0)
  1144. #endif
  1145. EXTERN_API( void )
  1146. DimmingControl(Boolean enableSleep) FOURWORDINLINE(0x4840, 0x303C, 0x001F, 0xA09E);
  1147. /*
  1148. * IsDimmingControlDisabled()
  1149. *
  1150. * Availability:
  1151. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  1152. * CarbonLib: in CarbonLib 1.0 and later
  1153. * Mac OS X: in version 10.0 and later
  1154. */
  1155. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1156. #pragma parameter __D0 IsDimmingControlDisabled
  1157. #endif
  1158. EXTERN_API( Boolean )
  1159. IsDimmingControlDisabled(void) TWOWORDINLINE(0x7020, 0xA09E);
  1160. /*
  1161. * IsAutoSlpControlDisabled()
  1162. *
  1163. * Availability:
  1164. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  1165. * CarbonLib: in CarbonLib 1.0 and later
  1166. * Mac OS X: in version 10.0 and later
  1167. */
  1168. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1169. #pragma parameter __D0 IsAutoSlpControlDisabled
  1170. #endif
  1171. EXTERN_API( Boolean )
  1172. IsAutoSlpControlDisabled(void) TWOWORDINLINE(0x7021, 0xA09E);
  1173. /*
  1174. * PMgrStateQInstall()
  1175. *
  1176. * Availability:
  1177. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  1178. * CarbonLib: in CarbonLib 1.0 and later
  1179. * Mac OS X: in version 10.0 and later
  1180. */
  1181. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1182. #pragma parameter __D0 PMgrStateQInstall(__A0)
  1183. #endif
  1184. EXTERN_API( OSErr )
  1185. PMgrStateQInstall(PMgrQueueElement * theElement) TWOWORDINLINE(0x7022, 0xA09E);
  1186. /*
  1187. * PMgrStateQRemove()
  1188. *
  1189. * Availability:
  1190. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  1191. * CarbonLib: in CarbonLib 1.0 and later
  1192. * Mac OS X: in version 10.0 and later
  1193. */
  1194. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1195. #pragma parameter __D0 PMgrStateQRemove(__A0)
  1196. #endif
  1197. EXTERN_API( OSErr )
  1198. PMgrStateQRemove(PMgrQueueElement * theElement) TWOWORDINLINE(0x7023, 0xA09E);
  1199. /*
  1200. * UpdateSystemActivity()
  1201. *
  1202. * Availability:
  1203. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  1204. * CarbonLib: in CarbonLib 1.0 and later
  1205. * Mac OS X: in version 10.0 and later
  1206. */
  1207. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1208. #pragma parameter __D0 UpdateSystemActivity(__D0)
  1209. #endif
  1210. EXTERN_API( OSErr )
  1211. UpdateSystemActivity(UInt8 activity) FOURWORDINLINE(0x4840, 0x303C, 0x0024, 0xA09E);
  1212. /*
  1213. * DelaySystemIdle()
  1214. *
  1215. * Availability:
  1216. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  1217. * CarbonLib: in CarbonLib 1.0 and later
  1218. * Mac OS X: in version 10.0 and later
  1219. */
  1220. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1221. #pragma parameter __D0 DelaySystemIdle
  1222. #endif
  1223. EXTERN_API( OSErr )
  1224. DelaySystemIdle(void) TWOWORDINLINE(0x7025, 0xA09E);
  1225. /*
  1226. * GetStartupTimer()
  1227. *
  1228. * Availability:
  1229. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  1230. * CarbonLib: in CarbonLib 1.0 and later
  1231. * Mac OS X: in version 10.0 and later
  1232. */
  1233. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1234. #pragma parameter __D0 GetStartupTimer(__A0)
  1235. #endif
  1236. EXTERN_API( OSErr )
  1237. GetStartupTimer(StartupTime * theTime) TWOWORDINLINE(0x7026, 0xA09E);
  1238. /*
  1239. * SetStartupTimer()
  1240. *
  1241. * Availability:
  1242. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  1243. * CarbonLib: in CarbonLib 1.0 and later
  1244. * Mac OS X: in version 10.0 and later
  1245. */
  1246. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1247. #pragma parameter __D0 SetStartupTimer(__A0)
  1248. #endif
  1249. EXTERN_API( OSErr )
  1250. SetStartupTimer(StartupTime * theTime) TWOWORDINLINE(0x7027, 0xA09E);
  1251. /*
  1252. * GetLastActivity()
  1253. *
  1254. * Availability:
  1255. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  1256. * CarbonLib: in CarbonLib 1.0 and later
  1257. * Mac OS X: in version 10.0 and later
  1258. */
  1259. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1260. #pragma parameter __D0 GetLastActivity(__A0)
  1261. #endif
  1262. EXTERN_API( OSErr )
  1263. GetLastActivity(ActivityInfo * theActivity) TWOWORDINLINE(0x7028, 0xA09E);
  1264. /*
  1265. * GetSoundMixerState()
  1266. *
  1267. * Availability:
  1268. * Non-Carbon CFM: in PowerMgrLib 1.1 and later
  1269. * CarbonLib: in CarbonLib 1.0 and later
  1270. * Mac OS X: in version 10.0 and later
  1271. */
  1272. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1273. #pragma parameter __D0 GetSoundMixerState(__A0)
  1274. #endif
  1275. EXTERN_API( OSErr )
  1276. GetSoundMixerState(SoundMixerByte * theSoundMixerByte) TWOWORDINLINE(0x7029, 0xA09E);
  1277. /*
  1278. * SetSoundMixerState()
  1279. *
  1280. * Availability:
  1281. * Non-Carbon CFM: in PowerMgrLib 1.1 and later
  1282. * CarbonLib: in CarbonLib 1.0 and later
  1283. * Mac OS X: in version 10.0 and later
  1284. */
  1285. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1286. #pragma parameter __D0 SetSoundMixerState(__A0)
  1287. #endif
  1288. EXTERN_API( OSErr )
  1289. SetSoundMixerState(SoundMixerByte * theSoundMixerByte) TWOWORDINLINE(0x702A, 0xA09E);
  1290. /*
  1291. * GetDimSuspendState()
  1292. *
  1293. * Availability:
  1294. * Non-Carbon CFM: in PowerMgrLib 1.1 and later
  1295. * CarbonLib: in CarbonLib 1.0 and later
  1296. * Mac OS X: in version 10.0 and later
  1297. */
  1298. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1299. #pragma parameter __D0 GetDimSuspendState
  1300. #endif
  1301. EXTERN_API( Boolean )
  1302. GetDimSuspendState(void) TWOWORDINLINE(0x702B, 0xA09E);
  1303. /*
  1304. * SetDimSuspendState()
  1305. *
  1306. * Availability:
  1307. * Non-Carbon CFM: in PowerMgrLib 1.1 and later
  1308. * CarbonLib: in CarbonLib 1.0 and later
  1309. * Mac OS X: in version 10.0 and later
  1310. */
  1311. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1312. #pragma parameter SetDimSuspendState(__D0)
  1313. #endif
  1314. EXTERN_API( void )
  1315. SetDimSuspendState(Boolean dimSuspendState) FOURWORDINLINE(0x4840, 0x303C, 0x002C, 0xA09E);
  1316. #if CALL_NOT_IN_CARBON
  1317. /*
  1318. * GetCoreProcessorTemperature()
  1319. *
  1320. * Availability:
  1321. * Non-Carbon CFM: in PowerMgrLib 2.0 and later
  1322. * CarbonLib: not available
  1323. * Mac OS X: not available
  1324. */
  1325. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1326. #pragma parameter __D0 GetCoreProcessorTemperature(__A0)
  1327. #endif
  1328. EXTERN_API( SInt32 )
  1329. GetCoreProcessorTemperature(MPCpuID inCpuID) TWOWORDINLINE(0x702D, 0xA09E);
  1330. /*
  1331. * GetWakeOnNetworkOptions()
  1332. *
  1333. * Availability:
  1334. * Non-Carbon CFM: in PowerMgrLib 2.0 and later
  1335. * CarbonLib: not available
  1336. * Mac OS X: not available
  1337. */
  1338. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1339. #pragma parameter __D0 GetWakeOnNetworkOptions
  1340. #endif
  1341. EXTERN_API( OptionBits )
  1342. GetWakeOnNetworkOptions(void) TWOWORDINLINE(0x702E, 0xA09E);
  1343. /*
  1344. * SetWakeOnNetworkOptions()
  1345. *
  1346. * Availability:
  1347. * Non-Carbon CFM: in PowerMgrLib 2.0 and later
  1348. * CarbonLib: not available
  1349. * Mac OS X: not available
  1350. */
  1351. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1352. #pragma parameter SetWakeOnNetworkOptions(__A0)
  1353. #endif
  1354. EXTERN_API( void )
  1355. SetWakeOnNetworkOptions(OptionBits inOptions) TWOWORDINLINE(0x702F, 0xA09E);
  1356. /*
  1357. * AddPowerSource()
  1358. *
  1359. * Availability:
  1360. * Non-Carbon CFM: in PowerMgrLib 2.0 and later
  1361. * CarbonLib: not available
  1362. * Mac OS X: not available
  1363. */
  1364. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1365. #pragma parameter __D0 AddPowerSource(__A0)
  1366. #endif
  1367. EXTERN_API( OSStatus )
  1368. AddPowerSource(PowerSourceParamBlock * ioPowerSource) TWOWORDINLINE(0x7030, 0xA09E);
  1369. /*
  1370. * RemovePowerSource()
  1371. *
  1372. * Availability:
  1373. * Non-Carbon CFM: in PowerMgrLib 2.0 and later
  1374. * CarbonLib: not available
  1375. * Mac OS X: not available
  1376. */
  1377. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1378. #pragma parameter __D0 RemovePowerSource(__D0)
  1379. #endif
  1380. EXTERN_API( OSStatus )
  1381. RemovePowerSource(PowerSourceID inSourceID) FOURWORDINLINE(0x4840, 0x303C, 0x0031, 0xA09E);
  1382. /*
  1383. * UpdatePowerSource()
  1384. *
  1385. * Availability:
  1386. * Non-Carbon CFM: in PowerMgrLib 2.0 and later
  1387. * CarbonLib: not available
  1388. * Mac OS X: not available
  1389. */
  1390. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1391. #pragma parameter __D0 UpdatePowerSource(__A0)
  1392. #endif
  1393. EXTERN_API( OSStatus )
  1394. UpdatePowerSource(PowerSourceParamBlock * ioSource) TWOWORDINLINE(0x7032, 0xA09E);
  1395. /*
  1396. * IsServerModeEnabled()
  1397. *
  1398. * Availability:
  1399. * Non-Carbon CFM: in PowerMgrLib 2.0 and later
  1400. * CarbonLib: not available
  1401. * Mac OS X: not available
  1402. */
  1403. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1404. #pragma parameter __D0 IsServerModeEnabled
  1405. #endif
  1406. EXTERN_API( Boolean )
  1407. IsServerModeEnabled(void) TWOWORDINLINE(0x7033, 0xA09E);
  1408. /*
  1409. * EnableServerMode()
  1410. *
  1411. * Availability:
  1412. * Non-Carbon CFM: in PowerMgrLib 2.0 and later
  1413. * CarbonLib: not available
  1414. * Mac OS X: not available
  1415. */
  1416. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1417. #pragma parameter EnableServerMode(__D0)
  1418. #endif
  1419. EXTERN_API( void )
  1420. EnableServerMode(Boolean inEnable) FOURWORDINLINE(0x4840, 0x303C, 0x0034, 0xA09E);
  1421. /*
  1422. NumBatteriesInstalled is different from BatteryCount in that it
  1423. indicates how many batteries are actually available at the time
  1424. it is called (including UPS batteries). BatteryCount shows a
  1425. static number of batteries a machine is capable of holding which does NOT
  1426. include UPS batteries. So, while a desktop might show a BatteryCount
  1427. of zero, its NumBatteriesInstalled value might be 1 or more if a UPS
  1428. is attached.
  1429. */
  1430. /*
  1431. * NumBatteriesInstalled()
  1432. *
  1433. * Availability:
  1434. * Non-Carbon CFM: in PowerMgrLib 2.0 and later
  1435. * CarbonLib: not available
  1436. * Mac OS X: not available
  1437. */
  1438. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1439. #pragma parameter __D0 NumBatteriesInstalled
  1440. #endif
  1441. EXTERN_API( UInt32 )
  1442. NumBatteriesInstalled(void) TWOWORDINLINE(0x7035, 0xA09E);
  1443. /* Power Handler Management */
  1444. /*
  1445. * IsPCIPowerOffDisabled()
  1446. *
  1447. * Availability:
  1448. * Non-Carbon CFM: in DriverServicesLib 1.1 and later
  1449. * CarbonLib: not available
  1450. * Mac OS X: not available
  1451. */
  1452. EXTERN_API_C( Boolean )
  1453. IsPCIPowerOffDisabled(void);
  1454. /*
  1455. * EnablePCIPowerOff()
  1456. *
  1457. * Availability:
  1458. * Non-Carbon CFM: in DriverServicesLib 1.1 and later
  1459. * CarbonLib: not available
  1460. * Mac OS X: not available
  1461. */
  1462. EXTERN_API_C( void )
  1463. EnablePCIPowerOff(Boolean inEnable);
  1464. /*
  1465. * AddDevicePowerHandler()
  1466. *
  1467. * Availability:
  1468. * Non-Carbon CFM: in DriverServicesLib 1.1 and later
  1469. * CarbonLib: not available
  1470. * Mac OS X: not available
  1471. */
  1472. EXTERN_API_C( OSStatus )
  1473. AddDevicePowerHandler(
  1474. RegEntryIDPtr regEntryID,
  1475. PowerHandlerProcPtr handler,
  1476. UInt32 refCon,
  1477. char * deviceType);
  1478. /*
  1479. * RemoveDevicePowerHandler()
  1480. *
  1481. * Availability:
  1482. * Non-Carbon CFM: in DriverServicesLib 1.1 and later
  1483. * CarbonLib: not available
  1484. * Mac OS X: not available
  1485. */
  1486. EXTERN_API_C( OSStatus )
  1487. RemoveDevicePowerHandler(RegEntryIDPtr regEntryID);
  1488. /*
  1489. * RemoveDevicePowerHandlerForProc()
  1490. *
  1491. * Availability:
  1492. * Non-Carbon CFM: in DriverServicesLib 1.1 and later
  1493. * CarbonLib: not available
  1494. * Mac OS X: not available
  1495. */
  1496. EXTERN_API_C( OSStatus )
  1497. RemoveDevicePowerHandlerForProc(PowerHandlerProcPtr proc);
  1498. /*
  1499. * GetDevicePowerLevel()
  1500. *
  1501. * Availability:
  1502. * Non-Carbon CFM: in DriverServicesLib 1.1 and later
  1503. * CarbonLib: not available
  1504. * Mac OS X: not available
  1505. */
  1506. EXTERN_API_C( OSStatus )
  1507. GetDevicePowerLevel(
  1508. RegEntryIDPtr regEntryID,
  1509. PowerLevel * devicePowerLevel);
  1510. /*
  1511. * SetDevicePowerLevel()
  1512. *
  1513. * Availability:
  1514. * Non-Carbon CFM: in DriverServicesLib 1.1 and later
  1515. * CarbonLib: not available
  1516. * Mac OS X: not available
  1517. */
  1518. EXTERN_API_C( OSStatus )
  1519. SetDevicePowerLevel(
  1520. RegEntryIDPtr regEntryID,
  1521. PowerLevel devicePowerLevel);
  1522. #endif /* CALL_NOT_IN_CARBON */
  1523. /*
  1524. * NewSleepQUPP()
  1525. *
  1526. * Availability:
  1527. * Non-Carbon CFM: available as macro/inline
  1528. * CarbonLib: in CarbonLib 1.0 and later
  1529. * Mac OS X: in version 10.0 and later
  1530. */
  1531. EXTERN_API_C( SleepQUPP )
  1532. NewSleepQUPP(SleepQProcPtr userRoutine);
  1533. #if !OPAQUE_UPP_TYPES
  1534. enum { uppSleepQProcInfo = 0x00131832 }; /* register 4_bytes:D0 Func(4_bytes:D0, 4_bytes:A0) */
  1535. #ifdef __cplusplus
  1536. inline DEFINE_API_C(SleepQUPP) NewSleepQUPP(SleepQProcPtr userRoutine) { return (SleepQUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSleepQProcInfo, GetCurrentArchitecture()); }
  1537. #else
  1538. #define NewSleepQUPP(userRoutine) (SleepQUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSleepQProcInfo, GetCurrentArchitecture())
  1539. #endif
  1540. #endif
  1541. /*
  1542. * NewHDSpindownUPP()
  1543. *
  1544. * Availability:
  1545. * Non-Carbon CFM: available as macro/inline
  1546. * CarbonLib: in CarbonLib 1.0 and later
  1547. * Mac OS X: in version 10.0 and later
  1548. */
  1549. EXTERN_API_C( HDSpindownUPP )
  1550. NewHDSpindownUPP(HDSpindownProcPtr userRoutine);
  1551. #if !OPAQUE_UPP_TYPES
  1552. enum { uppHDSpindownProcInfo = 0x000000C0 }; /* pascal no_return_value Func(4_bytes) */
  1553. #ifdef __cplusplus
  1554. inline DEFINE_API_C(HDSpindownUPP) NewHDSpindownUPP(HDSpindownProcPtr userRoutine) { return (HDSpindownUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppHDSpindownProcInfo, GetCurrentArchitecture()); }
  1555. #else
  1556. #define NewHDSpindownUPP(userRoutine) (HDSpindownUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppHDSpindownProcInfo, GetCurrentArchitecture())
  1557. #endif
  1558. #endif
  1559. /*
  1560. * NewPMgrStateChangeUPP()
  1561. *
  1562. * Availability:
  1563. * Non-Carbon CFM: available as macro/inline
  1564. * CarbonLib: in CarbonLib 1.0 and later
  1565. * Mac OS X: in version 10.0 and later
  1566. */
  1567. EXTERN_API_C( PMgrStateChangeUPP )
  1568. NewPMgrStateChangeUPP(PMgrStateChangeProcPtr userRoutine);
  1569. #if !OPAQUE_UPP_TYPES
  1570. enum { uppPMgrStateChangeProcInfo = 0x000003C0 }; /* pascal no_return_value Func(4_bytes, 4_bytes) */
  1571. #ifdef __cplusplus
  1572. inline DEFINE_API_C(PMgrStateChangeUPP) NewPMgrStateChangeUPP(PMgrStateChangeProcPtr userRoutine) { return (PMgrStateChangeUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppPMgrStateChangeProcInfo, GetCurrentArchitecture()); }
  1573. #else
  1574. #define NewPMgrStateChangeUPP(userRoutine) (PMgrStateChangeUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppPMgrStateChangeProcInfo, GetCurrentArchitecture())
  1575. #endif
  1576. #endif
  1577. /*
  1578. * DisposeSleepQUPP()
  1579. *
  1580. * Availability:
  1581. * Non-Carbon CFM: available as macro/inline
  1582. * CarbonLib: in CarbonLib 1.0 and later
  1583. * Mac OS X: in version 10.0 and later
  1584. */
  1585. EXTERN_API_C( void )
  1586. DisposeSleepQUPP(SleepQUPP userUPP);
  1587. #if !OPAQUE_UPP_TYPES
  1588. #ifdef __cplusplus
  1589. inline DEFINE_API_C(void) DisposeSleepQUPP(SleepQUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
  1590. #else
  1591. #define DisposeSleepQUPP(userUPP) DisposeRoutineDescriptor(userUPP)
  1592. #endif
  1593. #endif
  1594. /*
  1595. * DisposeHDSpindownUPP()
  1596. *
  1597. * Availability:
  1598. * Non-Carbon CFM: available as macro/inline
  1599. * CarbonLib: in CarbonLib 1.0 and later
  1600. * Mac OS X: in version 10.0 and later
  1601. */
  1602. EXTERN_API_C( void )
  1603. DisposeHDSpindownUPP(HDSpindownUPP userUPP);
  1604. #if !OPAQUE_UPP_TYPES
  1605. #ifdef __cplusplus
  1606. inline DEFINE_API_C(void) DisposeHDSpindownUPP(HDSpindownUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
  1607. #else
  1608. #define DisposeHDSpindownUPP(userUPP) DisposeRoutineDescriptor(userUPP)
  1609. #endif
  1610. #endif
  1611. /*
  1612. * DisposePMgrStateChangeUPP()
  1613. *
  1614. * Availability:
  1615. * Non-Carbon CFM: available as macro/inline
  1616. * CarbonLib: in CarbonLib 1.0 and later
  1617. * Mac OS X: in version 10.0 and later
  1618. */
  1619. EXTERN_API_C( void )
  1620. DisposePMgrStateChangeUPP(PMgrStateChangeUPP userUPP);
  1621. #if !OPAQUE_UPP_TYPES
  1622. #ifdef __cplusplus
  1623. inline DEFINE_API_C(void) DisposePMgrStateChangeUPP(PMgrStateChangeUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
  1624. #else
  1625. #define DisposePMgrStateChangeUPP(userUPP) DisposeRoutineDescriptor(userUPP)
  1626. #endif
  1627. #endif
  1628. /*
  1629. * InvokeSleepQUPP()
  1630. *
  1631. * Availability:
  1632. * Non-Carbon CFM: available as macro/inline
  1633. * CarbonLib: in CarbonLib 1.0 and later
  1634. * Mac OS X: in version 10.0 and later
  1635. */
  1636. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1637. #pragma parameter __D0 InvokeSleepQUPP(__D0, __A0, __A1)
  1638. #endif
  1639. EXTERN_API_C( long )
  1640. InvokeSleepQUPP(
  1641. long message,
  1642. SleepQRecPtr qRecPtr,
  1643. SleepQUPP userUPP) ONEWORDINLINE(0x4E91);
  1644. #if !OPAQUE_UPP_TYPES && (!TARGET_OS_MAC || !TARGET_CPU_68K || TARGET_RT_MAC_CFM)
  1645. #ifdef __cplusplus
  1646. inline DEFINE_API_C(long) InvokeSleepQUPP(long message, SleepQRecPtr qRecPtr, SleepQUPP userUPP) { return (long)CALL_TWO_PARAMETER_UPP(userUPP, uppSleepQProcInfo, message, qRecPtr); }
  1647. #else
  1648. #define InvokeSleepQUPP(message, qRecPtr, userUPP) (long)CALL_TWO_PARAMETER_UPP((userUPP), uppSleepQProcInfo, (message), (qRecPtr))
  1649. #endif
  1650. #endif
  1651. /*
  1652. * InvokeHDSpindownUPP()
  1653. *
  1654. * Availability:
  1655. * Non-Carbon CFM: available as macro/inline
  1656. * CarbonLib: in CarbonLib 1.0 and later
  1657. * Mac OS X: in version 10.0 and later
  1658. */
  1659. EXTERN_API_C( void )
  1660. InvokeHDSpindownUPP(
  1661. HDQueueElement * theElement,
  1662. HDSpindownUPP userUPP);
  1663. #if !OPAQUE_UPP_TYPES
  1664. #ifdef __cplusplus
  1665. inline DEFINE_API_C(void) InvokeHDSpindownUPP(HDQueueElement * theElement, HDSpindownUPP userUPP) { CALL_ONE_PARAMETER_UPP(userUPP, uppHDSpindownProcInfo, theElement); }
  1666. #else
  1667. #define InvokeHDSpindownUPP(theElement, userUPP) CALL_ONE_PARAMETER_UPP((userUPP), uppHDSpindownProcInfo, (theElement))
  1668. #endif
  1669. #endif
  1670. /*
  1671. * InvokePMgrStateChangeUPP()
  1672. *
  1673. * Availability:
  1674. * Non-Carbon CFM: available as macro/inline
  1675. * CarbonLib: in CarbonLib 1.0 and later
  1676. * Mac OS X: in version 10.0 and later
  1677. */
  1678. EXTERN_API_C( void )
  1679. InvokePMgrStateChangeUPP(
  1680. PMgrQueueElement * theElement,
  1681. long stateBits,
  1682. PMgrStateChangeUPP userUPP);
  1683. #if !OPAQUE_UPP_TYPES
  1684. #ifdef __cplusplus
  1685. inline DEFINE_API_C(void) InvokePMgrStateChangeUPP(PMgrQueueElement * theElement, long stateBits, PMgrStateChangeUPP userUPP) { CALL_TWO_PARAMETER_UPP(userUPP, uppPMgrStateChangeProcInfo, theElement, stateBits); }
  1686. #else
  1687. #define InvokePMgrStateChangeUPP(theElement, stateBits, userUPP) CALL_TWO_PARAMETER_UPP((userUPP), uppPMgrStateChangeProcInfo, (theElement), (stateBits))
  1688. #endif
  1689. #endif
  1690. #if CALL_NOT_IN_CARBON || OLDROUTINENAMES
  1691. /* support for pre-Carbon UPP routines: New...Proc and Call...Proc */
  1692. #define NewSleepQProc(userRoutine) NewSleepQUPP(userRoutine)
  1693. #define NewHDSpindownProc(userRoutine) NewHDSpindownUPP(userRoutine)
  1694. #define NewPMgrStateChangeProc(userRoutine) NewPMgrStateChangeUPP(userRoutine)
  1695. #define CallSleepQProc(userRoutine, message, qRecPtr) InvokeSleepQUPP(message, qRecPtr, userRoutine)
  1696. #define CallHDSpindownProc(userRoutine, theElement) InvokeHDSpindownUPP(theElement, userRoutine)
  1697. #define CallPMgrStateChangeProc(userRoutine, theElement, stateBits) InvokePMgrStateChangeUPP(theElement, stateBits, userRoutine)
  1698. #endif /* CALL_NOT_IN_CARBON */
  1699. #if PRAGMA_STRUCT_ALIGN
  1700. #pragma options align=reset
  1701. #elif PRAGMA_STRUCT_PACKPUSH
  1702. #pragma pack(pop)
  1703. #elif PRAGMA_STRUCT_PACK
  1704. #pragma pack()
  1705. #endif
  1706. #ifdef PRAGMA_IMPORT_OFF
  1707. #pragma import off
  1708. #elif PRAGMA_IMPORT
  1709. #pragma import reset
  1710. #endif
  1711. #ifdef __cplusplus
  1712. }
  1713. #endif
  1714. #endif /* __POWER__ */