The Portable module

Introduction

This module provides support for portable machines. The SWIs listed are not normally intended to be issued from user programs, they will normally be issued by other modules in the system.

Service Calls

Service_PortableService Call &8A
Portable state change request, or information
R1=&8A (service number)
R2=Sub-reason code:
ValueMeaning
0Hardware is about to be powered down
1Hardware has been powered up
2Tidy up
3Device is about to enter a stopped state (frozen)
4Device has left stopped state (awakened)
5Device wishes to be stopped (frozen)
6+Reserved for future expansion
R3=Bit mask of which ports are being powered down (if R2 = 0) (each bit set indicates port is being powered down) or bit mask of which ports have been powered up (if R2 = 1) (each bit set indicates port has been powered up)
R1=0 if R3 = 0, else preserved to pass on
R2=Preserved
R3=Bit mask of which ports may be powered down or up (each bit set indicates no objection to change of state)

This call is issued before power is removed or after power is reapplied to the following:

  • Econet (bit 0)
  • serial buffer/oscillator (bit 3)
  • FDC oscillator (bit 14)

If a module wishes to prevent hardware being powered down it should clear the appropriate bit or bits in R3. In addition, if the resulting value in R3 is now zero, the module should claim the service by setting R1 to zero. (This is to prevent the call being unnecessarily passed round the rest of the modules). Otherwise the service should be passed on by preserving R1.

This service call should never be claimed.

Service_Portable 0Portable_PowerDownService Call &8A
Hardware is about to be powered down
R1=&8A (service number)
R2=Sub-reason code (0)
R3=Bit mask of which ports are being powered down (each bit set indicates port is being powered down)
R1=0 if R3 = 0, else preserved to pass on
R2=Preserved
R3=Bit mask of which ports may be powered down (each bit set indicates no objection to change of state)

This call is issued before power is removed from the following:

  • Econet (bit 0)
  • serial buffer/oscillator (bit 3)
  • FDC oscillator (bit 14)

If a module wishes to prevent hardware being powered down it should clear the appropriate bit or bits in R3. In addition, if the resulting value in R3 is now zero, the module should claim the service by setting R1 to zero. (This is to prevent the call being unnecessarily passed round the rest of the modules). Otherwise the service should be passed on by preserving R1.

This service call should never be claimed.

Service_Portable 1Portable_PowerUpService Call &8A
Hardware has been powered up
R1=&8A (service number)
R2=Sub-reason code (1)
R3=Bit mask of which ports have been powered up (each bit set indicates port has been powered up)
R1=0 if R3 = 0, else preserved to pass on
R2=Preserved
R3=Preserved

This call is issued after power is reapplied to the following:

  • Econet (bit 0)
  • serial buffer/oscillator (bit 3)
  • FDC oscillator (bit 14)

The service should be passed on by preserving R1.

Service_Portable 3Portable_FreezingService Call &8A
Device is about to enter a stopped state (frozen)
R1=&8A (service number)
R2=Sub-reason code (3)
R1 - R2=Preserved

This call is issued before the device is put into a stopped mode where the CPU core has been disabled. RAM continues to be refreshed and the system will probably be woken up at some future point. It is possible that the power may fail on the device before it is awakened. In such cases, the device may next be activated from a hard reset condition.

Service_Portable 4Portable_AwakenedService Call &8A
Device has left stopped state (awakened)
R1=&8A (service number)
R2=Sub-reason code (4)
R3=Failure code:
ValueMeaning
0Freeze was successful and has now returned
1Freeze failed to halt IDE devices
2Freeze failed to halt sound system
3Freeze failed to halt display
4Freeze failed to halt other devices (FDC, Econet, etc)
5Freeze failed to halt some device
6Freeze failed to enter the suspend state
7+Reserved failure states for future expansion
R1 - R3=Preserved

This call is issued after the device returns from a stopped state. It may never have physically stopped the CPU if some part of the system failed to be shut down. In such cases, it may not be necessary to fully resynchronise the environment - for example, network connections may still be active.

Service_Portable 5Portable_StopRequestService Call &8A
Device wishes to be stopped (frozen)
R1=&8A (service number)
R2=Sub-reason code (5)
R1=0 if call is being claimed to prevent freeze, preserved to accept freeze
R2=Preserved

This call is issued before the device is stopped. Any module wishing to object to the request may claim the service.

SWI Calls

Portable_SpeedSWI &42FC0
Control the processor speed
R0=EOR mask
R1=AND mask
R0=Old speed
R1=New speed:
ValueMeaning
0Fast
1Slow
Interrupts are undefined
Fast interrupts are undefined
Processor is in undefined mode
Not defined

This SWI controls the processor speed, which is reduced when the system is idle in order to save power.

The new speed is calculated as follows:

new speed = (old speed AND R1) EOR R0

Portable_ControlSWI &42FC1
Control various power control and miscellaneous bits
R0=EOR mask
R1=AND mask
R0=Old control
R1=New control
Interrupts are undefined
Fast interrupts are undefined
Processor is in undefined mode
Not defined

This SWI controls various power control and miscellaneous bits in the portable machine.

The new control is calculated as follows:

new control = (old control AND R1) EOR R0

The bits in control are as follows:

Bit(s)Meaning
0Power to Econet enabled
1Power to LCD display enabled
2Power to external video display enabled
3Power to serial buffer and oscillator enabled
4Dual panel mode enabled
5-6Video clock control:
ValueMeaning
0External clock input
1Crystal oscillator, divided by 2
2Crystal oscillator
3Reserved, do not use
7Invert video clock
8Back-light enabled
9Set: 2 extra lines on display. Clear: 1 extra line on display
10Set: 2 DRAMs used for dual panel. Clear: 1 DRAM used for dual panel
11-13Reserved
14Power to FDC oscillator enabled
15Reserved
16LCD palette set up for inverse video
17Internal tracker ball enabled
18External mouse enabled
19Power to external keyboard and mouse enabled
20-31Reserved

Reserved bits must not be modified, nor assumed to read any particular value.

Note that the 82C711 has one oscillator which is used by the serial sub-unit and by the floppy disc controller (FDC). Power to the oscillator is removed only if bits 3 and 14 are both clear.

On some computers the power to the oscillator cannot be removed because the same oscillator drives other parts of the system (eg IOEB).

If this call results in bits 0, 3 or 14 changing (i.e. power being removed or applied to the serial buffer/oscillator, Econet or FDC oscillator), then Service_Portable 0 is issued (see Service_Portable 1).

Portable_ReadBMUVariableSWI &42FC2
Read Battery Management Unit variables
R0=BMU variable number
R0=Preserved
R1=Value of variable
Interrupts are undefined
Fast interrupts are undefined
Processor is in undefined mode
Not defined

This SWI reads Battery Management Unit variables. Any variable which is not supported will return an error.

The BMU variable numbers are:

VariableRead/WriteDescription
0RVersion number and memory map of BMU microcode
1RNominal battery capacity
2RMeasured battery capacity
3RUsed battery capacity
4RUsable battery capacity
5RReserved
6R/WCharge estimate
7RInstantaneous voltage
8RInstantaneous current
9RInstantaneous temperature
10RFlag bits (see below)
11RCharge rate (bits 4 to 7)
12RCharge current
13RDischarge current
14RVoltage
15RTemperature 1
16RTemperature 2
17RCharge level
18RStatus flags (as variable 10)
19RInput signals
20RBattery capacity
21RBattery time remaining in seconds
22RMaximum battery life in seconds

The flag bits of variable 10 are:

Bit(s)Meaning
0Battery has been replaced
1Lid is open
2Threshold 2 reached (battery is flat)
3Threshold 1 reached (battery is low)
4Charging system fault
5Charge state is known
6Battery present (set when battery is present, whether in use, charging or idle)
7Power connected (set when external power is available, whether charging or not)

Reading any variable except the flags (variable 10) will enable IRQs (the flags are read from a soft copy).

Variables 0-11 were implemented within the A4 version of the Portable module. Variables 12-20 and selected variables from 0-11 were implemented within the Stork version of the Portable module. Variables 21-22 are implemented within the Virtual RiscPC version of the Portable module. Variables 0-4, 10, 11 and 14 are provided by the A9 version of the Portable.

Despite this, clients should not expect any particular variables to be provided by a given implementation as hardware capabilities and software implementation may change. Clients should always attempt to read the value and take appropriate action if a failure occurs.

Variables which are not supported will return with the V flag set and R0 pointing to a standard error block. Applications trying to use the more advanced features and finding they are not available should attempt to fall back to earlier methods.

Portable_WriteBMUVariableSWI &42FC3
Write Battery Management Unit variables
R0=BMU variable number
R1=New value of variable
R0 - R1=Preserved
Interrupts are undefined
Fast interrupts are undefined
Processor is in undefined mode
Not defined

This SWI writes Battery Management Unit variables.

The variable numbers are as for Portable_ReadBMUVariable. Variables not marked with a 'W' should not be written.

Portable_CommandBMUSWI &42FC4
Issue a command to the Battery Management Unit
R0=Reason code:
ValueMeaning
1Remove power
2Reserved
3Reserved
4Set autostart (R1 = delay in minutes - 1; eg 0 for a 1 minute delay)
5Turn off AC power
6Turn on AC power
7Disable power management status
R1 - R5=Dependent on reason code
R1 - R5=Preserved
Interrupts are undefined
Fast interrupts are undefined
Processor is in undefined mode
Not defined

This SWI issues a command to the Battery Management Unit. The values of variables after a command may not change immediately after this command is issued.

Portable_ReadFeaturesSWI &42FC5
Read the feature set of the portable module
None
R1=Features of the portable module:
Bit(s)Meaning
0Portable_Speed SWI is implemented
1-3Reserved, must be zero
4Portable_Idle SWI is implemented
5Portable_Stop SWI is implemented
6-31Reserved, must be zero
Interrupts are undefined
Fast interrupts are undefined
Processor is in undefined mode
Not defined

This SWI is used to read the features provided by the Portable module. Where this module is not present, or this SWI generates an error if called, clients should treat the features as being 0.

Portable_IdleSWI &42FC6
Inform the portable module that the system is currently idle
None
None
Interrupts are undefined
Fast interrupts are undefined
Processor is in undefined mode
Not defined

This SWI places the system into idle mode. The CPU clock is stopped, but all other clocks run normally. This means the Video display and all the IO channels are active, the DRAM is refreshed, but the system consumes less power as the CPU is inactive. The CPU remains in this state until it receives a FIQ or IRQ interrupt (eg from the keyboard, floppy, centi-second timer etc).

Essentially it requests that the environment be stopped until 'something interesting' happens.

Portable_StopSWI &42FC7
Stop (freeze) the Portable
None
R0=Reason for wake up:
ValueMeaning
1Keyboard interrupt
2RTC timer interrupt
3+Reserved
Interrupts are undefined
Fast interrupts are undefined
Processor is in undefined mode
Not defined

This SWI places the machine into a 'standby' state, from which it can be awoken by certain interrupts. DRAM is set to self-refresh, and the system placed into stop mode (all clocks are stopped). Execution continues only on receipt of an external wakeup event from the keyboard or real-time-clock. Normal FIQ or IRQ or centi-second timer events cannot happen because the IO system is not clocked.

Freezing of the machine may be prevented by modules through the service call Service_Portable 5. This service is issued prior to attempts to freeze the machine. If no clients object to this service, Service_Portable 3 will be issued and the machine shut down. Upon an interrupt, Service_Portable 4 will be issued to notify clients that the power has been restored and a period of time has elapsed during which interrupts have not happened.

Portable_StatusSWI &42FC8
Read the status of the Portable environment
None
R0=Status of the Portable environment:
Bit(s)Meaning
0Device is currently docked
1Device has external floppy disc drive connected
2Device has tracker ball connected (rather than mouse)
3Device has internal display in use
4-31Reserved, must be zero
Interrupts are undefined
Fast interrupts are undefined
Processor is in undefined mode
Not defined

This SWI is used to read the status of the Portable environment. This allows applications to modify their behaviour, or for modules to configure their operations based on the environment in which the device is situated.