Commit Graph

600 Commits

Author SHA1 Message Date
GuEe-GUI 802a6ed2ca [DM] Extended drivers MISC interface
1. RT_FIELD_PREP: prepare a bitfield element.
2. RT_FIELD_GET: extract a bitfield element.
3. rt_offsetof: member offset of a struct
4. rt_upper_32_bits: high 32 bits of value.
5. rt_lower_32_bits: lower 32 bits of value.
6. rt_upper_16_bits: high 16 bits of value.
7. rt_lower_16_bits: lower 16 bits of value.
8. rt_max_t: fix type of max(...).
9. rt_ilog2: integer logarithm base 2.

Signed-off-by: GuEe-GUI <2991707448@qq.com>
2024-09-06 17:45:03 -04:00
Shell dfd8ccf262 feat: kernel/libcpu: fit into ilp32d 2024-09-01 15:12:34 -04:00
Shell e9b683d0b3 feat: set RT_USING_STDC_ATOMIC to first priority
RT_USING_STDC_ATOMIC is a user selected option on current config system.
While the RT_USING_HW_ATOMIC is a forced option selected by Kconfig
under libcpu. And the RT_USING_STDC_ATOMIC will be meaningless if we set
RT_USING_HW_ATOMIC to first priority if the arch has hw-atomic.

Changes:
- set RT_USING_STDC_ATOMIC to first priority on rttypes.h

Signed-off-by: Shell <smokewood@qq.com>
2024-08-13 04:13:51 -04:00
zhao maosheng f543160ead fix rt_atomic_dec_and_test 2024-08-09 12:54:10 +08:00
wdfk-prog 8d3ad68caf [src][tick]rt_tick setting arbitrary value function is added to support low-power wake-up tick compensation 2024-07-19 11:51:39 +08:00
supperthomas b79d5013ff [doc][doxygen] Fix hook struct error.
Signed-off-by: supperthomas <78900636@qq.com>
2024-06-27 23:05:12 +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 e5b7f3fdd8
[kservice] Enhance support for backtrace service (#9037)
[feat] Enhance support for backtrace service

rt_backtrace_formatted_print() and rt_backtrace_to_buffer() to help
debug routines.

Also, following modification are included:
- make rt_backtrace_frame patchable with weak attr
- replace lwp backtrace with sync output

Signed-off-by: Shell <smokewood@qq.com>
2024-06-13 08:55:53 +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
Yang Xijing f55187f830 [include/rtthread.h] rt_thread_close函数声明应当与RT_USING_HEAP无关 2024-05-11 13:42:27 -04:00
Shell 48bd0e49f2
[ipc] support of lockless rt_completion (#8887)
* [ipc] lockless rt_completion implementation

The new rt_completion implemented by lockless algorithm can improve timer resolution for up to ~12%, compare to sem IPC.

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

* fixup: error

* remove useless changes

---------

Signed-off-by: Shell <smokewood@qq.com>
2024-05-08 09:25:57 +08:00
Shell 6977cf9101
[src] add rt_hw_cpu_id() wrapper API (#8894)
* [src] add rt_hw_cpu_id() wrapper API

rt_hw_cpu_id() is an unsafe API which should not be used by most codes
directly. It's error-prone because it must be used in proper context,
otherwise it can lead to errors and unpredictable behavior.

This patch adds a wrapper API for rt_hw_cpu_id() to address this risk.
It includes the context-checking functionality and provides a safer
alternative for obtaining CPU IDs, ensuring that it is used correctly
within the appropriate context.

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

* fixup UMP

* update API & comment

* ci: cpp_check

---------

Signed-off-by: Shell <smokewood@qq.com>
2024-05-08 09:22:09 +08:00
zms123456 9112dffec8
[src][Kconfig]make RT_ASSERT independent of RT_USING_DEUBG 2024-05-06 20:40:30 -04:00
Shell 2c9b7c10b9
[kernel] add rt_thread_close()
* [thread] Add rt_thread_close()

This patch introduces a new function `rt_thread_close()` to enhances the
usability and maintainability by providing a dedicated mechanism for
closing threads.

- A new function `rt_thread_close()` is added to the API, providing a
  standardized approach for closing threads.
- The `rt_thread_close()` function removes a thread from the thread
  queue, updates its status to indicate closure, and performs the thread
  timer detaching which is a embedded timer in thread object.
- Additionally, the `rt_thread_detach()` function is modified to utilize
  `rt_thread_close()` internally, streamlining the thread detachment
  process.

Signed-off-by: Shell <smokewood@qq.com>
2024-05-01 00:49:09 -04:00
sp-cai 554632f1ee
[ipc] [dataqueue] 修复队列 pop 挂起的线程 push 无法恢复运行的错误 (#8839)
队列在 push 后查找挂起列表时使用了错误的挂起列表。
2024-04-22 20:20:35 +08:00
Meco Man d68e47eb25 [klibc] organize and renmae macros, and add CI check 2024-04-20 21:52:49 -04:00
Meco Man 792c3c0603 [kernel] move errno functions into klibc 2024-04-20 00:57:17 -04:00
Shell d1bb01621b fixup: add Kconfig option 2024-04-19 21:30:12 -04:00
Shell 8c4db32d04 fixup: debug 2024-04-19 21:30:12 -04:00
Shell 451ac03965 add cpu up 2024-04-19 21:30:12 -04:00
Shell 2aacba2c86 [src] Fixup UP irq_spinlock
Use scheduler lock in up irq_spinlock to avoid scheduling during spinlock.

Signed-off-by: Shell <smokewood@qq.com>
2024-04-19 21:30:12 -04:00
xiao-mang 84e6b3c393 fix for art-pi smart 2024-04-19 18:17:20 +08:00
xiao-mang 4de96450be fix for art-pi smart 2024-04-19 18:17:20 +08:00
zhao maosheng 24373e1ec3 add rt_hw_interrupt_uninstall declare in rthw 2024-04-18 22:08:08 -04: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
Shell ad9c20950f
[include] using signed atomic types 2024-04-11 18:48:54 -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
Shell f143ea2b31
[kernel] remove redundant _scheduler_stack_check 2024-03-20 22:26:41 -04:00
Meco Man e81978c5dc [kernel] move std libc related to rtklibc.h 2024-03-20 22:26:11 -04:00
Yuqiang Wang c0e632e56f Fixed an issue in mdk where macro definitions are not supported in the C99 specification 2024-03-20 22:43:55 +08:00
Meco Man e3a14a97a9
[kernel] fix warning of rt_thread_t struct (#8584) 2024-03-06 16:57:19 +08:00
Rbb666 d31c05a44c [tools]Fix project compilation errors generated by mdk and iar 2024-03-05 19:53:53 -05:00
Yuqiang Wang 7eccdb471e
[kernel] fix incorrect expression in macros (#8568) 2024-02-29 19:23:00 -05: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
Yuqiang Wang c6bdee3c50
[ci] open ci check with function declaration warning (#8546) 2024-02-20 22:45:04 -05:00
Meco Man 2748a6ada4 [kernel] fix some strict compiling warnings 2024-02-19 01:56:21 -05:00
Shell f6fce5f8d7 [kservice] MT-safe output support (kprintf/kputs)
Signed-off-by: Shell <smokewood@qq.com>
2024-01-16 00:59:18 +08:00
fangjianzhou 10b16273b8
[drivers][core] 完善设备模型 (#8384) 2024-01-09 23:10:42 +08:00
Shell cc157baf23
[kernel] fixup of data racing accessing percpu objects (#8475)
Signed-off-by: Shell <smokewood@qq.com>
2024-01-09 23:09:49 +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