4
0
mirror of https://github.com/RT-Thread/rt-thread.git synced 2025-01-16 18:03:31 +08:00
2018-03-04 08:21:19 +08:00

38 lines
632 B
C

#include "stdio.h"
#include "internal.h"
static enter_crit st_enter_critical = NULL;
static exit_crit st_exit_critical = NULL;
int st_register_crit_func(enter_crit ent, exit_crit exit)
{
if(ent == NULL || ent == NULL)
{
printf("parameter error\n");
return -1;
}
st_enter_critical = ent;
st_exit_critical = exit;
return 0;
}
uint32_t st_enter_crit_func()
{
if(st_enter_critical)
{
return st_enter_critical();
}
else
{
return -1;
}
}
void st_exit_crit_func(uint32_t flags)
{
if(st_exit_critical)
{
st_exit_critical(flags);
}
}