CHAPTER 13 SYSTEM DOWN


This chapter describes the system down functions performed by the RI600V4.

13.1 Outline

When the event that cannot be recovered while the RI600V4 is operating occurs, the system down is caused and the system down routine is invoked.

13.2 User-Own Coding Module

The system down routine must be implemented as user-own coding module.

Note The System down routine (_RI_sys_dwn__) which is provided by the RI600V4 as a sample file is implemented in the boot processing file "resetprg.c".

13.2.1 System down routine (_RI_sys_dwn__)

The following shows the basic form of the system down routine. The system down routine must not return.

 #include    "kernel.h"              /*Standard header file definition*/
 #include    "kernel_id.h"           /*Header file generated by cfg600*/
 
 void  _RI_sys_dwn__ ( W type, VW inf1, VW inf2, VW inf3 ); /*Prototype declaration*/
 
 void  _RI_sys_dwn__ ( W type, VW inf1, VW inf2, VW inf3 )
 {
     /* ......... */
 
         while(1);
 }


Note The function name of the system down routine is "_RI_sys_dwn__".

- Stack
The system down routine uses the system stack.


- Service call
The system down routine must not issue service calls.


- PSW register when processing is started

Table 13-1 PSW Register When System Down Routine is Started

Bit

Value

Note

I

0

IPL

- type < 0 : Undefined

- type >= 0 : Same before system down

Do not lower IPL more than the start of processing.

PM

0

Supervisor mode

U

0

System stack

C, Z, S, O

Undefined

Others

0



13.2.2 Parameters of system down routine

- type == -1 (Error when a kernel interrupt handler ends)

Table 13-2 Parameters of System Down Routine (type == -1)

inf1

inf2

inf3

Description

E_CTX (-25)

2

Undefined

PSW.PM == 1 (user mode) when a kernel interrupt handler ends.

3

Undefined

PSW.IPL > kernel interrupt mask level when a kernel interrupt handler ends.

5

Undefined

The system is in the CPU locked state when a kernel interrupt handler ends.



- type == -2 (Error in ext_tsk)

Table 13-3 Parameters of System Down Routine (type == -2)

inf1

inf2

inf3

Description

E_CTX (-25)

1

Undefined

The ext_tsk is called in the non-task context.

4

Undefined

PSW.IPL > kernel interrupt mask level when ext_tsk is called.



- type == -3 (Unlinked service call issued)

Table 13-4 Parameters of System Down Routine (type == -3)

inf1

inf2

inf3

Description

E_NOSPT (-9)

Undefined

Undefined

Unlinked service call is issued.



Note Refer to "2.6.1 Service call information files and "-ri600_preinit_mrc" compiler option".

- type == -16 (Undefined relocatable vector interrupt)

Table 13-5 Parameters of System Down Routine (type == -16)

inf1

inf2

inf3

- "-U" option is not specified for cfg600
Undefined


- "-U" option is specified for cfg600
Vector number


PC, which is pushed to the stack by CPU's interrupt operation

PSW, which is pushed to the stack by CPU's interrupt operation



- type == -17 (Undefined fixed vector/exception vector interrupt)

Table 13-6 Parameters of System Down Routine (type == -17)

inf1

inf2

inf3

- "-U" option is not specified for cfg600
Undefined


- "-U" option is specified for cfg600
Vector number


PC, which is pushed to the stack by CPU's interrupt operation

PSW, which is pushed to the stack by CPU's interrupt operation



- type > 0 (Issuing vsys_dwn, ivsys_dwn from application))
0 and a negative type value is reserved by the RI600V4. When calling vsys_dwn, ivsys_dwn from application, use positive type value.


Table 13-7 Parameters of System Down Routine (type > 0)

inf1

inf2

inf3

Value specified for vsys_dwn, ivsys_dwn