[Select]

Hardware


Index

 

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_Portable (&8A)

Portable state change request, or information

On entry
   R1 = Reason code (&8A)
   R2 = Sub-reason code :
         0 = Hardware is about to be powered down
         1 = Hardware has been powered up
         2 = Tidy up
         3 = Device is about to enter a stopped state (frozen)
         4 = Device has left stopped state (awakened)
         5 = Device wishes to be stopped (frozen)
         Other 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) 
On exit
   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 0 (&8A)

Hardware is about to be powered down

On entry
   R1 = reason code (&8A)
   R2 = Sub-reason code (0)
   R3 = bit mask of which ports are being powered down (each bit set indicates
        port is being powered down)
On exit
   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 1 (&8A)

Hardware has been powered up

On entry
   R1 = reason code (&8A)
   R2 = Sub-reason code (1)
   R3 = bit mask of which ports have been powered up (each bit set indicates
        port has been powered up)
On exit
   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 3 (&8A)

Device is about to enter a stopped state (frozen)

On entry
   R1 = reason code (&8A)
   R2 = Sub-reason code (3)
On exit
   R1 preserved
   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 4 (&8A)

Device has left stopped state (awakened)

On entry
   R1 = reason code (&8A)
   R2 = Sub-reason code (4)
   R3 = Failure code:
         0 = Freeze was successful and has now returned
         1 = Freeze failed to halt IDE devices
         2 = Freeze failed to halt sound system
         3 = Freeze failed to halt display
         4 = Freeze failed to halt other devices (FDC, Econet, etc)
         5 = Freeze failed to halt some device
         6 = Freeze failed to enter the suspend state
         Other Reserved failure states for future expansion 
On exit
   R1 preserved
   R2 preserved
   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 5 (&8A)

Device wishes to be stopped (frozen)

On entry
   R1 = reason code (&8A)
   R2 = Sub-reason code (5)
On exit
   R1 = 0 if call is being claimed to prevent freeze, preserved to accept freeze
   R2 preserved

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

SWIs

SWI Portable_Speed (SWI &42FC0)

Controls the processor speed

On entry
   R0 = EOR mask
   R1 = AND mask
On exit
   R0 = old speed
   R1 = new speed :
         0 = Fast
         1 = Slow

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
SWI Portable_Control (SWI &42FC1)

Controls various power control and miscellaneous bits

On entry
   R0 = EOR mask
   R1 = AND mask
On exit
   R0 = old control
   R1 = new control

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

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 is issued (see Service_Portable 0 and Service_Portable 1).

SWI Portable_ReadBMUVariable (SWI &42FC2)

Reads Battery Management Unit variables

On entry
    R0 = BMU variable number
On exit
   R0 preserved
   R1 = value of variable

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

The BMU variable numbers are:

    Variable Read/Write Description
    0            R      version number and memory map of BMU microcode
    1            R      nominal battery capacity
    2            R      measured battery capacity
    3            R      used battery capacity
    4            R      usable battery capacity
    5            R      reserved
    6            R/W    charge estimate
    7            R      instantaneous voltage
    8            R      instantaneous current
    9            R      instantaneous temperature
    10           R      flag bits as follows:
                            0 = battery has been replaced
                            1 = lid is open
                            2 = threshold 2 reached (battery is flat)
                            3 = threshold 1 reached (battery is low)
                            4 = charging system fault
                            5 = charge state is known
                            6 = battery present (set when battery is present,
                                whether in use, charging or idle)
                            7 = power connected (set when external power is
                                available, whether charging or not)
    11           R      charge rate (bits 4 to 7)
    12           R      charge current
    13           R      discharge current
    14           R      voltage
    15           R      temperature 1
    16           R      temperature 2
    17           R      charge level
    18           R      status flags (as variable 10)
    19           R      input signals
    20           R      battery capacity
    21           R      battery time remaining in seconds
    22           R      maximum battery life in seconds

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 point 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.

SWI Portable_WriteBMUVariable (SWI &42FC3)

Writes Battery Management Unit variables

On entry
   R0 = BMU variable number
   R1 = new value of variable
On exit
   R0 preserved
   R1 preserved

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.

SWI Portable_CommandBMU (SWI &42FC4)

Issues a command to the Battery Management Unit

On entry
   R0 = reason code
         1 Remove power
         2 Reserved
         3 Reserved
         4 Set autostart (R1 = delay in minutes - 1; eg 0 for a 1 minute delay)
         5 Turn off AC power
         6 Turn on AC power
         7 Disable power management status
   R1-R5 = Dependant on reason code
On exit
   R1-R5 preserved

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.

SWI Portable_ReadFeatures (SWI &42FC5)

Read feature set of the portable module

On entry
   None
On exit
   R1 = Features of the portable module :
         bit 0    = Portable_Speed SWI is implemented
         bit 1-3  = Reserved, must be zero
         bit 4    = Portable_Idle SWI is implemented
         bit 5    = Portable_Stop SWI is implemented
         bit 6-31 = Reserved, must be zero

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.

SWI Portable_Idle (SWI &42FC6)

Informs the portable module that the system is currently idle

On entry
   None
On exit
   None

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.

SWI Portable_Stop (SWI &42FC7)

Stops (freezes) the Portable

On entry
   None
On exit
   R0 = Reason for wake up :
         1 Keyboard interrupt
         2 RTC timer interrupt
         Other Reserved

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.

SWI Portable_Status (SWI &42FC8)

Reads the status of the Portable environment

On entry
   None
On exit
   R0 = Status of the Portable environment :
         bit 0    = Device is currently docked
         bit 1    = Device has external floppy disc drive connected
         bit 2    = Device has tracker ball connected (rather than mouse)
         bit 3    = Device has internal display in use
         bit 4-31 = Reserved, must be zero

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.


This documentation is copyright 3QD Developments Ltd 2013 and may not be reproduced or published in any form without the copyright holders permission. RISC OS is subject to continuous development and improvement as such all information is reproduced by 3QD Developments Ltd in good faith and is believed to be correct at the time of publication E&OE. 3QD Developments Ltd cannot accept any liability for any loss or damage arising from the use of any information provided as part of the RISC OS Documentation.

HTML document version 1.03 3rd November 2015