Chapter 5 Detailed Applications
- 70 -
5.1.2 Writing a Kernel (OS Dependent) Interrupt Handler
When describing the kernel (OS-dependent) interrupt handler in C language, observe the following precautions.
1. Describe the kernel(OS-dependent) interrupt handler as a function 47
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.48
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 5.3 Example of Kernel(OS-dependent) Interrupt Handler
47 A configuration file is used to define the relationship between handlers and functions.
48 When an kernel(OS-dependent) interrupt handler is declared with #pragma INTHANDLER ,code for the ret_int service call is automati-
cally generated.