; Copyright 1996 Acorn Computers Ltd
;
; Licensed under the Apache License, Version 2.0 (the "License");
; you may not use this file except in compliance with the License.
; You may obtain a copy of the License at
;
;     http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing, software
; distributed under the License is distributed on an "AS IS" BASIS,
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
;
        SUBT    Exported Portable constants

OldOpt  SETA    {OPT}
        OPT     OptNoList+OptNoP1List

; ***********************************
; ***    C h a n g e   L i s t    ***
; ***********************************

; Date       Name  Description
; ----       ----  -----------
; 25-Apr-91  TMD   File created
; 18-Nov-91  TMD   Added Portable_Control and associated bits
; 06-Dec-91  CDP   Added SWIs ReadBMUVariable, WriteBMUVariable, CommandBMU
;                  and definitions of BMU flags, variables and commands
; 11-Dec-91  TMD   Merged SerialEnable and SerialBufferEnable into one bit (bit 3)
;                  Removed parallel bit
; 29-Jan-92  CDP   Added PortableBMUC_SetAutostart.
; 02-Apr-92  CDP   Added PortableBMUV_ChargeRate.
;                  Renamed PortableBMUV_NominalLife, _MeasuredLife, _UsedLife
;                  to _UsableCapacity, _Reserved, _ChargeEstimate.
; 15-Feb-94  RCM   Added SWIs ReadFeatures, Idle and Stop for MORRIS based machines.
; 17-May-94  AMcC  Changed to using the preferred SWI base and name symbols
; 19-May-94  AMcC  Save & Restore listing options (OldOpt, OPT)
; 21-Jul-94  RCM   Added PortableControl_ParallelEnable
; 04-Aug-94  RCM   Added PortableControl_PCMCIAEnable
;                  Added PortableControl_IDEEnable
; 12-Aug-94  RCM   Added PortableBMUF_Threshold_3
; 28-Apr-98  amg   Added SWI SMBusOp and PortableFeature_SMBusOp for IMS


SWIClass        SETS    PortableSWI_Name

        ^       PortableSWI_Base

        AddSWI  Speed                   ; &42FC0
        AddSWI  Control                 ; &42FC1
        AddSWI  ReadBMUVariable         ; &42FC2
        AddSWI  WriteBMUVariable        ; &42FC3
        AddSWI  CommandBMU              ; &42FC4

PortableSWICheckValue * @               ;RCM says: this line in wrong place, but leave it here for now!
        AddSWI  ReadFeatures            ; &42FC5
        AddSWI  Idle                    ; &42FC6
        AddSWI  Stop                    ; &42FC7
        AddSWI  Status                  ; &42FC8
        AddSWI  Contrast                ; &42FC9 |
        AddSWI  Refresh                 ; &42FCA | conditioned out in source
        AddSWI  Halt                    ; &42FCB |
        AddSWI  SleepTime               ; &42FCC |
        AddSWI  SMBusOp                 ; &42FCD (IMS) 9-C conditioned out in file s.StPortable
        AddSWI  Speed2                  ; &42FCE } Reserved for PortableHAL
        AddSWI  WakeTime                ; &42FCF } use


; Sub-reason codes (in r2) for Service_Portable

ServicePortable_PowerDown       *       0       ; Power about to be removed from some ports
ServicePortable_PowerUp         *       1       ; Power has been reapplied to some ports
ServicePortable_TidyUp          *       2       ; Issued by Econet if it can't powerdown due to outstanding RxCBs
ServicePortable_Freeze          *       3       ; Issued on entry to SWI Portable_Stop
ServicePortable_Unfreeze        *       4       ; Issued on exit from SWI Portable_Stop
ServicePortable_FreezeRequest   *       5       ; Preceedes ServicePortable_Freeze


PortableControl_EconetEnable    *       1 :SHL: 0
PortableControl_LCDEnable       *       1 :SHL: 1
PortableControl_VideoEnable     *       1 :SHL: 2
PortableControl_SerialEnable    *       1 :SHL: 3       ; enable serial buffers and oscillator

PortableControl_DualEnable      *       1 :SHL: 4
PortableControl_ClockBits       *       3 :SHL: 5       ; control which clock is fed to VIDC
PortableControl_ExtClock        *       0 :SHL: 5       ; use external clock (from IOEB)
PortableControl_Crys2Clock      *       1 :SHL: 5       ; use crystal clock divided by 2
PortableControl_CrysClock       *       2 :SHL: 5       ; use crystal clock
PortableControl_InvertClock     *       1 :SHL: 7

PortableControl_BacklightEnable *       1 :SHL: 8

PortableControl_ExtraLines      *       1 :SHL: 9
PortableControl_ExtraLines1     *       0 :SHL: 9
PortableControl_ExtraLines2     *       1 :SHL: 9

PortableControl_DRAMs           *       1 :SHL: 10
PortableControl_DRAMs1          *       0 :SHL: 10
PortableControl_DRAMs2          *       1 :SHL: 10

PortableControl_SoundEnable     *       1 :SHL: 11      ; enable filters and amplifiers (new for Stork)
PortableControl_PCMCIAEnable    *       1 :SHL: 12      ; enable PCMCIA hardware (new for Stork)
PortableControl_ParallelEnable  *       1 :SHL: 13      ; enable parallel port (new for Stork)
PortableControl_FDCEnable       *       1 :SHL: 14      ; enable FDC oscillator
PortableControl_IDEEnable       *       1 :SHL: 15      ; enable IDE hard disc (new for Stork)

PortableControl_LCDInvert       *       1 :SHL: 16
PortableControl_IntTBallEnable  *       1 :SHL: 17      ;internal trackerball enabled } mutually
PortableControl_ExtMouseEnable  *       1 :SHL: 18      ;external mouse port enabled  } exclusive
PortableControl_ExtPowerEnable  *       1 :SHL: 19      ;power to external keyboard and mouse


; BMU flags

PortableBMUF_ChargerPresent     *       1 << 7
PortableBMUF_BatteryPresent     *       1 << 6
PortableBMUF_ChargeKnown        *       1 << 5
PortableBMUF_ChargeFault        *       1 << 4
PortableBMUF_Threshold_1        *       1 << 3                  ;Battery low  - warn user
PortableBMUF_Threshold_2        *       1 << 2                  ;Battery flat - shutdown now
PortableBMUF_LidOpen            *       1 << 1
PortableBMUF_Threshold_3        *       1 << 0  ;New for Stork  ;Battery charged


; BMU commands
                                ^       1
PortableBMU_Min_Command         #       0
PortableBMUC_RemovePower        #       1
PortableBMUC_SetPartCharge      #       1
PortableBMUC_SetFullCharge      #       1
PortableBMUC_SetAutostart       #       1
PortableBMUC_DisconnectCharger  #       1       ;New for Stork
PortableBMUC_ConnectCharger     #       1       ;New for Stork
PortableBMUC_DisablePMInts      #       1       ;New for Stork  ; Disable } reporting of battery
PortableBMUC_EnablePMInts       #       1       ;New for Stork  ; Enable  } state by interrupt

PortableBMU_Num_Commands        #       0


; BMU variables
                                ^       0
PortableBMU_Min_Variable        #       0
PortableBMUV_VersionNumber      #       1 ; 0
PortableBMUV_NominalCapacity    #       1 ; 1
PortableBMUV_MeasuredCapacity   #       1 ; 2
PortableBMUV_UsedCapacity       #       1 ; 3
PortableBMUV_UsableCapacity     #       1 ; 4
PortableBMUV_Reserved           #       1 ; 5
PortableBMUV_ChargeEstimate     #       1 ; 6
PortableBMUV_Voltage            #       1 ; 7
PortableBMUV_Current            #       1 ; 8
PortableBMUV_Temperature        #       1 ; 9
PortableBMUV_Flags              #       1 ;10
PortableBMUV_ChargeRate         #       1 ;11
;
; Stork variables
;
PortableBMUVar_ChargeCurrent    #       1 ;12
PortableBMUVar_DischargeCurrent #       1 ;13
PortableBMUVar_Voltage          #       1 ;14
PortableBMUVar_Temperature1     #       1 ;15
PortableBMUVar_Temperature2     #       1 ;16
PortableBMUVar_ChargeLevel      #       1 ;17
PortableBMUVar_StatusFlags      #       1 ;18
PortableBMUVar_InputSignals     #       1 ;19
PortableBMUVar_BatteryCapacity  #       1 ;20
;
PortableBMU_Num_Variables       #       0

PortableFeature_Speed           *       1 :SHL: 0
PortableFeature_Idle            *       1 :SHL: 4
PortableFeature_Stop            *       1 :SHL: 5
PortableFeature_SMBusOp         *       1 :SHL: 6 ; used by IMS

PortableStatus_DocStationConnected *    1 :SHL: 0
PortableStatus_PrinterFloppy    *       1 :SHL: 1
PortableStatus_LCDOn            *       1 :SHL: 3

 [ :DEF: MorrisSupport :LAND: :DEF: IOMD_Base
;******************************************************************************
;
; Hardware latches in PCMCIA ASIC and Morris that control
; power switching and other misc. functions on Stork.
;
HWLatchPA                       EQU     &03240000 + &68         ;PCMCIA I/O_A
HWLatchPB                       EQU     &03240000 + &70         ;PCMCIA I/O_B
HWLatchMC                       EQU     IOMD_Base + IOMD_CLINES ;MORRIS IOP
HWLatchMA                       EQU     IOMD_Base + &E8         ;MORRIS AtoD

;
; Initial values used by the Kernel to turn all the hardware on.
;
InitLatchPA                     EQU     2_00011111      ; __i11111
InitLatchPB                     EQU     2_00001100      ; ___011_i ExtMouse ExtPwr
InitLatchMC                     EQU     2_11111111      ; 111_i_11 LCDoff
InitLatchMA                     EQU     2_00010000      ; ___1____ SoundOn
 ]
;******************************************************************************
;
; 'Hot keys' defined for Stork
;
 [ 1 = 1
; Implemented by !BatMgr
;
HotKey_ToolBox                  EQU     &75     ;Open Apps directory
HotKey_Heart                    EQU     &7A     ;Run favourite application
HotKey_Battery                  EQU     &74     ;Toggle BatMgr icon on/off the iconbar
HotKey_On                       EQU     &6E     ;On/unfreeze - no action needed
HotKey_Off                      EQU     &6F     ;Shutdown machine
;
; Implemented by Portable module
;
HotKey_ContrastDown             EQU     &77
HotKey_ContrastUp               EQU     &76
HotKey_BrightnessDown           EQU     &79
HotKey_BrightnessUp             EQU     &78
HotKey_Freeze                   EQU     &7B
HotKey_MonLCD                   EQU     &7C     ;Toggle between LCD and external monitor
HotKey_InvertVideo              EQU     &7D
HotKey_AccessLock               EQU     &7F
HotKey_DimBrightness            EQU     &73
 |
;
; Implemented by !BatMgr
;
HotKey_ToolBox                  * &02 ;F2       ;Open Apps directory
HotKey_Heart                    * &07 ;F7       ;Run favourite application
HotKey_Battery                  * &01 ;F1       ;Toggle BatMgr icon on/off the iconbar
;
; Implemented by Portable module
;
HotKey_ContrastDown             * &03 ;F3
HotKey_ContrastUp               * &04 ;F4
HotKey_BrightnessDown           * &05 ;F5
HotKey_BrightnessUp             * &06 ;F6
HotKey_Freeze                   * &08 ;F8
HotKey_MonLCD                   * &09 ;F9       ;Toggle between LCD and external monitor
HotKey_InvertVideo              * &0A ;F10
HotKey_AccessLock               * &39 ;keypad 9 ;
HotKey_DimBrightness            * &0B ;F11
 ]
;******************************************************************************


        OPT     OldOpt
        END
