Everything

CHAPTER 11 SERVICE CALL MANAGEMENT FUNCTIONS


This chapter describes the service call management functions performed by the RI850V4.
11.1 Outline
The RI850V4's service call management function provides the function for manipulating the extended service call routine status, such as registering and calling of extended service call routines.
11.2 Extended Service Call Routines
This is a routine to which user-defined functions are registered in the RI850V4, and will never be executed unless it is called explicitly, using service calls provided by the RI850V4.
The RI850V4 positions extended service call routines as extensions of the processing program that called the extended service call routine.
The RI850V4 manages interrupt handlers themselves, by using management objects (extended service call routine control blocks) corresponding to extended service call routines one-to-one.
11.2.1 Basic form extended service call routines
Code extended service call routines by using the ER_UINT type argument that has three VP_INT type arguments.
Transferred data specified when a call request (cal_svc or ical_svc) is issued is set to arguments par1, par2, and par3.
The following shows the basic form of extended service call routines in C.
 #include    <kernel.h>              /*Standard header file definition*/
 #include    <kernel_id.h>           /*System information header file definition*/
 
 ER_UINT svcrtn (VP_INT par1, VP_INT par2, VP_INT par3)
 {
     .........
 
     return (ER_UINT ercd);          /*Terminate extended service call routine*/
 }

11.2.2 Internal processing of extended service call routine
The RI850V4 executes the original extended service call routine pre-processing when passing control from the processing program that issued a call request to an extended service call routine, as well as the original extended service call routine post-processing when returning control from the extended service call routine to the processing program.
Therefore, note the following points when coding extended service call routines.
- Coding method
Code extended service call routines using C or assembly language.
When coding in C, they can be coded in the same manner as ordinary functions coded.
When coding in assembly language, code them according to the calling rules prescribed in the compiler used.
- Stack switching
The RI850V4 positions extended service call routines as extensions of the processing program that called the extended service call routine. When passing control to an extended service call routine, stack switching processing is therefore not performed.
- Service call issue
The RI850V4 positions extended service call routines as extensions of the processing program that called the extended service call routine. Service calls that can be issued in extended service call routines depend on the type (task or non-task) of the processing program that called the extended service call routine.
Note For details on the valid issue range of each service call, refer to Table 16-1 to Table 16-12.
- Acceptance of EI level maskable interrupts
The RI850V4 handles an extended service call routine as an extension of the processing program that called the extended service call routine.
Therefore, when passing control to an extended service call routine, manipulation related to acceptance of EI level maskable interrupts (manipulation of the PMn bits in the priority mask register (PMR) and the ID bit in the program status word (PSW)) is not performed.
11.3 Define Extended Service Call Routine
The RI850V4 supports the static registration of extended service call routines only. They cannot be registered dynamically by issuing a service call from the processing program.
Static extended service call routine registration means defining of extended service call routines using static API "CRE_SVC" in the system configuration file.
For details about the static API "DEF_SVC", refer to "17.5.11 Extended service call routine information".
11.4 Invoke Extended Service Call Routine
Extended service call routines can be called by issuing the following service call from the processing program.
- cal_svc, ical_svc
These service calls call the extended service call routine specified by parameter fncd.
The following describes an example for coding this service call.
 #include    <kernel.h>              /*Standard header file definition*/
 #include    <kernel_id.h>           /*System information header file definition*/
 
 void task (VP_INT exinf)
 {
     ER_UINT ercd;                   /*Declares variable*/
     FN      fncd = 1;               /*Declares and initializes variable*/
     VP_INT  par1 = 123;             /*Declares and initializes variable*/
     VP_INT  par2 = 456;             /*Declares and initializes variable*/
     VP_INT  par3 = 789;             /*Declares and initializes variable*/
 
     .........
 
                                     /*Invoke extended service call routine*/
     ercd = cal_svc (fncd, par1, par2, par3);
 
     if (ercd != E_RSFN) {
         .........                   /*Normal termination processing*/
     }
 
 }

Note Extended service call routines that can be called using this service call are the routines whose transferred data total is less than four.