Power.h
上传用户:xjjlds
上传日期:2015-12-05
资源大小:22823k
文件大小:70k
源码类别:

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       Power.h
  3.  
  4.      Contains:   Power Manager Interfaces.
  5.  
  6.      Version:    Technology: Mac OS 9
  7.                  Release:    QuickTime 6.0.2
  8.  
  9.      Copyright:  (c) 1990-2001 by Apple Computer, Inc.  All rights reserved
  10.  
  11.      Bugs?:      For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __POWER__
  18. #define __POWER__
  19. #ifndef __MACTYPES__
  20. #include "MacTypes.h"
  21. #endif
  22. #ifndef __MIXEDMODE__
  23. #include "MixedMode.h"
  24. #endif
  25. #ifndef __MULTIPROCESSING__
  26. #include "Multiprocessing.h"
  27. #endif
  28. #ifndef __NAMEREGISTRY__
  29. #include "NameRegistry.h"
  30. #endif
  31. #ifndef __MACERRORS__
  32. #include "MacErrors.h"
  33. #endif
  34. #if PRAGMA_ONCE
  35. #pragma once
  36. #endif
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40. #if PRAGMA_IMPORT
  41. #pragma import on
  42. #endif
  43. #if PRAGMA_STRUCT_ALIGN
  44.     #pragma options align=mac68k
  45. #elif PRAGMA_STRUCT_PACKPUSH
  46.     #pragma pack(push, 2)
  47. #elif PRAGMA_STRUCT_PACK
  48.     #pragma pack(2)
  49. #endif
  50. enum {
  51.                                                                 /* Bit positions for ModemByte */
  52.     modemOnBit                  = 0,
  53.     ringWakeUpBit               = 2,
  54.     modemInstalledBit           = 3,
  55.     ringDetectBit               = 4,
  56.     modemOnHookBit              = 5
  57. };
  58. enum {
  59.                                                                 /* masks for ModemByte */
  60.     modemOnMask                 = 0x01,
  61.     ringWakeUpMask              = 0x04,
  62.     modemInstalledMask          = 0x08,
  63.     ringDetectMask              = 0x10,
  64.     modemOnHookMask             = 0x20
  65. };
  66. enum {
  67.                                                                 /* bit positions for BatteryByte */
  68.     chargerConnBit              = 0,
  69.     hiChargeBit                 = 1,
  70.     chargeOverFlowBit           = 2,
  71.     batteryDeadBit              = 3,
  72.     batteryLowBit               = 4,
  73.     connChangedBit              = 5
  74. };
  75. enum {
  76.                                                                 /* masks for BatteryByte */
  77.     chargerConnMask             = 0x01,
  78.     hiChargeMask                = 0x02,
  79.     chargeOverFlowMask          = 0x04,
  80.     batteryDeadMask             = 0x08,
  81.     batteryLowMask              = 0x10,
  82.     connChangedMask             = 0x20
  83. };
  84. enum {
  85.                                                                 /* bit positions for SoundMixerByte */
  86.     MediaBaySndEnBit            = 0,
  87.     PCISndEnBit                 = 1,
  88.     ZVSndEnBit                  = 2,
  89.     PCCardSndEnBit              = 3
  90. };
  91. enum {
  92.                                                                 /* masks for SoundMixerByte */
  93.     MediaBaySndEnMask           = 0x01,
  94.     PCISndEnMask                = 0x02,
  95.     ZVSndEnMask                 = 0x04,
  96.     PCCardSndEnMask             = 0x08
  97. };
  98. enum {
  99.                                                                 /* commands to SleepQRec sleepQProc */
  100.     kSleepRequest               = 1,
  101.     kSleepDemand                = 2,
  102.     kSleepWakeUp                = 3,
  103.     kSleepRevoke                = 4,
  104.     kSleepUnlock                = 4,
  105.     kSleepDeny                  = 5,
  106.     kSleepNow                   = 6,
  107.     kDozeDemand                 = 7,
  108.     kDozeWakeUp                 = 8,
  109.     kDozeRequest                = 9,                            /* additional messages for Power Mgr 2.0*/
  110.     kEnterStandby               = 10,
  111.     kEnterRun                   = 11,
  112.     kSuspendRequest             = 12,
  113.     kSuspendDemand              = 13,
  114.     kSuspendRevoke              = 14,
  115.     kSuspendWakeUp              = 15,
  116.     kGetPowerLevel              = 16,
  117.     kSetPowerLevel              = 17,
  118.     kDeviceInitiatedWake        = 18,
  119.     kWakeToDoze                 = 19,
  120.     kDozeToFullWakeUp           = 20,
  121.     kGetPowerInfo               = 21,
  122.     kGetWakeOnNetInfo           = 22
  123. };
  124. enum {
  125.                                                                 /* depreciated commands to SleepQRec sleepQProc */
  126.     sleepRequest                = kSleepRequest,
  127.     sleepDemand                 = kSleepDemand,
  128.     sleepWakeUp                 = kSleepWakeUp,
  129.     sleepRevoke                 = kSleepRevoke,
  130.     sleepUnlock                 = kSleepUnlock,
  131.     sleepDeny                   = kSleepDeny,
  132.     sleepNow                    = kSleepNow,
  133.     dozeDemand                  = kDozeDemand,
  134.     dozeWakeUp                  = kDozeWakeUp,
  135.     dozeRequest                 = kDozeRequest,
  136.     enterStandby                = kEnterStandby,
  137.     enterRun                    = kEnterRun,
  138.     suspendRequestMsg           = kSuspendRequest,
  139.     suspendDemandMsg            = kSuspendDemand,
  140.     suspendRevokeMsg            = kSuspendRevoke,
  141.     suspendWakeUpMsg            = kSuspendWakeUp,
  142.     getPowerLevel               = kGetPowerLevel,
  143.     setPowerLevel               = kSetPowerLevel
  144. };
  145. /* Power Handler func messages */
  146. typedef UInt32                          PowerLevel;
  147. /* Power levels corresponding to PCI Bus Power Management Interface Spec (PMIS) */
  148. enum {
  149.     kPMDevicePowerLevel_On      = 0,                            /* fully-powered 'On' state (D0 state)    */
  150.     kPMDevicePowerLevel_D1      = 1,                            /* not used by Apple system SW         */
  151.     kPMDevicePowerLevel_D2      = 2,                            /* not used by Apple system SW         */
  152.     kPMDevicePowerLevel_Off     = 3                             /* main PCI bus power 'Off', but PCI standby power available (D3cold state) */
  153. };
  154. /* PowerHandlerProc definition */
  155. typedef CALLBACK_API( OSStatus , PowerHandlerProcPtr )(UInt32 message, void *param, UInt32 refCon, RegEntryID *regEntryID);
  156. typedef STACK_UPP_TYPE(PowerHandlerProcPtr)                     PowerHandlerUPP;
  157. #if OPAQUE_UPP_TYPES
  158. #if CALL_NOT_IN_CARBON
  159.     EXTERN_API(PowerHandlerUPP)
  160.     NewPowerHandlerUPP             (PowerHandlerProcPtr     userRoutine);
  161.     EXTERN_API(void)
  162.     DisposePowerHandlerUPP         (PowerHandlerUPP         userUPP);
  163.     EXTERN_API(OSStatus)
  164.     InvokePowerHandlerUPP          (UInt32                  message,
  165.                                     void *                  param,
  166.                                     UInt32                  refCon,
  167.                                     RegEntryID *            regEntryID,
  168.                                     PowerHandlerUPP         userUPP);
  169. #endif  /* CALL_NOT_IN_CARBON */
  170. #else
  171.     enum { uppPowerHandlerProcInfo = 0x00003FF0 };                  /* pascal 4_bytes Func(4_bytes, 4_bytes, 4_bytes, 4_bytes) */
  172.     #define NewPowerHandlerUPP(userRoutine)                         (PowerHandlerUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppPowerHandlerProcInfo, GetCurrentArchitecture())
  173.     #define DisposePowerHandlerUPP(userUPP)                         DisposeRoutineDescriptor(userUPP)
  174.     #define InvokePowerHandlerUPP(message, param, refCon, regEntryID, userUPP)  (OSStatus)CALL_FOUR_PARAMETER_UPP((userUPP), uppPowerHandlerProcInfo, (message), (param), (refCon), (regEntryID))
  175. #endif
  176. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  177. #define NewPowerHandlerProc(userRoutine)                        NewPowerHandlerUPP(userRoutine)
  178. #define CallPowerHandlerProc(userRoutine, message, param, refCon, regEntryID) InvokePowerHandlerUPP(message, param, refCon, regEntryID, userRoutine)
  179. /* DriverPowerCapabilities struct */
  180. /*
  181.    The DriverPowerCapabilities structure is used only by PPC native drivers (ndrv).
  182.    A native driver will export this structure like it currently does now when
  183.    exporting a DriverDescription structure (e.g. TheDriverDescription).
  184.    The well-defined export that will be exported must be called: TheDriverPowerCapabilities
  185.    IMPORTANT NOTE:  ALL native drivers that match to their respective PCI
  186.                     slot devices MUST signify to the Power Manager that
  187.                     they can recover their device functionality after
  188.                     waking from Sleep with PCI bus power removed.
  189.                     If ANY PCI slot driver has not been updated and fails
  190.                     to indicate to the Power Manager that it can recover
  191.                     after PCI bus power is restored, then PCI bus power
  192.                     will NOT be removed during Sleep.  Without the ability
  193.                     to remove PCI bus power, the ability to switch the main
  194.                     power supply on some CPUs to a very-low power state
  195.                     will be unavailable to the System.
  196.    The PowerCapsFlags are used to determine:
  197.     - if a PCI slot device can recover from PCI power removal during Sleep.
  198.       Drivers should set the 'kDevicePowerCanBeRemovedForSleep' bit if true.
  199.         ***  ALL PCI slot device drivers must set this bit in order    ***
  200.         ***  that PCI bus power is allowed to be removed during Sleep. ***
  201.     - if the driver overrides the device's PCI Config space for determining
  202.       how much Standby (e.g. 3.3V Aux pin) power is used during Sleep.
  203.       Drivers should set the 'kDriverSpecifiesStandbyPower' bit only if the
  204.       device's PCI Config values are known to be corrupted or do not specify
  205.       the Standby power consumed during D3cold.
  206.         If 'kDriverSpecifiesStandbyPower' bit is set:
  207.           - the 'kDeviceCanGeneratePMEDuringSleep' bit should be set if
  208.             the PCI slot device is able to use standby (3.3V Aux) power
  209.             to assert the PME signal during Sleep..
  210.           - the 'powerCapsStandbyPowerMilliWatts' field is used to specify
  211.             how much Standby power is needed.  This value is only used
  212.             if both the 'kDriverSpecifiesStandbyPower' and
  213.             'kDeviceCanGeneratePMEDuringSleep' bits are set.
  214.     - the method of support chosen by the driver for implementing the Power
  215.       handler mechanism:
  216.         If 'kDriverPowerMgtAware' is set, then the driver supports the Power
  217.         Handler mechanism which exists in the new Power Manager (v2.0 and later).
  218.         If 'kDriverPowerMgtUnderExpertControl' is set, then the Power Manager
  219.         will assume that the driver's Expert/Manager will communicate with the
  220.         driver's Power handler and the 'kDriverHasPowerHandlerExport bit'
  221.         will be ignored.
  222.         If 'kDriverHasPowerHandlerExport' is set, then the driver must export
  223.         a well-defined Power handler entry point called:
  224.             DoDriverPowerManagement
  225.         If this bit is not set and the 'kDriverPowerMgtAware' is set, then the
  226.         device must support Power handling within its DoDriverIO entry point.
  227.         Drivers that implement a DoDriverIO entry point will receive
  228.         IO Control and Status selectors that are defined in Devices.h.
  229.         Drivers that elect to export a "DoDriverPowerManagement" entry point should
  230.         set up the entry point as follows:
  231.             OSStatus
  232.             DoDriverPowerManagement( UInt32             message,
  233.                                      PowerLevel             *powerLevel,
  234.                                      UInt32                 refCon,
  235.                                      RegEntryIDPtr      regEntryID);
  236.         "DoDriverPowerManagement" entry points have the same parameters and expected
  237.         behavior as a Power handler that has been explicitly registered via the
  238.         Driver Services API "AddDevicePowerHandler"; the difference is that,
  239.         during system startup, the Power Manager will automatically register the
  240.         "DoDriverPowerManagement" entry point found within each driver.
  241. */
  242. /* Used in DriverPowerCapabilities*/
  243. typedef UInt32                          PowerCapsVersion;
  244. enum {
  245.     kVersionOnePowerCapabilities = 1
  246. };
  247. typedef OptionBits                      PowerCapsFlags;
  248. enum {
  249.     kDevicePowerCanBeRemovedForSleep = 0x00000001,              /* only remove PCI power when every device has this bit set */
  250.     kDriverSpecifiesStandbyPower = 0x00000002,                  /* set when driver overrides PCI device Config values */
  251.     kDeviceCanGeneratePMEDuringSleep = 0x00000004,              /* 3.3V standby power can be used to assert the PME# */
  252.     kDriverPowerMgtAware        = 0x00000008,                   /* new Power handler mechanism is supported */
  253.     kDriverPowerMgtUnderExpertControl = 0x00000010,             /* Expert or Manager will call the driver's Power handler */
  254.     kDriverHasPowerHandlerExport = 0x00000020                   /* Type of Power handler entry point: only set this bit if the */
  255. };
  256. /*  driver exports a "DevicePowerManagement" entry point */
  257. /*
  258.    A device reliability issue arises when a device is subjected to shortened power
  259.    cycling intervals.  The new Power Manager allows a device to specify a minimum
  260.    value (in seconds) that a device must be powered on before being powered off.
  261.    The system has a default value of around 5 minutes (300 seconds).  If 5 minutes
  262.    is sufficient for a device, then use the following constant within DriverPowerCapabilities.
  263. */
  264. enum {
  265.     kUseDefaultWakeTime         = 0                             /* used when the system's default is sufficient */
  266. };
  267. /*
  268.    This structure describes a device's power capabilities as well as general Power Management support.
  269.     Note: powerCapsMinimumWakeTimeSeconds can be specified as kUseDefaultWakeTime
  270.     if the system's default time interval - 5 minutes - is sufficient.
  271. */
  272. struct DriverPowerCapabilities {
  273.     PowerCapsVersion                powerCapsVersion;           /* Version of this data structure */
  274.     PowerCapsFlags                  powerCapsFlags;             /* Power Management support characteristics */
  275.     UInt32                          powerCapsStandbyPowerMilliWatts; /* Power consumed during PCI bus sleep, 0 if none */
  276.     UInt32                          powerCapsMinimumWakeTimeSeconds; /* Safe time interval between removing and */
  277.                                                                 /*   restoring power to this device */
  278. };
  279. typedef struct DriverPowerCapabilities  DriverPowerCapabilities;
  280. typedef DriverPowerCapabilities *       DriverPowerCapabilitiesPtr;
  281. /* PCI power management support*/
  282. enum {
  283.     kUseDefaultMinimumWakeTime  = 0,                            /* Defaults to 5 minutes*/
  284.     kPowerSummaryVersion        = 1,                            /* Version of PowerSummary structure.*/
  285.     kDevicePowerInfoVersion     = 1                             /* Version of DevicePowerInfo structure.*/
  286. };
  287. enum {
  288.                                                                 /* PowerSummary flags*/
  289.     kPCIPowerOffAllowed         = (1L << 0)                     /* PCI power off is allowed.*/
  290. };
  291. enum {
  292.                                                                 /* DevicePowerInfo flags*/
  293.     kDevicePCIPowerOffAllowed   = (1L << 0),                    /* PCI power off is allowed for device.*/
  294.     kDeviceSupportsPMIS         = (1L << 1),                    /* Device supports Power Mgt Interface Spec.*/
  295.     kDeviceCanAssertPMEDuringSleep = (1L << 2),                 /* Device can assert PME# during sleep.*/
  296.     kDeviceUsesCommonLogicPower = (1L << 3),                    /* Device uses common-logic power*/
  297.     kDeviceDriverPresent        = (1L << 4),                    /* Driver present for device.*/
  298.     kDeviceDriverSupportsPowerMgt = (1L << 5)                   /* Driver installed a power handler.*/
  299. };
  300. struct DevicePowerInfo {
  301.     UInt32                          version;                    /* Version of this structure.*/
  302.     RegEntryID                      regID;                      /* RegEntryID for device.*/
  303.     OptionBits                      flags;                      /* Flags*/
  304.     UInt32                          minimumWakeTime;            /* Minimum seconds before sleeping again.*/
  305.     UInt32                          sleepPowerNeeded;           /* Milliwatts needed in the sleep state.*/
  306. };
  307. typedef struct DevicePowerInfo          DevicePowerInfo;
  308. struct PowerSummary {
  309.     UInt32                          version;                    /* Version of this structure.*/
  310.     OptionBits                      flags;                      /* Flags*/
  311.     UInt32                          sleepPowerAvailable;        /* Milliwatts available during sleep.*/
  312.     UInt32                          sleepPowerNeeded;           /* Milliwatts needed during sleep.*/
  313.     UInt32                          minimumWakeTime;            /* Minimum seconds before sleeping again.*/
  314.     ItemCount                       deviceCount;                /* Number of device power info records.*/
  315.     DevicePowerInfo                 devices[1];                 /* Array of device power info records.*/
  316. };
  317. typedef struct PowerSummary             PowerSummary;
  318. enum {
  319.                                                                 /* SleepQRec.sleepQFlags */
  320.     noCalls                     = 1,
  321.     noRequest                   = 2,
  322.     slpQType                    = 16,
  323.     sleepQType                  = 16
  324. };
  325. /* Power Mgt Apple Event types and errors */
  326. enum {
  327.                                                                 /* power mgt class*/
  328.     kAEMacPowerMgtEvt           = FOUR_CHAR_CODE('pmgt'),       /* event ids*/
  329.     kAEMacToWake                = FOUR_CHAR_CODE('wake'),
  330.     kAEMacLowPowerSaveData      = FOUR_CHAR_CODE('pmsd'),
  331.     kAEMacEmergencySleep        = FOUR_CHAR_CODE('emsl'),
  332.     kAEMacEmergencyShutdown     = FOUR_CHAR_CODE('emsd')
  333. };
  334. /*
  335.    These are result values returned by a Power Handler when queries
  336.    by the Power Mgr if the device which that Power Handler represents
  337.    woke the machine.
  338. */
  339. enum {
  340.     kDeviceDidNotWakeMachine    = 0,                            /* device did NOT wake machine*/
  341.     kDeviceRequestsFullWake     = 1,                            /* device did wake machine and requests full wakeup*/
  342.     kDeviceRequestsWakeToDoze   = 2                             /* device did wake machine and requests partial wakeup*/
  343. };
  344. /* bits in bitfield returned by PMFeatures */
  345. enum {
  346.     hasWakeupTimer              = 0,                            /* 1=wakeup timer is supported                    */
  347.     hasSharedModemPort          = 1,                            /* 1=modem port shared by SCC and internal modem       */
  348.     hasProcessorCycling         = 2,                            /* 1=processor cycling is supported                */
  349.     mustProcessorCycle          = 3,                            /* 1=processor cycling should not be turned off          */
  350.     hasReducedSpeed             = 4,                            /* 1=processor can be started up at reduced speed        */
  351.     dynamicSpeedChange          = 5,                            /* 1=processor speed can be switched dynamically       */
  352.     hasSCSIDiskMode             = 6,                            /* 1=SCSI Disk Mode is supported                 */
  353.     canGetBatteryTime           = 7,                            /* 1=battery time can be calculated                */
  354.     canWakeupOnRing             = 8,                            /* 1=can wakeup when the modem detects a ring          */
  355.     hasDimmingSupport           = 9,                            /* 1=has dimming support built in (DPMS standby by default)   */
  356.     hasStartupTimer             = 10,                           /* 1=startup timer is supported                    */
  357.     hasChargeNotification       = 11,                           /* 1=client can determine of charge connect status change notifications available */
  358.     hasDimSuspendSupport        = 12                            /* 1=supports dimming LCD and CRT to DPMS suspend state     */
  359. };
  360. /* more bits in bitfield returned by PMFeatures to be merged with above when time */
  361. enum {
  362.     hasWakeOnNetActivity        = 13,                           /* 1=hardware supports wake on network activity          */
  363.     hasWakeOnLid                = 14,                           /* 1=hardware can wake when opened                   */
  364.     canPowerOffPCIBus           = 15,                           /* 1=hardware can power off PCI bus during sleep if cards allow */
  365.     hasDeepSleep                = 16,                           /* 1=hardware supports deep sleep (hibernation) mode   */
  366.     hasSleep                    = 17                            /* 1=hardware supports normal (PowerBook-like) sleep   */
  367. };
  368. /* bits in bitfield returned by GetIntModemInfo and set by SetIntModemState */
  369. enum {
  370.     hasInternalModem            = 0,                            /* 1=internal modem installed               */
  371.     intModemRingDetect          = 1,                            /* 1=internal modem has detected a ring          */
  372.     intModemOffHook             = 2,                            /* 1=internal modem is off hook               */
  373.     intModemRingWakeEnb         = 3,                            /* 1=wakeup on ring is enabled                 */
  374.     extModemSelected            = 4,                            /* 1=external modem selected             */
  375.     modemSetBit                 = 15                            /* 1=set bit, 0=clear bit (SetIntModemState)   */
  376. };
  377. /* bits in BatteryInfo.flags                                    */
  378. /* ("chargerConnected" doesn't mean the charger is plugged in)  */
  379. enum {
  380.     batteryInstalled            = 7,                            /* 1=battery is currently connected             */
  381.     batteryCharging             = 6,                            /* 1=battery is being charged               */
  382.     chargerConnected            = 5                             /* 1=charger is connected to the PowerBook         */
  383. };
  384. enum {
  385.     HDPwrQType                  = 0x4844,                       /* 'HD' hard disk spindown queue element type     */
  386.     PMgrStateQType              = 0x504D                        /* 'PM' Power Manager state queue element type       */
  387. };
  388. /* client notification bits in PMgrQueueElement.pmNotifyBits */
  389. enum {
  390.     pmSleepTimeoutChanged       = 0,
  391.     pmSleepEnableChanged        = 1,
  392.     pmHardDiskTimeoutChanged    = 2,
  393.     pmHardDiskSpindownChanged   = 3,
  394.     pmDimmingTimeoutChanged     = 4,
  395.     pmDimmingEnableChanged      = 5,
  396.     pmDiskModeAddressChanged    = 6,
  397.     pmProcessorCyclingChanged   = 7,
  398.     pmProcessorSpeedChanged     = 8,
  399.     pmWakeupTimerChanged        = 9,
  400.     pmStartupTimerChanged       = 10,
  401.     pmHardDiskPowerRemovedbyUser = 11,
  402.     pmChargeStatusChanged       = 12,
  403.     pmPowerLevelChanged         = 13,
  404.     pmWakeOnNetActivityChanged  = 14
  405. };
  406. enum {
  407.     pmSleepTimeoutChangedMask   = (1 << pmSleepTimeoutChanged),
  408.     pmSleepEnableChangedMask    = (1 << pmSleepEnableChanged),
  409.     pmHardDiskTimeoutChangedMask = (1 << pmHardDiskTimeoutChanged),
  410.     pmHardDiskSpindownChangedMask = (1 << pmHardDiskSpindownChanged),
  411.     pmDimmingTimeoutChangedMask = (1 << pmDimmingTimeoutChanged),
  412.     pmDimmingEnableChangedMask  = (1 << pmDimmingEnableChanged),
  413.     pmDiskModeAddressChangedMask = (1 << pmDiskModeAddressChanged),
  414.     pmProcessorCyclingChangedMask = (1 << pmProcessorCyclingChanged),
  415.     pmProcessorSpeedChangedMask = (1 << pmProcessorSpeedChanged),
  416.     pmWakeupTimerChangedMask    = (1 << pmWakeupTimerChanged),
  417.     pmStartupTimerChangedMask   = (1 << pmStartupTimerChanged),
  418.     pmHardDiskPowerRemovedbyUserMask = (1 << pmHardDiskPowerRemovedbyUser),
  419.     pmChargeStatusChangedMask   = (1 << pmChargeStatusChanged),
  420.     pmPowerLevelChangedMask     = (1 << pmPowerLevelChanged),
  421.     pmWakeOnNetActivityChangedMask = (1 << pmWakeOnNetActivityChanged)
  422. };
  423. /* System Activity Selectors */
  424. enum {
  425.     OverallAct                  = 0,                            /* general type of activity                */
  426.     UsrActivity                 = 1,                            /* user specific type of activity           */
  427.     NetActivity                 = 2,                            /* network specific activity             */
  428.     HDActivity                  = 3                             /* Hard Drive activity                    */
  429. };
  430. /* Storage Media sleep mode defines */
  431. enum {
  432.     kMediaModeOn                = 0,                            /* Media active (Drive spinning and at full power)    */
  433.     kMediaModeStandBy           = 1,                            /* Media standby (not implemented)    */
  434.     kMediaModeSuspend           = 2,                            /* Media Idle (not implemented)   */
  435.     kMediaModeOff               = 3                             /* Media Sleep (Drive not spinning and at min power, max recovery time)   */
  436. };
  437. enum {
  438.     kMediaPowerCSCode           = 70
  439. };
  440. /* definitions for HDQueueElement.hdFlags   */
  441. enum {
  442.     kHDQueuePostBit             = 0,                            /* 1 = call this routine on the second pass     */
  443.     kHDQueuePostMask            = (1 << kHDQueuePostBit)
  444. };
  445. struct ActivityInfo {
  446.     short                           ActivityType;               /* Type of activity to be fetched.  Same as UpdateSystemActivity Selectors */
  447.     unsigned long                   ActivityTime;               /* Time of last activity (in ticks) of specified type. */
  448. };
  449. typedef struct ActivityInfo             ActivityInfo;
  450. /* information returned by GetScaledBatteryInfo */
  451. struct BatteryInfo {
  452.     UInt8                           flags;                      /* misc flags (see below)                  */
  453.     UInt8                           warningLevel;               /* scaled warning level (0-255)               */
  454.     UInt8                           reserved;                   /* reserved for internal use             */
  455.     UInt8                           batteryLevel;               /* scaled battery level (0-255)               */
  456. };
  457. typedef struct BatteryInfo              BatteryInfo;
  458. typedef SInt8                           ModemByte;
  459. typedef SInt8                           BatteryByte;
  460. typedef SInt8                           SoundMixerByte;
  461. typedef long                            PMResultCode;
  462. typedef struct SleepQRec                SleepQRec;
  463. typedef SleepQRec *                     SleepQRecPtr;
  464. typedef struct HDQueueElement           HDQueueElement;
  465. typedef struct PMgrQueueElement         PMgrQueueElement;
  466. typedef CALLBACK_API( long , SleepQProcPtr )(long message, SleepQRecPtr qRecPtr);
  467. /*
  468.     WARNING: SleepQProcPtr uses register based parameters under classic 68k
  469.              and cannot be written in a high-level language without 
  470.              the help of mixed mode or assembly glue.
  471. */
  472. typedef CALLBACK_API( void , HDSpindownProcPtr )(HDQueueElement *theElement);
  473. typedef CALLBACK_API( void , PMgrStateChangeProcPtr )(PMgrQueueElement *theElement, long stateBits);
  474. typedef REGISTER_UPP_TYPE(SleepQProcPtr)                        SleepQUPP;
  475. typedef STACK_UPP_TYPE(HDSpindownProcPtr)                       HDSpindownUPP;
  476. typedef STACK_UPP_TYPE(PMgrStateChangeProcPtr)                  PMgrStateChangeUPP;
  477. struct SleepQRec {
  478.     SleepQRecPtr                    sleepQLink;                 /* pointer to next queue element          */
  479.     short                           sleepQType;                 /* queue element type (must be SleepQType)       */
  480.     SleepQUPP                       sleepQProc;                 /* pointer to sleep universal proc ptr         */
  481.     short                           sleepQFlags;                /* flags                       */
  482. };
  483. struct HDQueueElement {
  484.     struct HDQueueElement *         hdQLink;                    /* pointer to next queue element          */
  485.     short                           hdQType;                    /* queue element type (must be HDPwrQType)       */
  486.     short                           hdFlags;                    /* miscellaneous flags                   */
  487.     HDSpindownUPP                   hdProc;                     /* pointer to routine to call           */
  488.     long                            hdUser;                     /* user-defined (variable storage, etc.)   */
  489. };
  490. struct PMgrQueueElement {
  491.     struct PMgrQueueElement *       pmQLink;                    /* pointer to next queue element          */
  492.     short                           pmQType;                    /* queue element type (must be PMgrStateQType)    */
  493.     short                           pmFlags;                    /* miscellaneous flags                   */
  494.     long                            pmNotifyBits;               /* bitmap of which changes to be notified for */
  495.     PMgrStateChangeUPP              pmProc;                     /* pointer to routine to call           */
  496.     long                            pmUser;                     /* user-defined (variable storage, etc.)   */
  497. };
  498. struct BatteryTimeRec {
  499.     unsigned long                   expectedBatteryTime;        /* estimated battery time remaining (seconds) */
  500.     unsigned long                   minimumBatteryTime;         /* minimum battery time remaining (seconds)     */
  501.     unsigned long                   maximumBatteryTime;         /* maximum battery time remaining (seconds)     */
  502.     unsigned long                   timeUntilCharged;           /* time until battery is fully charged (seconds)*/
  503. };
  504. typedef struct BatteryTimeRec           BatteryTimeRec;
  505. struct WakeupTime {
  506.     unsigned long                   wakeTime;                   /* wakeup time (same format as current time)   */
  507.     Boolean                         wakeEnabled;                /* 1=enable wakeup timer, 0=disable wakeup timer  */
  508.     SInt8                           filler;
  509. };
  510. typedef struct WakeupTime               WakeupTime;
  511. struct StartupTime {
  512.     unsigned long                   startTime;                  /* startup time (same format as current time)     */
  513.     Boolean                         startEnabled;               /* 1=enable startup timer, 0=disable startup timer    */
  514.     SInt8                           filler;
  515. };
  516. typedef struct StartupTime              StartupTime;
  517. /* PowerSource version*/
  518. enum {
  519.     kVersionOnePowerSource      = 1
  520. };
  521. /* PowerSourceAttrs bits*/
  522. enum {
  523.     bSourceIsBattery            = 0,                            /* power source is battery*/
  524.     bSourceIsAC                 = 1,                            /* power source is AC*/
  525.     bSourceCanBeCharged         = 2,                            /* power source can be charged*/
  526.     bSourceIsUPS                = 3,                            /* power source is UPS. NOTE: software should set bSourceIsBattery and bSourceIsAC also, as appropriate*/
  527.     kSourceIsBatteryMask        = (1 << bSourceIsBattery),
  528.     kSourceIsACMask             = (1 << bSourceIsAC),
  529.     kSourceCanBeChargedMask     = (1 << bSourceCanBeCharged),
  530.     kSourceIsUPSMask            = (1 << bSourceIsUPS)
  531. };
  532. /* PowerSourceFlags bits*/
  533. enum {
  534.     bSourceIsAvailable          = 0,                            /* power source is installed*/
  535.     bSourceIsCharging           = 1,                            /* power source being charged*/
  536.     bChargerIsAttached          = 2,                            /* a charger is connected*/
  537.     kSourceIsAvailableMask      = (1 << bSourceIsAvailable),
  538.     kSourceIsChargingMask       = (1 << bSourceIsCharging),
  539.     kChargerIsAttachedMask      = (1 << bChargerIsAttached)
  540. };
  541. /* Power Capacity Types*/
  542. enum {
  543.     kCapacityIsActual           = 0,                            /* current capacity is expessed as actual capacity in same units as max*/
  544.     kCapacityIsPercentOfMax     = 1                             /* current capacity is expressed as a percentage of maximumCapacity*/
  545. };
  546. /* Net Activity Wake Options*/
  547. enum {
  548.     kConfigSupportsWakeOnNetBit = 0,
  549.     kWakeOnNetAdminAccessesBit  = 1,
  550.     kWakeOnAllNetAccessesBit    = 2,
  551.     kUnmountServersBeforeSleepingBit = 3,
  552.     kConfigSupportsWakeOnNetMask = (1 << kConfigSupportsWakeOnNetBit),
  553.     kWakeOnNetAdminAccessesMask = (1 << kWakeOnNetAdminAccessesBit),
  554.     kWakeOnAllNetAccessesMask   = (1 << kWakeOnAllNetAccessesBit),
  555.     kUnmountServersBeforeSleepingMask = (1 << kUnmountServersBeforeSleepingBit)
  556. };
  557. /* Power Source capacity usage types*/
  558. enum {
  559.     kCurrentCapacityIsActualValue = 0,                          /* currentCapacity is a real value in same units as maxCapacity*/
  560.     kCurrentCapacityIsPercentOfMax = 1                          /* currentCapacity is expressed as a percentage of maxCapacity.*/
  561. };
  562. typedef SInt16                          PowerSourceID;
  563. struct PowerSourceParamBlock {
  564.     PowerSourceID                   sourceID;                   /* unique id assigned by Power Mgr*/
  565.     UInt16                          sourceCapacityUsage;        /* how currentCapacity is used*/
  566.     UInt32                          sourceVersion;              /* version of this record*/
  567.     OptionBits                      sourceAttr;                 /* attribute flags (see below)*/
  568.     OptionBits                      sourceState;                /* state flags (see below)*/
  569.     UInt32                          currentCapacity;            /* current capacity, in*/
  570.                                                                 /*   milliwatts*/
  571.     UInt32                          maxCapacity;                /* full capacity, in milliwatts*/
  572.     UInt32                          timeRemaining;              /* time left to deplete, */
  573.                                                                 /*   in milliwatt-hours*/
  574.     UInt32                          timeToFullCharge;           /* time to charge, */
  575.                                                                 /*   in milliwatt-hours*/
  576.     UInt32                          voltage;                    /* voltage in millivolts*/
  577.     SInt32                          current;                    /* current in milliamperes */
  578.                                                                 /*  (negative if consuming, */
  579.                                                                 /*   positive if charging)*/
  580. };
  581. typedef struct PowerSourceParamBlock    PowerSourceParamBlock;
  582. typedef PowerSourceParamBlock *         PowerSourceParamBlockPtr;
  583. EXTERN_API( OSErr )
  584. DisableWUTime                   (void);
  585. EXTERN_API( OSErr )
  586. SetWUTime                       (long                   wuTime);
  587. EXTERN_API( OSErr )
  588. GetWUTime                       (long *                 wuTime,
  589.                                  Byte *                 wuFlag);
  590. EXTERN_API( OSErr )
  591. BatteryStatus                   (Byte *                 status,
  592.                                  Byte *                 power);
  593. EXTERN_API( OSErr )
  594. ModemStatus                     (Byte *                 status);
  595.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  596.                                                                                             #pragma parameter __D0 IdleUpdate
  597.                                                                                             #endif
  598. EXTERN_API( long )
  599. IdleUpdate                      (void)                                                      ONEWORDINLINE(0xA285);
  600.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  601.                                                                                             #pragma parameter __D0 GetCPUSpeed
  602.                                                                                             #endif
  603. EXTERN_API( long )
  604. GetCPUSpeed                     (void)                                                      TWOWORDINLINE(0x70FF, 0xA485);
  605. EXTERN_API( void )
  606. EnableIdle                      (void)                                                      TWOWORDINLINE(0x7000, 0xA485);
  607. EXTERN_API( void )
  608. DisableIdle                     (void)                                                      TWOWORDINLINE(0x7001, 0xA485);
  609.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  610.                                                                                             #pragma parameter SleepQInstall(__A0)
  611.                                                                                             #endif
  612. EXTERN_API( void )
  613. SleepQInstall                   (SleepQRecPtr           qRecPtr)                            ONEWORDINLINE(0xA28A);
  614.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  615.                                                                                             #pragma parameter SleepQRemove(__A0)
  616.                                                                                             #endif
  617. EXTERN_API( void )
  618. SleepQRemove                    (SleepQRecPtr           qRecPtr)                            ONEWORDINLINE(0xA48A);
  619. EXTERN_API( void )
  620. AOn                             (void)                                                      TWOWORDINLINE(0x7004, 0xA685);
  621. EXTERN_API( void )
  622. AOnIgnoreModem                  (void)                                                      TWOWORDINLINE(0x7005, 0xA685);
  623. EXTERN_API( void )
  624. BOn                             (void)                                                      TWOWORDINLINE(0x7000, 0xA685);
  625. EXTERN_API( void )
  626. AOff                            (void)                                                      TWOWORDINLINE(0x7084, 0xA685);
  627. EXTERN_API( void )
  628. BOff                            (void)                                                      TWOWORDINLINE(0x7080, 0xA685);
  629. /* Public Power Management API  */
  630.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  631.                                                                                             #pragma parameter __D0 PMSelectorCount
  632.                                                                                             #endif
  633. EXTERN_API( short )
  634. PMSelectorCount                 (void)                                                      TWOWORDINLINE(0x7000, 0xA09E);
  635.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  636.                                                                                             #pragma parameter __D0 PMFeatures
  637.                                                                                             #endif
  638. EXTERN_API( UInt32 )
  639. PMFeatures                      (void)                                                      TWOWORDINLINE(0x7001, 0xA09E);
  640.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  641.                                                                                             #pragma parameter __D0 GetSleepTimeout
  642.                                                                                             #endif
  643. EXTERN_API( UInt8 )
  644. GetSleepTimeout                 (void)                                                      TWOWORDINLINE(0x7002, 0xA09E);
  645.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  646.                                                                                             #pragma parameter SetSleepTimeout(__D0)
  647.                                                                                             #endif
  648. EXTERN_API( void )
  649. SetSleepTimeout                 (UInt8                  timeout)                            FOURWORDINLINE(0x4840, 0x303C, 0x0003, 0xA09E);
  650.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  651.                                                                                             #pragma parameter __D0 GetHardDiskTimeout
  652.                                                                                             #endif
  653. EXTERN_API( UInt8 )
  654. GetHardDiskTimeout              (void)                                                      TWOWORDINLINE(0x7004, 0xA09E);
  655.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  656.                                                                                             #pragma parameter SetHardDiskTimeout(__D0)
  657.                                                                                             #endif
  658. EXTERN_API( void )
  659. SetHardDiskTimeout              (UInt8                  timeout)                            FOURWORDINLINE(0x4840, 0x303C, 0x0005, 0xA09E);
  660.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  661.                                                                                             #pragma parameter __D0 HardDiskPowered
  662.                                                                                             #endif
  663. EXTERN_API( Boolean )
  664. HardDiskPowered                 (void)                                                      TWOWORDINLINE(0x7006, 0xA09E);
  665.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  666.                                                                                             #pragma parameter SpinDownHardDisk
  667.                                                                                             #endif
  668. EXTERN_API( void )
  669. SpinDownHardDisk                (void)                                                      TWOWORDINLINE(0x7007, 0xA09E);
  670.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  671.                                                                                             #pragma parameter __D0 IsSpindownDisabled
  672.                                                                                             #endif
  673. EXTERN_API( Boolean )
  674. IsSpindownDisabled              (void)                                                      TWOWORDINLINE(0x7008, 0xA09E);
  675.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  676.                                                                                             #pragma parameter SetSpindownDisable(__D0)
  677.                                                                                             #endif
  678. EXTERN_API( void )
  679. SetSpindownDisable              (Boolean                setDisable)                         FOURWORDINLINE(0x4840, 0x303C, 0x0009, 0xA09E);
  680.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  681.                                                                                             #pragma parameter __D0 HardDiskQInstall(__A0)
  682.                                                                                             #endif
  683. EXTERN_API( OSErr )
  684. HardDiskQInstall                (HDQueueElement *       theElement)                         TWOWORDINLINE(0x700A, 0xA09E);
  685.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  686.                                                                                             #pragma parameter __D0 HardDiskQRemove(__A0)
  687.                                                                                             #endif
  688. EXTERN_API( OSErr )
  689. HardDiskQRemove                 (HDQueueElement *       theElement)                         TWOWORDINLINE(0x700B, 0xA09E);
  690.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  691.                                                                                             #pragma parameter GetScaledBatteryInfo(__D0, __A0)
  692.                                                                                             #endif
  693. EXTERN_API( void )
  694. GetScaledBatteryInfo            (short                  whichBattery,
  695.                                  BatteryInfo *          theInfo)                            FIVEWORDINLINE(0x4840, 0x303C, 0x000C, 0xA09E, 0x2080);
  696.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  697.                                                                                             #pragma parameter AutoSleepControl(__D0)
  698.                                                                                             #endif
  699. EXTERN_API( void )
  700. AutoSleepControl                (Boolean                enableSleep)                        FOURWORDINLINE(0x4840, 0x303C, 0x000D, 0xA09E);
  701.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  702.                                                                                             #pragma parameter __D0 GetIntModemInfo
  703.                                                                                             #endif
  704. EXTERN_API( UInt32 )
  705. GetIntModemInfo                 (void)                                                      TWOWORDINLINE(0x700E, 0xA09E);
  706.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  707.                                                                                             #pragma parameter SetIntModemState(__D0)
  708.                                                                                             #endif
  709. EXTERN_API( void )
  710. SetIntModemState                (short                  theState)                           FOURWORDINLINE(0x4840, 0x303C, 0x000F, 0xA09E);
  711.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  712.                                                                                             #pragma parameter __D0 MaximumProcessorSpeed
  713.                                                                                             #endif
  714. EXTERN_API( short )
  715. MaximumProcessorSpeed           (void)                                                      TWOWORDINLINE(0x7010, 0xA09E);
  716.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  717.                                                                                             #pragma parameter __D0 CurrentProcessorSpeed
  718.                                                                                             #endif
  719. EXTERN_API( short )
  720. CurrentProcessorSpeed           (void)                                                      TWOWORDINLINE(0x7011, 0xA09E);
  721.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  722.                                                                                             #pragma parameter __D0 FullProcessorSpeed
  723.                                                                                             #endif
  724. EXTERN_API( Boolean )
  725. FullProcessorSpeed              (void)                                                      TWOWORDINLINE(0x7012, 0xA09E);
  726.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  727.                                                                                             #pragma parameter __D0 SetProcessorSpeed(__D0)
  728.                                                                                             #endif
  729. EXTERN_API( Boolean )
  730. SetProcessorSpeed               (Boolean                fullSpeed)                          FOURWORDINLINE(0x4840, 0x303C, 0x0013, 0xA09E);
  731.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  732.                                                                                             #pragma parameter __D0 GetSCSIDiskModeAddress
  733.                                                                                             #endif
  734. EXTERN_API( short )
  735. GetSCSIDiskModeAddress          (void)                                                      TWOWORDINLINE(0x7014, 0xA09E);
  736.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  737.                                                                                             #pragma parameter SetSCSIDiskModeAddress(__D0)
  738.                                                                                             #endif
  739. EXTERN_API( void )
  740. SetSCSIDiskModeAddress          (short                  scsiAddress)                        FOURWORDINLINE(0x4840, 0x303C, 0x0015, 0xA09E);
  741.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  742.                                                                                             #pragma parameter GetWakeupTimer(__A0)
  743.                                                                                             #endif
  744. EXTERN_API( void )
  745. GetWakeupTimer                  (WakeupTime *           theTime)                            TWOWORDINLINE(0x7016, 0xA09E);
  746.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  747.                                                                                             #pragma parameter SetWakeupTimer(__A0)
  748.                                                                                             #endif
  749. EXTERN_API( void )
  750. SetWakeupTimer                  (WakeupTime *           theTime)                            TWOWORDINLINE(0x7017, 0xA09E);
  751.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  752.                                                                                             #pragma parameter __D0 IsProcessorCyclingEnabled
  753.                                                                                             #endif
  754. EXTERN_API( Boolean )
  755. IsProcessorCyclingEnabled       (void)                                                      TWOWORDINLINE(0x7018, 0xA09E);
  756.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  757.                                                                                             #pragma parameter EnableProcessorCycling(__D0)
  758.                                                                                             #endif
  759. EXTERN_API( void )
  760. EnableProcessorCycling          (Boolean                enable)                             FOURWORDINLINE(0x4840, 0x303C, 0x0019, 0xA09E);
  761.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  762.                                                                                             #pragma parameter __D0 BatteryCount
  763.                                                                                             #endif
  764. EXTERN_API( short )
  765. BatteryCount                    (void)                                                      TWOWORDINLINE(0x701A, 0xA09E);
  766.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  767.                                                                                             #pragma parameter __D0 GetBatteryVoltage(__D0)
  768.                                                                                             #endif
  769. EXTERN_API( Fixed )
  770. GetBatteryVoltage               (short                  whichBattery)                       FOURWORDINLINE(0x4840, 0x303C, 0x001B, 0xA09E);
  771.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  772.                                                                                             #pragma parameter GetBatteryTimes(__D0, __A0)
  773.                                                                                             #endif
  774. EXTERN_API( void )
  775. GetBatteryTimes                 (short                  whichBattery,
  776.                                  BatteryTimeRec *       theTimes)                           FOURWORDINLINE(0x4840, 0x303C, 0x001C, 0xA09E);
  777.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  778.                                                                                             #pragma parameter __D0 GetDimmingTimeout
  779.                                                                                             #endif
  780. EXTERN_API( UInt8 )
  781. GetDimmingTimeout               (void)                                                      TWOWORDINLINE(0x701D, 0xA09E);
  782.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  783.                                                                                             #pragma parameter SetDimmingTimeout(__D0)
  784.                                                                                             #endif
  785. EXTERN_API( void )
  786. SetDimmingTimeout               (UInt8                  timeout)                            FOURWORDINLINE(0x4840, 0x303C, 0x001E, 0xA09E);
  787.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  788.                                                                                             #pragma parameter DimmingControl(__D0)
  789.                                                                                             #endif
  790. EXTERN_API( void )
  791. DimmingControl                  (Boolean                enableSleep)                        FOURWORDINLINE(0x4840, 0x303C, 0x001F, 0xA09E);
  792.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  793.                                                                                             #pragma parameter __D0 IsDimmingControlDisabled
  794.                                                                                             #endif
  795. EXTERN_API( Boolean )
  796. IsDimmingControlDisabled        (void)                                                      TWOWORDINLINE(0x7020, 0xA09E);
  797.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  798.                                                                                             #pragma parameter __D0 IsAutoSlpControlDisabled
  799.                                                                                             #endif
  800. EXTERN_API( Boolean )
  801. IsAutoSlpControlDisabled        (void)                                                      TWOWORDINLINE(0x7021, 0xA09E);
  802.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  803.                                                                                             #pragma parameter __D0 PMgrStateQInstall(__A0)
  804.                                                                                             #endif
  805. EXTERN_API( OSErr )
  806. PMgrStateQInstall               (PMgrQueueElement *     theElement)                         TWOWORDINLINE(0x7022, 0xA09E);
  807.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  808.                                                                                             #pragma parameter __D0 PMgrStateQRemove(__A0)
  809.                                                                                             #endif
  810. EXTERN_API( OSErr )
  811. PMgrStateQRemove                (PMgrQueueElement *     theElement)                         TWOWORDINLINE(0x7023, 0xA09E);
  812.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  813.                                                                                             #pragma parameter __D0 UpdateSystemActivity(__D0)
  814.                                                                                             #endif
  815. EXTERN_API( OSErr )
  816. UpdateSystemActivity            (UInt8                  activity)                           FOURWORDINLINE(0x4840, 0x303C, 0x0024, 0xA09E);
  817.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  818.                                                                                             #pragma parameter __D0 DelaySystemIdle
  819.                                                                                             #endif
  820. EXTERN_API( OSErr )
  821. DelaySystemIdle                 (void)                                                      TWOWORDINLINE(0x7025, 0xA09E);
  822.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  823.                                                                                             #pragma parameter __D0 GetStartupTimer(__A0)
  824.                                                                                             #endif
  825. EXTERN_API( OSErr )
  826. GetStartupTimer                 (StartupTime *          theTime)                            TWOWORDINLINE(0x7026, 0xA09E);
  827.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  828.                                                                                             #pragma parameter __D0 SetStartupTimer(__A0)
  829.                                                                                             #endif
  830. EXTERN_API( OSErr )
  831. SetStartupTimer                 (StartupTime *          theTime)                            TWOWORDINLINE(0x7027, 0xA09E);
  832.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  833.                                                                                             #pragma parameter __D0 GetLastActivity(__A0)
  834.                                                                                             #endif
  835. EXTERN_API( OSErr )
  836. GetLastActivity                 (ActivityInfo *         theActivity)                        TWOWORDINLINE(0x7028, 0xA09E);
  837.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  838.                                                                                             #pragma parameter __D0 GetSoundMixerState(__A0)
  839.                                                                                             #endif
  840. EXTERN_API( OSErr )
  841. GetSoundMixerState              (SoundMixerByte *       theSoundMixerByte)                  TWOWORDINLINE(0x7029, 0xA09E);
  842.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  843.                                                                                             #pragma parameter __D0 SetSoundMixerState(__A0)
  844.                                                                                             #endif
  845. EXTERN_API( OSErr )
  846. SetSoundMixerState              (SoundMixerByte *       theSoundMixerByte)                  TWOWORDINLINE(0x702A, 0xA09E);
  847.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  848.                                                                                             #pragma parameter __D0 GetDimSuspendState
  849.                                                                                             #endif
  850. EXTERN_API( Boolean )
  851. GetDimSuspendState              (void)                                                      TWOWORDINLINE(0x702B, 0xA09E);
  852.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  853.                                                                                             #pragma parameter SetDimSuspendState(__D0)
  854.                                                                                             #endif
  855. EXTERN_API( void )
  856. SetDimSuspendState              (Boolean                dimSuspendState)                    FOURWORDINLINE(0x4840, 0x303C, 0x002C, 0xA09E);
  857. #if CALL_NOT_IN_CARBON
  858.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  859.                                                                                             #pragma parameter __D0 GetCoreProcessorTemperature(__A0)
  860.                                                                                             #endif
  861. EXTERN_API( SInt32 )
  862. GetCoreProcessorTemperature     (MPCpuID                inCpuID)                            TWOWORDINLINE(0x702D, 0xA09E);
  863.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  864.                                                                                             #pragma parameter __D0 GetWakeOnNetworkOptions
  865.                                                                                             #endif
  866. EXTERN_API( OptionBits )
  867. GetWakeOnNetworkOptions         (void)                                                      TWOWORDINLINE(0x702E, 0xA09E);
  868.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  869.                                                                                             #pragma parameter SetWakeOnNetworkOptions(__A0)
  870.                                                                                             #endif
  871. EXTERN_API( void )
  872. SetWakeOnNetworkOptions         (OptionBits             inOptions)                          TWOWORDINLINE(0x702F, 0xA09E);
  873.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  874.                                                                                             #pragma parameter __D0 AddPowerSource(__A0)
  875.                                                                                             #endif
  876. EXTERN_API( OSStatus )
  877. AddPowerSource                  (PowerSourceParamBlock * ioPowerSource)                     TWOWORDINLINE(0x7030, 0xA09E);
  878.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  879.                                                                                             #pragma parameter __D0 RemovePowerSource(__D0)
  880.                                                                                             #endif
  881. EXTERN_API( OSStatus )
  882. RemovePowerSource               (PowerSourceID          inSourceID)                         FOURWORDINLINE(0x4840, 0x303C, 0x0031, 0xA09E);
  883.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  884.                                                                                             #pragma parameter __D0 UpdatePowerSource(__A0)
  885.                                                                                             #endif
  886. EXTERN_API( OSStatus )
  887. UpdatePowerSource               (PowerSourceParamBlock * ioSource)                          TWOWORDINLINE(0x7032, 0xA09E);
  888. EXTERN_API( Boolean )
  889. IsServerModeEnabled             (void)                                                      TWOWORDINLINE(0x7033, 0xA09E);
  890. EXTERN_API( void )
  891. EnableServerMode                (Boolean                inEnable)                           FOURWORDINLINE(0x4840, 0x303C, 0x0034, 0xA09E);
  892. /* Power Handler Management */
  893. EXTERN_API_C( Boolean )
  894. IsPCIPowerOffDisabled           (void);
  895. EXTERN_API_C( void )
  896. EnablePCIPowerOff               (Boolean                inEnable);
  897. EXTERN_API_C( OSStatus )
  898. AddDevicePowerHandler           (RegEntryIDPtr          regEntryID,
  899.                                  PowerHandlerProcPtr    handler,
  900.                                  UInt32                 refCon,
  901.                                  char *                 deviceType);
  902. EXTERN_API_C( OSStatus )
  903. RemoveDevicePowerHandler        (RegEntryIDPtr          regEntryID);
  904. EXTERN_API_C( OSStatus )
  905. RemoveDevicePowerHandlerForProc (PowerHandlerProcPtr    proc);
  906. EXTERN_API_C( OSStatus )
  907. GetDevicePowerLevel             (RegEntryIDPtr          regEntryID,
  908.                                  PowerLevel *           devicePowerLevel);
  909. EXTERN_API_C( OSStatus )
  910. SetDevicePowerLevel             (RegEntryIDPtr          regEntryID,
  911.                                  PowerLevel             devicePowerLevel);
  912. #endif  /* CALL_NOT_IN_CARBON */
  913. #if OPAQUE_UPP_TYPES
  914.     EXTERN_API(SleepQUPP)
  915.     NewSleepQUPP                   (SleepQProcPtr           userRoutine);
  916.     EXTERN_API(HDSpindownUPP)
  917.     NewHDSpindownUPP               (HDSpindownProcPtr       userRoutine);
  918.     EXTERN_API(PMgrStateChangeUPP)
  919.     NewPMgrStateChangeUPP          (PMgrStateChangeProcPtr  userRoutine);
  920.     EXTERN_API(void)
  921.     DisposeSleepQUPP               (SleepQUPP               userUPP);
  922.     EXTERN_API(void)
  923.     DisposeHDSpindownUPP           (HDSpindownUPP           userUPP);
  924.     EXTERN_API(void)
  925.     DisposePMgrStateChangeUPP      (PMgrStateChangeUPP      userUPP);
  926.     EXTERN_API(long)
  927.     InvokeSleepQUPP                (long                    message,
  928.                                     SleepQRecPtr            qRecPtr,
  929.                                     SleepQUPP               userUPP);
  930.     EXTERN_API(void)
  931.     InvokeHDSpindownUPP            (HDQueueElement *        theElement,
  932.                                     HDSpindownUPP           userUPP);
  933.     EXTERN_API(void)
  934.     InvokePMgrStateChangeUPP       (PMgrQueueElement *      theElement,
  935.                                     long                    stateBits,
  936.                                     PMgrStateChangeUPP      userUPP);
  937. #else
  938.     enum { uppSleepQProcInfo = 0x00131832 };                        /* register 4_bytes:D0 Func(4_bytes:D0, 4_bytes:A0) */
  939.     enum { uppHDSpindownProcInfo = 0x000000C0 };                    /* pascal no_return_value Func(4_bytes) */
  940.     enum { uppPMgrStateChangeProcInfo = 0x000003C0 };               /* pascal no_return_value Func(4_bytes, 4_bytes) */
  941.     #define NewSleepQUPP(userRoutine)                               (SleepQUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSleepQProcInfo, GetCurrentArchitecture())
  942.     #define NewHDSpindownUPP(userRoutine)                           (HDSpindownUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppHDSpindownProcInfo, GetCurrentArchitecture())
  943.     #define NewPMgrStateChangeUPP(userRoutine)                      (PMgrStateChangeUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppPMgrStateChangeProcInfo, GetCurrentArchitecture())
  944.     #define DisposeSleepQUPP(userUPP)                               DisposeRoutineDescriptor(userUPP)
  945.     #define DisposeHDSpindownUPP(userUPP)                           DisposeRoutineDescriptor(userUPP)
  946.     #define DisposePMgrStateChangeUPP(userUPP)                      DisposeRoutineDescriptor(userUPP)
  947.     #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  948.     #pragma parameter __D0 InvokeSleepQUPP(__D0, __A0, __A1)
  949.     long InvokeSleepQUPP(long message, SleepQRecPtr qRecPtr, SleepQUPP userUPP) = 0x4E91;
  950.     #else
  951.         #define InvokeSleepQUPP(message, qRecPtr, userUPP)              (long)CALL_TWO_PARAMETER_UPP((userUPP), uppSleepQProcInfo, (message), (qRecPtr))
  952.     #endif
  953.     #define InvokeHDSpindownUPP(theElement, userUPP)                CALL_ONE_PARAMETER_UPP((userUPP), uppHDSpindownProcInfo, (theElement))
  954.     #define InvokePMgrStateChangeUPP(theElement, stateBits, userUPP)  CALL_TWO_PARAMETER_UPP((userUPP), uppPMgrStateChangeProcInfo, (theElement), (stateBits))
  955. #endif
  956. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  957. #define NewSleepQProc(userRoutine)                              NewSleepQUPP(userRoutine)
  958. #define NewHDSpindownProc(userRoutine)                          NewHDSpindownUPP(userRoutine)
  959. #define NewPMgrStateChangeProc(userRoutine)                     NewPMgrStateChangeUPP(userRoutine)
  960. #define CallSleepQProc(userRoutine, message, qRecPtr)           InvokeSleepQUPP(message, qRecPtr, userRoutine)
  961. #define CallHDSpindownProc(userRoutine, theElement)             InvokeHDSpindownUPP(theElement, userRoutine)
  962. #define CallPMgrStateChangeProc(userRoutine, theElement, stateBits) InvokePMgrStateChangeUPP(theElement, stateBits, userRoutine)
  963. #if PRAGMA_STRUCT_ALIGN
  964.     #pragma options align=reset
  965. #elif PRAGMA_STRUCT_PACKPUSH
  966.     #pragma pack(pop)
  967. #elif PRAGMA_STRUCT_PACK
  968.     #pragma pack()
  969. #endif
  970. #ifdef PRAGMA_IMPORT_OFF
  971. #pragma import off
  972. #elif PRAGMA_IMPORT
  973. #pragma import reset
  974. #endif
  975. #ifdef __cplusplus
  976. }
  977. #endif
  978. #endif /* __POWER__ */