52 lines
1.1 KiB
C
52 lines
1.1 KiB
C
#ifndef INCLUDED_OS_ISR_H
|
|
#define INCLUDED_OS_ISR_H
|
|
|
|
#ifndef INCLUDED_OS_TYPES_H
|
|
#include <os_types.h>
|
|
#endif /*INCLUDED_OS_TYPES_H*/
|
|
|
|
#ifndef INCLUDED_OS_COMPILER_H
|
|
#include <os_compiler.h>
|
|
#endif /*INCLUDED_OS_COMPILER_H*/
|
|
|
|
#ifndef INCLUDED_OS_CRITICAL_H
|
|
#include <os_critical.h>
|
|
#endif /*INCLUDED_OS_CRITICAL_H*/
|
|
|
|
#ifndef INCLUDED_OS_SCHED_H
|
|
#include <os_sched.h>
|
|
#endif /*INCLUDED_OS_SCHED_H*/
|
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------------------------------------------------ */
|
|
/* */
|
|
|
|
extern volatile os_size_t g_os_isr_nesting_cnt;
|
|
|
|
|
|
OS_STATIC_FORCE_INLINE
|
|
void os_isr_enter(void){
|
|
os_critical_enter_in_isr();
|
|
g_os_isr_nesting_cnt++;
|
|
os_critical_leave_in_isr();
|
|
}
|
|
|
|
OS_STATIC_FORCE_INLINE
|
|
void os_isr_leave(void){
|
|
os_critical_enter_in_isr();
|
|
g_os_isr_nesting_cnt--;
|
|
if(g_os_isr_nesting_cnt==0){
|
|
if(g_os_sched_pending_cnt>0){
|
|
g_os_sched_pending_cnt = 0;
|
|
os_critical_leave_in_isr();
|
|
os_sched_in_isr();
|
|
return;
|
|
}
|
|
}
|
|
os_critical_leave_in_isr();
|
|
}
|
|
|
|
|
|
#endif /*INCLUDED_OS_ISR_H*/
|