summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/rtdef.h3
-rw-r--r--include/rtthread.h23
2 files changed, 24 insertions, 2 deletions
diff --git a/include/rtdef.h b/include/rtdef.h
index 1d6993eab6..2cfec3da0a 100644
--- a/include/rtdef.h
+++ b/include/rtdef.h
@@ -848,9 +848,8 @@ struct rt_user_context
typedef void (*rt_thread_cleanup_t)(struct rt_thread *tid);
/**
- * Thread structure
+ * @brief Thread Control Block
*/
-
struct rt_thread
{
struct rt_object parent;
diff --git a/include/rtthread.h b/include/rtthread.h
index f910cfa1c0..73b31cf1e8 100644
--- a/include/rtthread.h
+++ b/include/rtthread.h
@@ -208,7 +208,30 @@ RT_OBJECT_HOOKLIST_DECLARE(rt_thread_inited_hookproto_t, rt_thread_inited);
*/
void rt_thread_idle_init(void);
#if defined(RT_USING_HOOK) || defined(RT_USING_IDLE_HOOK)
+// FIXME: Have to write doxygen comment here for rt_thread_idle_sethook/rt_thread_idle_delhook
+// but not in src/idle.c. Because the `rt_align(RT_ALIGN_SIZE)` in src/idle.c
+// will make wierd output for html document generation, i.e. can not generate
+// function link to rt_thread_idle_sethook, while function link to rt_thread_idle_delhook is ok.
+/**
+ * @brief This function sets a hook function to idle thread loop. When the system performs
+ * idle loop, this hook function should be invoked.
+ *
+ * @param hook the specified hook function.
+ *
+ * @return `RT_EOK`: set OK.
+ * `-RT_EFULL`: hook list is full.
+ *
+ * @note the hook function must be simple and never be blocked or suspend.
+ */
rt_err_t rt_thread_idle_sethook(void (*hook)(void));
+/**
+ * @brief delete the idle hook on hook list.
+ *
+ * @param hook the specified hook function.
+ *
+ * @return `RT_EOK`: delete OK.
+ * `-RT_ENOSYS`: hook was not found.
+ */
rt_err_t rt_thread_idle_delhook(void (*hook)(void));
#endif /* defined(RT_USING_HOOK) || defined(RT_USING_IDLE_HOOK) */
rt_thread_t rt_thread_idle_gethandler(void);