340 Commits

Author SHA1 Message Date
Chen Wang
3dd4f71bb6 doxygen: cleanup code for group_thread_management
The cleanup involved three parts:

- Merging the standalone "/**@{*/" into
  "@addtogroup group_thread_management"

- Changing "/**@}*/" to "/** @} group_thread_management */",
  adding the group name makes it easier to find the matching "@{" part.

- Deleting the "@addtogroup" directive in "include/rtthread.h"
  because this header file doesn't have doxygen comments.
  All doxygen comments for function bodies are defined in other .c files.

  Note, we remian two doxygen comments for rt_thread_inited_hookproto_t
  and rt_thread_idle_sethook in the "include/rtthread.h".
  rt_thread_inited_hookproto_t is really defined here.
  For rt_thread_idle_sethook, please see FIXME comment for reason.

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-09-30 10:25:08 +08:00
Chen Wang
05dc189e37 doxygen: cleanup code for group_object_management
The cleanup involved three parts:

- Merging the standalone "/**@{*/" into
  "@addtogroup group_object_management"

- Changing "/**@}*/" to "/** @} group_object_management */",
  adding the group name makes it easier to find the matching "@{" part.

- Deleting the "@addtogroup" directive in "include/rtthread.h"
  because this header file doesn't have doxygen comments.
  All doxygen comments for function bodies are defined in "src/object.c".

Plus minor cleanup for group_hook in src/object.c.

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-09-29 14:22:40 +08:00
蒙蒙plus
138c8887e7 移除已经废弃的CPU使用率相关的字段和初始化代码 2025-09-12 09:56:16 +08:00
Chen Wang
f44ce3a64c doxygen: updated doc for thread management subsystem
Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-09-02 18:05:44 +08:00
R b b666
0b14a54614 Update RT_VERSION to 5.2.2 (#10627)
Update RT_VERSION to 5.2.2.
2025-08-22 10:56:29 +08:00
Chen Wang
3c046646cb doxygen: promote object management to a separate page
For "RT-Thread User Guide":
Take the "RT-Thread Kernel Object Model" sub-section out of
the "Kernel Basics" section and rename it to "Object Management".

Correspondingly, rename the "Kernel Object Management" section
in the "RT-Thread API Guide" to "Object Management".

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-07-22 18:07:17 +08:00
Chen Wang
2aebe694d9 doxygen: group name all in lowcase (part 2) (#10530)
* doxygen: fs: unify groupname to lowercase

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>

* doxygen: drivers: unify groupname to lowercase

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>

* doxygen: signal: unify groupname to lowercase

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>

---------

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-07-22 13:59:25 +08:00
Chen Wang
8e9872a554 doxygen: group name all in lowcase
This patch only updated the groups defined in documentation/0.doxygen.

Other groups will be moved into documentation/0.doxygen and updated at
that time.

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-06-25 14:02:28 +08:00
Chen Wang
e234cc8658 doxygen: change group_Device to group_device_driver
The originally defined "group_Device" should actually
be part of the device-driver component, so create
a new "group_device_driver" and then rename
"group_Device" to "group_device_driver".

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-05-29 13:47:46 +08:00
ricky
7125e7bebd include:rtdef.h: comment Refine the annotation of RT_ALIGN and RT_ALIGN_DOWN (#10201)
include :rtdef.h : [ Refine the annotation of RT_ALIGN and RT_ALIGN_DOWN ]

This macro is vulnerable to non-2-byte alignments,
but I assume that the macro definition was designed with an explicit use case of 2-byte alignments in mind.
Therefore, I only modify the comment to remind the user.

Solution:
RT_ALIGN(size, align) ((size) + (align) - 1) / (align) * (align)
RT_ALIGN_DOWN(size, align) (size) / (align) * (align)
Here's what deepseek recommends more.

Signed-off-by: Yucai Liu <1486344514@qq.com>
2025-04-18 17:07:57 +08:00
wycwyhwyq
12de72a462 add RT_THREAD_CTRL_SET_PRIORITY 2025-04-13 15:25:42 +08:00
wycwyhwyq
da1c5c7882 add RT_THREAD_CTRL_SET_PRIORITY 2025-04-13 15:25:42 +08:00
Yang Xijing
6639dbe252 【修改】timer parameter注释 (#10172) 2025-04-08 12:11:19 +08:00
kk
4acef9b1cd Update include/rtdef.h version to 5.2.1 2025-03-28 23:12:14 -04:00
Chen Wang
c40b79037c doxygen: add prefix for groups (#9991)
* doxygen: add prefix for groups

Add "group_" prefix to doxygen group names. This makes
it easier to grep with group name later.

This patch only modifies the groups defined in the pathes
of INPUT of documentation/Doxyfile:

INPUT = . \
        ../src \
        ../include \
        ../components/finsh \
        ../components/drivers/include/drivers \
        ../components/drivers/clk \
        ../components/dfs/dfs_v2/src \
        ../components/dfs/dfs_v2/include

Other groups are not touched.

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>

* ci: fixed error report when run file_check.py

Such as:
- "please delete extra space at the end of this line."
- "the RT-Thread error code should return negative value. e.g. return
  -RT_ERROR"

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>

---------

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2025-02-15 12:15:19 +08:00
GUI
945114fd59 [DM/FEATURE] Support NVME (#9591)
* [DM/FEATURE] Support NVME

1. Support PRP and SGL (>= NVME v1.1) transport.
2. Support MSI/MSI-X for IO queues.
3. Support NVME on PCI.

Signed-off-by: GuEe-GUI <2991707448@qq.com>
2024-11-24 13:57:37 +08:00
GuEe-GUI
1bef42c64c [DM/FIXUP] remove some redundant INIT_EXPORT
Signed-off-by: GuEe-GUI <2991707448@qq.com>
2024-11-18 15:03:23 +08:00
GuEe-GUI
3b22dbd049 [DM/FEATURE] DM Device IDA management
Drivers can manage their own IDs without having to concern
themselves with the register/unregister in system

Link: https://github.com/RT-Thread/rt-thread/issues/9534

Signed-off-by: GuEe-GUI <2991707448@qq.com>
2024-11-18 14:23:25 +08:00
Shell
2f6d98bfcb feat: smp_call: added signaling call_req
This patch introduces `rt_smp_call_request` API to handle queued
requests across cores with user provided data buffer, which provides a
way to request IPI through a non-blocking pattern.

It also resolved several issues in the old implementation:
- Multiple requests from different cores can not be queued in the work
  object of the target core.
- Data racing on `rt_smp_work` of same core. If multiple requests came
  in turns, or if the call is used by the target cpu, while a new
  request is coming, the value will be overwrite.
- Memory vulnerability. The rt_smp_event is allocated on stack, though
  the caller may not wait until the call is done.
- API naming problem. Actually we don't provide a way to issue an IPI to
  ANY core in mask. What the API do is aligned to MANY pattern.
- FUNC_IPI registering to PIC.

Changes:
- Declared and configured the new `RT_SMP_CALL_IPI` to support
  functional IPIs for task requests across cores.
- Replaced the single `rt_smp_work` array with `call_req_cores` to
  manage per-core call requests safely.
- Added `_call_req_take` and `_call_req_release` functions for atomic
  handling of request lifetimes, preventing data race conditions.
- Replaced single event handling with a queue-based approach
  (`call_queue`) for efficient multi-request processing per core.
- Introduced `rt_smp_call_ipi_handler` to process queued requests,
  reducing IPI contention by only sending new requests when needed.
- Implemented `_smp_call_remote_request` to handle remote requests
  with specific flags, enabling more flexible core-to-core task
  signaling.
- Refined `rt_smp_call_req_init` to initialize and track requests
  with atomic usage flags, mitigating potential memory vulnerabilities.

Signed-off-by: Shell <smokewood@qq.com>
2024-11-03 10:08:45 +08:00
Shell
40cd8cce99 feat: Added rt_interrupt_context* family for nested interrupt handling
These changes introduce the rt_interrupt_context family, providing a
mechanism for managing nested interrupts. The context management
ensures proper storage and retrieval of interrupt states, improving
reliability in nested interrupt scenarios by enabling context tracking
across different interrupt levels. This enhancement is essential for
platforms where nested interrupt handling is crucial, such as in real-
time or multi-threaded applications.

Changes:
- Defined rt_interrupt_context structure with context and node fields
  in `rtdef.h` to support nested interrupts.
- Added rt_slist_pop function in `rtservice.h` for simplified node
  removal in singly linked lists.
- Declared rt_interrupt_context_push, rt_interrupt_context_pop, and
  rt_interrupt_context_get functions in `rtthread.h` to manage the
  interrupt/exception stack.
- Modified AArch64 CPU support in `cpuport.h` to include
  rt_hw_show_register for debugging registers.
- Refactored `_rt_hw_trap_irq` in `trap.c` for context-aware IRQ
  handling, with stack push/pop logic to handle nested contexts.
- Implemented interrupt context push, pop, and retrieval logic in
  `irq.c` to manage context at the CPU level.

Signed-off-by: Shell <smokewood@qq.com>
2024-11-03 10:08:45 +08:00
KunYi Chen
6b7f1177de fix: suppress unused warnings when DEBUG disabled
When RT_USING_DEBUG is disabled, variables used only in RT_ASSERT
statements become unused, triggering -Wunused-but-set-variable compiler
warnings. These variables are essential for runtime assertions in debug
builds but appear unused in release builds.

Example:
- Variables used in RT_ASSERT(var != RT_NULL) checks
- Affects multiple drivers and components using RT_ASSERT

This is a general cleanup to improve code compilation without affecting
functionality.
2024-10-25 22:22:09 -04:00
Shell
588611d314 feat: includes: included kerrno.h in rtdef.h
Those definitions are presented in rtdef.h until PR #9461 moved them to
kerrno.h, which introduced unknown definition error for project building

Changes:

- Added includes of kerrno.h

Signed-off-by: Shell <smokewood@qq.com>
2024-09-25 21:03:48 -04:00
zhujiale
244cf61af6 SMP 2024-09-24 09:56:30 +08:00
zhujiale
512dae84be smp_ipi 2024-09-24 09:56:30 +08:00
Meco Man
ee5014d32f [klibc] add kerrno.h 2024-09-23 21:30:37 +08:00
supperthomas
14e4c45408 [doc][doxygen] Fix doxygen struct error.
Signed-off-by: supperthomas <78900636@qq.com>
2024-06-26 20:22:43 +08:00
zms123456
59193dfeeb [timer]add all soft timer config (#9048)
* add all soft timer

* update wq

* add timer test

* shield LOG_D
2024-06-20 04:20:38 +08:00
Shell
6ca327d8ce [smart] add CPU/thread usage tracing config (#8947)
* [smart] add CPU usage tracing config

This patch introduces following features:

- Added CPU usage tracing functionality, enabled by default, for
  applications like 'top'
- update time as smart independent

Signed-off-by: Shell <smokewood@qq.com>

* fixup: add ump idle thread

---------

Signed-off-by: Shell <smokewood@qq.com>
2024-06-04 00:06:41 +08:00
GUI
e7cddf3a52 [Feature] Support simple power domain API (#9005)
* [Feature] Power domain for device

1.Support device power on/off.
2.Support attach/detach device.
3.Support power domain driver api.

Signed-off-by: GuEe-GUI <2991707448@qq.com>

* [DM/platform] Enhanced platform bus

1.Add power domain for device.
2.Support `remove` and `shutdown` bus interface.

Signed-off-by: GuEe-GUI <2991707448@qq.com>

---------

Signed-off-by: GuEe-GUI <2991707448@qq.com>
2024-05-30 15:30:40 +08:00
Shell
f17f994f8c [arm64] add hw thread self (#8942)
* [libcpu] arm64: Add hardware thread_self support

This patch introduces hardware-based thread self-identification
for the AArch64 architecture. It optimizes thread management by
using hardware registers to store and access the current thread's
pointer, reducing overhead and improving overall performance.

Changes include:
- Added `ARCH_USING_HW_THREAD_SELF` configuration option.
- Modified `rtdef.h`, `rtsched.h` to conditionally include
  `critical_switch_flag` based on the new config.
- Updated context management in `context_gcc.S`, `cpuport.h`
  to support hardware-based thread self.
- Enhanced `scheduler_mp.c` and `thread.c` to leverage the new
  hardware thread self feature.

These modifications ensure better scheduling and thread handling,
particularly in multi-core environments, by minimizing the
software overhead associated with thread management.

Signed-off-by: Shell <smokewood@qq.com>

* fixup: address suggestion

* fixup: rt_current_thread as global

* scheduler: add cpu object for UP scheduler

Also, maintain the rt_current_thread in cpu object on UP scheduler.

---------

Signed-off-by: Shell <smokewood@qq.com>
2024-05-28 14:27:55 +08:00
Shell
f2d6325b43 [smart] select console device dynamically (#8949)
* [smart] select console device dynamically

- Fixed compiler warning on terminal subsystem for
  `components/lwp/terminal/terminal.h`
- Updated default console setup to dynamically select an appropriate tty
  device based on the configured console device name.

Signed-off-by: Shell <smokewood@qq.com>

* fixup: remove useless codes

---------

Signed-off-by: Shell <smokewood@qq.com>
2024-05-17 13:19:00 +08:00
Meco Man
a0735dcb11 upgrade RT-Thread version to v5.2.0 2024-04-16 23:04:24 -04:00
zms123456
6ad0b2bd09 [components][drivers]fix workqueue bug
fix workqueue bug
2024-04-15 23:15:37 -04:00
geniusgogo
48f83a5416 add subsys early init level (#8756)
Signed-off-by: geniusgogo <xpxyr@sina.com>
2024-04-10 23:55:58 +08:00
Shell
4b0f42c24a [drivers/serial] Introduce hooker for TTY (#8733)
In this patch, a hook list has been introduced to address the concerns
regarding coupling issues arising from modifications to the serial code
for integrating TTY logic.

Signed-off-by: Shell <smokewood@qq.com>
2024-04-09 21:36:16 +08:00
Shell
83e95bdff4 sync smart & dfs (#8672)
Signed-off-by: xqyjlj <xqyjlj@126.com>
Signed-off-by: Shell <smokewood@qq.com>
Co-authored-by: xqyjlj <xqyjlj@126.com>
2024-03-28 23:42:56 +08:00
Meco Man
e3a14a97a9 [kernel] fix warning of rt_thread_t struct (#8584) 2024-03-06 16:57:19 +08:00
Shell
71560bafb5 🎯 Sync smart & scheduler codes (#8537)
Signed-off-by: Shell <smokewood@qq.com>
Co-authored-by: xqyjlj <xqyjlj@126.com>
2024-02-23 17:49:15 +08:00
Meco Man
2748a6ada4 [kernel] fix some strict compiling warnings 2024-02-19 01:56:21 -05:00
fangjianzhou
10b16273b8 [drivers][core] 完善设备模型 (#8384) 2024-01-09 23:10:42 +08:00
xqyjlj
6b6d39d716 feat: delete thread ref (#8456) 2024-01-05 17:03:55 +08:00
Shell
e7880a9713 [kernel] support for hook list
Signed-off-by: Shell <smokewood@qq.com>
2024-01-02 19:42:46 +08:00
Shell
3a7903b799 [kernel] Add hook for malloc services
Including the patch for memory allocation, testsuites and fixups of
static analysis.

Signed-off-by: Shell <smokewood@qq.com>
2024-01-02 19:42:46 +08:00
Meco Man
20fb70ba15 [rtdef] remove legacy code 2023-12-25 10:50:43 +08:00
geniusgogo
3dfafcd1d9 add semaphore max value control. (#8390) 2023-12-21 10:31:27 +08:00
xqyjlj
0541b39d61 feat(rtdef.h): add rt_always_inline 2023-12-21 01:00:59 +08:00
Meco Man
005828eba7 [nano] rt-thread susport nano option 2023-11-30 11:39:34 +08:00
Meco Man
873fd76b2f [libc] add RT_USING_INTERNAL_LIBC_ONLY macro
This option is for RT-Thread Nano version.
If select this option, it will not compile components/libc
folder and only use tool chain internal libc. Normally, the
tool chain internal is only cover ISO standard (e.g. armcc),
but some tool chains' internal libc will cover more than
ISO standard (e.g. newlib).
2023-11-21 23:22:55 -05:00
geniusgogo
9acebb07dc fix rt_channel lock. (#8244) 2023-11-10 21:37:07 +08:00
Meco Man
589641258e [debug] rename RT_DEBUGING_INIT as RT_DEBUGING_AUTO_INIT 2023-11-10 05:24:33 -05:00