sys7.1-doc-wip/Internal/Asm/PowerPrivEqu.a
2019-07-27 22:37:48 +08:00

1063 lines
58 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

;
; File: PowerPrivEqu.a
;
; Contains: Equates used by the Power Manager
;
; Written by: Helder J. Ramalho
;
; Copyright: © 1990-1994 by Apple Computer, Inc. All rights reserved.
;
; This file is used in these builds: ROM
;
; Change History (most recent first):
;
; <SM8> 1/14/94 ged Added ModemSndReq/State bits to the PmgrFlags3 field for modem
; sound support.
; <SM7> 12/13/93 PN Roll in KAOs and Horror changes to support Malcom and AJ
; machines
; <SM6> 9/2/93 SKH Completely replace the old SuperMario PowerPrivEqu.a with one
; which has the many horror changes.
;
; <H57> 6/2/93 SWC Added a modem type vector to the modem primitive table.
; <H56> 05-31-93 jmp Added yet-another-field to the PmgrRec called “fadeVars” -- it
; will be used to fade screens (usually CRT) during dimming.
; <H55> 5/31/93 RLE change set/getmachineid to set/getmachineattr (this way PG&E
; won't need to be updated for each and every new machine)
; <H54> 5/28/93 SWC Moved the absolute battery level selector from the private
; dispatch to the public one. Removed the PowerMgrDispatch record
; so additions won't force major rebuilds. All that information
; can now be found in PowerMgrDispatchEqu.a.
; <H53> 5/27/93 RLE add PrimChargerAttr field to PrimInfoTble
; <H52> 05-19-93 jmp Added a warning about the use of the PmgrFlags1 field and the
; PmgrExtVidOn bit as it relates to the original DeclROMs of the
; Duo/MiniDocks.
; <H51> 5/17/93 RLE move ignoreClamshell variable to PmgrFlags3
; <H50> 5/4/93 SWC Moved all PowerMgrDispatch stuff to PowerMgrDispatchEqu.a. Added
; a primitive routine to dynamically set full/reduced CPU speed.
; Added space to the globals to hold copies of the TimeDBRA
; constants for full and reduced speed modes.
; <H49> 4/23/93 SWC Made some additions to sync up with the gibbly.
; <H48> 4/21/93 SWC Added a selector to _PowerDispatch to return a bitmap of private
; Power Manager features so software like the PowerBook control
; panel can get this without having to be rev'd for each CPU.
; Added the definition of bits returned by the public modem info
; selector. Added a bit to disable hard disk spindown.
; <H47> 4/19/93 SWC Added some more feature bits and selectors to _PowerMgrDispatch.
; <H46> 4/16/93 SWC Added a new field to the HDQueueElement record so a user will
; have some place to stash their variables.
; <H45> 4/15/93 SWC Added variables, etc., to support the public Power Manager
; dispatch trap.
; <H44> 4/14/93 RLE add commands to set and get cutoff voltage
; <H43> 4/8/93 RLE add charger control to power1 commands
; <H42> 3/24/93 RLE add power manager commands SetMachineID and GetMachineID
; <H41> 8/18/92 djw Define 2 new PmgrFlag2 bits
; <H40> 7/13/92 ag Added constants to the info tables for delay time before shorted
; battery dialog and delta battery warn level if external monitor
; is being used. Added two new fields in the globals to handle
; shorted battery delay software.
; <H39> 7/13/92 HJR Changed polarity of PmgrExtVidOn.
; <H38> 7/11/92 ag Changed SecondaryInitDisp to PMgrHookDisp. The selector is now a
; general purpose selector with data passed in the upper word of
; d0. Defined "scsidiskmodeon" bit.
; <H37> 7/11/92 HJR Change the name of WakeScrnPtr to ScreenRedrawPtr.
; <H36> 7/10/92 ag Adding table definition for modem primitives table.
; <H35> 7/9/92 ag Adding vector location in PmgrPrimInfoRec for modem primitives
; subtable.
; <H34> 7/7/92 ag Adding vector location for softshutdown routine.
; <H33> 6/24/92 SWC Changed the clamshellShutdown bit to ignoreClamshell since
; it turned out that there were lots of problems associated with
; trying to shutdown (gracefully) when the clamshell was closed.
; The default state of the bit will now put the system to sleep as
; before, and if the bit is turned on, we'll ignore the clamshell
; switch.
; <H32> 6/18/92 SWC Added a vector for the PMgrOp exceptions, and a flag to let us
; know that we're going to sleep because of a low power condition.
; <H31> 6/10/92 HJR Added saveGDflags to PmgrRec.
; <H30> 6/2/92 djw Add PmgrFlags1 bit PmgrAvoidUsrMsg to disable user warning
; messages
; <H29> 6/1/92 HJR Added NoVidSTRPtr, NoChrgrSTRPtr, UNmQEntry to PmgrRec. Added
; PmgrExtVidOn, PmgrExtVidAlrt to PmgrFlags field names.
; <H28> 5/19/92 HJR Added new selector to PowerDispatchRec, DimScreen. Change
; HdSpinDown to RunIdleRoutines. Added PmgrDimReq and
; PmgrDimState to PmgrFlags1.
; <H27> 5/15/92 SWC Added BatteryVBLPtr and SoundVBLPtr to PmgrPrimitives.
; <SM4> 09-03-92 jmp Added some equates from Horror that I needed.
; <SM3> 6/4/92 KW Rolled in more Horror changes.
; <H26> 5/12/92 ag Added Dart SPI bit in PMGRFlags1
; <H25> 5/12/92 ag Adding "Secondary Init" selector to powerdispatch selectors.
; <H24> 5/8/92 HJR Added WakeScrnPtr to PmgrPrimitives.
; <H23> 5/7/92 SWC Added PowerDispatch selector and primitive table vector for
; returning scaled battery, warning levels (for Battery DA).
; <H22> 5/7/92 ag Added new flags to globals (we ran out again).
; <SM2> 5/17/92 kc Roll in Horror Changes. Comments follow:
; <H21> 4/21/92 SWC Added new power control/status commands.
; <H20> 3/16/92 SWC Added CPUSpeed20MHz cuz it looks like we might need it.
; <H19> 3/11/92 SWC Renamed JAWSPwrCycREG to PowerCycleReg since there's more than
; one way to do power cycling. Added a VBL task record for
; monitoring the clamshell switch. Added an entry in the
; primitives table to return the address of the power cycle
; register so we won't need a chain of TestFor's in InitPmgrVars.
; <H18> 3/9/92 SWC Added SetModemInts ($71) and ReadModemInts ($79) commands.
; <H17> 2/27/92 SWC Moved the clamshell flag from bit 3 to 5 since bits 3-4 have
; been used in the past (these are now documented as well).
; <H16> 2/21/92 HJR Added power cycling routines in the PmgrPrimsRec, added Pmgr
; wake level in PrimsInfoRec, changed PmgrRec by adding
; SleepSaveFlag and SleepSaveCrsr while removing
; NoVidRamSleepSave, set the default PwrCycProgMax to $c0 to
; prevent the watch cursor from coming up in finder.
; <H15> 2/17/92 SWC Changed pmFree2 to dockFlags so we can keep track of related
; docking attributes.
; <H14> 2/10/92 SWC Added SCSI Disk Mode internal HD to PmgrOtherFlags. Added
; BasePRAMDisp to PowerDispRec.
; <H13> 2/7/92 SWC Added default low power and dead battery warning levels to the
; primitive info table so we can initialize them if necessary.
; <H12> 2/7/92 SWC Added more bits to PmgrStatusFlags/SleepFlags. Added definition
; of EconoBit so it's in one place. Added a GetLevel entry to the
; primitives table since it looks like we'll have more than one
; way to characterize the current battery level.
; <H11> 2/5/92 SWC Added new battery commands to the list. Removed <H8> since
; there's actually a command to directly return the low warning
; and cutoff battery levels.
; <H10> 2/4/92 SWC Added sleep and wakeup table entries to the primitives record.
; <H9> 2/3/92 HJR Added PRAMbase and VPmgrPrimitives to PmgrGlobals. Added Power
; Manager Primitives table to support new structure.
; <H8> 1/30/92 SWC Added low and dead battery bytes to the PRAM record since
; there's currently no place these go for PMGR-based PRAM models
; (TIM didn't have to worry because they used a RTC for real PRAM
; and the PMGR for those 2 bytes).
; <H7> 1/27/92 SWC Added two new commands to read the clamshell switch and the
; connector bar sense on DBLite.
; <H6> 12/3/91 SWC Added CPUSpeed33MHz in case we ever get a fast DB-Lite going.
; <H5> 8/15/91 SWC Rolled out the SetOneSecInt command ($70) from <T3>, since we're
; not going to selectively enable and disable its interrupt
; sources.
; <H4> 8/14/91 SWC Added vectors for the PMgr send and receive count tables so we
; can make changes/additions more easily.
; <H3> 8/14/91 SWC Added oneSecIntFlag to the list of interrput sources for the
; PMgr interrupt (command $78).
; <H2> 8/5/91 SWC Added NoVRAMVidRam to PMgrGlobals as an alternate place to save
; state when VRAM is not kept powered across sleep.
; ———————————————————————————————————————————————————————————————————————————————————————
; Pre-HORROR ROM comments begin here.
; ———————————————————————————————————————————————————————————————————————————————————————
; <16> 7/11/91 HJR Added MdmSndVect to PMgrGlobals.
; <15> 7/11/91 HJR Added SleepHook and WakeUpHook to PMgrGlobals.
; <14> 7/8/91 HJR Added CPUSpeedDisp to PowerDispRec.
; <13> 6/25/91 HJR Changed PwrCycProgMaxDef to $600 approximately 13 seconds.
; <12> 6/25/91 ag added hysteresis low power value to power manager globals.
; <11> 6/24/91 ag fix some commenting.
; <10> 6/24/91 HJR Added Autoslpdisable, a counting semaphore, to PmgrRec.
; <9> 6/24/91 HJR Changed sleepq and pmCommand to records. Added PwrCycProg and
; PwrCycRestore to PmgrRec.
; <8> 6/24/91 djw Add new PmgrFlags for hard drive, low power dialog disable, and
; bad battery detected condition.
; <7> 6/12/91 ag added network warning override bit in PmgrFlags.
; <6> 6/11/91 HJR Added PwrCycProgGrow and PwrCycProgMax in order to parameterize
; the progressive power cycling scheme.
; <5> 6/9/91 HJR Added IdleDelay to the PowerDispRec. Added PwrCycDelay to the
; PMgrRec and added some default equates for Power Cycling.
; <4> 6/5/91 djw Add hard drive delay fields to fix 40mb Conner's drive problem
; <3> 5/31/91 djw Add new power mgr command equate for DB-Lite to set 1 sec
; interrupt
; <2> 5/23/91 HJR Clean up header.
; <1> 5/23/91 HJR first checked in
;
IF &TYPE('__PowerPrivEqu__') = 'UNDEFINED' THEN
__PowerPrivEqu__ SET 1
;—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
;
; Power Dispatch Record
;
; Equates for the list of routines that can be called from the [private] _PowerDispatch trap.
;
;—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
PowerDispRec RECORD 0,Increment ; Record for the Power Dispatch Trap
PmgrTrapDisp DS.B 1 ; Selector #0
IdleUpdateDisp DS.B 1 ; Selector #1
IdleDelayDisp DS.B 1 ; Selector #2
IdleMindDisp DS.B 1 ; Selector #3
IdleReadDisp DS.B 1 ; Selector #4
IdleEnableDisp DS.B 1 ; Selector #5
IdleDisableDisp DS.B 1 ; Selector #6
CPUSpeedDisp DS.B 1 ; Selector #7
BasePRAMDisp DS.B 1 ; Selector #8
ScaledBattDisp DS.B 1 ; Selector #9
PMgrHookDisp DS.B 1 ; Selector #10
DimScreen DS.B 1 ; Selector #11
FactoryDisp DS.B 1 ; Selector #12
PrivFeatureDisp DS.B 1 ; Selector #13
GetCCRecordDisp DS.B 1 ; Selector #14 <K21>
GetBtnValDisp DS.B 1 ; Selector #15 <K22>
SetHDStateDisp DS.B 1 ; Selector #16
ENDR
;—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
;
; IdleUpdate Type
;
; Enumeration of the different types of activity.
;
;—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
OverallAct EQU 0 ; general type of activity
UsrActivity EQU 1 ; user specific type of activity
NetActivity EQU 2 ; network specific activity
HDActivity EQU 3 ; Hard Drive activity
MACRO
_IdleUpdateDispatch
MOVE.L #(OverallAct<<16)|\
(PowerDispRec.IdleUpdateDisp),D0
_PowerDispatch
ENDM
MACRO
_UsrIdleUpdate
MOVE.L #(UsrActivity<<16)|\
(PowerDispRec.IdleUpdateDisp),D0
_PowerDispatch
ENDM
MACRO
_NetIdleUpdate
MOVE.L #(NetActivity<<16)|\
(PowerDispRec.IdleUpdateDisp),D0
_PowerDispatch
ENDM
MACRO
_HDIdleUpdate
MOVE.L #(HDActivity<<16)|\
(PowerDispRec.IdleUpdateDisp),D0
_PowerDispatch
ENDM
;—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
;
; PMgrHookDisp Record
;
; Equates for the list of routines that can be called from the PMgrHookDisp trap.
;
;—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
PMgrHookDispRec RECORD 0,Increment ; Record for the PMgrHookDisp Trap
PSecondaryInit DS.B 1 ; Selector #0
PScsiDiskMode DS.B 1 ; Selector #1
PExternalVidOn DS.B 1 ; Selector #2
PModemType DS.B 1 ; Selector #3
ENDR
;—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
;
; GetBtnValsDisp Record
;
; Equates for the list of routines that can be called from the GetBtnValsDisp trap.
;
;—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
GetBrightnessButtonSelector EQU 0 ; BrightnessSelector
GetContrassButtonSelector EQU 1 ; Contrass Selector
MACRO
_GetBrightnessButton
MOVE.L #(GetBrightnessButtonSelector<<16)|\
(PowerDispRec.GetBtnValDisp),D0
_PowerDispatch
ENDM
MACRO
_GetContrassButton
MOVE.L #(GetContrassButtonSelector<<16)|\
(PowerDispRec.GetBtnValDisp),D0
_PowerDispatch
ENDM
;—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
;
; SetHDStateDisp Record
;
; Equates for the list of routines that can be called from the SetHDStateDisp trap.
;
;—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
SpinDownHDSelector EQU 0 ; Spin down hard drive selector
SpinUpHDSelector EQU 1 ; Spin up the hard drive selector
MACRO
_SpinDownHardDrive
MOVE.L #(SpinDownHDSelector<<16)|\
(PowerDispRec.SetHDStateDisp),D0
_PowerDispatch
ENDM
MACRO
_SpinUPHardDrive
MOVE.L #(SpinUpHDSelector<<16)|\
(PowerDispRec.SetHDStateDisp),D0
_PowerDispatch
ENDM
;—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
;
; Modem Type
;
; Enumeration of the different types of internal modems available.
;
;—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
ModemTypeUnk EQU -1 ; modem installed but type unknown
ModemTypeNone EQU 0 ; no modem installed
ModemTypeSerial EQU 1 ; original serial modem
ModemTypeDUO EQU 2 ; rockwell data pump modem (RC144DPL)
ModemTypeDUOPlus EQU 3 ; rockwell data pump modem (RC144DPL) + 6805 controller
ModemTypeHardRock EQU 4 ; BlackBird Modem
;••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
;—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
;
; Power Manager Primitive Table
;
; Records to describe the structure of Power Manager Primitives.
;
;—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
PmgrPrimitivesRec RECORD {PmgrRoutineTbl},Increment ; Record for Power Manager Primitives table
PmgrPrimsFlags DS.L 1 ; miscellaneous flags
PmgrPrimsCount DS.L 1 ; Size of primitives record
PmgrRoutineTbl DS.L 1 ; offset to table of basic power manager routines
PrimInfoTblPtr DS.L 1 ; offset to table of primitives
IdleMindTblPtr DS.L 1 ; offset to table IdleMind of routines
SleepTblPtr DS.L 1 ; offset to table of routines to be run when going to sleep
WakeTblPtr DS.L 1 ; offset to table of routines to be run when waking up
PMgrOpExcepTbl DS.L 1 ; offset to table of exceptions for PMgrOp
ModemTblPtr DS.L 1 ; offset to table of routines to handle the internal modem
PwrDispatchTbl DS.L 1 ; offset to table of dispatch vectors
PmgrHookTbl DS.L 1 ; offset to table of Hook vectors
PmgrCommTblPtr DS.L 1 ; offset to table of comms power vectors
PMgrOpTblPtr DS.L 1 ; offset to table of PmgrOp Routines
BklightTblPtr DS.L 1 ; offset to table of backlight information
ENDR
PmgrRoutineRec RECORD {PowerCycPtr},Increment ; Record for PMgr Routines
PgmrRoutineFlags DS.L 1 ; miscellaneous flags
PmgrRoutineCount DS.L 1 ; Size of primitives record
PowerCycPtr DS.L 1 ; offset to routine for powering down cpu
PowerCycResPtr DS.L 1 ; offset to routine for powering up cpu
BatteryVBLPtr DS.L 1 ; offset to VBL task to check the battery level
GetLevelPtr DS.L 1 ; offset to routine to determine current battery level
ScaledBattPtr DS.L 1 ; offset to routine to return scaled battery,warning levels
EnvIntPtr DS.L 1 ; offset to routine to handle environment interrupts
CPUSpeedPtr DS.L 1 ; offset to machine specific cpu speed routine
SoundVBLPtr DS.L 1 ; offset to VBL task to check for sound usage
ScreenRedrawPtr DS.L 1 ; offset to routine which refreshes the screen after wake
AbsoluteBattPtr DS.L 1 ; offset to routine to return absolute battery voltage
BatteryTimePtr DS.L 1 ; offset to routine to return info about battery times <H54>
SpeedChangePtr DS.L 1 ; offset to routine to set full/reduced processor speed
ENDR
PrimInfoTbleRec RECORD {PrimPRAMBase},Increment ; Machine specific info
PrimInfoFlags DS.L 1 ; miscellaneous flags
PrimInfoCount DS.L 1 ; size of primitives record
PrimPRAMBase DS.B 1 ; Base address of PRAM
PrimDefHyst DS.B 1 ; default hysteresis
PrimLowWarn DS.B 1 ; default low power warning level
PrimCutOff DS.B 1 ; default dead battery warning level
PrimWakeLvl DS.B 1 ; default pmgr wake battery level
PrimBatWarnCt DS.B 1 ; Number-1 of shorted bat int's before displaying dialog
PrimExtVidCor DS.B 1 ; External video correction to low power warning (10's mvolt)
PrimChargerAttr DS.B 1 ; bitmap of charger features <15>
PowerCycRegAddr DS.L 1 ; address of power cycling register
PrimPubFeatures DS.L 1 ; bitmap of public Power Manager features
PrimPrivFeatures DS.L 1 ; bitmap of private Power Manager features
PrimBatteryCount DS.W 1 ; number of batteries supported <H54>
PrimPMgrCommType DS.B 1 ; 0=parallel interface, 2=serial interface
PrimInfoPad1 DS.B 1 ;•padding, for now
PrimExtChrgTime DS.L 1 ; minutes to extend bulk charge time of the battery
PrimCycRegValue DS.B 1 ; value for power cycling register to cycle power <K14>
PrimSlpRegValue DS.B 1 ; value for sleep register to set machine to sleep <K14>
PrimInfoPad2 DS.B 1 ;•padding, for now
PrimInfoPad3 DS.B 1 ;•padding, for now
ENDR
SleepTableRec RECORD {SleepTableStart},INCREMENT ; record for list of routines called before sleeping
SleepTableFlags DS.L 1 ; miscellaneous flags
SleepTableCount DS.L 1 ; size of primitives record
SleepTableStart DS.L 0 ; offset to first sleep routine
ENDR
WakeTableRec RECORD {WakeTableStart},INCREMENT ; record for list of routines called before waking
WakeTableFlags DS.L 1 ; miscellaneous flags
WakeTableCount DS.L 1 ; size of primitives record
WakeTableStart DS.L 0 ; offset to first wake routine
ENDR
IdleMindTblRec RECORD {CountDownTimer},Increment ; Record for the IdleMind call
IdleMindFlags DS.L 1 ; miscellaneous flags
IdleMindCount DS.L 1 ; size of primitives record
CountDownTimer DS.L 1 ; offset to routine for checking countdown condition
RunIdleRoutines DS.L 1 ; offset to routine for checking hard drive spindown
SleepTimeOut DS.L 1 ; offset to routine for checking sleep timeout
CheckIdle DS.L 1 ; offset to routine for checking idle
CalcProgPwrCyc DS.L 1 ; offset to routine for calculating progressive value
CyclePower DS.L 1 ; offset to routine for power cycling
ENDR
PMgrOpTblRec RECORD {PMgrOpTrapPtr},Increment ; Record for the PmgrOp Trap
PMgrOpTblFlags DS.L 1 ; miscellaneous flags
PMgrOpTblCount DS.L 1 ; size of primitive record
PMgrOpTrapPtr DS.L 1 ; offset to Pmgr Trap $A085
IdleUpdatePtr DS.L 1 ; offset to Pmgr Trap $A285
IdleStatePtr DS.L 1 ; offset to Pmgr Trap $A485
SerialPowerPtr DS.L 1 ; offset to Pmgr Trap $A685
ENDR
PwrDispatchRec RECORD {PmgrTrapPtr},Increment ; Record for the PowerDispatch Trap
PwrDispFlags DS.L 1 ; miscellaneous flags
PwrDispCount DS.L 1 ; size of primitive record
PmgrTrapPtr DS.L 1 ; offset to PmgrTrap
IdleUpdatePtr DS.L 1 ; offset to IdleUpdate
IdleDelayPtr DS.L 1 ; offset to IdleDelay
IdleMindPtr DS.L 1 ; offset to IdleMind
IdleReadPtr DS.L 1 ; offset to IdleRead
IdleEnablePtr DS.L 1 ; offset to IdleEnable
IdleDisablePtr DS.L 1 ; offset to IdleDisable
CPUSpeedPtr DS.L 1 ; offset to CPUSpeed
BasePRAMPtr DS.L 1 ; offset to BasePRAM
ScaledBatteryPtr DS.L 1 ; offset to ScaledBattery
PowerMgrHookPtr DS.L 1 ; offset to PowerMgrHook
PDimScreensPtr DS.L 1 ; offset to PDimScreens
FactoryDispPtr DS.L 1 ; offset to FactoryDispatch
AbsoluteBatteryPtr DS.L 1 ; offset to AbsoluteBattery
PrivateFeaturesPtr DS.L 1 ; offset to PrivateFeatures
ENDR
PMgrHookRec RECORD {SecondaryInitPtr},Increment ; Record for the PmgrHook Dispatch
PMgrHookFlags DS.L 1 ; miscellaneous flags
PmgrHookCount DS.L 1 ; size of primitive record
SecondaryInitPtr DS.L 1 ; offset to Selector #0 routine
ScsiDiskModePtr DS.L 1 ; offset to Selector #1 routine
ExternaVideoOnPtr DS.L 1 ; offset to Selector #2 routine
ModemTypePtr DS.L 1 ; offset to Selector #3 routine
ENDR
ModemTblRec RECORD {PowerOnModem},Increment ; Record for the modem call
ModemPrimsFlags DS.L 1 ; miscellaneous flags
ModemPrimsCount DS.L 1 ; Size of primitives record
PowerOnModem DS.L 1 ; offset to routine to powerup modem hardware
PowerOffModem DS.L 1 ; offset to routine to powerdown modem hardware
GetModemType DS.L 1 ; offset to routine to return the modem type (if any) <H57>
ENDR
CommsPwrTblRec RECORD {PowerOnB},Increment ; Record for the comms power call <K8>
CommsPwrFlags DS.L 1 ; miscellaneous flags
CommsPwrCount DS.L 1 ; Size of primitives record
PowerOnB DS.L 1 ; offset to routine to power up SCC port B
PowerOnA DS.L 1 ; offset to routine to power up SCC port A
PowerOnC DS.L 1 ; offset to routine to power up SCC port C
PowerOnEnet DS.L 1 ; offset to routine to power up onboard ethernet
PowerOffB DS.L 1 ; offset to routine to power down SCC port B
PowerOffA DS.L 1 ; offset to routine to power down SCC port A
PowerOffC DS.L 1 ; offset to routine to power down SCC port C
PowerOffEnet DS.L 1 ; offset to routine to power down onboard ethernet
ENDR
;—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
; Table Types and mask bits 0-1
PrimsTypeMask EQU %0000000000000111 ; Mask for this feature
PrimsTypeTable EQU %0000000000000000 ; Table of Tables
PrimsTypePtr EQU %0000000000000001 ; Table of pointer
PrimsTypeInfo EQU %0000000000000010 ; Table of information
PrimsTypePMgrEx EQU %0000000000000011 ; Table is Power Manager Exceptions
PrimsTypeExp1 EQU %0000000000000100 ; Table is for expansion
PrimsTypeExp2 EQU %0000000000000101 ; Table is for expansion
PrimsTypeExp3 EQU %0000000000000110 ; Table is for expansion
PrimsTypeExp4 EQU %0000000000000111 ; Table is for expansion
;—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
; Definition of bits in bitfield in PrimInfoTbleRec.PrimPrivFeatures
hasExtdBattInfo EQU 0 ; 1=extended battery status call is supported by PMGR
hasBatteryID EQU 1 ; 1=battery ID call is supported by PMGR
canSwitchPower EQU 2 ; 1=switch AC power on/off call is supported by PMGR
privBitsInvalid EQU 31 ; reserved: negative value indicates PowerDispatch call not supported
; definition of bits in PrimChargerAttr
hasSleepLED EQU 0 ; supports sleep LED <H53>
hasForcedDischarge EQU 1 ; supports forced discharge mode <H53>
hasDBCharger EQU 2 ; should use DB charging tables <H53>
hasEscherCharger EQU 3 ; should use Escher charging tables <H53>
;—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
; Handy little macro for using with the Primitive Table
MACRO
LoadTbl &Table,&GlobalReg,&Reg
MOVEA.L vPMgrPrimitives(&GlobalReg),&Reg
MOVEA.L &Table(&Reg),&Reg
TST.L &Reg
ENDM
MACRO
JsrPrimTbl &Routine,&Tbl
TST.L ([&Routine,&Tbl])
BEQ.S *+2+6
JSR ([&Routine,&Tbl])
ENDM
MACRO
JmpPrimTbl &Routine,&Tbl
TST.L ([&Routine,&Tbl])
BEQ.S *+2+6
JMP ([&Routine,&Tbl])
RTS
ENDM
MACRO
JsrRoutine &Routine,&GlobalsReg,&Reg
MOVEA.L vPMgrPrimitives(&GlobalsReg),&Reg
MOVEA.L PmgrRoutineTbl(&Reg),&Reg
TST.L ([&Routine,&Reg])
BEQ.S *+2+6
JSR ([&Routine,&Reg])
ENDM
MACRO
JmpRoutine &Routine,&GlobalsReg,&Reg
MOVEA.L vPMgrPrimitives(&GlobalsReg),&Reg
MOVEA.L PmgrRoutineTbl(&Reg),&Reg
TST.L ([&Routine,&Reg])
BEQ.S *+2+6
JMP ([&Routine,&Reg])
RTS
ENDM
;••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
;—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
;
; Power Manager Local Storage
;
; The Following are the records used for the power manager. The PmgrRec is a superset of the original power
; manager globals and maintains the first 158 bytes appropriately. PowerCycleRec was added to facilitate
; power cycling and sleep. VidRamSaveRec was added to replace some hard-coded addresses thus making it more
; universal. PMgrScratchRec helps maintain the integrity of the original Pmgr globals.
;
;—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
PMgrScratchRec RECORD 0,Increment ; Local Scratch storage
ProgLastAct DS.L 1 ; Progressive Power Cycling Last Activity
ProgCounter DS.W 1 ; Progressive Power Cycling Counter
SyncCounter DS.W 1 ; Sync Idle Patch Counter
SaveBusErrVect DS.L 1 ; Saved bus error vector
pmgrFree DS.W 2 ; Free Storage
PMgrScratchSz EQU *-PMgrScratchRec; 16 bytes now
ENDR
;—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
PowerCycleRec RECORD 0,Increment ; Global storage for power cycling and sleep
PCRHasMMUFlag DS.W 1 ; Saved MMU Flag
PCROldStackPtr DS.L 1 ; Stack Ptr
PCRSRsave DS.W 1 ; Status Register
PCRNMIsave DS.L 1 ; NMI Vector
PCRMMUTCsave DS.L 1 ; MMU TC
PCRMMUCRPsave DS.L 2 ; MMU CRP
PCRMMUTT1save DS.L 1 ; MMU TT1
PCRMMUTT0save DS.L 1 ; MMU TT0
PCRSize EQU *-PowerCycleRec ; 32 bytes right now
ENDR
;—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
CPUStateRec RECORD 0,Increment ; Global storage for power cycling and sleep
NMIStkFrame DS.W 4 ; Save 4 words in case of stack frame
CPUMMUCRPsave EQU * ; MMU 030 CPU Root Pointer (2 Longs)
CPUMMUURPsave DS.L 1 ; MMU 040 User Root Pointer
CPUMMUSRPsave DS.L 1 ; MMU 040 Supervisor Root Pointer
CPUMMUTCsave DS.L 1 ; MMU 030/040 TC
CPUMMUTT0save EQU * ; MMU 030 TT0
CPUMMUDTT0save DS.L 1 ; MMU 040 Data TT0
CPUMMUTT1save EQU * ; MMU 030 TT1
CPUMMUDTT1save DS.L 1 ; MMU 040 Data TT1
CPUMMUITT0save DS.L 1 ; MMU Instruction TT0
CPUMMUITT1save DS.L 1 ; MMU Instruction TT1
CPUCACRsave DS.L 1 ; Cache Control Register
CPUVBRsave DS.L 1 ; Vector Base Register
CPUUSPsave DS.L 1 ; User Stack Pointer
CPUMSPsave DS.L 1 ; Master Stack Pointer
CPUISPsave DS.L 1 ; Interrupt Stack Pointer
CPUCAARsave DS.L 1 ; Cache Address Register '030 only
CPUNMIsave DS.L 1 ; NMI Vector
CPUSRsave DS.W 1 ; Status Register
CPUUnused DS.W 1 ; currently unused
CPUStateSize EQU *-CPUStateRec ; 68 bytes right now
ENDR
CelsiusCycleRec RECORD 0,Increment
CCDeferredTask DS.B 20 ; ($00) Deferred Task Queue Element <H59>
CCVBLTask DS.B 14 ; ($14) VBL task queue element
CCCurTemp DS.B 1 ; ($22) Current temperature
CCMaxTemp DS.B 1 ; ($27) Maximum seen so far
CCLevel1Temp DS.B 1 ; ($23) Lvl1 °C threshold, more effecient pwr cycling
CCLevel2Temp DS.B 1 ; ($24) Lvl2 °C threshold, deferred task cycling
CCLevel3Temp DS.B 1 ; ($25) Lvl3 °C threshold, user warning dialog
CCLevel4Temp DS.B 1 ; ($26) Lvl4 °C threshold, turn off computer
CCRate1 DS.B 1 ; ($28) Cycling rate curve values
CCRate2 DS.B 1 ; ($29) Cycling rate curve values
CCRate3 DS.B 1 ; ($2A) Cycling rate curve values
CCRate4 DS.B 1 ; ($2B) Cycling rate curve values
CCLastCycTicks DS.L 1 ; ($2C) Last tick time we power cycled
CCVBLFreq DS.W 1 ; ($30) Adjustable VBL Frequency
CCExtraWord DS.W 1 ; ($32) This space for rent
CCExtraLongs DS.L 3 ; ($34) For later use
CCRecSize EQU *-CelsiusCycleRec ; ($40) <H59>
PmgrRec RECORD 0,Increment
SleepTime DS.B 1 ; (00) Copies of sleep time out values
HDTime DS.B 1 ; (01) Hard disk time out
SleepQHdr DS.W 0 ; (02) sleep queue header
SlpQFlags DS.W 1 ; (02) Sleep queue flags
SlpQHead DS.L 1 ; (04) First sleep queue entry
SlpQTail DS.L 1 ; (08) last sleep queue entry
SysTaskFlag DS.B 1 ; (0C) SystemTask been called flag
LastLevel DS.B 1 ; (0D) Previous normalized power level
SaveSpeedo DS.B 1 ; (0E) save the speedometer reading here
Charger DS.B 1 ; (0F) charger status flag
SleepFlags DS.B 1 ; (10) misc status flags
TOdirtyFlag DS.B 1 ; (11) time outs are dirty flag
WakeVector DS.L 1 ; (12) wake up vector
HDvector DS.L 1 ; (16) vector to spin down proc
LastAct DS.L 1 ; (1A) Last user activity
LastHd DS.L 1 ; (1E) Last hard disk activity
LowWarn DS.B 1 ; (22) Low power warning threshold
Cutoff DS.B 1 ; (23) Power manager cutoff voltage
BNmQEntry DS.L 9 ; (24) Low power alert
BatQ DS.B 8 ; (48) Battery level circular queue
lpMSGvalid DS.B 1 ; (50) Low power message pending flag
IdleFlagCnt DS.B 1 ; (51) Idle flag set/clear counter
BatAvg DS.B 1 ; (52) Average of BatQ
NTSCcopy DS.B 1 ; (53) Copy of NTSC byte, only used from restart to drawbeepscreen
PmgrFlags DS.B 1 ; (54) general power manager bit flags
PRAMbase DS.B 1 ; (55) Base address of PRAM
RAMwatchPtr DS.L 1 ; (56) Pointer to system disk watch cursor
ROMwatchPtr DS.L 1 ; (5A) Pointer to rom watch cursor
watchCrsr DS.B 1 ; (5E) Flag indicating the watch cursor in use
BatQIndex DS.B 1 ; (5F) Index into circular battery averaging queue
SleepNetHook DS.L 1 ; (60) Hook for calling pre-closeATalk
vBatInt DS.L 1 ; (64) Vector to battery interrupt handler
vEnvInt DS.L 1 ; (68) Vector to environment interrupt handler
WakeWarn DS.B 1 ; (6C) AppleTalk services closed
Level4Cnt DS.B 1 ; (6D) Must sleep now counter
lpSICNHndl DS.L 1 ; (6E) Low power icon handle
lpSTR0Ptr DS.L 1 ; (72) Low power messages storage
lpSTR1Ptr DS.L 1 ; (76)
lpSTR2Ptr DS.L 1 ; (7A)
lpSTR3Ptr DS.L 1 ; (7E)
BatVBLTask DS.B 14 ; (82) Battery monitor task
SwVBLTask DS.B 14 ; (90) Sound watch task
PowerCycleReg DS.L 1 ; (9E) address of power cycling register <H19>
PhysVidRamPtr DS.L 1 ; (A2) Pointer to Physical Video Ram for PwrCycling & Sleep
PmgrVarPhysPtr DS.L 1 ; (A6) Pointer to physical address of the PMgrGlobals
PwrCycSyncCount DS.W 1 ; (AA) Interval between SyncIdle Calls to power cycle
PwrCycWaitTime DS.W 1 ; (AC) Time we wait till entering power cycling
PwrCycCounter DS.W 1 ; (AE) Counter for times it will power cycle
PwrCycDelay DS.W 1 ; (B0) Delay time used by IdleDelay
PMgrScratch DS.B PMgrScratchRec ; (B2) Local Scratch area for the Power Manager
PwrCycSave DS.B PowerCycleRec ; (C2) Save area for Power Cycling
PwrCycProgGrow DS.W 1 ; (E2) Increment by which progressive power cycling grows
PwrCycProgMax DS.W 1 ; (E4) Maximum setting for progressive power cycling
PwrCycProc DS.L 1 ; (E6) Pointer to power down code of power cycling
PwrCycRestore DS.L 1 ; (EA) Pointer to restore code for power cycling
BBSTR0Ptr DS.L 1 ; (EE) First Bad Battery message
BBSTR1Ptr DS.L 1 ; (F2) Second Bad Battery message
Hysteresis DS.W 1 ; (F6) low power hysteresis (10mv)
AutoSlpDisable DS.B 1 ; (F8) Counting semaphor to disable sleep
dockFlags DS.B 1 ; (F9) docking flags (inhibit sleep/power cycling, etc.) <H15>
SleepHook DS.L 1 ; (FA) Hook in going to sleep code
WakeUpHook DS.L 1 ; (FE) Hook in wake-up code
MdmSndVect DS.L 1 ; (102) Vector for modem sound routine
vSendCountTbl DS.L 1 ; (106) pointer to PMgr send count table <H4>
vRecvCountTbl DS.L 1 ; (10A) pointer to PMgr receive count table <H4>
vPMgrPrimitives DS.L 1 ; (10E) pointer to PMgr Primitives <H8>
SleepSaveFlag DS.L 1 ; (112) warm start constant saved here <H16>
SleepSaveCrsr DS.L 1 ; (116) pointer to cursor <H16>
ClamshellVBLTask DS.B 14 ; (11A) VBL queue element for clamshell switch monitoring <H19>
PmgrFlags1 DS.B 1 ; (128) general power manager bit flags (extended) •• Please see note on PmgrFlags1 below ••
PmgrFlags2 DS.B 1 ; (129) general power manager bit flags (extended) <H22>
PmgrFlags3 DS.B 1 ; (12A) general power manager bit flags (extended) <H22>
PmgrFlags4 DS.B 1 ; (12B) general power manager bit flags (extended) <H22>
NoVidSTRPtr DS.L 1 ; (12C) handle to no external video message string <H29>
NoChrgrSTRPtr DS.L 1 ; (130) handle to no external video w/o charger message string <H29>
UNmQEntry DS.L 9 ; (134) notification mgr entry for user warning messages <H29>
saveGDFlags DS.W 1 ; (158) saved flags for power dimming <H31>
pmgrOpExceptions DS.L 1 ; (15A) pointer to table of PMgrOp exceptions <H32>
vSoftShutdown DS.L 1 ; (15E) pointer to soft shutdown routine <H34>
BatteryWarnDly DS.W 1 ; (162) value to reload into BatteryWarnCnt <H40>
BatteryWarnCnt DS.W 1 ; (164) count down timer for battery interrupt <H40>
HardDiskQHdr DS.W 0 ; (166) hard disk spindown queue header <H45>
hdQFlags DS.W 1 ; (166) hard disk queue flags <H45>
hdQHead DS.L 1 ; (168) first hard disk queue entry <H45>
hdQTail DS.L 1 ; (16C) last hard disk queue entry <H45>
vPublicDispatch DS.L 1 ; (170) pointer to table used by PowerMgrDispatch trap <H45>
fullSpeedDBRAs DS.W 4 ; (174) full speed TimeDBRA values <H50>
lowSpeedDBRAs DS.W 4 ; (17C) reduced speed TimeDBRA values <H50>
fadeVars DS.L 1 ; (184) used by fade-in/fade-out screens code
LastUsrAct DS.L 1 ; (188) last user level activity
LastNetAct DS.L 1 ; (18C) last network level activity
DimmingWaitTime DS.L 1 ; (190) time to wait before dimming
DimmingDisable DS.B 1 ; (194) Counting semaphor to disable dimming
PwrCycRegValue DS.B 1 ; (195) Value for Power Cycling Register to kill power <K14>
HardRockDMAFlag DS.W 1 ; (196) Flags for HardRock DMA
SaveCPUState DS.B CPUStateRec ; (198) record for Power Cycling and Sleep
CCRecord DS.B CelsiusCycleRec ; (1DC) Celsius Cycling Record <K19>
HDSpinUpVector DS.L 1 ; (21C) vector for spinning up the hard drive
PmgrVarSize EQU *-PmgrRec ; (21C) Total
ENDR
; Define fields in SleepFlags (PMGR globals) / PmgrStatusFlags (PRAM)
IdleBit EQU 0 ; 1 = Do not idle
ChargeSleep EQU 1 ; 1 = Do not sleep or spin down while charging
UseIntrnlModem EQU 2 ; 1 = Do not use internal modem
RingWakeup EQU 3 ; 1 = wakeup on modem ring (only on Portable, PowerBook 100) <H17>
TimerWakeup EQU 4 ; 1 = wakeup on timer (only on Portable, PowerBook 100) <H17>
; define fields in PmgrOtherFlags (PRAM)
EconoBit EQU 1 ; 1 = econo-mode enabled <H12>
DiskModeAddr EQU 5 ; bits 5-7 contain SCSI Disk Mode "address" of internal HD <H14>
; Define fields in PmgrFlags
InSleep EQU 0 ; 1 = In sleep code, don't re-enter
AvoidNetDiag EQU 1 ; 1 = skip network dialog warning
HDPowerOn EQU 2 ; 1 = hard drive is powered and spun up
AvoidLowPMsg EQU 3 ; 1 = skip low power messages
BadBatDet EQU 4 ; 1 = bad battery already detected
PmgrWakeLvlSet EQU 5 ; 1 = currently with wakeup PmgrWake Level Set <H16>
ClamshellClosed EQU 6 ; 1 = detected clamshell close <H19>
ScsiDiskModeOn EQU 7 ; 1 = cpu operating in scsi disk mode
; Define fields in PmgrFlags1
;
; Note: In the original DuoDock and MiniDock DeclROMs, the location of the PmgrFlags1
; field and the bit number of the PmgrExtVidOn flag were hard coded as
; $128 and 5 respectively. If you plan on changing either of these, then
; the potential for problems arises.
;
PmgrShutdownEnb EQU 0 ; 1 = allow soft shutdown <H22>
PmgrShutdownReq EQU 1 ; 1 = user requested to shutdown <H22> <ag>
PmgrDartSPI EQU 2 ; 1 = use SPI port for modem <H26>
PmgrDimReq EQU 3 ; 1 = change state of screen <H28>
PmgrDimState EQU 4 ; 1 = Power Dowm screens <H28>
PmgrExtVidOn EQU 5 ; 1 = Ext Video is on <H29>
PmgrExtVidAlrt EQU 6 ; 1 = Alert user that Video On without charger <H29>
PmgrAvoidUsrMsg EQU 7 ; 1 = skip user warning messages <H30>
; Define fields in PmgrFlags2
LowPowerSleep EQU 0 ; 1 = going to sleep because of low power condition <H32>
QuickHDSpinDwn EQU 1 ; 1 = use quick hard drive spindown time
PmgrDimStatus EQU 2 ; 1 = currently dimmed
ShutHelderDown EQU 3 ; 1 = don't Helder, go straight to shutdown
SerPortAPwr EQU 4 ; 1 = port A powered <H49>
SerPortBPwr EQU 5 ; 1 = port B powered <H49>
SerPortCPwr EQU 6 ; 1 = port C powered <H49>
HDSpinDownDisable EQU 7 ; 1 = disable hard disk spindown <H48><H49>
; Define fields in PmgrFlags3
ignoreClamshell EQU 0 ; 1 = ignore clamshell close, 0 = sleep when clamshell is closed<H51>
ignoreTemperature EQU 1 ; 1 = ignore temperature, 0 = pwr cycle when hot <20>
EnetPwr EQU 2 ; 1 = onboard ethernet chip powered <K8>
ModemSndReq EQU 3 ; 1 = change the current state of modem sound
ModemSndState EQU 4 ; 1 = modem sound currently on, 0 = currently off
; sleep queue commands
; Moved to PowerEqu.a
; Structure of sleep queue record
; Moved to PowerEqu.a
; Sleep Queue Flags - SleepqFlags
; Moved to PowerEqu.a
; ChooserBits definition
noChoos EQU 7 ; don't change printer now
noATChg EQU 6 ; ATalk in use bit
; AppleTalk warnings
ClosedMPP EQU 1 ; MPP was closed
ClosedXPP EQU 2 ; XPP was closed
ClosedSvr EQU 3 ; Server was closed
ClearedChsr EQU 4 ; Magic chooser bit cleared
;••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
;—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
;
; PMgrOp Equates
;
; Equates that deal with the Power Manager Micro specifically.
;—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
pmCommandRec RECORD 0,Increment ; Power manager command
pmCommand DS.W 1 ; Command
pmLength DS.W 1 ; Length
pmSBuffer DS.L 1 ; Send Buffer
pmRBuffer DS.L 1 ; Receive Buffer
pmData DS.L 1 ; Data
pmBlkSize EQU *-pmCommandRec
ENDR
; Power Manager Commands
powerCntl EQU $10 ; power plane/clock control
power1Cntl EQU $11 ; more power control (DBLite)
powerRead EQU $18 ; power plane/clock status
power1Read EQU $19 ; more power status (DBLite)
pMgrADB EQU $20 ; send ADB command
pMgrADBoff EQU $21 ; turn ADB auto-poll off
readADB EQU $28 ; Apple Desktop Bus
pMgrADBInt EQU $2F ; get ADB interrupt data (Portable only)
timeWrite EQU $30 ; write the time to the clock chip
pramWrite EQU $31 ; write the original 20 bytes of PRAM (Portable only)
xPramWrite EQU $32 ; write extended PRAM byte(s)
timeRead EQU $38 ; read the time from the clock chip
pramRead EQU $39 ; read the original 20 bytes of PRAM (Portable only)
xPramRead EQU $3A ; read extended PRAM byte(s)
contrast EQU $40 ; set screen contrast
modemSet EQU $50 ; internal modem control
modemClrFIFO EQU $51 ; clear modem fifo's <H22>
modemSetFIFOIntMask EQU $52 ; set the mask for fifo interrupts <H22>
modemWriteData EQU $54 ; write data to modem <H22>
modemSetDataMode EQU $55 ; <H22>
modemSetFloCtlMode EQU $56 ; <H22>
modemDAACnt EQU $57 ;
modemRead EQU $58 ; internal modem status
modemDAAID EQU $59 ;
modemGetFIFOCnt EQU $5A ; <H22>
modemSetMaxFIFOSize EQU $5B ; <H22>
modemReadFIFOData EQU $5C ;
modemExtend EQU $5D ;
setBattWarning EQU $60 ; set low power warning and cutoff battery levels (PowerBook 140/170, DBLite)
setCutoff EQU $61 ; set hardware cutoff voltage <H44>
batteryRead EQU $68 ; read battery/charger level and status
batteryNow EQU $69 ; read battery/charger instantaneous level and status
readBattWarning EQU $6A ; read low power warning and cutoff battery levels (PowerBook 140/170, DBLite)
readExtBatt EQU $6B ; read extended battery/charger level and status (DBLite)
readBatteryID EQU $6C ; read the battery ID
readBatteryInfo EQU $6D ; return battery parameters
readCutoff EQU $6F ; return hardware cutoff voltage <H44>
SetModem1SecInt EQU $70 ; <H22>
SetModemInts EQU $71 ; turn modem interrupts on/off
readINT EQU $78 ; get PMGR interrupt data
ReadModemInts EQU $79 ; read modem interrupt status
PmgrPWRoff EQU $7E ; turn system power off
sleepReq EQU $7F ; put the system to sleep
sleepSig EQU 'MATT' ; sleep/power off signature
sleepAck EQU $70 ; sleep acknowledge
timerSet EQU $80 ; set the wakeup timer
timerRead EQU $88 ; read the wakeup timer setting
soundSet EQU $90 ; sound power control
SetDFAC EQU $91 ; set DFAC register (DBLite)
soundRead EQU $98 ; read sound power state
ReadDFAC EQU $99 ; read DFAC register (DBLite)
modemWriteReg EQU $A0 ; Write Modem Register <H22>
modemClrRegBits EQU $A1 ; Clear Modem Register Bits <H22>
modemSetRegBits EQU $A2 ; Set Modem Register Bits <H22>
modemWriteDSPRam EQU $A3 ; Write DSP RAM <H22>
modemSetFilterCoeff EQU $A4 ; Set Filter Coefficients <H22>
modemReset EQU $A5 ; Reset Modem <H22>
modemUNKNOWN EQU $A6 ; <filler for now> <H22>
modemReadReg EQU $A8 ; Read Modem Register <H22>
modemReadDSPRam EQU $AB ; Read DSP RAM <H22>
resetCPU EQU $D0 ; reset the CPU
readAtoD EQU $D8 ; read A/D channel
readButton EQU $D9 ; read button values on Channel 0 = Brightness, Channel 1 = Contrast 0-31
readExtSwitches EQU $DC ; read external switch status (DBLite)
writePmgrRAM EQU $E0 ; write to internal PMGR RAM
setMachineAttr EQU $E3 ; set machine id
readPmgrRAM EQU $E8 ; read from internal PMGR RAM
readPmgrVers EQU $EA ; read the PMGR version number
readMachineAttr EQU $EB ; read the machine id
PmgrSelfTest EQU $EC ; run the PMGR selftest
DBPMgrTest EQU $ED ; DON'T USE THIS!! <K23>
FactoryTest EQU $EE ; hook for factory requests <K23>
PmgrSoftReset EQU $EF ; soft reset of the PMGR
; power control/status equates (commands $10 and $18)
pIWM EQU 0 ; IWM power
pSCC EQU 1 ; SCC power
pHD EQU 2 ; internal hard disk power
pModem EQU 3 ; internal modem power
pSerDrvr EQU 4 ; serial driver chip power
pASC EQU 5 ; sound power
pMinus5V EQU 6 ; -5 volt power
pTurnOn EQU 7 ; turn on/off devices corresponding to 1's in bits 0-6
iwmOff EQU (0<<pTurnOn) | (1<<pIWM) ; turn off/on IWM
iwmOn EQU (1<<pTurnOn) | (1<<pIWM)
sccOff EQU (0<<pTurnOn) | (1<<pSCC) ; turn off/on SCC
sccOn EQU (1<<pTurnOn) | (1<<pSCC)
hdOff EQU (0<<pTurnOn) | (1<<pHD) ; turn off/on hard disk
hdOn EQU (1<<pTurnOn) | (1<<pHD)
modemOff EQU (0<<pTurnOn) | (1<<pModem) ; turn off/on modem
modemOn EQU (1<<pTurnOn) | (1<<pModem)
serOff EQU (0<<pTurnOn) | (1<<pSerDrvr); turn off/on serial driver chip
serOn EQU (1<<pTurnOn) | (1<<pSerDrvr)
ascOff EQU (0<<pTurnOn) | (1<<pASC) ; clear/release sound latch
ascOn EQU (1<<pTurnOn) | (1<<pASC)
minus5Off EQU (0<<pTurnOn) | (1<<pMinus5V); turn off/on serial driver chip
minus5On EQU (1<<pTurnOn) | (1<<pMinus5V)
allOff EQU (1<<pIWM) |\ ; turn off everything except hard disk and sound latch ready
(1<<pSCC) |\
(0<<pHD) |\
(1<<pModem) |\
(1<<pSerDrvr) |\
(0<<pASC) |\
(1<<pMinus5V) |\
(0<<pTurnOn)
; new power control/status equates (commands $11 and $19)
pScreen EQU 0 ; screen power
pCharger EQU 1 ; AC adapter connection
screenOff EQU (0<<pTurnOn) | (1<<pScreen)
screenOn EQU (1<<pTurnOn) | (1<<pScreen)
chargerOff EQU (0<<pTurnOn) | (1<<pCharger)
chargerOn EQU (1<<pTurnOn) | (1<<pCharger)
; sound control/status equates (commands $90 and $98)
soundOff EQU $00 ; sound latch released, sound power off
soundOn EQU $01 ; sound latch released, sound power on
sndClrLtch EQU $02 ; clear sound latch, sound power off
sndOnClrLtch EQU $03 ; clear sound latch, sound power on
; interrupt flag register usage (command $78)
adbIntFlag EQU 0 ;ADB data ready
batIntFlag EQU 1 ;Low BATtery power
envIntFlag EQU 2 ;ENVironmental problem
oneSecIntFlag EQU 3 ;one-second interrupt <H3>
; external switch status bits (command $DC)
clamshell EQU 0 ; 1 = clamshell is closed
dockingBar EQU 1 ; 1 = docking bar is connected
; battery/charger status bits
HasCharger EQU 0 ;Charger connected
ShortedBat EQU 2 ;Shorted battery condition
LowBattery EQU 4 ;Low battery condition
ChrgState EQU 5 ;Charger connection state change
OverTemp EQU 6 ;High temperature condition
; modem command bits ;
ModemPwr EQU 0 ;Modem power control (1=true)
ModemAorB EQU 1 ;Modem connection to port A or B (1=A)
RingWakeEnable EQU 2 ;Modem ring detect wake up enable (1=true)
ModemInstalled EQU 3 ;Modem in the slot (1=true)
RingDetect EQU 4 ;Modem ring detect pin (1=ringing)
ModemHook EQU 5 ;Modem on/off hook (1=off hook)
; SerialPower bits and bytes
BypassModem EQU 0 ;Ignore pram internal modem designation (1=ignore)
PortAorB EQU 2 ;Port A or Port B (1=port A)
SerialOff EQU 7 ;Power on/off selector bit
PortAPower EQU 4 ;Power port A command (byte version of PortAorB)
PortBPower EQU 0 ;Power port B command
;••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
;—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
;
; Power Manager Misc.
;
;—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
PmgrPramBase EQU $70 ; Start of Power Manager PRam on PowerBook 140/170, Dartanian
; PRAM Record of individual bytes
PmgrPramRec RECORD 0,Increment
SlpTimeOut DS.B 1 ; Sleep time-out, in seconds/15
HDTimeOut DS.B 1 ; Hard disk time-out, in seconds/15
PmgrStatusFlags DS.B 1 ; Power Manager Flags (get copied to SleepFlags)
PmgrOtherFlags DS.B 1 ; yet more Power Manager flags
Brightness DS.B 1 ; Brightness level
VidMode DS.B 1 ; Video Mode
PmgrPramSize EQU *
ENDR
; Basic Pmgr Defaults
DfltHDTime EQU 4*60/15 ; Default number of minutes before hd spin down time out (4 min)
DfltSlpTime EQU 8*60/15 ; Default number of minutes before sleep time out (8 min)
PwrCycWaitTmDef EQU 2*60 ; Default value for PwrCycWaitTime (2 seconds)
PwrCycSynCntDef EQU 3 ; Default value for PwrCycSyncCount
PwrCycleDef EQU 10 ; Default value for PwrCycCounter
PwrCycDelayDef EQU 15*60 ; Default value for PwrCycDelay (15 seconds)
PwrCycProgGrowDef EQU 10 ; Default value for PwrCycProgGrow
PwrCycProgMaxDef EQU $C0 ; Default value for PwrCycProgMax
; CPU Speeds
idlespeed EQU 1 ; Idle is at 1Mhz
CPUSpeed8MHz EQU 8 ; 8 MHz CPU Speed
CPUSpeed16MHz EQU 16 ; 16 MHz CPU Speed
CPUSpeed20MHz EQU 20 ; 20 MHz CPU Speed
CPUSpeed25MHz EQU 25 ; 25 MHz CPU Speed
CPUSpeed33MHz EQU 33 ; 33 MHz CPU Speed
CPUSpeed40MHz EQU 40 ; 40 MHz CPU Speed
; Power Manager loopcounts
wait8us EQU $40 ;For software loop, remove later
BootDevTicks EQU 2*60*60 ; Wait for boot device before sleep, in ticks.
; Power Manager Power Voltages
DefHysteresis EQU 20 ; default to 200mv
DefLowWarn EQU 585-512 ; default low battery warning level
DefCutoff EQU 560-512 ; default dead battery warning level
PMGRWARNLEVEL EQU 585 ; set low power level
PGMRWAKELEVEL EQU 609 ; set hysteresis for 6.09(max allowed) volts for wake
PMGRCUTOFF EQU 560 ; set 68k shutdown to 5.60(min allowed)
STDOFFSET EQU 512 ; base offset of voltages
; Power Manager Misc Equates
MaxHDTime EQU 60*60/15 ; Maximum number of minutes before hd spin down time out (60 min)
MaxSlpTime EQU 60*60/15 ; Maximum number of minutes before sleep time out (60 min)
SndWFreq EQU 60*10 ; Sound watch VBL is called very 10 seconds
BatFreq EQU 60*1 ; Battery level monitor every second
ClamshellVBLFreq EQU 60*2 ; check for clamshell closed every 2 seconds
SleepWait EQU 10 ; Delay from last alert to auto sleep
pram2ticks EQU 60*15 ; Convert pram count to ticks
CelsiusVBLFreq EQU 60*10 ; Monitor temperature every 10 seconds <20>
MaxTempCelsius EQU 72 ; Maximum internal temperature before shutdown <20>
WarnTempCelsius EQU 68 ; Temperature that requires a user warning <20>
MinTempCelsius EQU 65 ; Minimum temperature to start deferred task pwr cycling <20>
NeverCelsiusCycl EQU $FF ; Temperature at which we will never cycle <20>
InitialTmpCycl EQU (NeverCelsiusCycl<<24) | \ ; normal pwr cycling is ok <20>
(MinTempCelsius<<16) | \ ; start cycling at this temp <20>
(WarnTempCelsius<<8) | \ ; warn the user it's getting hot <20>
(MaxTempCelsius<<0) ; turn off the maching <20>
InitialCycRates EQU $0A050302 ; Initial cycle rate curves <20>
jModemSnd EQU Lvl1DT+4*ifCB2 ; addr of VIA1 DT CB2 vector (modem sound)
ENDIF ; ...already included