Download 1.1 Programming in C Language

Transcript
Using Real-time OS (MR30)
3
3.4 Building MR30 into Program Using NC30
Precautions for writing OS-dependent interrupt handlers
Write OS-dependent interrupt handlers in function style. At this time, pay attention to the
following:
•
•
•
•
Only void-type return values are valid.
Only void-type arguments are valid.
No static-type functions can be defined.
Only those system calls that are usable in handlers can be used in the OS-dependent
interrupt handler.
#include
#include
void
{
< mr30.h >
" id.h "
int_hand ( void )
iwup_tsk ( ID_task1 ) ;
••
•
}
Only void-type return values and arguments
are accepted for OS-dependent interrupt
handlers.
In an OS-dependent interrupt handler, use those
system calls that are usable in handlers.
Figure 3.4.7 Example for writing OS-dependent interrupt handlers
#include
#include
static
{
< mr30.h >
" id.h "
void int_hand ( void )
••
•
}
No static-type functions can be defined as OS-dependent
interrupt handler
Figure 3.4.8 Precautions for writing OS- dependent interrupt handlers (regarding statictype functions)
148