Renesas M3T-MR100 Network Card User Manual


 
- 211 -
7. Detailed Applications
7.1 Program Coding Procedure in C Language
7.1.1 Task Description Procedure
1. Describe the task as a function.
To register the task for the MR100, enter its function name in the configuration file. When, for instance, the
function name "task()" is to be registered as the task ID number 3, proceed as follows.
task[3]{
name = ID_task;
entry_address = task();
stack_size = 100;
priority = 3;
};
2. At the beginning of file, be sure to include "itron.h",”kernel.h” which is in system directory
as well as "kernel_id.h" which is in the current directory. That is, be sure to enter the fol-
lowing two lines at the beginning of file.
#include <itron.h>
#include <kernel.h>
#include "kernel_id.h"
3. No return value is provided for the task start function. Therefore, declare the task start
function as a void function.
4. A function that is declared to be static cannot be registered as a task.
5. It isn't necessary to describe ext_tsk() at the exit of task start function.
40
If you exit the task
from the subroutine in task start function, please describe ext_tsk() in the subroutine.
6. It is also possible to describe the task startup function, using the infinite loop.
#include <itron.h>
#include <kernel.h>
#include "kernel_id.h"
void task(void)
{
/* process */
}
Figure 7.1 Example Infinite Loop Task Described in C Language
40
The task is ended by ext_tsk() automatically if #pramga TASK is declared in the MR100. Similarly, it is ended by ext_tsk when returned
halfway of the function by return sentence.