mac-rom/Drivers/Backlight/backlight.a
Elliot Nunn 5b0f0cc134 Bring in CubeE sources
Resource forks are included only for .rsrc files. These are DeRezzed into their data fork. 'ckid' resources, from the Projector VCS, are not included.

The Tools directory, containing mostly junk, is also excluded.
2017-12-26 10:02:57 +08:00

631 lines
21 KiB
Plaintext

;
; File: backlight.a
;
; Contains: backlight driver low level glue
;
; Written by: Andy Gong 4-6595
;
; Copyright: © 1990-1993 by Apple Computer, Inc., all rights reserved.
;
; Change History (most recent first):
;
; <SM4> 12/13/93 PN Roll in KAOs and Horror changes to support Malcom and AJ
; machines
; <SM3> 11/8/93 JRH boxDBLite16 is now boxPowerBookDuo250. boxDBLite20 is now
; boxPenLite. boxEscher25 is now boxYeagerFSTN. boxEscher33 is now
; boxPowerBookDuo270C.
; <SM2> 2/11/93 CSS Updated some code names to real names, and include
; boxflags from InternalOnlyEqu.a rather than from
; backlightequ.a. Update from Horror. Comments follow:
; <H10> 1/21/93 RLE add support for Escher
; <H9> 7/13/92 SWC Yet another pass at the DBLite table. Deja vu, eh?
; <H8> 6/30/92 ag Added cpu info tables for cpu dependent information.
; <H7> 5/7/92 ag Changed the structure of the backlight tables. Included in the
; tables are a header which indicates the minimun and maximum
; values.
; <H6> 4/10/92 SWC Yet another pass at the DBLite table.
; <H5> 3/4/92 SWC Next pass at the DBLite table.
; <H4> 2/12/92 SWC Changed the DB-Lite table limits to have a narrower range of
; values.
; <H3> 9/10/91 SWC Changed the DB-Lite table to have a span of 0..127 instead of
; 0..255 since the backlight values don't go that high.
; <H2> 8/26/91 SWC Added a PWM lookup table for DB-Lite.
; <9> 10/28/91 SAM Rolled in Regatta file.
;
; Regatta Change History:
;
; <6> 8/29/91 SAM (ag) changed asahi look up table to avoid 1-4 because the new
; backlight sometimes flickers at these settings.
; <5> 7/18/91 SAM (ag) added asahi look up table.
; <4> 6/30/91 SAM Merged from Terror [<3><4>]
; <3> 6/14/91 SAM (ag) added new table for low power scaling.
; <1> 5/15/91 SAM Split off from TERRORProj.;
;
; Change History 7.0:
;
; <8> 11/10/90 ag added 5 volt table
; <7> 11/8/90 ag changed range of table because of reduced slider range. slider
; is 0 to 29 now
; <6> 11/7/90 ag bump up maximum value
; <5> 9/25/90 ag added sleep queue entry point for turning on and off the
; backlight during wakeup and sleep.
; <4> 9/12/90 ag Added backlight setting lookup table to increase backlight
; brightness
; <3> 8/29/90 ag added lookup table for the brightness values.
; <1+> 8/15/90 ag removing sleep stuff
; 90/03/15 ag new today
;
; To Do:
;
;_______________________________________________________________________
BLANKS ON
PRINT OFF
INCLUDE 'SysEqu.a'
INCLUDE 'SysErr.a'
INCLUDE 'HardwarePrivateEqu.a'
INCLUDE 'PowerPrivEqu.a'
INCLUDE 'Traps.a'
INCLUDE 'InternalOnlyEqu.a' ; <SM2> CSS
INCLUDE 'backlightequ.a'
PRINT ON
CASE OBJECT
MACHINE MC68020
IMPORT VBL_Task
IMPORT Sleep_Task
STRING PASCAL
;-----------------------------------------------------------------------------------
; glue for vbl task
;
;
;
VBLEntry PROC EXPORT
move.l a0,-(sp) ; param block
jsr VBL_Task
move.l (sp)+,a0 ; param block
rts
;-----------------------------------------------------------------------------------
;
;
;
;
SleepEntry PROC EXPORT
move.l d0,-(sp) ; sleep selector
move.l a0,-(sp) ; parameter block pointer
jsr Sleep_Task ; call sleep task
move.l (sp)+,a0
move.l (sp)+,d0
clr.l d0
rts ;
;--------------------------------------------------------------------------------------------------------------
;
GetBkltPrimInfo proc export
with PmgrRec,PmgrPrimitivesRec
movea.l PmgrBase,a0 ; point to power manager globals
LoadTbl BklightTblPtr,a0,a0 ; get backlight table pointer in a0
move.l a0,d0 ; move pointer to d0 for C return
rts
END
;-----------------------------------------------------------------------------------
;
PortableTable7V PROC EXPORT
dc.w 0 ; minimum value <H7>
dc.w @end - @start ; <H7>
@start dc.b 0 ; 0 <H7>
dc.b 1 ; 1
dc.b 2 ; 2
dc.b 3 ; 3
dc.b 4 ; 4
dc.b 5 ; 5
dc.b 6 ; 6
dc.b 7 ; 7
dc.b 8 ; 8
dc.b 9 ; 9
dc.b 10 ; 10
dc.b 11 ; 11
dc.b 12 ; 12
dc.b 13 ; 13
dc.b 14 ; 14
dc.b 15 ; 15
dc.b 16 ; 16
dc.b 17 ; 17
dc.b 18 ; 18
dc.b 19 ; 19
dc.b 20 ; 20
dc.b 21 ; 21
dc.b 22 ; 22
dc.b 23 ; 23
dc.b 25 ; 24
dc.b 28 ; 25
dc.b 32 ; 26
dc.b 36 ; 27
dc.b 40 ; 28
dc.b 45 ; 29
@end dc.b 50 ; 30 <H7>
;--------------------------------------------------------------------------------------------------------------
;
PortableTbl5V PROC EXPORT
dc.w 0 ; minimum value <H7>
dc.w @end - @start ; <H7>
@start
dc.b 0 ; 0 <H7>
dc.b 2 ; 1
dc.b 5 ; 2
dc.b 7 ; 3
dc.b 9 ; 4
dc.b 11 ; 5
dc.b 13 ; 6
dc.b 15 ; 7
dc.b 17 ; 8
dc.b 19 ; 9
dc.b 21 ; 10
dc.b 23 ; 11
dc.b 25 ; 12
dc.b 27 ; 13
dc.b 29 ; 14
dc.b 31 ; 15
dc.b 33 ; 16
dc.b 35 ; 17
dc.b 37 ; 18
dc.b 39 ; 19
dc.b 42 ; 20
dc.b 45 ; 21
dc.b 48 ; 22
dc.b 51 ; 23
dc.b 54 ; 24
dc.b 58 ; 25
dc.b 62 ; 26
dc.b 66 ; 27
dc.b 70 ; 28
dc.b 75 ; 29
@end dc.b 80 ; 30 <H7>
;--------------------------------------------------------------------------------------------------------------
;
asahiTbl PROC EXPORT
dc.w 0 ; minimum value <H7>
dc.w @end - @start ; <H7>
@start dc.b 0 ; 0 <H7>
dc.b 1 ; 1
dc.b 2 ; 2
dc.b 3 ; 3
dc.b 4 ; 4
dc.b 5 ; 5
dc.b 6 ; 6
dc.b 7 ; 7
dc.b 8 ; 8
dc.b 9 ; 9
dc.b 10 ; 10
dc.b 11 ; 11
dc.b 12 ; 12
dc.b 13 ; 13
dc.b 14 ; 14
dc.b 15 ; 15
dc.b 16 ; 16
dc.b 17 ; 17
dc.b 18 ; 18
dc.b 19 ; 19
dc.b 20 ; 20
dc.b 21 ; 21
dc.b 22 ; 22
dc.b 23 ; 23
dc.b 24 ; 24
dc.b 25 ; 25
dc.b 26 ; 26
dc.b 27 ; 27
dc.b 28 ; 28
dc.b 29 ; 29
dc.b 30 ; 30
@end dc.b 31 ; 31 <H7>
;--------------------------------------------------------------------------------------------------------------
;
timTbl PROC EXPORT
dc.w 0 ; minimum value <H7>
dc.w @end - @start ; <H7>
@start dc.b 31 ; 0 <H7>
dc.b 30 ; 1
dc.b 29 ; 2
dc.b 28 ; 3
dc.b 27 ; 4
dc.b 26 ; 5
dc.b 25 ; 6
dc.b 24 ; 7
dc.b 23 ; 8
dc.b 22 ; 9
dc.b 21 ; 10
dc.b 20 ; 11
dc.b 19 ; 12
dc.b 18 ; 13
dc.b 17 ; 14
dc.b 16 ; 15
dc.b 15 ; 16
dc.b 14 ; 17
dc.b 13 ; 18
dc.b 12 ; 19
dc.b 11 ; 20
dc.b 10 ; 21
dc.b 9 ; 22
dc.b 8 ; 23
dc.b 7 ; 24
dc.b 6 ; 25
dc.b 5 ; 26
dc.b 4 ; 27
dc.b 3 ; 28
dc.b 2 ; 29
dc.b 1 ; 30
@end dc.b 0 ; 31 <H7>
;--------------------------------------------------------------------------------------------------------------
;
timTblLow PROC EXPORT
dc.w 0 ; minimum value <H7>
dc.w @end - @start ; <H7>
@start dc.b 31 ; 0 <H7>
dc.b 30 ; 1
dc.b 30 ; 2
dc.b 29 ; 3
dc.b 28 ; 4
dc.b 28 ; 5
dc.b 27 ; 6
dc.b 26 ; 7
dc.b 25 ; 8
dc.b 25 ; 9
dc.b 24 ; 10
dc.b 23 ; 11
dc.b 22 ; 12
dc.b 22 ; 13
dc.b 21 ; 14
dc.b 20 ; 15
dc.b 20 ; 16
dc.b 19 ; 17
dc.b 18 ; 18
dc.b 17 ; 19
dc.b 17 ; 20
dc.b 16 ; 21
dc.b 15 ; 22
dc.b 14 ; 23
dc.b 14 ; 24
dc.b 13 ; 25
dc.b 12 ; 26
dc.b 11 ; 27
dc.b 11 ; 28
dc.b 11 ; 29
dc.b 10 ; 30
@end dc.b 10 ; 31 <H7>
;--------------------------------------------------------------------------------------------------------------
;
PortableMaxTbl PROC EXPORT ; power range
dc.w 30 ; 0
dc.w 15 ; 1
dc.w 15 ; 2
dc.w 7 ; 3
dc.w 3 ; 4
;--------------------------------------------------------------------------------------------------------------
;
PWMMaxTbl PROC EXPORT
dc.w 31 ; 0
dc.w 15 ; 1
dc.w 15 ; 2
dc.w 7 ; 3
dc.w 3 ; 4
;--------------------------------------------------------------------------------------------------------------
;
PotInputRangeShiftTblPWM PROC EXPORT
dc.w 0 ; 0
dc.w 1 ; 1
dc.w 1 ; 2
dc.w 2 ; 3
dc.w 3 ; 4
;--------------------------------------------------------------------------------------------------------------
;
dbTbl PROC EXPORT ; <H2>
dc.w 0 ; minimum value <H7>
dc.w @end - @start ; <H7>
@start DC.B 127 ; 0 <H7>
DC.B 89 ; 1
DC.B 87 ; 2
DC.B 86 ; 3
DC.B 84 ; 4
DC.B 82 ; 5
DC.B 81 ; 6
DC.B 79 ; 7
DC.B 77 ; 8
DC.B 76 ; 9
DC.B 74 ; 10
DC.B 71 ; 11
DC.B 69 ; 12
DC.B 67 ; 13
DC.B 66 ; 14
DC.B 64 ; 15
DC.B 62 ; 16
DC.B 61 ; 17
DC.B 59 ; 18
DC.B 57 ; 19
DC.B 56 ; 20
DC.B 54 ; 21
DC.B 52 ; 22
DC.B 51 ; 23
DC.B 49 ; 24
DC.B 47 ; 25
DC.B 46 ; 26
DC.B 44 ; 27
DC.B 42 ; 28
DC.B 41 ; 29
DC.B 39 ; 30
@end DC.B 38 ; 31 <H7>
;--------------------------------------------------------------------------------------------------------------
;
DartTable proc export
dc.w 0 ; minimum value
dc.w @end - @start
@start dc.b 3 ; 0
dc.b 2 ; 1
dc.b 1 ; 2
@end dc.b 0 ; 3
;
;
DartMaxTbl PROC EXPORT ; power range
dc.w 3 ; 0
dc.w 2 ; 1
dc.w 2 ; 2
dc.w 1 ; 3
dc.w 0 ; 4
;--------------------------------------------------------------------------------------------------------------
;
; generic exit for non-supported functions
;
StandardExit PROC EXPORT
rts
;--------------------------------------------------------------------------------------------------------------
;
; list to supported cpu's (boxflags)
;
cpuTable PROC EXPORT
dc.w boxPortable
dc.l Portableinfo - cpuTable
dc.w boxPowerBook100
dc.l PowerBook100info - cpuTable
dc.w boxPowerBookDuo250 ; <SM3>
dc.l PowerBookDuoinfo - cpuTable
dc.w boxDBLite20
dc.l PowerBookDuoinfo - cpuTable
dc.w boxPowerBookDuo210
dc.l PowerBookDuoinfo - cpuTable
dc.w boxPowerBookDuo230
dc.l PowerBookDuoinfo - cpuTable
dc.w boxPowerBook140 ; cpu id
dc.l PowerBook170info - cpuTable
dc.w boxPowerBook170 ; cpu id
dc.l PowerBook170info - cpuTable
dc.w boxPowerBook180
dc.l PowerBook180info - cpuTable
dc.w boxPowerBook160
dc.l PowerBook180info - cpuTable
dc.w boxYeagerFSTN ; <SM3>
dc.l PowerBookDuoinfo - cpuTable
dc.w boxPowerBookDuo270C ; <SM3>
dc.l PowerBookDuoinfo - cpuTable
dc.w -1
;--------------------------------------------------------------------------------------------------------------
;
;
import StandardExit
import SetBrightness,KbdControl,InitRegControls,RegisterClose,RegisterControl,RegisterStatus
import SetPWM,PotControl,InitPWMControls,PWMCloseRoutine,PWMControl,GenericStatus,PortableBacklightValue
import SetDart,GetDart,InitTimControls,InitDartControls,PowerMgrPot,ChargerAdjust
import PGE_button
with backlightflags
;--------------------------------------------------------------------------------------------------------------
;
;
Portableinfo
dc.l (0 << disableHWinput)\ ; operating flag (stops user input)
+(0 << kbdactive)\ ; operating flag (kbd control inprogress)
+(1 << vbl_ok)\ ; operating flag (allow vbl operations)
+(0 << flyByWire)\ ; config flag (hardware input)
+(0 << freeflag)\ ; (n/a) unused flag
+(0 << dualTable)\ ; config flag (use multi tables)
+(0 << lowTable)\ ; operating flag (currently using low table)
+(0 << slewChange) ; operating flag (table transition inprogress)
dc.l SetBrightness - Portableinfo ; set routine
dc.l KbdControl - Portableinfo ; get user input routine
dc.l InitRegControls - Portableinfo ; initialization routine
dc.l RegisterClose - Portableinfo ; close routine
dc.l RegisterControl - Portableinfo ; control routine
dc.l RegisterStatus - Portableinfo ; status routine
dc.l StandardExit - Portableinfo ; (n/a) charger state change routine
dc.l PortableMaxTbl - Portableinfo ; table of maximum value for different power ranges
dc.l PortableTable7V - Portableinfo ; low range table
dc.l PortableTable7V - Portableinfo ; high range table
dc.l PowerMgrPot - Portableinfo ; hardware dependent var
dc.w 1 ; vbl count SampleRate
dc.w 0 ; (n/a) lowThreshold
dc.w 0 ; (n/a) hiThreshold
;--------------------------------------------------------------------------------------------------------------
;
;
PowerBook100info
dc.l (0 << disableHWinput)\ ; operating flag (stops user input)
+(0 << kbdactive)\ ; operating flag (kbd control inprogress)
+(1 << vbl_ok)\ ; operating flag (allow vbl operations)
+(1 << flyByWire)\ ; config flag (hardware input)
+(0 << freeflag)\ ; unused flag
+(0 << dualTable)\ ; config flag (use multi tables)
+(0 << lowTable)\ ; operating flag (currently using low table)
+(0 << slewChange) ; operating flag (table transition inprogress)
dc.l SetPWM - PowerBook100info ; set routine
dc.l PotControl - PowerBook100info ; get user input routine
dc.l InitPWMControls - PowerBook100info ; initialization routine
dc.l PWMCloseRoutine - PowerBook100info ; close routine
dc.l PWMControl - PowerBook100info ; control routine
dc.l GenericStatus - PowerBook100info ; status routine
dc.l StandardExit - PowerBook100info ; (n/a) charger state change routine
dc.l PWMMaxTbl - PowerBook100info ; table of maximum value for different power ranges
dc.l asahiTbl - PowerBook100info ; low range table
dc.l asahiTbl - PowerBook100info ; high range table
dc.l PortableBacklightValue- PowerBook100info; hardware dependent var
dc.w 10 ; vbl count SampleRate
dc.w 0 ; (n/a) lowThreshold
dc.w 0 ; (n/a) hiThreshold
;--------------------------------------------------------------------------------------------------------------
;
;
HITABLETHRESHOLD170 equ (685 - 512)
LOWTABLETHRESHOLD170 equ (675 - 512)
PowerBook170info
dc.l (0 << disableHWinput)\ ; operating flag (stops user input)
+(0 << kbdactive)\ ; (n/a) operating flag (kbd control inprogress)
+(1 << vbl_ok)\ ; operating flag (allow vbl operations)
+(1 << flyByWire)\ ; config flag (hardware input)
+(1 << freeflag)\ ; (n/a)
+(0 << dualTable)\ ; config flag (use multi tables)
+(0 << lowTable)\ ; operating flag (currently using low table)
+(0 << slewChange) ; operating flag (table transition inprogress)
dc.l SetPWM - PowerBook170info ; set routine
dc.l PotControl - PowerBook170info ; get user input routine
dc.l InitTimControls - PowerBook170info ; initialization routine
dc.l PWMCloseRoutine - PowerBook170info ; close routine
dc.l PWMControl - PowerBook170info ; control routine
dc.l GenericStatus - PowerBook170info ; status routine
dc.l ChargerAdjust - PowerBook170info ; charger state change routine
dc.l PWMMaxTbl - PowerBook170info ; table of maximum value for different power ranges
dc.l timTblLow - PowerBook170info ; low range table
dc.l timTbl - PowerBook170info ; high range table
dc.l PowerMgrPot - PowerBook170info ; hardware dependent var
dc.w 10 ; vbl count SampleRate
dc.w LOWTABLETHRESHOLD170 ; voltage threshold before switching from high to low table
dc.w HITABLETHRESHOLD170 ; voltage threshold before switching from low to high table
;--------------------------------------------------------------------------------------------------------------
;
;
PowerBook180info
dc.l (0 << disableHWinput)\ ; operating flag (stops user input)
+(0 << kbdactive)\ ; (n/a) operating flag (kbd control inprogress)
+(1 << vbl_ok)\ ; operating flag (allow vbl operations)
+(1 << flyByWire)\ ; config flag (hardware input)
+(1 << freeflag)\ ; (n/a)
+(1 << dualTable)\ ; config flag (use multi tables)
+(0 << lowTable)\ ; operating flag (currently using low table)
+(0 << slewChange) ; operating flag (table transition inprogress)
dc.l SetPWM - PowerBook180info ; set routine
dc.l PotControl - PowerBook180info ; get user input routine
dc.l InitPWMControls - PowerBook180info ; initialization routine
dc.l PWMCloseRoutine - PowerBook180info ; close routine
dc.l PWMControl - PowerBook180info ; control routine
dc.l GenericStatus - PowerBook180info ; status routine
dc.l ChargerAdjust - PowerBook180info ; charger state change routine
dc.l PWMMaxTbl - PowerBook180info ; table of maximum value for different power ranges
dc.l timTblLow - PowerBook180info ; low range table
dc.l timTbl - PowerBook180info ; high range table
dc.l PowerMgrPot - PowerBook180info ; hardware dependent var
dc.w 10 ; vbl count SampleRate
dc.w LOWTABLETHRESHOLD170 ; voltage threshold before switching from high to low table
dc.w HITABLETHRESHOLD170 ; voltage threshold before switching from low to high table
PowerBook180infoHWControl
dc.l (0 << disableHWinput)\ ; operating flag (stops user input)
+(0 << kbdactive)\ ; operating flag (kbd control inprogress)
+(1 << vbl_ok)\ ; operating flag (allow vbl operations)
+(1 << flyByWire)\ ; config flag (hardware input)
+(1 << freeflag)\
+(0 << dualTable)\ ; config flag (use multi tables)
+(0 << lowTable)\ ; operating flag (currently using low table)
+(0 << slewChange) ; operating flag (table transition inprogress)
dc.l SetPWM - PowerBook180info ; set routine
dc.l PotControl - PowerBook180info ; get user input routine
dc.l InitDartControls - PowerBook180info ; initialization routine
dc.l PWMCloseRoutine - PowerBook180info ; close routine
dc.l PWMControl - PowerBook180info ; control routine
dc.l GenericStatus - PowerBook180info ; status routine
dc.l 0 ; (n/a) charger state change routine
dc.l DartMaxTbl - PowerBook180info ; table of maximum value for different power ranges
dc.l DartTable - PowerBook180info ; low range table
dc.l DartTable - PowerBook180info ; high range table
dc.l PowerMgrPot - PowerBook180info ; hardware dependent var
dc.w 10 ; vbl count SampleRate
dc.w 0 ; (n/a) lowThreshold
dc.w 0 ; (n/a) hiThreshold
;--------------------------------------------------------------------------------------------------------------
;
;
PowerBookDuoinfo
dc.l (0 << disableHWinput)\ ; operating flag (stops user input)
+(0 << kbdactive)\ ; operating flag (kbd control inprogress)
+(1 << vbl_ok)\ ; operating flag (allow vbl operations)
+(1 << flyByWire)\ ; config flag (hardware input)
+(1 << freeflag)\
+(0 << dualTable)\ ; config flag (use multi tables)
+(0 << lowTable)\ ; operating flag (currently using low table)
+(0 << slewChange) ; operating flag (table transition inprogress)
dc.l SetPWM - PowerBookDuoinfo ; set routine
dc.l PotControl - PowerBookDuoinfo ; get user input routine
dc.l InitPWMControls - PowerBookDuoinfo ; initialize routine
dc.l PWMCloseRoutine - PowerBookDuoinfo ; close routine
dc.l PWMControl - PowerBookDuoinfo ; control routine
dc.l GenericStatus - PowerBookDuoinfo ; status routine
dc.l StandardExit - PowerBookDuoinfo ; (n/a) charger state change routine
dc.l PWMMaxTbl - PowerBookDuoinfo ; table of maximum value for different power ranges
dc.l dbTbl - PowerBookDuoinfo ; low range table
dc.l dbTbl - PowerBookDuoinfo ; high range table
dc.l PGE_button - PowerBookDuoinfo ; hardware dependent var
dc.w 10 ; vbl count SampleRate
dc.w 0 ; (n/a) lowThreshold
dc.w 0 ; (n/a) hiThreshold
END