Commit Graph

4534 Commits

Author SHA1 Message Date
LaterComer 2cbe8bdae0
解决ktime部分函数计算时unsigned long溢出 (#9008)
* 解决ktime部分函数计算时unsigned long溢出

* 恢复部分不需要ktime中部分rt_uint64_t类型的为unsigned long
2024-05-30 12:04:33 +08:00
Jiading Xu 2fcf151a8e [components][drivers][include][phy] add one more parameter for mulitiple phys
- add parameter phy to specify multiple-phy instance

Signed-off-by: Jiading Xu <Jiading.Xu@hpmicro.com>
2024-05-29 22:22:51 +08:00
Shell 63591d935e
[smart] fixup errno passing on sys_mkdir() (#9007)
Use _SYS_WRAP to fetch errno on return of mkdir to avoiding overriding
of it on other system APIs.

Signed-off-by: Shell <smokewood@qq.com>
2024-05-29 18:06:54 +08:00
Shell f179ce12b7
[smart] update sched_setaffinity() to use thread(task) ID (#9004)
Correct `sched_setaffinity()` to use the thread IDs (TIDs) instead of
process IDs (PIDs). The previous implementation used PIDs, which
caused issues since affinity settings need to be applied at the
thread level.

As the manual documented, the signature is:

>        int sched_setaffinity(pid_t pid, size_t cpusetsize,
>                             const cpu_set_t *mask);

Yes, it's tricky, the identification passing in is called **'PID'**.
But when we talk about 'pid' from GNU libc, it's the **'task-id'**,
aka, `thread->tid` known in kernel.

Changes were made by updating the function signatures and logic in
`lwp.h`, `lwp_pid.c`, and `lwp_syscall.c` to accept TIDs. Specifically,
the `lwp_setaffinity` function and related internal functions now
operate using thread IDs and adjust thread affinity settings accordingly

Signed-off-by: Shell <smokewood@qq.com>
2024-05-29 06:53:22 +08:00
heyuanjie87 326150e2f4
[lwp/riscv]进入libc前初始化用户态sp (#8997) 2024-05-29 06:52:38 +08:00
GUI b45fb59df2
[OFW] io ranges use list to storage without ofw data (#8993)
[OFW] io ranges use ptr array to storage without ofw data

ofw data is private data for every ofw node that
the drivers of ofw node will use item.
replace the ranges supported to a ptr array.

the ptr array size is config by `RT_USING_OFW_BUS_RANGES_NUMBER`

Signed-off-by: GuEe-GUI <2991707448@qq.com>
2024-05-28 14:25:09 +08:00
GUI 6f6b0c3ba0
[DM/feature] Simple NUMA (Non-Uniform Memory Access) (#9000)
For some CPU memory access devices, that the drivers
will find memory and CPU affinity to config device.

Signed-off-by: GuEe-GUI <2991707448@qq.com>
2024-05-28 14:08:33 +08:00
Shell 952f2c43f8
[smart] add FIONREAD ioctl support for tty (#8996)
Signed-off-by: Shell <smokewood@qq.com>
2024-05-28 09:56:10 +08:00
GUI de352aee62
[PIC] Make affinity helper interface (#8995)
* [PIC] Make affinity helper interface

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

* [PIC/GIC] Fixup GIC affinity init

GICv2 is not support if current CPU is not startup,
but RT-Thread SMP is startup after the devices init
in the `main` thread.

This patch fixup the cpumask to init once and check
the init status in affinity interface.

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

---------

Signed-off-by: GuEe-GUI <2991707448@qq.com>
2024-05-28 09:55:24 +08:00
GUI f035188094
[OFW] Support ID map interface (#8994)
The OFW map id is always use in DMA, PCI, IOMMU
bus system to find the device identity. this is
a access interface.

Signed-off-by: GuEe-GUI <2991707448@qq.com>
2024-05-28 09:54:03 +08:00
GUI 8c6c9205b0
[OFW] Fixup irq parse map and map mask (#8992)
`map_len` and `map_mask_len` is the count of elements,
not the bytes size of elements.

Signed-off-by: GuEe-GUI <2991707448@qq.com>
2024-05-28 09:52:10 +08:00
GUI 754c59a411
[Feature] DFS mount auto by kernel parameters (#8989)
DFS mount auto by kernel parameters

1.Mount the rootfs options by parameters:
- root=: root device, like vda1, sda1, sd0p1, nvme0n0p1...
- rootfstype=: root file system type, like elm, ext, crom...
- rw/ro: root is readonly or all enable, if not have 'rw' flag,
         the 'ro' flag is default.
- rootwait: always wait for root device status is OK.
- rootdelay=: mount rootfs delay amount of time (millisecond).

2.Mount the other fs options by `fstab.sh`, it will read the script
after root mount is OK, it's format is a list of mount cmds in MSH:

mount vda2 /mnt elm
mount 192.168.1.1:/ /mnt/remote nfs

Signed-off-by: GuEe-GUI <2991707448@qq.com>
2024-05-28 00:26:57 +08:00
winfenggao 80dc539698 如果申请空间不足,申请不到合适的空间,需要回收new_rbb 2024-05-27 11:28:45 +08:00
Fan YANG 2cc2743fc7 [components][drivers][sd] add uhs-i mode support to sd driver
- added SDR50, SDR104 and DDR50 support to SD driver

Signed-off-by: Fan YANG <fan.yang@hpmicro.com>
2024-05-27 11:27:03 +08:00
Shell 5f71da566a
[libcpu] arm: fixup signal handling (#8988)
Signed-off-by: Shell <smokewood@qq.com>
2024-05-26 22:00:48 +08:00
Shell 397cdcd132
[libcpu] discard rt_current_thread (#8976)
* [libcpu] rv64: discard rt_current_thread

* arm: using rt_thread_self to fetch current TCB
2024-05-26 22:00:17 +08:00
Fan YANG 1a1514640a [components][drivers][mmc] add HS400 support to mmc driver
- added HS400 supprt (both eMMC5.0 and eMMC5.1 flavor are supported)

Signed-off-by: Fan YANG <fan.yang@hpmicro.com>
2024-05-26 12:36:02 +08:00
zms123456 adf2b35ec6
[component][driver]init dm serial naming framework in a separate phase (#8971)
init dm serial naming framework in a phase
2024-05-21 22:36:20 +08:00
Shell 6b12bce22f
[quality] fixup compiler warning (#8961)
Signed-off-by: Shell <smokewood@qq.com>
2024-05-21 19:47:42 +08:00
Shell 5f947863b4
[dfsv2] fixup out-of-memory access (#8973)
This change addresses a potential out-of-memory access issue in the
devfs filesystem component. The issue arises when the `rt_malloc`
function allocates memory for a path string without accounting for
the null terminator, leading to undefined behavior.

As the manual documented:

> DESCRIPTION
>   The strlen() function calculates the length of the string pointed to
>   by s, excluding the terminating null byte ('\0').

To fix this, the memory allocation size was increased by one byte
to ensure space for the null terminator. This prevents potential
out-of-memory access and ensures proper string termination.

Signed-off-by: Shell <smokewood@qq.com>
2024-05-21 19:45:08 +08:00
zms123456 6101f1fd29
[components][driver]add isr statistics (#8955)
add isr statistics
2024-05-21 09:01:42 +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
xiao-mang e46333496f
fix specified network card not taking effect with msh's ping error (#8937)
* fix specified network card not taking effect with msh's ping error

* fix specified network card not taking effect with msh's ping error
2024-05-16 15:43:50 +08:00
zms123456 ed002bb84a
[drivers][serial]fix error in getting serial_tty settings (#8953)
fix error in getting serial_tty settings
2024-05-16 15:36:16 +08:00
liYangYang 78bdf67ab2
[drivers][ofw] fix ofw_alias_scan() bug (#8908)
* fix ofw_alias_scan() bug

* fix tag_len
2024-05-13 20:56:32 +08:00
atwww b421b4e1f4
修复C++11 thread_local对象析构函数与实际内存释放动作顺序相反问题 2024-05-11 13:50:02 -04:00
zms123456 151a96cb88
[components][drivers]fix compiler error in serial dm (#8927)
fix compiler error in serial dm
2024-05-11 11:16:26 +08:00
Shell 989cc61f48
[hrtimer] fixup use-after-free (#8928)
Signed-off-by: Shell <smokewood@qq.com>
2024-05-11 08:53:42 +08:00
zhao maosheng 5dba9a4214 remove intr disable 2024-05-10 14:39:53 +08:00
zhao maosheng e2214cc899 add percpu interrupt info 2024-05-10 14:39:53 +08:00
Shell 017b2a5a44
[smart] fixup arm64 aspace switch (#8925)
* [smart] fixup arm64 aspace switch

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

* fixup: arm add arch_kernel_mmu_table_get

---------

Signed-off-by: Shell <smokewood@qq.com>
2024-05-10 09:17:19 +08:00
geniusgogo 79b3d5ec1e fix_serial_baudrate_set 2024-05-09 00:35:46 -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 9ba6cec663
[libcpu/arm64] dealing with mem region out of kernel space (#8847)
* [ofw] dealing with mem region out of kernel space

- Fix parameter checking in _out_of_range() that NULL is excluded for
  fixed mapping
- Split page install with a deferred stage to avoid mapping over
  ARCH_EARLY_MAP_SIZE

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

* fixup: restrict vstart for using of RT_NULL

---------

Signed-off-by: Shell <smokewood@qq.com>
2024-05-08 09:23:31 +08:00
geniusgogo 02e0334ac3 fix_serial_baudrate_set
Signed-off-by: geniusgogo <xpxyr@sina.com>
2024-05-07 19:03:14 -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
Troy 1d2fde8d73 Add comments for all functions in components/libc/posix/ipc/mqueue.c 2024-04-30 01:08:36 -04:00
LZerro f190cba0ab
[i2c] adjust the timing for I2C initialization 2024-04-29 20:46:12 -04:00
yiyi 4c9d3be98a
[components][drivers] added sensor device lookup function 2024-04-29 17:54:13 -04:00
xiao-mang b586889216
fix baudrate error (#8873)
* fix baudrate error

* fix baudrate error

* fix baudrate error

* fix baudrate error

* fix baudrate error

* fix baudrate error

* fix baudrate error

* fix baudrate error

* fix baudrate error
2024-04-29 18:00:34 +08:00
xiao-mang c359e93a9c
fix file mmap (#8865) 2024-04-28 15:21:02 +08:00
liYangYang d30c8b340e
[drivers][ofw] Fixed fdt_scan_memory() memory adjustment bug (#8853)
* Fixed fdt memory adjustment bug

* Modify the memory adjustment logic
2024-04-27 18:25:42 +08:00
Troy 946dd264ed Add comments for all functions in components/libc/posix/io/termios/termios.c 2024-04-26 23:13:27 -04:00
xiao-mang 75f41723cb
fix sys_getcwd (#8852) 2024-04-25 18:28:53 +08:00
zms123456 be97a8ef25
[components][dfs]remove duplicate lseek in devfs (#8859)
remove duplicate lseek in devfs
2024-04-25 18:28:43 +08:00
Shell 9e1a816f06
[smart] fix tty serial ioctl (#8861)
Using param callback to reduce unnecessary call.

Signed-off-by: Shell <smokewood@qq.com>
2024-04-25 18:21:32 +08:00
Troy 98a234d430
Add some comments in components/libc/posix/ipc/semaphore.c (#8848) 2024-04-24 05:46:43 +08:00
sp-cai 554632f1ee
[ipc] [dataqueue] 修复队列 pop 挂起的线程 push 无法恢复运行的错误 (#8839)
队列在 push 后查找挂起列表时使用了错误的挂起列表。
2024-04-22 20:20:35 +08:00
zms123456 5ca1e45020
[components][drivers]improve ktimer sleep (#8838)
improve ktimer sleep
2024-04-22 11:55:20 +08:00
latercomer 3ff2b08d82 [clang-format] 增加clang-format格式化配置,通过ide或者手动运行tools/run-clang-format.py进行代码自动格式化 2024-04-21 01:18:37 -04:00