Standby Software Functional Specification


    Distribution: COMPANY CONFIDENTIAL

    Project:      NC Model 1
    Issue:        0.08
    Author(s):    Steve Cormie
    Date:         02 Sep 1996
    Last Issue:   0.07
  

Contents.


History

	0.01 SMC 27-Feb-96 First created.
	0.02 SMC 01-May-96 More definite specification.
	0.03 SMC 24-May-96 Added upcalls and new SWIs.
	0.04 SMC 07-Jun-96 Added Service_PreReset.
	0.05 SMC 10-Jun-96 Added ScreenBlanker_Control reason codes.
	0.06 SMC 12-Jun-96 Added reference to TaskModule spec.
	0.07 JS  03-Jul-96 Added details about Message_PreQuit etc.
	0.08 SMC 02-Sep-96 Corrected the SWI numbers.

Outstanding issues

There are no outstanding issues.


Overview

The NC does not have a power on/off button. Instead, it is operated like a VCR in that there is a standby mode which is toggled by a button on the front panel (or under software control from an IR handset). This document specifies the software required to implement support for the NC standby mode.

Technical background

NC standby mode is handled by a new "Standby" module. This module detects when the standby button is pressed, informs the rest of the OS of what is going to happen and then performs some internal actions before going into standby mode. The machine is still fully operational in standby mode except that the screen is blanked and keyboard and mouse input is suppressed. This allows background tasks to continue execution eg. a fax application could spool incoming faxes to a printer.

Initialisation

When the Standby module initialises it immediately enters active (non-standby) mode and sets the front panel LEDs to red off, green on.

Standby button detection

The status of the front panel standby switch is reflected in bit 6 of the IOLINES register in the ARM7500 ie. the 8-bit I/O port (pins IOP[7:0]). These I/O pins are also reflected in the IRQC set of control registers which means that operation of the standby button can be detected via an interrupt. The Kernel is modified to support the IRQC control registers so that the interrupt can be claimed.

A new device vector has been assigned, IOMD_Standby_DevNo, which the Standby module claims using SWI OS_ClaimDeviceVector. The Kernel is modified to detect whether an interrupt is pending in IRQRQC (interrupt request) and, if there is, to read the offset to the appropriate device vector from a new table for the IRQC control register set (similar to the existing tables for IRQA, IRQB and IRQD control registers). The new device vector is also added to the Kernel.

The Standby module claims this device vector during module initialisation and releases it during module finalisation. The interrupt routine which is attached to the vector simply sets a flag which specifies that it is busy and then sets a callback using SWI OS_CallAfter with a specified delay of 10cs and returns. This callback performs the processing required to put the NC into or bring it out of standby mode depending on the current state. It then checks the state of the standby button by testing bit 6 of the IOLINES register. If the button is still being pressed then the callback arranges for itself to be called again after a further 10cs. If it is not being pressed then the busy flag is cleared. This callback structure is to provide debouncing of the standby button such that if the interrupt routine is called when the busy flag is set then the interrupt is ignored.

Standby mode

When the standby button is pressed to go into standby mode the Standby module initiates the desktop shutdown sequence by broadcasting a Message_PreQuit using SWI TaskModule_SendMessage which allows applications to prompt the user to save any unsaved data.

The Message_PreQuit is sent with all bits of the flag-word (offset 20 in the Message_PreQuit block) set to zero. In particular, bit 0 is left unset. This means that applications which need to prompt the user to save data don't think they are the only application being asked to quit, and terminate themselves.

Instead, they will send a Shift-Ctrl-F12 to TaskModule in an attempt to restart the closedown. This is ignored at present, but a future modification to TaskModule to allow registration of interest in non-broadcast messages would enable Standby to restart the Message_PreQuit process in response to this.

The switch to standby-mode is only continued when/if the the Standby module receives a Wimp event 19 (ie the Message_PreQuit bounced).

When the shutdown process is complete, the machine is not actually shut down. Instead, the Standby module issues the following upcall.

UpCall_Standby (UpCall &E)

Notification that the system is about to enter standby state.

On entry
	R0 = &E (Standby)
On exit
	R0 = 0 to prevent standby, otherwise preserved

The module also issues the following service call.

Service_Shutdown (Service Call &7E)

Notification that the system is about to enter standby state.

On entry
	R1 = &7E
On exit
	R1 = 0 to prevent standby, otherwise preserved

If no objection to going into standby is raised by either of these mechanisms then the following service call is issued.

Service_ShutDownComplete (Service Call &80)

Notification that the system is entering standby state.

On entry
	R1 = &80
On exit
	R1 preserved (must not be claimed)

This service call should be used by other modules to detect that the system is entering standby state eg. modem software could drop the line. The Standby module then uses the following additional SWI ScreenBlanker_Control reason code to blank the screen.

ScreenBlanker_Control 8 (SWI &43100)

Enter a strict blank state which can only be unblanked by ScreenBlanker_Control 9.

On entry
	R0 = 8 (reason code)
On exit
	R0 preserved

Mouse movements and key presses do not unblank the screen when this SWI call is used. When coming out of standby mode the Standby module calls the following SWI to unblank the screen.

ScreenBlanker_Control 9 (SWI &43100)

Exit strict blank state.

On entry
	R0 = 9 (reason code)
On exit
	R0 preserved

The Standby module then issues the following upcall which can be trapped by modules which need to know when the system has come out of standby state.

UpCall_Online (UpCall &D)

Notification that the system is entering online state.

On entry
	R0 = &D (Online)
On exit
	R0 preserved (must not be claimed)

User interface

There is no user interface.

Programmer interface

The Standby module provides a SWI interface for controlling the state of the machine:

Standby_State (SWI &4C7C0)

Read the current state of the machine.

On entry
	R0 = flags (must be 0)
On exit
	R0 = current state
		Bit     Meaning when set
		0       in standby mode
		1-31    reserved

Standby_Standby (SWI &4C7C1)

Put the machine into standby mode.

On entry
	R0 = flags (must be 0)
On exit
	R0 = previous state (as for Standby_State)

Standby_Online (SWI &4C7C2)

Bring the machine out of standby mode.

On entry
	R0 = flags (must be 0)
On exit
	R0 = previous state (as for StandbyState)

Standby_Control (SWI &4C7C3)

For test purpose only.

On entry
	R0 = flags
		Bit     Meaning
		0       0=green LED on, 1=red LED ON
		1-31    reserved (must be 0)
On exit
	R0 preserved

This interface allows the machine to be put into and brought out of standby mode via software control. For example, an IR handset driver would call this SWI when the standby button on the handset is pressed.


Acceptance test

To be determined.

Development test strategy

The Standby module can only be tested on the NC with appropriate support from the Kernel. It must be ensured that rapid switching of the standby button does not break the system. It must be ensured that debouncing works to the required extent when switching rapidly or when holding the standby button in for a significant period (more than 1 second) and then releasing it.

Product organisation

Standard RiscOS module written in C with supporting veneers written in objasm. Module will be built as part of the NCD build tree.

Future enhancements

None planned at present.