Skip to content

Commit b383fbe

Browse files
committed
doxygen: fixed duplicated comments for cpu APIs
Refer to the issue described in PR #10599. This was a temporary fix at that time. After further research, we discovered that this issue can be addressed using the "@cond" command supported by Doxygen. Since we currently do not intend to generate two sets of documentation for UP and MP when generating Doxygen documentation, the current solution is to generate only MP documentation by default. For functions defined in MP but not in UP, we will use the "@note" command in the function's Doxygen comment to indicate whether the function supports both UP and MP, or only MP. Signed-off-by: Chen Wang <[email protected]>
1 parent 7d4efba commit b383fbe

File tree

3 files changed

+57
-7
lines changed

3 files changed

+57
-7
lines changed

documentation/Doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ GENERATE_DEPRECATEDLIST= YES
718718
# sections, marked by \if <section_label> ... \endif and \cond <section_label>
719719
# ... \endcond blocks.
720720

721-
ENABLED_SECTIONS =
721+
ENABLED_SECTIONS = DOXYGEN_SMP
722722

723723
# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
724724
# initial value of a variable or macro / define can have for it to appear in the

src/cpu_mp.c

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,20 @@ void *_cpus_lock_pc = 0;
2929

3030
#endif /* RT_DEBUGING_SPINLOCK */
3131

32+
/**
33+
* @addtogroup group_thread_comm
34+
*
35+
* @cond DOXYGEN_SMP
36+
*
37+
* @{
38+
*/
39+
3240
/**
3341
* @brief Initialize a static spinlock object.
3442
*
3543
* @param lock is a pointer to the spinlock to initialize.
44+
*
45+
* @note This function has UP version and MP version.
3646
*/
3747
void rt_spin_lock_init(struct rt_spinlock *lock)
3848
{
@@ -43,10 +53,12 @@ RTM_EXPORT(rt_spin_lock_init)
4353
/**
4454
* @brief This function will lock the spinlock, will lock the thread scheduler.
4555
*
46-
* @note If the spinlock is locked, the current CPU will keep polling the spinlock state
47-
* until the spinlock is unlocked.
56+
* If the spinlock is locked, the current CPU will keep polling the spinlock state
57+
* until the spinlock is unlocked.
4858
*
4959
* @param lock is a pointer to the spinlock.
60+
*
61+
* @note This function has UP version and MP version.
5062
*/
5163
void rt_spin_lock(struct rt_spinlock *lock)
5264
{
@@ -59,9 +71,11 @@ RTM_EXPORT(rt_spin_lock)
5971
/**
6072
* @brief This function will unlock the spinlock, will unlock the thread scheduler.
6173
*
62-
* @note If the scheduling function is called before unlocking, it will be scheduled in this function.
74+
* If the scheduling function is called before unlocking, it will be scheduled in this function.
6375
*
6476
* @param lock is a pointer to the spinlock.
77+
*
78+
* @note This function has UP version and MP version.
6579
*/
6680
void rt_spin_unlock(struct rt_spinlock *lock)
6781
{
@@ -75,12 +89,14 @@ RTM_EXPORT(rt_spin_unlock)
7589
/**
7690
* @brief This function will disable the local interrupt and then lock the spinlock, will lock the thread scheduler.
7791
*
78-
* @note If the spinlock is locked, the current CPU will keep polling the spinlock state
79-
* until the spinlock is unlocked.
92+
* If the spinlock is locked, the current CPU will keep polling the spinlock state
93+
* until the spinlock is unlocked.
8094
*
8195
* @param lock is a pointer to the spinlock.
8296
*
8397
* @return Return current cpu interrupt status.
98+
*
99+
* @note This function has UP version and MP version.
84100
*/
85101
rt_base_t rt_spin_lock_irqsave(struct rt_spinlock *lock)
86102
{
@@ -97,11 +113,13 @@ RTM_EXPORT(rt_spin_lock_irqsave)
97113
/**
98114
* @brief This function will unlock the spinlock and then restore current cpu interrupt status, will unlock the thread scheduler.
99115
*
100-
* @note If the scheduling function is called before unlocking, it will be scheduled in this function.
116+
* If the scheduling function is called before unlocking, it will be scheduled in this function.
101117
*
102118
* @param lock is a pointer to the spinlock.
103119
*
104120
* @param level is interrupt status returned by rt_spin_lock_irqsave().
121+
*
122+
* @note This function has UP version and MP version.
105123
*/
106124
void rt_spin_unlock_irqrestore(struct rt_spinlock *lock, rt_base_t level)
107125
{
@@ -118,6 +136,8 @@ RTM_EXPORT(rt_spin_unlock_irqrestore)
118136
* @brief This fucntion will return current cpu object.
119137
*
120138
* @return Return a pointer to the current cpu object.
139+
*
140+
* @note This function has UP version and MP version.
121141
*/
122142
struct rt_cpu *rt_cpu_self(void)
123143
{
@@ -130,6 +150,8 @@ struct rt_cpu *rt_cpu_self(void)
130150
* @param index is the index of target cpu object.
131151
*
132152
* @return Return a pointer to the cpu object corresponding to index.
153+
*
154+
* @note This function has UP version and MP version.
133155
*/
134156
struct rt_cpu *rt_cpu_index(int index)
135157
{
@@ -140,6 +162,8 @@ struct rt_cpu *rt_cpu_index(int index)
140162
* @brief This function will lock all cpus's scheduler and disable local irq.
141163
*
142164
* @return Return current cpu interrupt status.
165+
*
166+
* @note This function only has MP version.
143167
*/
144168
rt_base_t rt_cpus_lock(void)
145169
{
@@ -176,6 +200,8 @@ RTM_EXPORT(rt_cpus_lock);
176200
* @brief This function will restore all cpus's scheduler and restore local irq.
177201
*
178202
* @param level is interrupt status returned by rt_cpus_lock().
203+
*
204+
* @note This function only has MP version.
179205
*/
180206
void rt_cpus_unlock(rt_base_t level)
181207
{
@@ -211,6 +237,8 @@ RTM_EXPORT(rt_cpus_unlock);
211237
* If target thread not locked the cpus then unlock the cpus lock.
212238
*
213239
* @param thread is a pointer to the target thread.
240+
*
241+
* @note This function only has MP version.
214242
*/
215243
void rt_cpus_lock_status_restore(struct rt_thread *thread)
216244
{
@@ -228,6 +256,8 @@ RTM_EXPORT(rt_cpus_lock_status_restore);
228256
* @brief Get logical CPU ID
229257
*
230258
* @return logical CPU ID
259+
*
260+
* @note This function only has MP version.
231261
*/
232262
rt_base_t rt_cpu_get_id(void)
233263
{
@@ -238,3 +268,9 @@ rt_base_t rt_cpu_get_id(void)
238268

239269
return rt_hw_cpu_id();
240270
}
271+
272+
/**
273+
* @}
274+
*
275+
* @endcond
276+
*/

src/cpu_up.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@
1414

1515
static struct rt_cpu _cpu;
1616

17+
/**
18+
* @addtogroup group_thread_comm
19+
*
20+
* @cond
21+
*
22+
* @{
23+
*/
24+
1725
/**
1826
* @brief Initialize a static spinlock object.
1927
*
@@ -110,3 +118,9 @@ struct rt_cpu *rt_cpu_index(int index)
110118
{
111119
return index == 0 ? &_cpu : RT_NULL;
112120
}
121+
122+
/**
123+
* @}
124+
*
125+
* @endcond
126+
*/

0 commit comments

Comments
 (0)