RISCOS.com

www.riscos.com Technical Support:
Programmer's Reference Manual

 

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.

Technical details

Colour to grey-scale mapping

The Portable module has to convert the users RGB palette settings into a grey-scale value in the range 0 to 14 (since the LCD panel only supports 15 unique grey levels). It does this using the following algorithm:

Luminance = (4 × Green) + (2 × Red) + Blue

Red, Green and Blue are in the range 0 to 255, so the luminance is in the range 0 to 1785 (255 × 7). It is then mapped down onto the range 0 to 14 using the following table:

Luminance Grey level Palette values for R, G and B
0 - 118 0 &00
119 - 237 1 &12
238 - 356 2 &24
357 - 475 3 &37
476 - 594 4 &49
595 - 713 5 &5B
714 - 832 6 &6D
833 - 952 7 &7F
953 - 1071 8 &92
1072 - 1190 9 &A4
1191 - 1309 10 &B6
1310 - 1428 11 &C8
1429 - 1547 12 &DB
1548 - 1666 13 &ED
1667 - 1785 14 &FF

The mapping table above is provided for information only, and may be subject to change in later versions of the Portable module.

In 256 colour modes the colour mapping is partly determined by the hardware, since the top 4 bits of the pixel value go directly to particular bits of the three guns, and the LCD ASIC only takes input from VIDC's red output. Thus the grey level will not in general map correctly from the luminance of the RGB value which would normally be output.

Service calls


Service_Portable
(Service Call &8A)

Power down or up

On entry

R1 = reason code (&8A)
R2 = power up or down:

0 = power down
1 = power up
R3 = bit mask of which ports are being powered down (if R2 = 0) (bit set => port is being powered down)
bit mask of which ports have been powered up (if R2 = 1) (bit set => 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 (bit set => no objection to change of state)

Use

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 call should never be claimed.

SWI Calls


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)

Interrupts

Interrupt status is not defined
Fast interrupts are enabled

Processor mode

Processor is in SVC mode

Re-entrancy

SWI is not re-entrant

Use

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

Speed settings currently supported are:

0 fast
1 slow

Related SWIs

Portable_Control

Related vectors

None


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

Interrupts

Interrupt status is not defined
Fast interrupts are enabled

Processor mode

Processor is in SVC mode

Re-entrancy

SWI is not re-entrant

Use

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 Meaning
0 Set => power to Econet enabled
1 Set => power to LCD display enabled
2 Set => power to external video display enabled
3 Set => power to serial buffer and oscillator enabled
4 Set => 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 Set => invert video clock
8 Set => back-light enabled
9 Clear => 1 extra line on display
Set => 2 extra lines on display
10 Clear => 1 DRAM used for dual panel
Set => 2 DRAMs used for dual panel
11 - 13 Reserved
14 Set => power to FDC oscillator enabled
15 Reserved
16 Set => LCD palette set up for inverse video
17 - 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 subunit 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 (ie power being removed or applied to the serial buffer/oscillator, Econet or FDC oscillator), then Service_Portable is issued (see Service_Portable (Service Call &8A)).

Related SWIs

Portable_Speed

Related vectors

None


Portable_ReadBMUVariable
(SWI &42FC2)

Reads Battery Management Unit variables

On entry

R0 = BMU variable number

On exit

R0 preserved
R1 = value of variable

Interrupts

Interrupts enabled except if R0 = 10
Fast interrupts are enabled

Processor mode

Processor is in SVC mode

Re-entrancy

SWI is not re-entrant

Use

This SWI reads Battery Management Unit variables.

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 flags as follows:
Bit Meaning
1 Set => lid is open
2 Set => threshold 2 reached
3 Set => threshold 1 reached
4 Set => charging system fault
5 Set => charge state is known
6 Set => battery present
7 Set => charger connected
11 R charge rate (bits 4 to 7)

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

Related SWIs

Portable_WriteBMUVariable

Related vectors

None


Portable_WriteBMUVariable
(SWI &42FC3)

Writes Battery Management Unit variables

On entry

R0 = BMU variable number
R1 = new value of variable

On exit

R0, R1preserved

Interrupts

Interrupts status is not defined
Fast interrupts are enabled

Processor mode

Processor is in SVC mode

Re-entrancy

SWI is not re-entrant

Use

This SWI writes Battery Management Unit variables.

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

Related SWIs

Portable_ReadBMUVariable

Related vectors

None


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 => 1 minute delay)
Other registers hold reason-code-dependent parameters

On exit

All registers preserved

Interrupts

Interrupts are not defined
Fast interrupts are enabled

Processor mode

Processor is in SVC mode

Re-entrancy

SWI is not re-entrant

Use

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

Related SWIs

None

Related vectors

None

This edition Copyright © 3QD Developments Ltd 2015
Last Edit: Tue,03 Nov 2015