CHAPTER 14 OBJECT RESET FUNCTIONS


This chapter describes the object reset functions performed by the RI600PX.

14.1 Outline

The object reset function returns Data Queues, Mailboxes, Message Buffers, Fixed-Sized Memory Pools and Variable-Sized Memory Pools to the initial state. The object reset function falls outside mITRON4.0 specification.

14.2 Reset Data Queue

A data queue is reset by issuing the following service call from the processing program.

- vrst_dtq
This service call reset the data queue specified by parameter dtqid.
The data having been accumulated by the data queue area are annulled. The tasks to wait to send data to the target data queue are released from the WAITING state, and EV_RST is returned as a return value for the tasks.
The following describes an example for coding this service call.



 #include    "kernel.h"              /*Standard header file definition*/
 #include    "kernel_id.h"           /*Header file generated by cfg600px*/
 #pragma task Task1                  /*Refer to note 2*/
 void Task1 (VP_INT exinf);          /*Refer to note 2*/
 void Task1 (VP_INT exinf)
 {
     ER      ercd;               /*Declares variable*/
     ID      dtqid = 1;          /*Declares and initializes variable*/
 
     /* ......... */
 
     ercd = vrst_dtq ( dtqid );  /*Reset data queue*/
 
     /* ......... */
 }


Note 1 In this service call, the tasks to wait to receive data do not released from the WAITING state.

Note 2 These statements are unnecessary for the task which is created by the system configuration file because the cfg600px generates these statement into the "kernel_id.h".

14.3 Reset Mailbox

A mailbox is reset by issuing the following service call from the processing program.

- vrst_mbx
This service call reset the mailbox specified by parameter mbxid.
The messages having been accumulated by the mailbox come off from the management of the RI600PX.
The following describes an example for coding this service call.



 #include    "kernel.h"              /*Standard header file definition*/
 #include    "kernel_id.h"           /*Header file generated by cfg600px*/
 #pragma task Task1                  /*Refer to note 2*/
 void Task1 (VP_INT exinf);          /*Refer to note 2*/
 void Task1 (VP_INT exinf)
 {
     ER      ercd;               /*Declares variable*/
     ID      mbxid = 1;          /*Declares and initializes variable*/
 
     /* ......... */
 
     ercd = vrst_mbx ( mbxid) ;  /*Reset mailbox*/
 
    /* ......... */
 }


Note 1 In this service call, the tasks to wait to receive message do not released from the WAITING state.

Note 2 These statements are unnecessary for the task which is created by the system configuration file because the cfg600px generates these statement into the "kernel_id.h".

14.4 Reset Message Buffer

A message buffer is reset by issuing the following service call from the processing program.

- vrst_mbf
This service call reset the message buffer specified by parameter mbfid.
The messages having been accumulated by the message buffer area are annulled. The tasks to wait to send message to the target message buffer are released from the WAITING state, and EV_RST is returned as a return value for the tasks.
The following describes an example for coding this service call.



 #include    "kernel.h"              /*Standard header file definition*/
 #include    "kernel_id.h"           /*Header file generated by cfg600px*/
 #pragma task Task1                  /*Refer to note 2*/
 void Task1 (VP_INT exinf);          /*Refer to note 2*/
 void Task1 (VP_INT exinf)
 {
     ER      ercd;               /*Declares variable*/
     ID      mbfid = 1;          /*Declares and initializes variable*/
 
     /* ......... */
 
     ercd = vrst_mbf ( mbfid );  /*Reset message buffer*/
 
     /* ......... */
 }


Note 1 In this service call, the tasks to wait to receive message do not released from the WAITING state.

Note 2 These statements are unnecessary for the task which is created by the system configuration file because the cfg600px generates these statement into the "kernel_id.h".

14.5 Reset Fixed-sized Memory Pool

A fixed-sized memory pool is reset by issuing the following service call from the processing program.

- vrst_mpf
This service call reset the fixed-sized memory pool specified by parameter mpfid.
The tasks to wait to get memory block from the target fixed-sized memory pool are released from the WAITING state, and EV_RST is returned as a return value for the tasks.
All fixed-sized memory blocks that had already been acquired are returned to the target fixed-sized memory pool. Therefore, do not access those fixed-sized memory blocks after issuing this service call.
The following describes an example for coding this service call.




 #include    "kernel.h"              /*Standard header file definition*/
 #include    "kernel_id.h"           /*Header file generated by cfg600px*/
 #pragma task Task1                  /*Refer to note*/
 void Task1 (VP_INT exinf);          /*Refer to note*/
 void Task1 (VP_INT exinf)
 {
     ER      ercd;               /*Declares variable*/
     ID      mpfid = 1;          /*Declares and initializes variable*/
 
     /* ......... */
 
     ercd = vrst_mpf ( mpfid );  /*Reset fixed-sized memory pool*/
 
     /* ......... */
 }


Note These statements are unnecessary for the task which is created by the system configuration file because the cfg600px generates these statement into the "kernel_id.h".

14.6 Reset Variable-sized Memory Pool

A variable-sized memory pool is reset by issuing the following service call from the processing program.

- vrst_mpl
This service call reset the variable-sized memory pool specified by parameter mpfid. The tasks to wait to get memory block from the target variable-sized memory pool are released from the WAITING state, and EV_RST is returned as a return value for the tasks.
All variable-sized memory blocks that had already been acquired are returned to the target variable-sized memory pool. Therefore, do not access those variable-sized memory blocks after issuing this service call.
The following describes an example for coding this service call.



 #include    "kernel.h"              /*Standard header file definition*/
 #include    "kernel_id.h"           /*Header file generated by cfg600px*/
 #pragma task Task1                  /*Refer to note*/
 void Task1 (VP_INT exinf);          /*Refer to note*/
 void Task1 (VP_INT exinf)
 {
     ER      ercd;               /*Declares variable*/
     ID      mplid = 1;          /*Declares and initializes variable*/
 
     /* ......... */
 
     ercd = vrst_mpl ( mplid );  /*Reset variable-sized memory pool*/
 
     if (ercd == E_OK) {
 
     /* ......... */
 }


Note These statements are unnecessary for the task which is created by the system configuration file because the cfg600px generates these statement into the "kernel_id.h".