Renesas M3T-MR100 Network Card User Manual


 
- 213 -
1. Describe the kernel interrupt handler as a function
43
2. Be sure to use the void type to declare the interrupt handler start function return value and
argument.
3. At the beginning of file, be sure to include "itron.h",”kernel.h” which is in the system di-
rectory as well as "kernel_id.h" which is in the current directory.
4. Do not use
the ret_int service call in the interrupt handler.
44
5. The static declared functions can not be registered as an interrupt handler.
#include <itron.h>
#include <kernel.h>
#include "kernel_id.h"
void inthand(void)
{
/* process */
iwup_tsk(ID_main);
}
Figure 7.3 Example of Kernel Interrupt Handler
7.1.3 Writing Non-kernel Interrupt Handler
When describing the non-kernel interrupt handler in C language, observe the following precautions.
1. Be sure to declare the return value and argument of the interrupt handler start function as
a void type.
2. No service call can be issued from a non-kernel interrupt handler.
NOTE: If this restriction is not observed, the software may malfunction.
3. A function that is declared to be static cannot be registered as an interrupt handler.
4. If you want multiple interrupts to be enabled in a non-kernel interrupt handler, always make
sure that the non-kernel interrupt handler is assigned a priority level higher than other
kernel interrupt handlers.
45
#include <itron.h>
#include <kernel.h>
#include "kernel_id.h"
void inthand(void)
{
/* process */
}
Figure 7.4 Example of Non-kernel Interrupt Handler
7.1.4 Writing Cyclic Handler/Alarm Handler
When describing the cyclic or alarm handler in C language, observe the following precautions.
43
A configuration file is used to define the relationship between handlers and functions.
44
When an kernel interrupt handler is declared with #pragma INTHANDLER ,code for the ret_int service call is automatically generated.
45
If you want the non-kernel interrupt handler to be assigned a priority level lower than kernel interrupt handlers, change the description of
the non-kernel interrupt handler to that of the kernel interrupt handler.