Mac OS 9
Power.h
Go to the documentation of this file.
1 
19 #ifndef __POWER__
20 #define __POWER__
21 
22 #ifndef __MACTYPES__
23 #include <MacTypes.h>
24 #endif
25 
26 #ifndef __MIXEDMODE__
27 #include <MixedMode.h>
28 #endif
29 
30 #ifndef __MULTIPROCESSING__
31 #include <Multiprocessing.h>
32 #endif
33 
34 #ifndef __NAMEREGISTRY__
35 #include <NameRegistry.h>
36 #endif
37 
38 #ifndef __MACERRORS__
39 #include <MacErrors.h>
40 #endif
41 
42 #if PRAGMA_ONCE
43 #pragma once
44 #endif
45 
46 #ifdef __cplusplus
47 extern "C"
48 {
49 #endif
50 
51 #if PRAGMA_IMPORT
52 #pragma import on
53 #endif
54 
55 #if PRAGMA_STRUCT_ALIGN
56 #pragma options align = mac68k
57 #elif PRAGMA_STRUCT_PACKPUSH
58 #pragma pack(push, 2)
59 #elif PRAGMA_STRUCT_PACK
60 #pragma pack(2)
61 #endif
62 
63  enum
64  {
65  /* Bit positions for ModemByte */
66  modemOnBit = 0,
67  ringWakeUpBit = 2,
68  modemInstalledBit = 3,
69  ringDetectBit = 4,
70  modemOnHookBit = 5
71  };
72 
73  enum
74  {
75  /* masks for ModemByte */
76  modemOnMask = 0x01,
77  ringWakeUpMask = 0x04,
78  modemInstalledMask = 0x08,
79  ringDetectMask = 0x10,
80  modemOnHookMask = 0x20
81  };
82 
83  enum
84  {
85  /* bit positions for BatteryByte */
86  chargerConnBit = 0,
87  hiChargeBit = 1,
88  chargeOverFlowBit = 2,
89  batteryDeadBit = 3,
90  batteryLowBit = 4,
91  connChangedBit = 5
92  };
93 
94  enum
95  {
96  /* masks for BatteryByte */
97  chargerConnMask = 0x01,
98  hiChargeMask = 0x02,
99  chargeOverFlowMask = 0x04,
100  batteryDeadMask = 0x08,
101  batteryLowMask = 0x10,
102  connChangedMask = 0x20
103  };
104 
105  enum
106  {
107  /* bit positions for SoundMixerByte */
108  MediaBaySndEnBit = 0,
109  PCISndEnBit = 1,
110  ZVSndEnBit = 2,
111  PCCardSndEnBit = 3
112  };
113 
114  enum
115  {
116  /* masks for SoundMixerByte */
117  MediaBaySndEnMask = 0x01,
118  PCISndEnMask = 0x02,
119  ZVSndEnMask = 0x04,
120  PCCardSndEnMask = 0x08
121  };
122 
123  enum
124  {
125  /* commands to SleepQRec sleepQProc */
126  kSleepRequest = 1,
127  kSleepDemand = 2,
128  kSleepWakeUp = 3,
129  kSleepRevoke = 4,
130  kSleepUnlock = 4,
131  kSleepDeny = 5, /* A non-zero value clients can use to deny requests*/
132  kSleepNow = 6,
133  kDozeDemand = 7,
134  kDozeWakeUp = 8,
135  kDozeRequest = 9, /* additional messages for Power Mgr 2.0*/
136  kEnterStandby = 10, /* Idle Queue Only*/
137  kEnterRun = 11, /* Idle Queue Only*/
138  kSuspendRequest = 12,
139  kSuspendDemand = 13,
140  kSuspendRevoke = 14,
141  kSuspendWakeUp = 15,
142  kGetPowerLevel = 16,
143  kSetPowerLevel = 17,
144  kDeviceInitiatedWake = 18,
145  kWakeToDoze = 19,
146  kDozeToFullWakeUp = 20,
147  kGetPowerInfo = 21,
148  kGetWakeOnNetInfo = 22,
149  kSuspendWakeToDoze = 23,
150  kEnterIdle = 24, /* Idle Queue Only*/
151  kStillIdle = 25, /* Idle Queue Only*/
152  kExitIdle = 26 /* Idle Queue Only*/
153  };
154 
155  enum
156  {
157  /* depreciated commands to SleepQRec sleepQProc */
158  sleepRequest = kSleepRequest,
159  sleepDemand = kSleepDemand,
160  sleepWakeUp = kSleepWakeUp,
161  sleepRevoke = kSleepRevoke,
162  sleepUnlock = kSleepUnlock,
163  sleepDeny = kSleepDeny,
164  sleepNow = kSleepNow,
165  dozeDemand = kDozeDemand,
166  dozeWakeUp = kDozeWakeUp,
167  dozeRequest = kDozeRequest,
168  enterStandby = kEnterStandby,
169  enterRun = kEnterRun,
170  suspendRequestMsg = kSuspendRequest,
171  suspendDemandMsg = kSuspendDemand,
172  suspendRevokeMsg = kSuspendRevoke,
173  suspendWakeUpMsg = kSuspendWakeUp,
174  getPowerLevel = kGetPowerLevel,
175  setPowerLevel = kSetPowerLevel
176  };
177 
178  /* Power Handler func messages */
179  typedef UInt32 PowerLevel;
180  /* Power levels corresponding to PCI Bus Power Management Interface Spec (PMIS)
181  */
182  enum
183  {
184  kPMDevicePowerLevel_On = 0, /* fully-powered 'On' state (D0 state) */
185  kPMDevicePowerLevel_D1 = 1, /* not used by Apple system SW */
186  kPMDevicePowerLevel_D2 = 2, /* not used by Apple system SW */
187  kPMDevicePowerLevel_Off = 3 /* main PCI bus power 'Off', but PCI standby power
188  available (D3cold state) */
189  };
190 
191  /* PowerHandlerProc definition */
192  typedef CALLBACK_API(OSStatus, PowerHandlerProcPtr)(UInt32 message, void *param,
193  UInt32 refCon,
194  RegEntryID *regEntryID);
195  typedef STACK_UPP_TYPE(PowerHandlerProcPtr) PowerHandlerUPP;
196 #if CALL_NOT_IN_CARBON
205  PowerHandlerUPP
206  NewPowerHandlerUPP(PowerHandlerProcPtr userRoutine);
207 #if !OPAQUE_UPP_TYPES
208  enum
209  {
210  uppPowerHandlerProcInfo = 0x00003FF0
211  }; /* pascal 4_bytes Func(4_bytes, 4_bytes, 4_bytes, 4_bytes) */
212 #ifdef __cplusplus
213  inline PowerHandlerUPP NewPowerHandlerUPP(PowerHandlerProcPtr userRoutine)
214  {
215  return (PowerHandlerUPP)NewRoutineDescriptor((ProcPtr)(userRoutine),
216  uppPowerHandlerProcInfo,
217  GetCurrentArchitecture());
218  }
219 #else
220 #define NewPowerHandlerUPP(userRoutine) \
221  (PowerHandlerUPP) \
222  NewRoutineDescriptor((ProcPtr)(userRoutine), uppPowerHandlerProcInfo, \
223  GetCurrentArchitecture())
224 #endif
225 #endif
226 
235  void
236  DisposePowerHandlerUPP(PowerHandlerUPP userUPP);
237 #if !OPAQUE_UPP_TYPES
238 #ifdef __cplusplus
239  inline void DisposePowerHandlerUPP(PowerHandlerUPP userUPP)
240  {
241  DisposeRoutineDescriptor((UniversalProcPtr)userUPP);
242  }
243 #else
244 #define DisposePowerHandlerUPP(userUPP) DisposeRoutineDescriptor(userUPP)
245 #endif
246 #endif
247 
256  OSStatus
257  InvokePowerHandlerUPP(UInt32 message, void *param, UInt32 refCon,
258  RegEntryID *regEntryID, PowerHandlerUPP userUPP);
259 #if !OPAQUE_UPP_TYPES
260 #ifdef __cplusplus
261  inline OSStatus InvokePowerHandlerUPP(UInt32 message, void *param,
262  UInt32 refCon, RegEntryID *regEntryID,
263  PowerHandlerUPP userUPP)
264  {
265  return (OSStatus)CALL_FOUR_PARAMETER_UPP(userUPP, uppPowerHandlerProcInfo,
266  message, param, refCon, regEntryID);
267  }
268 #else
269 #define InvokePowerHandlerUPP(message, param, refCon, regEntryID, userUPP) \
270  (OSStatus) \
271  CALL_FOUR_PARAMETER_UPP((userUPP), uppPowerHandlerProcInfo, (message), \
272  (param), (refCon), (regEntryID))
273 #endif
274 #endif
275 
276 #endif /* CALL_NOT_IN_CARBON */
277 
278 #if CALL_NOT_IN_CARBON || OLDROUTINENAMES
279 /* support for pre-Carbon UPP routines: New...Proc and Call...Proc */
280 #define NewPowerHandlerProc(userRoutine) NewPowerHandlerUPP(userRoutine)
281 #define CallPowerHandlerProc(userRoutine, message, param, refCon, regEntryID) \
282  InvokePowerHandlerUPP(message, param, refCon, regEntryID, userRoutine)
283 #endif /* CALL_NOT_IN_CARBON */
284 
290 #define kIdleQueueDeviceType "idle-queue"
291  /* PCI power management support*/
292 
293  enum
294  {
295  kUseDefaultMinimumWakeTime = 0, /* Defaults to 5 minutes*/
296  kPowerSummaryVersion = 1, /* Version of PowerSummary structure.*/
297  kDevicePowerInfoVersion = 1 /* Version of DevicePowerInfo structure.*/
298  };
299 
300  enum
301  {
302  /* PowerSummary flags*/
303  kPCIPowerOffAllowed = (1L << 0) /* PCI power off is allowed.*/
304  };
305 
306  enum
307  {
308  /* DevicePowerInfo flags*/
309  kDevicePCIPowerOffAllowed =
310  (1L << 0), /* PCI power off is allowed for device.*/
311  kDeviceSupportsPMIS =
312  (1L << 1), /* Device supports Power Mgt Interface Spec.*/
313  kDeviceCanAssertPMEDuringSleep =
314  (1L << 2), /* Device can assert PME# during sleep.*/
315  kDeviceUsesCommonLogicPower = (1L << 3), /* Device uses common-logic power*/
316  kDeviceDriverPresent = (1L << 4), /* Driver present for device.*/
317  kDeviceDriverSupportsPowerMgt =
318  (1L << 5) /* Driver installed a power handler.*/
319  };
320 
322  {
323  UInt32 version; /* Version of this structure.*/
324  RegEntryID regID; /* RegEntryID for device.*/
325  OptionBits flags; /* Flags*/
326  UInt32 minimumWakeTime; /* Minimum seconds before sleeping again.*/
327  UInt32 sleepPowerNeeded; /* Milliwatts needed in the sleep state.*/
328  };
329  typedef struct DevicePowerInfo DevicePowerInfo;
331  {
332  UInt32 version; /* Version of this structure.*/
333  OptionBits flags; /* Flags*/
334  UInt32 sleepPowerAvailable; /* Milliwatts available during sleep.*/
335  UInt32 sleepPowerNeeded; /* Milliwatts needed during sleep.*/
336  UInt32 minimumWakeTime; /* Minimum seconds before sleeping again.*/
337  ItemCount deviceCount; /* Number of device power info records.*/
338  DevicePowerInfo devices[1]; /* Array of device power info records.*/
339  };
340  typedef struct PowerSummary PowerSummary;
341  enum
342  {
343  /* SleepQRec.sleepQFlags */
344  noCalls = 1,
345  noRequest = 2,
346  slpQType = 16,
347  sleepQType = 16
348  };
349 
350  /* Power Mgt Apple Event types and errors */
351  enum
352  {
353  /* power mgt class*/
354  kAEMacPowerMgtEvt = FOUR_CHAR_CODE('pmgt'), /* event ids*/
355  kAEMacToWake = FOUR_CHAR_CODE('wake'),
356  kAEMacLowPowerSaveData = FOUR_CHAR_CODE('pmsd'),
357  kAEMacEmergencySleep = FOUR_CHAR_CODE('emsl'),
358  kAEMacEmergencyShutdown = FOUR_CHAR_CODE('emsd')
359  };
360 
366  enum
367  {
368  kDeviceDidNotWakeMachine = 0, /* device did NOT wake machine*/
369  kDeviceRequestsFullWake =
370  1, /* device did wake machine and requests full wakeup*/
371  kDeviceRequestsWakeToDoze =
372  2 /* device did wake machine and requests partial wakeup*/
373  };
374 
375  /* bits in bitfield returned by PMFeatures */
376  enum
377  {
378  hasWakeupTimer = 0, /* 1=wakeup timer is supported */
379  hasSharedModemPort = 1, /* 1=modem port shared by SCC and internal modem */
380  hasProcessorCycling = 2, /* 1=processor cycling is supported */
381  mustProcessorCycle = 3, /* 1=processor cycling should not be turned off */
382  hasReducedSpeed = 4, /* 1=processor can be started up at reduced speed */
383  dynamicSpeedChange = 5, /* 1=processor speed can be switched dynamically */
384  hasSCSIDiskMode = 6, /* 1=SCSI Disk Mode is supported */
385  canGetBatteryTime = 7, /* 1=battery time can be calculated */
386  canWakeupOnRing = 8, /* 1=can wakeup when the modem detects a ring */
387  hasDimmingSupport =
388  9, /* 1=has dimming support built in (DPMS standby by default) */
389  hasStartupTimer = 10, /* 1=startup timer is supported */
390  hasChargeNotification = 11, /* 1=client can determine of charge connect status
391  change notifications available */
392  hasDimSuspendSupport =
393  12, /* 1=supports dimming LCD and CRT to DPMS suspend state */
394  hasWakeOnNetActivity = 13, /* 1=hardware supports wake on network activity */
395  hasWakeOnLid = 14, /* 1=hardware can wake when opened */
396  canPowerOffPCIBus =
397  15, /* 1=hardware can power off PCI bus during sleep if cards allow */
398  hasDeepSleep = 16, /* 1=hardware supports deep sleep (hibernation) mode */
399  hasSleep = 17, /* 1=hardware supports normal (PowerBook-like) sleep */
400  supportsServerModeAPIs =
401  18, /* 1=hardware supports server mode API routines */
402  supportsUPSIntegration =
403  19, /* 1=hardware support UPS integration and reporting */
404  hasAggressiveIdling =
405  20, /* 1=Power Manager only resets OverallAct on UsrActvity */
406  supportsIdleQueue = 21 /* 1=Power Manager supports the idle queue */
407  };
408 
409  /* bits in bitfield returned by GetIntModemInfo and set by SetIntModemState */
410  enum
411  {
412  hasInternalModem = 0, /* 1=internal modem installed */
413  intModemRingDetect = 1, /* 1=internal modem has detected a ring */
414  intModemOffHook = 2, /* 1=internal modem is off hook */
415  intModemRingWakeEnb = 3, /* 1=wakeup on ring is enabled */
416  extModemSelected = 4, /* 1=external modem selected */
417  modemSetBit = 15 /* 1=set bit, 0=clear bit (SetIntModemState) */
418  };
419 
420  /* bits in BatteryInfo.flags */
421  /* ("chargerConnected" doesn't mean the charger is plugged in) */
422  enum
423  {
424  batteryInstalled = 7, /* 1=battery is currently connected */
425  batteryCharging = 6, /* 1=battery is being charged */
426  chargerConnected = 5, /* 1=charger is connected to the PowerBook */
427  upsConnected = 4, /* 1=there is a UPS connected */
428  upsIsPowerSource = 3 /* 1=UPS is source of power */
429  };
430 
431  enum
432  {
433  HDPwrQType = 0x4844, /* 'HD' hard disk spindown queue element type */
434  PMgrStateQType = 0x504D /* 'PM' Power Manager state queue element type */
435  };
436 
437  /* client notification bits in PMgrQueueElement.pmNotifyBits */
438  enum
439  {
440  pmSleepTimeoutChanged = 0,
441  pmSleepEnableChanged = 1,
442  pmHardDiskTimeoutChanged = 2,
443  pmHardDiskSpindownChanged = 3,
444  pmDimmingTimeoutChanged = 4,
445  pmDimmingEnableChanged = 5,
446  pmDiskModeAddressChanged = 6,
447  pmProcessorCyclingChanged = 7,
448  pmProcessorSpeedChanged = 8,
449  pmWakeupTimerChanged = 9,
450  pmStartupTimerChanged = 10,
451  pmHardDiskPowerRemovedbyUser = 11,
452  pmChargeStatusChanged = 12,
453  pmPowerLevelChanged = 13,
454  pmWakeOnNetActivityChanged = 14
455  };
456 
457  enum
458  {
459  pmSleepTimeoutChangedMask = (1 << pmSleepTimeoutChanged),
460  pmSleepEnableChangedMask = (1 << pmSleepEnableChanged),
461  pmHardDiskTimeoutChangedMask = (1 << pmHardDiskTimeoutChanged),
462  pmHardDiskSpindownChangedMask = (1 << pmHardDiskSpindownChanged),
463  pmDimmingTimeoutChangedMask = (1 << pmDimmingTimeoutChanged),
464  pmDimmingEnableChangedMask = (1 << pmDimmingEnableChanged),
465  pmDiskModeAddressChangedMask = (1 << pmDiskModeAddressChanged),
466  pmProcessorCyclingChangedMask = (1 << pmProcessorCyclingChanged),
467  pmProcessorSpeedChangedMask = (1 << pmProcessorSpeedChanged),
468  pmWakeupTimerChangedMask = (1 << pmWakeupTimerChanged),
469  pmStartupTimerChangedMask = (1 << pmStartupTimerChanged),
470  pmHardDiskPowerRemovedbyUserMask = (1 << pmHardDiskPowerRemovedbyUser),
471  pmChargeStatusChangedMask = (1 << pmChargeStatusChanged),
472  pmPowerLevelChangedMask = (1 << pmPowerLevelChanged),
473  pmWakeOnNetActivityChangedMask = (1 << pmWakeOnNetActivityChanged)
474  };
475 
476  /* System Activity Selectors */
477  /* Notes: The IdleActivity selector is not available unless the
478  * hasAggressiveIdling PMFeatures bit is set. */
479  /* Use IdleActivity where you used to use OverallAct if necessary.
480  * OverallAct will only */
481  /* delay power cycling if it's enabled, and will delay sleep by a small
482  * amount when */
483  /* hasAggressiveIdling is set. Don't use IdleActivity unless
484  * hasAggressiveIdling is set; when */
485  /* hasAggressiveIdling is not set, the use of IdleActivity is undefined,
486  * and well do different */
487  /* things depending on which Power Manager is currently running. */
488  enum
489  {
490  OverallAct = 0, /* Delays idle sleep by small amount */
491  UsrActivity = 1, /* Delays idle sleep and dimming by timeout time */
492  NetActivity = 2, /* Delays idle sleep and power cycling by small amount */
493  HDActivity =
494  3, /* Delays hard drive spindown and idle sleep by small amount */
495  IdleActivity = 4 /* Delays idle sleep by timeout time */
496  };
497 
498  /* Storage Media sleep mode defines */
499  enum
500  {
501  kMediaModeOn = 0, /* Media active (Drive spinning and at full power) */
502  kMediaModeStandBy = 1, /* Media standby (not implemented) */
503  kMediaModeSuspend = 2, /* Media Idle (not implemented) */
504  kMediaModeOff = 3 /* Media Sleep (Drive not spinning and at min power, max
505  recovery time) */
506  };
507 
508  enum
509  {
510  kMediaPowerCSCode = 70
511  };
512 
513  /* definitions for HDQueueElement.hdFlags */
514  enum
515  {
516  kHDQueuePostBit = 0, /* 1 = call this routine on the second pass */
517  kHDQueuePostMask = (1 << kHDQueuePostBit)
518  };
519 
521  {
522  short ActivityType; /* Type of activity to be fetched. Same as
523  UpdateSystemActivity Selectors */
524  unsigned long
525  ActivityTime; /* Time of last activity (in ticks) of specified type. */
526  };
527  typedef struct ActivityInfo ActivityInfo;
528  /* information returned by GetScaledBatteryInfo */
529  struct BatteryInfo
530  {
531  UInt8 flags; /* misc flags (see below) */
532  UInt8 warningLevel; /* scaled warning level (0-255) */
533  UInt8 reserved; /* reserved for internal use */
534  UInt8 batteryLevel; /* scaled battery level (0-255) */
535  };
536  typedef struct BatteryInfo BatteryInfo;
537 
538  typedef SInt8 ModemByte;
539  typedef SInt8 BatteryByte;
540  typedef SInt8 SoundMixerByte;
541  typedef long PMResultCode;
542  typedef struct SleepQRec SleepQRec;
543  typedef SleepQRec *SleepQRecPtr;
544  typedef struct HDQueueElement HDQueueElement;
545  typedef struct PMgrQueueElement PMgrQueueElement;
546  typedef CALLBACK_API_REGISTER68K(long, SleepQProcPtr,
547  (long message, SleepQRecPtr qRecPtr));
548  typedef CALLBACK_API(void, HDSpindownProcPtr)(HDQueueElement *theElement);
549  typedef CALLBACK_API(void, PMgrStateChangeProcPtr)(PMgrQueueElement *theElement,
550  long stateBits);
551  typedef REGISTER_UPP_TYPE(SleepQProcPtr) SleepQUPP;
552  typedef STACK_UPP_TYPE(HDSpindownProcPtr) HDSpindownUPP;
553  typedef STACK_UPP_TYPE(PMgrStateChangeProcPtr) PMgrStateChangeUPP;
554  struct SleepQRec
555  {
556  SleepQRecPtr sleepQLink; /* pointer to next queue element */
557  short sleepQType; /* queue element type (must be SleepQType) */
558  SleepQUPP sleepQProc; /* pointer to sleep universal proc ptr */
559  short sleepQFlags; /* flags */
560  };
561 
563  {
564  struct HDQueueElement *hdQLink; /* pointer to next queue element */
565  short hdQType; /* queue element type (must be HDPwrQType) */
566  short hdFlags; /* miscellaneous flags */
567  HDSpindownUPP hdProc; /* pointer to routine to call */
568  long hdUser; /* user-defined (variable storage, etc.) */
569  };
570 
572  {
573  struct PMgrQueueElement *pmQLink; /* pointer to next queue element */
574  short pmQType; /* queue element type (must be PMgrStateQType) */
575  short pmFlags; /* miscellaneous flags */
576  long pmNotifyBits; /* bitmap of which changes to be notified for */
577  PMgrStateChangeUPP pmProc; /* pointer to routine to call */
578  long pmUser; /* user-defined (variable storage, etc.) */
579  };
580 
582  {
583  unsigned long
584  expectedBatteryTime; /* estimated battery time remaining (seconds) */
585  unsigned long
586  minimumBatteryTime; /* minimum battery time remaining (seconds) */
587  unsigned long
588  maximumBatteryTime; /* maximum battery time remaining (seconds) */
589  unsigned long
590  timeUntilCharged; /* time until battery is fully charged (seconds)*/
591  };
592  typedef struct BatteryTimeRec BatteryTimeRec;
593 
594  struct WakeupTime
595  {
596  unsigned long wakeTime; /* wakeup time (same format as current time) */
597  Boolean wakeEnabled; /* 1=enable wakeup timer, 0=disable wakeup timer */
598  SInt8 filler;
599  };
600  typedef struct WakeupTime WakeupTime;
601 
602  struct StartupTime
603  {
604  unsigned long startTime; /* startup time (same format as current time) */
605  Boolean startEnabled; /* 1=enable startup timer, 0=disable startup timer */
606  SInt8 filler;
607  };
608  typedef struct StartupTime StartupTime;
609  /* PowerSource version*/
610  enum
611  {
612  kVersionOnePowerSource = 1,
613  kVersionTwoPowerSource = 2,
614  kCurrentPowerSourceVersion = kVersionTwoPowerSource
615  };
616 
617  /* PowerSourceAttrs bits*/
618 
619  enum
620  {
621  bSourceIsBattery = 0, /* power source is battery*/
622  bSourceIsAC = 1, /* power source is AC*/
623  bSourceCanBeCharged = 2, /* power source can be charged*/
624  bSourceIsUPS = 3, /* power source is UPS. NOTE: software should set
625  bSourceIsBattery and bSourceIsAC also, as appropriate*/
626  bSourceProvidesWarnLevels =
627  4, /* power source provides low power and dead battery warning levels*/
628  kSourceIsBatteryMask = (1 << bSourceIsBattery),
629  kSourceIsACMask = (1 << bSourceIsAC),
630  kSourceCanBeChargedMask = (1 << bSourceCanBeCharged),
631  kSourceIsUPSMask = (1 << bSourceIsUPS),
632  kSourceProvidesWarnLevelsMask = (1 << bSourceProvidesWarnLevels)
633  };
634 
635  /* PowerSourceFlags bits*/
636 
637  enum
638  {
639  bSourceIsAvailable = 0, /* power source is installed*/
640  bSourceIsCharging = 1, /* power source being charged*/
641  bChargerIsAttached = 2, /* a charger is connected*/
642  kSourceIsAvailableMask = (1 << bSourceIsAvailable),
643  kSourceIsChargingMask = (1 << bSourceIsCharging),
644  kChargerIsAttachedMask = (1 << bChargerIsAttached)
645  };
646 
647  /* Power Capacity Types*/
648 
649  enum
650  {
651  kCapacityIsActual = 0, /* current capacity is expessed as actual capacity in
652  same units as max*/
653  kCapacityIsPercentOfMax =
654  1 /* current capacity is expressed as a percentage of maximumCapacity*/
655  };
656 
657  /* Net Activity Wake Options*/
658  enum
659  {
660  kConfigSupportsWakeOnNetBit = 0,
661  kWakeOnNetAdminAccessesBit = 1,
662  kWakeOnAllNetAccessesBit = 2,
663  kUnmountServersBeforeSleepingBit = 3,
664  kConfigSupportsWakeOnNetMask = (1 << kConfigSupportsWakeOnNetBit),
665  kWakeOnNetAdminAccessesMask = (1 << kWakeOnNetAdminAccessesBit),
666  kWakeOnAllNetAccessesMask = (1 << kWakeOnAllNetAccessesBit),
667  kUnmountServersBeforeSleepingMask = (1 << kUnmountServersBeforeSleepingBit)
668  };
669 
670  /* Power Source capacity usage types*/
671  enum
672  {
673  kCurrentCapacityIsActualValue =
674  0, /* currentCapacity is a real value in same units as maxCapacity*/
675  kCurrentCapacityIsPercentOfMax =
676  1 /* currentCapacity is expressed as a percentage of maxCapacity.*/
677  };
678 
679  typedef SInt16 PowerSourceID;
681  {
682  PowerSourceID sourceID; /* unique id assigned by Power Mgr*/
683  UInt16 sourceCapacityUsage; /* how currentCapacity is used*/
684  UInt32 sourceVersion; /* version of this record*/
685  OptionBits sourceAttr; /* attribute flags (see below)*/
686  OptionBits sourceState; /* state flags (see below)*/
687  UInt32 currentCapacity; /* current capacity, in*/
688  /* milliwatts or %*/
689  UInt32 maxCapacity; /* full capacity, in milliwatts*/
690  UInt32 timeRemaining; /* time left to deplete, */
691  /* in milliwatt-hours*/
692  UInt32 timeToFullCharge; /* time to charge, */
693  /* in milliwatt-hours*/
694  UInt32 voltage; /* voltage in millivolts*/
695  SInt32 current; /* current in milliamperes */
696  /* (negative if consuming, */
697  /* positive if charging)*/
698  UInt32 lowWarnLevel; /* low warning level in milliwatts (or % if
699  sourceCapacityUsage is %)*/
700  UInt32 deadWarnLevel; /* dead warning level in milliwatts (or % if
701  sourceCapacityUsage is %)*/
702  UInt32 reserved[16]; /* for future expansion*/
703  };
706 
718  OSErr
720 
742  OSErr
743  SetWUTime(long wuTime);
744 
760  OSErr
761  GetWUTime(long *wuTime, Byte *wuFlag);
762 
810  OSErr
811  BatteryStatus(Byte *status, Byte *power);
812 
846  OSErr
847  ModemStatus(Byte *status);
848 
859 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
860 #pragma parameter __D0 IdleUpdate
861 #endif
862  long
863  IdleUpdate(void);
864 
877 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
878 #pragma parameter __D0 GetCPUSpeed
879 #endif
880  long
881  GetCPUSpeed(void);
882 
897  void
898  EnableIdle(void);
899 
913  void
914  DisableIdle(void);
915 
930 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
931 #pragma parameter SleepQInstall(__A0)
932 #endif
933  void
935 
950 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
951 #pragma parameter SleepQRemove(__A0)
952 #endif
953  void
955 
969  void
970  AOn(void);
971 
985  void
987 
999  void
1000  BOn(void);
1001 
1016  void
1017  AOff(void);
1018 
1033  void
1034  BOff(void);
1035 
1036 /* Public Power Management API */
1045 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1046 #pragma parameter __D0 PMSelectorCount
1047 #endif
1048  short
1050 
1059 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1060 #pragma parameter __D0 PMFeatures
1061 #endif
1062  UInt32
1063  PMFeatures(void);
1064 
1073 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1074 #pragma parameter __D0 GetSleepTimeout
1075 #endif
1076  UInt8
1078 
1087 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1088 #pragma parameter SetSleepTimeout(__D0)
1089 #endif
1090  void
1091  SetSleepTimeout(UInt8 timeout);
1092 
1101 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1102 #pragma parameter __D0 GetHardDiskTimeout
1103 #endif
1104  UInt8
1106 
1115 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1116 #pragma parameter SetHardDiskTimeout(__D0)
1117 #endif
1118  void
1119  SetHardDiskTimeout(UInt8 timeout);
1120 
1129 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1130 #pragma parameter __D0 HardDiskPowered
1131 #endif
1132  Boolean
1134 
1143 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1144 #pragma parameter SpinDownHardDisk
1145 #endif
1146  void
1148 
1157 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1158 #pragma parameter __D0 IsSpindownDisabled
1159 #endif
1160  Boolean
1162 
1171 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1172 #pragma parameter SetSpindownDisable(__D0)
1173 #endif
1174  void
1176 
1185 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1186 #pragma parameter __D0 HardDiskQInstall(__A0)
1187 #endif
1188  OSErr
1190 
1199 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1200 #pragma parameter __D0 HardDiskQRemove(__A0)
1201 #endif
1202  OSErr
1204 
1213 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1214 #pragma parameter GetScaledBatteryInfo(__D0, __A0)
1215 #endif
1216  void
1217  GetScaledBatteryInfo(short whichBattery, BatteryInfo *theInfo);
1218 
1227 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1228 #pragma parameter AutoSleepControl(__D0)
1229 #endif
1230  void
1232 
1241 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1242 #pragma parameter __D0 GetIntModemInfo
1243 #endif
1244  UInt32
1246 
1255 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1256 #pragma parameter SetIntModemState(__D0)
1257 #endif
1258  void
1259  SetIntModemState(short theState);
1260 
1269 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1270 #pragma parameter __D0 MaximumProcessorSpeed
1271 #endif
1272  short
1274 
1283 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1284 #pragma parameter __D0 MinimumProcessorSpeed
1285 #endif
1286  short
1288 
1297 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1298 #pragma parameter __D0 CurrentProcessorSpeed
1299 #endif
1300  short
1302 
1311 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1312 #pragma parameter __D0 FullProcessorSpeed
1313 #endif
1314  Boolean
1316 
1325 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1326 #pragma parameter __D0 SetProcessorSpeed(__D0)
1327 #endif
1328  Boolean
1330 
1339 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1340 #pragma parameter __D0 GetSCSIDiskModeAddress
1341 #endif
1342  short
1344 
1353 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1354 #pragma parameter SetSCSIDiskModeAddress(__D0)
1355 #endif
1356  void
1357  SetSCSIDiskModeAddress(short scsiAddress);
1358 
1367 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1368 #pragma parameter GetWakeupTimer(__A0)
1369 #endif
1370  void
1372 
1381 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1382 #pragma parameter SetWakeupTimer(__A0)
1383 #endif
1384  void
1386 
1395 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1396 #pragma parameter __D0 IsProcessorCyclingEnabled
1397 #endif
1398  Boolean
1400 
1409 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1410 #pragma parameter EnableProcessorCycling(__D0)
1411 #endif
1412  void
1414 
1423 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1424 #pragma parameter __D0 BatteryCount
1425 #endif
1426  short
1428 
1437 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1438 #pragma parameter __D0 GetBatteryVoltage(__D0)
1439 #endif
1440  Fixed
1441  GetBatteryVoltage(short whichBattery);
1442 
1451 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1452 #pragma parameter GetBatteryTimes(__D0, __A0)
1453 #endif
1454  void
1455  GetBatteryTimes(short whichBattery, BatteryTimeRec *theTimes);
1456 
1465 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1466 #pragma parameter __D0 GetDimmingTimeout
1467 #endif
1468  UInt8
1470 
1479 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1480 #pragma parameter SetDimmingTimeout(__D0)
1481 #endif
1482  void
1483  SetDimmingTimeout(UInt8 timeout);
1484 
1493 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1494 #pragma parameter DimmingControl(__D0)
1495 #endif
1496  void
1497  DimmingControl(Boolean enableSleep);
1498 
1507 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1508 #pragma parameter __D0 IsDimmingControlDisabled
1509 #endif
1510  Boolean
1512 
1521 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1522 #pragma parameter __D0 IsAutoSlpControlDisabled
1523 #endif
1524  Boolean
1526 
1535 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1536 #pragma parameter __D0 PMgrStateQInstall(__A0)
1537 #endif
1538  OSErr
1540 
1549 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1550 #pragma parameter __D0 PMgrStateQRemove(__A0)
1551 #endif
1552  OSErr
1554 
1563 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1564 #pragma parameter __D0 UpdateSystemActivity(__D0)
1565 #endif
1566  OSErr
1567  UpdateSystemActivity(UInt8 activity);
1568 
1577 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1578 #pragma parameter __D0 DelaySystemIdle
1579 #endif
1580  OSErr
1582 
1591 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1592 #pragma parameter __D0 GetStartupTimer(__A0)
1593 #endif
1594  OSErr
1596 
1605 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1606 #pragma parameter __D0 SetStartupTimer(__A0)
1607 #endif
1608  OSErr
1610 
1619 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1620 #pragma parameter __D0 GetLastActivity(__A0)
1621 #endif
1622  OSErr
1624 
1633 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1634 #pragma parameter __D0 GetSoundMixerState(__A0)
1635 #endif
1636  OSErr
1637  GetSoundMixerState(SoundMixerByte *theSoundMixerByte);
1638 
1647 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1648 #pragma parameter __D0 SetSoundMixerState(__A0)
1649 #endif
1650  OSErr
1651  SetSoundMixerState(SoundMixerByte *theSoundMixerByte);
1652 
1661 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1662 #pragma parameter __D0 GetDimSuspendState
1663 #endif
1664  Boolean
1666 
1675 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1676 #pragma parameter SetDimSuspendState(__D0)
1677 #endif
1678  void
1679  SetDimSuspendState(Boolean dimSuspendState);
1680 
1681 #if CALL_NOT_IN_CARBON
1690 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1691 #pragma parameter __D0 GetCoreProcessorTemperature(__A0)
1692 #endif
1693  SInt32
1695 
1704 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1705 #pragma parameter __D0 GetWakeOnNetworkOptions
1706 #endif
1707  OptionBits
1709 
1718 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1719 #pragma parameter SetWakeOnNetworkOptions(__A0)
1720 #endif
1721  void
1722  SetWakeOnNetworkOptions(OptionBits inOptions);
1723 
1732 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1733 #pragma parameter __D0 AddPowerSource(__A0)
1734 #endif
1735  OSStatus
1737 
1746 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1747 #pragma parameter __D0 RemovePowerSource(__D0)
1748 #endif
1749  OSStatus
1750  RemovePowerSource(PowerSourceID inSourceID);
1751 
1760 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1761 #pragma parameter __D0 UpdatePowerSource(__A0)
1762 #endif
1763  OSStatus
1765 
1774 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1775 #pragma parameter __D0 IsServerModeEnabled
1776 #endif
1777  Boolean
1779 
1788 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1789 #pragma parameter EnableServerMode(__D0)
1790 #endif
1791  void
1793 
1811 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
1812 #pragma parameter __D0 NumBatteriesInstalled
1813 #endif
1814  UInt32
1816 
1817  /* Power Handler Management */
1826  Boolean
1828 
1837  void
1839 
1848  OSStatus
1849  AddDevicePowerHandler(RegEntryIDPtr regEntryID, PowerHandlerProcPtr handler,
1850  UInt32 refCon, char *deviceType);
1851 
1860  OSStatus
1862 
1871  OSStatus
1872  RemoveDevicePowerHandlerForProc(PowerHandlerProcPtr proc);
1873 
1882  OSStatus
1883  GetDevicePowerLevel(RegEntryIDPtr regEntryID, PowerLevel *devicePowerLevel);
1884 
1893  OSStatus
1894  SetDevicePowerLevel(RegEntryIDPtr regEntryID, PowerLevel devicePowerLevel);
1895 
1896 #endif /* CALL_NOT_IN_CARBON */
1897 
1906  SleepQUPP
1907  NewSleepQUPP(SleepQProcPtr userRoutine);
1908 #if !OPAQUE_UPP_TYPES
1909  enum
1910  {
1911  uppSleepQProcInfo = 0x00131832
1912  }; /* register 4_bytes:D0 Func(4_bytes:D0, 4_bytes:A0) */
1913 #ifdef __cplusplus
1914  inline SleepQUPP NewSleepQUPP(SleepQProcPtr userRoutine)
1915  {
1916  return (SleepQUPP)NewRoutineDescriptor(
1917  (ProcPtr)(userRoutine), uppSleepQProcInfo, GetCurrentArchitecture());
1918  }
1919 #else
1920 #define NewSleepQUPP(userRoutine) \
1921  (SleepQUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppSleepQProcInfo, \
1922  GetCurrentArchitecture())
1923 #endif
1924 #endif
1925 
1934  HDSpindownUPP
1935  NewHDSpindownUPP(HDSpindownProcPtr userRoutine);
1936 #if !OPAQUE_UPP_TYPES
1937  enum
1938  {
1939  uppHDSpindownProcInfo = 0x000000C0
1940  }; /* pascal no_return_value Func(4_bytes) */
1941 #ifdef __cplusplus
1942  inline HDSpindownUPP NewHDSpindownUPP(HDSpindownProcPtr userRoutine)
1943  {
1944  return (HDSpindownUPP)NewRoutineDescriptor(
1945  (ProcPtr)(userRoutine), uppHDSpindownProcInfo, GetCurrentArchitecture());
1946  }
1947 #else
1948 #define NewHDSpindownUPP(userRoutine) \
1949  (HDSpindownUPP) NewRoutineDescriptor( \
1950  (ProcPtr)(userRoutine), uppHDSpindownProcInfo, GetCurrentArchitecture())
1951 #endif
1952 #endif
1953 
1962  PMgrStateChangeUPP
1963  NewPMgrStateChangeUPP(PMgrStateChangeProcPtr userRoutine);
1964 #if !OPAQUE_UPP_TYPES
1965  enum
1966  {
1967  uppPMgrStateChangeProcInfo = 0x000003C0
1968  }; /* pascal no_return_value Func(4_bytes, 4_bytes) */
1969 #ifdef __cplusplus
1970  inline PMgrStateChangeUPP
1971  NewPMgrStateChangeUPP(PMgrStateChangeProcPtr userRoutine)
1972  {
1973  return (PMgrStateChangeUPP)NewRoutineDescriptor((ProcPtr)(userRoutine),
1974  uppPMgrStateChangeProcInfo,
1975  GetCurrentArchitecture());
1976  }
1977 #else
1978 #define NewPMgrStateChangeUPP(userRoutine) \
1979  (PMgrStateChangeUPP) \
1980  NewRoutineDescriptor((ProcPtr)(userRoutine), uppPMgrStateChangeProcInfo, \
1981  GetCurrentArchitecture())
1982 #endif
1983 #endif
1984 
1993  void
1994  DisposeSleepQUPP(SleepQUPP userUPP);
1995 #if !OPAQUE_UPP_TYPES
1996 #ifdef __cplusplus
1997  inline void DisposeSleepQUPP(SleepQUPP userUPP)
1998  {
1999  DisposeRoutineDescriptor((UniversalProcPtr)userUPP);
2000  }
2001 #else
2002 #define DisposeSleepQUPP(userUPP) DisposeRoutineDescriptor(userUPP)
2003 #endif
2004 #endif
2005 
2014  void
2015  DisposeHDSpindownUPP(HDSpindownUPP userUPP);
2016 #if !OPAQUE_UPP_TYPES
2017 #ifdef __cplusplus
2018  inline void DisposeHDSpindownUPP(HDSpindownUPP userUPP)
2019  {
2020  DisposeRoutineDescriptor((UniversalProcPtr)userUPP);
2021  }
2022 #else
2023 #define DisposeHDSpindownUPP(userUPP) DisposeRoutineDescriptor(userUPP)
2024 #endif
2025 #endif
2026 
2035  void
2036  DisposePMgrStateChangeUPP(PMgrStateChangeUPP userUPP);
2037 #if !OPAQUE_UPP_TYPES
2038 #ifdef __cplusplus
2039  inline void DisposePMgrStateChangeUPP(PMgrStateChangeUPP userUPP)
2040  {
2041  DisposeRoutineDescriptor((UniversalProcPtr)userUPP);
2042  }
2043 #else
2044 #define DisposePMgrStateChangeUPP(userUPP) DisposeRoutineDescriptor(userUPP)
2045 #endif
2046 #endif
2047 
2056 #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
2057 #pragma parameter __D0 InvokeSleepQUPP(__D0, __A0, __A1)
2058 #endif
2059  long
2060  InvokeSleepQUPP(long message, SleepQRecPtr qRecPtr, SleepQUPP userUPP);
2061 #if !OPAQUE_UPP_TYPES && \
2062  (!TARGET_OS_MAC || !TARGET_CPU_68K || TARGET_RT_MAC_CFM)
2063 #ifdef __cplusplus
2064  inline long InvokeSleepQUPP(long message, SleepQRecPtr qRecPtr,
2065  SleepQUPP userUPP)
2066  {
2067  return (long)CALL_TWO_PARAMETER_UPP(userUPP, uppSleepQProcInfo, message,
2068  qRecPtr);
2069  }
2070 #else
2071 #define InvokeSleepQUPP(message, qRecPtr, userUPP) \
2072  (long)CALL_TWO_PARAMETER_UPP((userUPP), uppSleepQProcInfo, (message), \
2073  (qRecPtr))
2074 #endif
2075 #endif
2076 
2085  void
2086  InvokeHDSpindownUPP(HDQueueElement *theElement, HDSpindownUPP userUPP);
2087 #if !OPAQUE_UPP_TYPES
2088 #ifdef __cplusplus
2089  inline void InvokeHDSpindownUPP(HDQueueElement *theElement,
2090  HDSpindownUPP userUPP)
2091  {
2092  CALL_ONE_PARAMETER_UPP(userUPP, uppHDSpindownProcInfo, theElement);
2093  }
2094 #else
2095 #define InvokeHDSpindownUPP(theElement, userUPP) \
2096  CALL_ONE_PARAMETER_UPP((userUPP), uppHDSpindownProcInfo, (theElement))
2097 #endif
2098 #endif
2099 
2108  void
2109  InvokePMgrStateChangeUPP(PMgrQueueElement *theElement, long stateBits,
2110  PMgrStateChangeUPP userUPP);
2111 #if !OPAQUE_UPP_TYPES
2112 #ifdef __cplusplus
2113  inline void InvokePMgrStateChangeUPP(PMgrQueueElement *theElement,
2114  long stateBits,
2115  PMgrStateChangeUPP userUPP)
2116  {
2117  CALL_TWO_PARAMETER_UPP(userUPP, uppPMgrStateChangeProcInfo, theElement,
2118  stateBits);
2119  }
2120 #else
2121 #define InvokePMgrStateChangeUPP(theElement, stateBits, userUPP) \
2122  CALL_TWO_PARAMETER_UPP((userUPP), uppPMgrStateChangeProcInfo, (theElement), \
2123  (stateBits))
2124 #endif
2125 #endif
2126 
2127 #if CALL_NOT_IN_CARBON || OLDROUTINENAMES
2128 /* support for pre-Carbon UPP routines: New...Proc and Call...Proc */
2129 #define NewSleepQProc(userRoutine) NewSleepQUPP(userRoutine)
2130 #define NewHDSpindownProc(userRoutine) NewHDSpindownUPP(userRoutine)
2131 #define NewPMgrStateChangeProc(userRoutine) NewPMgrStateChangeUPP(userRoutine)
2132 #define CallSleepQProc(userRoutine, message, qRecPtr) \
2133  InvokeSleepQUPP(message, qRecPtr, userRoutine)
2134 #define CallHDSpindownProc(userRoutine, theElement) \
2135  InvokeHDSpindownUPP(theElement, userRoutine)
2136 #define CallPMgrStateChangeProc(userRoutine, theElement, stateBits) \
2137  InvokePMgrStateChangeUPP(theElement, stateBits, userRoutine)
2138 #endif /* CALL_NOT_IN_CARBON */
2139 
2140 #if PRAGMA_STRUCT_ALIGN
2141 #pragma options align = reset
2142 #elif PRAGMA_STRUCT_PACKPUSH
2143 #pragma pack(pop)
2144 #elif PRAGMA_STRUCT_PACK
2145 #pragma pack()
2146 #endif
2147 
2148 #ifdef PRAGMA_IMPORT_OFF
2149 #pragma import off
2150 #elif PRAGMA_IMPORT
2151 #pragma import reset
2152 #endif
2153 
2154 #ifdef __cplusplus
2155 }
2156 #endif
2157 
2158 #endif /* __POWER__ */
OSErr codes.
Basic Macintosh data types.
long Fixed
Definition: MacTypes.h:153
unsigned char Boolean
Definition: MacTypes.h:318
Mixed Mode Manager Interfaces.
void DisposeRoutineDescriptor(UniversalProcPtr theUPP)
#define STACK_UPP_TYPE(name)
Definition: MixedMode.h:734
UniversalProcPtr NewRoutineDescriptor(ProcPtr theProc, ProcInfoType theProcInfo, ISAType theISA)
Multiprocessing interfaces.
NameRegistry Interfaces.
UInt8 GetDimmingTimeout(void)
OSErr GetStartupTimer(StartupTime *theTime)
void AutoSleepControl(Boolean enableSleep)
UInt32 GetIntModemInfo(void)
void SetSCSIDiskModeAddress(short scsiAddress)
OSStatus AddDevicePowerHandler(RegEntryIDPtr regEntryID, PowerHandlerProcPtr handler, UInt32 refCon, char *deviceType)
short GetSCSIDiskModeAddress(void)
OSErr ModemStatus(Byte *status)
Get information about Mac Portable internal modem.
void DisposeSleepQUPP(SleepQUPP userUPP)
void SetIntModemState(short theState)
void SpinDownHardDisk(void)
void InvokePMgrStateChangeUPP(PMgrQueueElement *theElement, long stateBits, PMgrStateChangeUPP userUPP)
PMgrStateChangeUPP NewPMgrStateChangeUPP(PMgrStateChangeProcPtr userRoutine)
UInt32 NumBatteriesInstalled(void)
OSErr BatteryStatus(Byte *status, Byte *power)
Get status of battery charger and voltage level.
OSErr GetWUTime(long *wuTime, Byte *wuFlag)
Get the current wakeup time settings.
OptionBits GetWakeOnNetworkOptions(void)
Boolean IsServerModeEnabled(void)
OSStatus RemoveDevicePowerHandlerForProc(PowerHandlerProcPtr proc)
void AOn(void)
Switch on power to the SCC and the -5 volt supply.
long InvokeSleepQUPP(long message, SleepQRecPtr qRecPtr, SleepQUPP userUPP)
OSStatus UpdatePowerSource(PowerSourceParamBlock *ioSource)
void EnableProcessorCycling(Boolean enable)
void BOff(void)
Switch off power to SCC and -5 volt supply if portA not in use.
void SetDimmingTimeout(UInt8 timeout)
void SleepQRemove(SleepQRecPtr qRecPtr)
Remove an entry from the sleep queue.
void AOnIgnoreModem(void)
Switch on power to SCC, -5 volt supply and serial driver chips.
SInt32 GetCoreProcessorTemperature(MPCpuID inCpuID)
long GetCPUSpeed(void)
Return the current effective clock speed of the CPU.
short MaximumProcessorSpeed(void)
OSErr UpdateSystemActivity(UInt8 activity)
void DisposeHDSpindownUPP(HDSpindownUPP userUPP)
Boolean IsDimmingControlDisabled(void)
void DimmingControl(Boolean enableSleep)
void GetWakeupTimer(WakeupTime *theTime)
OSStatus RemovePowerSource(PowerSourceID inSourceID)
void InvokeHDSpindownUPP(HDQueueElement *theElement, HDSpindownUPP userUPP)
void EnableIdle(void)
Enable the Idle state.
void DisableIdle(void)
Disable the Idle state.
Boolean SetProcessorSpeed(Boolean fullSpeed)
void BOn(void)
Switch on power to SCC, -5 volt supply and serial driver chips.
Boolean IsAutoSlpControlDisabled(void)
short PMSelectorCount(void)
void SetSleepTimeout(UInt8 timeout)
long IdleUpdate(void)
Reset the activity timer.
OSErr HardDiskQRemove(HDQueueElement *theElement)
UInt32 PMFeatures(void)
OSStatus RemoveDevicePowerHandler(RegEntryIDPtr regEntryID)
short MinimumProcessorSpeed(void)
OSErr HardDiskQInstall(HDQueueElement *theElement)
OSErr GetSoundMixerState(SoundMixerByte *theSoundMixerByte)
PowerHandlerUPP NewPowerHandlerUPP(PowerHandlerProcPtr userRoutine)
short BatteryCount(void)
Boolean IsProcessorCyclingEnabled(void)
void DisposePMgrStateChangeUPP(PMgrStateChangeUPP userUPP)
OSStatus AddPowerSource(PowerSourceParamBlock *ioPowerSource)
OSErr SetWUTime(long wuTime)
Set and enable the wakeup timer.
void GetScaledBatteryInfo(short whichBattery, BatteryInfo *theInfo)
SleepQUPP NewSleepQUPP(SleepQProcPtr userRoutine)
OSErr DelaySystemIdle(void)
void EnableServerMode(Boolean inEnable)
HDSpindownUPP NewHDSpindownUPP(HDSpindownProcPtr userRoutine)
OSErr PMgrStateQRemove(PMgrQueueElement *theElement)
UInt8 GetHardDiskTimeout(void)
void SetDimSuspendState(Boolean dimSuspendState)
Boolean GetDimSuspendState(void)
OSStatus InvokePowerHandlerUPP(UInt32 message, void *param, UInt32 refCon, RegEntryID *regEntryID, PowerHandlerUPP userUPP)
short CurrentProcessorSpeed(void)
void AOff(void)
Switch off power to SCC and -5 volt supply if portB not in use.
void DisposePowerHandlerUPP(PowerHandlerUPP userUPP)
OSErr GetLastActivity(ActivityInfo *theActivity)
Boolean FullProcessorSpeed(void)
OSErr SetSoundMixerState(SoundMixerByte *theSoundMixerByte)
OSErr PMgrStateQInstall(PMgrQueueElement *theElement)
UInt8 GetSleepTimeout(void)
OSStatus GetDevicePowerLevel(RegEntryIDPtr regEntryID, PowerLevel *devicePowerLevel)
void SleepQInstall(SleepQRecPtr qRecPtr)
Add an entry to the sleep queue.
Boolean HardDiskPowered(void)
void SetWakeupTimer(WakeupTime *theTime)
OSErr SetStartupTimer(StartupTime *theTime)
void SetWakeOnNetworkOptions(OptionBits inOptions)
Fixed GetBatteryVoltage(short whichBattery)
Boolean IsSpindownDisabled(void)
void EnablePCIPowerOff(Boolean inEnable)
OSStatus SetDevicePowerLevel(RegEntryIDPtr regEntryID, PowerLevel devicePowerLevel)
Boolean IsPCIPowerOffDisabled(void)
void SetHardDiskTimeout(UInt8 timeout)
OSErr DisableWUTime(void)
Disable the wakeup timer.
void GetBatteryTimes(short whichBattery, BatteryTimeRec *theTimes)
void SetSpindownDisable(Boolean setDisable)
typedef CALLBACK_API_REGISTER68K(void, SIInterruptProcPtr,(SPBPtr inParamPtr, Ptr dataBuffer, short peakAmplitude, long sampleSize))
typedef REGISTER_UPP_TYPE(HighHookProcPtr) HighHookUPP
Definition: Power.h:521
Definition: Power.h:530
Definition: Power.h:582
Definition: Power.h:322
Definition: Power.h:563
Definition: Power.h:572
Definition: Power.h:681
Definition: Power.h:331
Definition: NameRegistry.h:62
Definition: Power.h:555
Definition: Power.h:603
Definition: Power.h:595