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

356 lines
17 KiB
Plaintext

;
; File: DockingEqu.a
;
; Contains: equates for docking portable Macintoshes into desktop docking modules
;
; Written by: Steve Christensen
;
; Copyright: © 1992-1993 by Apple Computer, Inc. All rights reserved.
;
; Change History (most recent first):
;
; <SM5> 12/13/93 PN Roll in KAOs and Horror changes to support Malcom and AJ
; machines
; <SM4> 9/1/93 SKH Update from Horror
; <SM3> 3/2/93 CSS Update from Horror:
; <H15> 1/28/93 RLE add cache control selector
; <SM2> 11/20/92 SWC Rolled in the rest of the Horror changes.
; <H14> 8/13/92 SWC Added a selector to let us do any last minute pre-boot patching
; should we find a need after the ROM goes final.
; <H13> 8/10/92 SWC Added a selector to return the slot number of the docking slot.
; <H12> 7/24/92 SWC Added a new flag to signal when a user has added a "can't add
; during sleep" kind of bar so we can force the removal of its
; handler in case the user tries multiple times.
; <H11> 6/29/92 SWC Added eject/shutdown equates.
; <H10> 6/25/92 SWC More vectorizing, and added sound attributes selector.
; <H9> 6/18/92 SWC Added a new vector (jRegisterVideo) to provide a hook to let us
; notify the system that a new video device has been added (this
; currently doesn't do anything).
; <H8> 5/29/92 SWC Added a selector to install an interrupt handler for an external
; SCSI chip (if any) for use by SCSI Disk Mode.
; <H7> 5/20/92 SWC Added a selector so we can pass the CPU clock speed to the
; docking handler in case its hardware cares.
; <H6> 5/8/92 SWC Fixed the CTB macros.
; <H5> 5/7/92 SWC Updated a couple of bit names. Added some Comm Toolbox stuff for
; resolving which serial ports are available.
; <H4> 4/22/92 SWC Added a Notification Manager record which is used when sleep is
; denied because the bar doesn't want to sleep.
; <H3> 4/13/92 SWC Added some more selectors. Defined flags byte in globals so we
; can keep track of state info.
; <H2> 3/20/92 SWC Added sleep/wakeup selectors. Added some more vectors to the
; globals.
; <H1> 2/14/92 SWC First checked in.
IF &TYPE('__DockingEquates__') = 'UNDEFINED' THEN
__DockingEquates__ SET 1
dockDockingSlot EQU 'slot' ; returns the slot number of the docking slot
; (this doesn't call the docking handler)
; status selectors and function result values
dockHardwareAttr EQU 'hdwr' ; hardware attributes
dockHasADB EQU 0 ; has an ADB connector
dockHasSoundIn EQU 1 ; has a sound input connector
dockHasSoundOut EQU 2 ; has a sound output connector
dockHasFPU EQU 3 ; FPU exists
dockHasSWIM EQU 4 ; SWIM (floppy disk controller) exists
dockHasSCC EQU 5 ; SCC (serial ports) exists
dockHasSCSI EQU 6 ; SCSI exists
dockHasVideo EQU 7 ; video exists
dockHasNetStuff EQU 8 ; has network services (e.g. ethernet, token ring)
dockHasModemDAA EQU 9 ; has modem DAA
dockHasOther EQU 10 ; miscellaneous other devices exist
dockHasExtCache EQU 11 ; has external processor cache
dockWakeADB EQU 16 ; ADB available on wakeup
dockWakeSoundIn EQU 17 ; sound input available on wakeup
dockWakeSoundOut EQU 18 ; sound output available on wakeup
dockWakeFPU EQU 19 ; FPU available on wakeup
dockWakeSWIM EQU 20 ; SWIM available on wakeup
dockWakeSCC EQU 21 ; SCC available on wakeup
dockWakeSCSI EQU 22 ; SCSI available on wakeup
dockWakeVideo EQU 23 ; video available on wakeup
dockWakeNetStuff EQU 24 ; network services available on wakeup
dockWakeModemDAA EQU 25 ; modem DAA available on wakeup
dockWakeOther EQU 26 ; other devices available on wakeup
dockWakeExtCache EQU 27 ; external processor cache available on wakeup
dockDockingAttr EQU 'dock' ; docking attributes
dockNoSleep EQU 0 ; going to sleep is not allowed
dockNoWakeup EQU 1 ; cannot wakeup if this bar was attached during sleep
dockNoPowerCycle EQU 2 ; power cycling is not allowed
dockNoLCDScreen EQU 3 ; don't use built-in LCD screen (i.e., in a docking station)
dockingStation EQU 4 ; bar is a docking station (desktop, AC power, etc.)
dockDockReserved5 EQU 5 ; [reserved]
dockDockReserved6 EQU 6 ; [reserved]
dockDockReserved7 EQU 7 ; [reserved]
dockEjectStatus EQU 'ejsw' ; eject attributes
dockEjectExists EQU 0 ; this bar contains a CPU eject mechanism
dockEjectEnabled EQU 1 ; user has pressed eject button
dockEjectReserved2 EQU 2 ; [reserved]
dockEjectReserved3 EQU 3 ; [reserved]
dockEjectReserved4 EQU 4 ; [reserved]
dockEjectReserved5 EQU 5 ; [reserved]
dockEjectReserved6 EQU 6 ; [reserved]
dockEjectReserved7 EQU 7 ; [reserved]
dockLockAttr EQU 'lock' ; lock attributes
dockLockExists EQU 0 ; this bar contains a device to lock the CPU to it
dockLockEnabled EQU 1 ; CPU is currently locked to the bar
dockLockReserved2 EQU 2 ; [reserved]
dockLockReserved3 EQU 3 ; [reserved]
dockLockReserved4 EQU 4 ; [reserved]
dockLockReserved5 EQU 5 ; [reserved]
dockLockReserved6 EQU 6 ; [reserved]
dockLockReserved7 EQU 7 ; [reserved]
dockPowerStatus EQU 'powr' ; returns information about the state of power planes
dockSWIMPower EQU 0 ; SWIM chip is turned on
dockSCCPower EQU 1 ; SCC is turned on
dockSCSIPower EQU 2 ; SCSI chip is turned on
dockPowerReserved3 EQU 3 ; [reserved]
dockSerDriverPower EQU 4 ; serial driver chip is turned on
dockPowerReserved5 EQU 5 ; [reserved]
dockPowerReserved6 EQU 6 ; [reserved]
dockPowerReserved7 EQU 7 ; [reserved]
dockSCCReadAddr EQU 'sccr' ; returns SCC read base address (if any)
dockSCCWriteAddr EQU 'sccw' ; returns SCC write base address (if any)
dockSCCPorts EQU 'scc#' ; which SCC ports are available
dockSCCModemPort EQU 0 ; modem port is available
dockSCCPrinterPort EQU 1 ; printer port is available
dockSCCReserved2 EQU 2 ; [reserved]
dockSCCReserved3 EQU 3 ; [reserved]
dockSCCReserved4 EQU 4 ; [reserved]
dockSCCReserved5 EQU 5 ; [reserved]
dockSCCReserved6 EQU 6 ; [reserved]
dockSCCReserved7 EQU 7 ; [reserved]
dockSCSIType EQU 'sctp' ; SCSI chip type
dock53C80 EQU 0 ; 53C80
dock53C96 EQU 1 ; 53C96
dockSCSIReserved2 EQU 2 ; [reserved]
dockSCSIReserved3 EQU 3 ; [reserved]
dockSCSIReserved4 EQU 4 ; [reserved]
dockSCSIReserved5 EQU 5 ; [reserved]
dockSCSIReserved6 EQU 6 ; [reserved]
dockSCSIReserved7 EQU 7 ; [reserved]
dockSCSIAddr EQU 'scsi' ; returns SCSI registers base address (if any)
dockSCSIDMAAddr EQU 'sdma' ; returns SCSI DMA base address (if any)
dockSCSIHskAddr EQU 'shsk' ; returns SCSI handshake base address (if any)
dockSCSIDiskMode EQU 'sdm ' ; SCSI Disk Mode info
dockSDMExists EQU 0 ; SCSI Disk Mode is supported by this bar
dockSDMCable EQU 1 ; special cable is attached
dockNuBusConnectors EQU 'sltc' ; bitmap of external NuBus connectors on this bar
dockSlot0 Equ 0 ; “slot” 0 -- used to add/remove internal video if necessary
dockSlot9 EQU 9 ; slot 9
dockSlotA EQU 10 ; slot A
dockSlotB EQU 11 ; slot B
dockSlotC EQU 12 ; slot C
dockSlotD EQU 13 ; slot D
dockSlotE EQU 14 ; slot E
dockSoundAttributes EQU 'snd ' ; sound attributes
dockSndAttrValid EQU 0 ; sound attributes are valid
dockStereoOutput EQU 1 ; hardware supports stereo output
dockStereoMixing EQU 2 ; hardware mixes channels on external speaker
dockHeadphoneAttached EQU 3 ; a headphone is plugged into the jack
dockHasSoundInput EQU 4 ; hardware supports sound input
dockSIDAttached EQU 5 ; sound input device is attached
dockSoundReserved6 EQU 6 ; [reserved]
dockSoundReserved7 EQU 7 ; [reserved]
dockROMVersion EQU 'vers' ; ROM version, in the form:
; [major rev (BCD)][minor rev (BCD)][release stage][non-final release]
; release stage: development = 0x20, alpha = 0x40, beta = 0x60, release = 0x80
dockCacheStatus EQU 'csta' ; External cache status
dockCacheCPU EQU 'ccpu' ; input parameter causes advisory CPU compatibilty information to be returned
dockCache68000 EQU 1 ; the cache is compatible with MC68000 (gestalt68000)
dockCache68010 EQU 2 ; the cache is compatible with MC68010 (gestalt68010)
dockCache68020 EQU 3 ; the cache is compatible with MC68020 (gestalt68020)
dockCache68030 EQU 4 ; the cache is compatible with MC68030 (gestalt68030)
dockCache68040 EQU 5 ; the cache is compatible with MC68040 (gestalt68040)
dockCacheDataSize EQU 'cdat' ; input parameter causes the cache size in bytes to be returned
dockCacheLineSize EQU 'clin' ; input parameter causes the cache line size in bytes to be returned
dockCacheSpace EQU 'cspc' ; input parameter causes the cacheable address space to be returned
dockCacheConfig EQU 'ccfg' ; input parameter causes the current cache configuration to be returned
dockCacheROM EQU 0 ; the cache supports caching of ROM accessess
dockCacheRAM EQU 1 ; the cache supports caching of RAM accesses
dockCacheProg EQU 2 ; the cache supports caching of instructions
dockCacheData EQU 3 ; the cache supports caching of data
dockCacheWriteAlloc EQU 4 ; the cache supports write allocate
dockCache4Way EQU 23 ; the cache supports 4 way set associative
dockCache3Way EQU 24 ; the cache supports 3 way set associative
dockCache2Way EQU 25 ; the cache supports 2 way set associative
dockCache1Way EQU 26 ; the cache supports 1 way set associative (direct mapped)
dockCacheSplit EQU 27 ; the cache supports split
dockCacheUnified EQU 28 ; the cache supports unified
dockCacheWriteThru EQU 29 ; the cache supports write-thru
dockCacheCopyBack EQU 30 ; the cache supports copyback
dockCacheAvail EQU 31 ; the cache is available
; control selectors and parameter values
; (return zero as function result unless otherwise specified)
dockBootHook EQU 'boot' ; lets docking handler do last minute pre-boot setup
dockCacheControl EQU 'cctl' ; External Cache Control
dockCacheOn EQU 'on ' ; input parameter enables the cache
dockCacheOff EQU 'off ' ; input parameter disables the cache
dockCacheFlush EQU 'flsh' ; input parameter flushes the cache
dockDiagnostics EQU 'diag' ; run diagnostics: params contains pointer to test parameter block
; result = 0 if invalid/unsupported test,
; result = $8000 0000 if test passes
; result = error code, otherwise
dockFloppyDriveIcon EQU 'dicn' ; return floppy disk drive icon:
; params = drive number, result = pointer to drive icon structure
dockEjectCPU EQU 'ejct' ; enable ejecting the CPU when it powers off
dockRemoved EQU 'gone' ; does cleanup if board was removed across sleep
dockInit EQU 'init' ; does power-up board initialization
dockWakeupInit EQU 0 ; initializing when board was added during sleep
dockIgnoreExtCache EQU 1 ; set if external cache shouldn't be used
dockWorldChanged Equ 2 ; set when the docking manager needs to know if the world changed
dockCPUSpeed EQU 'mhz ' ; sends CPU's speed in MHz to the docking handler
dockPowerControl EQU 'pctl' ; turn power planes on a bar on/off
dockPowerOn EQU 7 ; 1=turn on, 0=turn off all "1" bits in bits 0-6
dockSWIMOff EQU (0<<dockPowerOn)|\ ; turn SWIM power off
(1<<dockSWIMPower)
dockSWIMOn EQU (1<<dockPowerOn)|\ ; turn SWIM power on
(1<<dockSWIMPower)
dockSCCOff EQU (0<<dockPowerOn)|\ ; turn SCC power off
(1<<dockSCCPower)
dockSCCOn EQU (1<<dockPowerOn)|\ ; turn SCC power on
(1<<dockSCCPower)
dockSCSIOff EQU (0<<dockPowerOn)|\ ; turn SCSI power off
(1<<dockSCSIPower)
dockSCSIOn EQU (1<<dockPowerOn)|\ ; turn SCSI power on
(1<<dockSCSIPower)
dockSerDriverOff EQU (0<<dockPowerOn)|\ ; turn serial driver chips off
(1<<dockSerDriverPower)
dockSerDriverOn EQU (1<<dockPowerOn)|\ ; turn serial driver chips on
(1<<dockSerDriverPower)
dockSCSIDiskIRQ EQU 'sdmi' ; install external chip IRQ handler for SCSI Disk Mode
; (params=address of handler)
dockSleepSave EQU 'slep' ; saves state of bar's hardware before going to sleep
; result=pointer to block containing state (allocated by handler)
dockWakeupRestore EQU 'wake' ; restores the state of the bar's hardware upon wakeup
; params=pointer to block containing state (disposed by handler)
dockFlush Equ 'wipe' ; called after Docking Manager is done “waking up” a device; allows handler
; to “wipe” itself clean, so to speak (status call)
;•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
;
; FROM HERE TO THE END OF THE FILE SHOULD ALWAYS REMAIN PRIVATE
; Docking Manager's variables
DockingGlobRec RECORD 0,INCREMENT
dockingHandler DS.L 1 ; [ 0] pointer to docking handler
dockingSlotNum DS.B 1 ; [ 4] NuBus slot number of docking slot
dockingFlags DS.B 1 ; [ 5] miscellaneous flags
ejectVBLTask DS.B 14 ; [ 6] VBL queue element to check for bar eject
ejectNMEntry DS.B 36 ; [ 20] NM record for handling eject when the CPU is locked into the bar
dockingEjectFlags EQU ejectNMEntry+33 ; [◊53] flags to keep track of eject state
sleepNMEntry DS.B 36 ; [ 56] NM record for handling denied sleep because a bar can't sleep
savedSleepState DS.L 1 ; [ 92] handle to bar's saved sleep state (allocated by handler)
wakeupNMEntry DS.B 36 ; [ 96] NM record for handling denied wakeup because a "no wakeup" bar was added
lockedEjectMsg DS.L 1 ; [132] string: can't eject because CPU is locked to docking bar
finderBlockedMsg DS.L 1 ; [136] string: can't shutdown because Finder can't be brought to the front
dockOldSyncIdleTime DS.L 1 ; [140] previous address of _SyncIdleTime trap
dockingReserved DS.L 1 ; [144] reserved
builtInSCCPorts DS.L 1 ; [148] built-in SCC ports
noBoardAddr DS.L 1 ; [152] address of "no board" handler
travelBarAddr DS.L 1 ; [156] address of travel bar handler
jDockingSleep DS.L 1 ; [160] docking sleep routine
jDockingWakeup DS.L 1 ; [164] docking wakeup routine
jInstallHandler DS.L 1 ; [168] install a new handler
jSetHardwareBases DS.L 1 ; [172] setup hardware bases
jCheckConnect DS.L 1 ; [176] check if a docking bar is connected
jCheckBarChanged DS.L 1 ; [180] check if a different bar is now connected
jAddSlot DS.L 1 ; [184] install a slot
jRemoveSlot DS.L 1 ; [188] remove a slot
jGetDockingHandler DS.L 1 ; [192] load docking handler, if any
jTurnOffBarIO DS.L 1 ; [196] turn off bar I/O (clocks, etc.)
jTurnOnBarIO DS.L 1 ; [200] turn on bar I/O
jAddVideoDevice DS.L 1 ; [204] add a video device on a new bar
jRegisterVideo DS.L 1 ; [208] register a new video device with the system
jRemoveVideo DS.L 1 ; [212] remove an existing video device from the system
jResolveSerialPorts DS.L 1 ; [216] resolve serial ports with CTB
jDockingSleepDenied DS.L 1 ; [220] routine to put up "can't sleep" message
jDockingWakeDenied DS.L 1 ; [224] routine to put up "can add this bar during sleep" message
jDockingFilter DS.L 1 ; [228] filterProc to pre-process docking attributes
jGracefulShutdown DS.L 1 ; [232] have the Finder shut us down, closing all apps
DockingGlobalSIze EQU *-DockingGlobRec ; [236] size of globals
ejectVBLCount EQU 2*60 ; check for eject every 2 seconds
; bit definitions in dockingFlags
dockSleepAddition EQU 0 ; bar was added during sleep
dockForceRemoval EQU 1 ; force removal of bar user tried to add during sleep
; bit definitions in dockingEjectFlags
dockShuttingDown EQU 6 ; in the process of shutting down
dockEjectPressed EQU 7 ; user has pressed eject button
ENDR
; Comm Toolbox equates for ResolveSerialPorts
CTB_ModemIconID EQU -32512 ; modem port's icon ID
CTB_PrinterIconID EQU -32511 ; printer port's icon ID
MACRO
_CTBAddPort
MOVE.W #$0527,-(SP)
MOVEA.L SP,A0
_CommToolboxDispatch
ADDQ.W #4,SP
ENDM
MACRO
_CTBRemovePort
MOVE.W #$0528,-(SP)
MOVEA.L SP,A0
_CommToolboxDispatch
ADDQ.W #4,SP
ENDM
ENDIF ; {__DockingEquates__}