|
@@ -9,6 +9,7 @@
|
|
|
* 2006-05-03 Bernard add IRQ_DEBUG
|
|
|
* 2016-08-09 ArdaFu add interrupt enter and leave hook.
|
|
|
* 2018-11-22 Jesven rt_interrupt_get_nest function add disable irq
|
|
|
+ * 2021-08-15 Supperthomas fix the comment
|
|
|
*/
|
|
|
|
|
|
#include <rthw.h>
|
|
@@ -21,19 +22,26 @@ static void (*rt_interrupt_leave_hook)(void);
|
|
|
|
|
|
/**
|
|
|
* @ingroup Hook
|
|
|
- * This function set a hook function when the system enter a interrupt
|
|
|
- *
|
|
|
+ *
|
|
|
+ * @brief This function set a hook function when the system enter a interrupt
|
|
|
+ *
|
|
|
* @note the hook function must be simple and never be blocked or suspend.
|
|
|
+ *
|
|
|
+ * @param hook The function point to be called
|
|
|
*/
|
|
|
void rt_interrupt_enter_sethook(void (*hook)(void))
|
|
|
{
|
|
|
rt_interrupt_enter_hook = hook;
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* @ingroup Hook
|
|
|
- * This function set a hook function when the system exit a interrupt.
|
|
|
- *
|
|
|
+ *
|
|
|
+ * @brief This function set a hook function when the system exit a interrupt.
|
|
|
+ *
|
|
|
* @note the hook function must be simple and never be blocked or suspend.
|
|
|
+ *
|
|
|
+ * @param hook The function point to be called
|
|
|
*/
|
|
|
void rt_interrupt_leave_sethook(void (*hook)(void))
|
|
|
{
|
|
@@ -53,11 +61,12 @@ void rt_interrupt_leave_sethook(void (*hook)(void))
|
|
|
volatile rt_uint8_t rt_interrupt_nest = 0;
|
|
|
#endif /* RT_USING_SMP */
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
- * This function will be invoked by BSP, when enter interrupt service routine
|
|
|
- *
|
|
|
+ * @brief This function will be invoked by BSP, when enter interrupt service routine
|
|
|
+ *
|
|
|
* @note please don't invoke this routine in application
|
|
|
- *
|
|
|
+ *
|
|
|
* @see rt_interrupt_leave
|
|
|
*/
|
|
|
void rt_interrupt_enter(void)
|
|
@@ -74,11 +83,12 @@ void rt_interrupt_enter(void)
|
|
|
}
|
|
|
RTM_EXPORT(rt_interrupt_enter);
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
- * This function will be invoked by BSP, when leave interrupt service routine
|
|
|
- *
|
|
|
+ * @brief This function will be invoked by BSP, when leave interrupt service routine
|
|
|
+ *
|
|
|
* @note please don't invoke this routine in application
|
|
|
- *
|
|
|
+ *
|
|
|
* @see rt_interrupt_enter
|
|
|
*/
|
|
|
void rt_interrupt_leave(void)
|
|
@@ -95,13 +105,14 @@ void rt_interrupt_leave(void)
|
|
|
}
|
|
|
RTM_EXPORT(rt_interrupt_leave);
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
- * This function will return the nest of interrupt.
|
|
|
- *
|
|
|
+ * @brief This function will return the nest of interrupt.
|
|
|
+ *
|
|
|
* User application can invoke this function to get whether current
|
|
|
* context is interrupt context.
|
|
|
- *
|
|
|
- * @return the number of nested interrupts.
|
|
|
+ *
|
|
|
+ * @return rt_uint8_t the number of nested interrupts.
|
|
|
*/
|
|
|
RT_WEAK rt_uint8_t rt_interrupt_get_nest(void)
|
|
|
{
|