mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-02-06 17:12:01 +08:00
change the RT_DEBUG_NOT_REENT to RT_DEBUG_NOT_IN_INTERRUPT.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1503 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
@@ -39,9 +39,9 @@
|
||||
#define RT_DEBUG_IPC 0
|
||||
#endif
|
||||
|
||||
/* Turn on this to enable reentrance check */
|
||||
#ifndef RT_DEBUG_REENT_CHK
|
||||
#define RT_DEBUG_REENT_CHK 1
|
||||
/* Turn on this to enable context check */
|
||||
#ifndef RT_DEBUG_CONTEXT_CHECK
|
||||
#define RT_DEBUG_CONTEXT_CHECK 1
|
||||
#endif
|
||||
|
||||
#define RT_DEBUG_LOG(type,message) do{ if(type) rt_kprintf message;}while(0)
|
||||
@@ -50,39 +50,21 @@
|
||||
rt_kprintf("(%s) assert failed at %s:%d \n", \
|
||||
#EX, __FUNCTION__, __LINE__); while (dummy==0);}
|
||||
|
||||
/* Reentrance check */
|
||||
/* counter */
|
||||
extern rt_uint8_t rt_debug_reent_cnt;
|
||||
|
||||
#define RT_DEBUG_REENT_IN if(RT_DEBUG_REENT_CHK){\
|
||||
/* Macro to check current context */
|
||||
#if RT_DEBUG_CONTEXT_CHECK
|
||||
#define RT_DEBUG_NOT_IN_INTERRUPT do {\
|
||||
rt_base_t level;\
|
||||
level = rt_hw_interrupt_disable();\
|
||||
rt_debug_reent_cnt++;\
|
||||
rt_hw_interrupt_enable(level);}
|
||||
|
||||
#define RT_DEBUG_REENT_OUT if(RT_DEBUG_REENT_CHK){\
|
||||
rt_base_t level;\
|
||||
level = rt_hw_interrupt_disable();\
|
||||
rt_debug_reent_cnt--;\
|
||||
rt_hw_interrupt_enable(level);}
|
||||
|
||||
/* Mark those non-reentrant functions with this macro */
|
||||
#define RT_DEBUG_NOT_REENT if(RT_DEBUG_REENT_CHK){\
|
||||
rt_base_t level;\
|
||||
level = rt_hw_interrupt_disable();\
|
||||
if(rt_debug_reent_cnt != 0){\
|
||||
rt_kprintf("Non-reentrant function used in critical area!\n");\
|
||||
if(rt_interrupt_get_nest() != 0){\
|
||||
rt_kprintf("Function[%s] shall not used in ISR\n", __FUNCTION__);\
|
||||
RT_ASSERT(0)}\
|
||||
rt_hw_interrupt_enable(level);}
|
||||
|
||||
|
||||
rt_hw_interrupt_enable(level);} while (0)
|
||||
#endif
|
||||
#else /* RT_DEBUG */
|
||||
|
||||
#define RT_ASSERT(EX)
|
||||
#define RT_DEBUG_LOG(type,message)
|
||||
#define RT_DEBUG_REENT_IN
|
||||
#define RT_DEBUG_REENT_OUT
|
||||
#define RT_DEBUG_NOT_REENT
|
||||
#define RT_DEBUG_NOT_IN_INTERRUPT
|
||||
|
||||
#endif /* RT_DEBUG */
|
||||
|
||||
|
||||
@@ -264,6 +264,17 @@ struct rt_object_information
|
||||
rt_list_t object_list; /**< object list */
|
||||
rt_size_t object_size; /**< object size */
|
||||
};
|
||||
|
||||
/**
|
||||
* The hook function call macro
|
||||
*/
|
||||
#ifdef RT_USING_HOOK
|
||||
#define RT_OBJECT_HOOK_CALL(func, argv) \
|
||||
do { if ((func) != RT_NULL) func argv; } while (0)
|
||||
#else
|
||||
#define RT_OBJECT_HOOK_CALL(func, argv)
|
||||
#endif
|
||||
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
|
||||
@@ -36,6 +36,7 @@ extern "C" {
|
||||
*/
|
||||
|
||||
void rt_system_object_init(void);
|
||||
struct rt_object_information *rt_object_get_information(enum rt_object_class_type type);
|
||||
void rt_object_init(struct rt_object* object, enum rt_object_class_type type, const char* name);
|
||||
void rt_object_detach(rt_object_t object);
|
||||
rt_object_t rt_object_allocate(enum rt_object_class_type type, const char* name);
|
||||
@@ -49,24 +50,6 @@ void rt_object_detach_sethook(void (*hook)(struct rt_object* object));
|
||||
void rt_object_trytake_sethook(void (*hook)(struct rt_object* object));
|
||||
void rt_object_take_sethook(void (*hook)(struct rt_object* object));
|
||||
void rt_object_put_sethook(void (*hook)(struct rt_object* object));
|
||||
#define RT_OBJECT_HOOK_CALL(hookfunc)\
|
||||
do{\
|
||||
register rt_base_t temp;\
|
||||
temp = rt_hw_interrupt_disable();\
|
||||
RT_DEBUG_REENT_IN\
|
||||
if (hookfunc != RT_NULL) hookfunc();\
|
||||
RT_DEBUG_REENT_OUT\
|
||||
rt_hw_interrupt_enable(temp);\
|
||||
}while(0)
|
||||
#define RT_OBJECT_HOOK_CALL2(hookfunc,...)\
|
||||
do{\
|
||||
register rt_base_t temp;\
|
||||
temp = rt_hw_interrupt_disable();\
|
||||
RT_DEBUG_REENT_IN\
|
||||
if (hookfunc != RT_NULL) hookfunc(__VA_ARGS__);\
|
||||
RT_DEBUG_REENT_OUT\
|
||||
rt_hw_interrupt_enable(temp);\
|
||||
}while(0)
|
||||
#endif
|
||||
|
||||
/*@}*/
|
||||
@@ -346,6 +329,10 @@ typedef void (*rt_isr_handler_t)(int vector);
|
||||
*/
|
||||
void rt_interrupt_enter(void);
|
||||
void rt_interrupt_leave(void);
|
||||
/*
|
||||
* the number of nested interrupts.
|
||||
*/
|
||||
rt_uint8_t rt_interrupt_get_nest(void);
|
||||
|
||||
/**
|
||||
* @addtogroup KernelService
|
||||
|
||||
Reference in New Issue
Block a user