Commit Graph

16444 Commits

Author SHA1 Message Date
Shell 57d002b25e feat: remove redundant codes under virt64, c906
Changes:

- create new folder name `common64` and save all common codes of rv64
  inside

Signed-off-by: Shell <smokewood@qq.com>
2024-09-13 17:35:00 -04:00
GuEe-GUI 2d026a316a [FEATURE/OFW] add address reverse/translate for DMA/CPU's address
DMA and CPU address view is different, we need to convert them:

    +--------+    +--------+  +---------+          +--------+
    |        |    |        |  |         |          |        |
    |  CPUs  |    |  DEV0  |  |  IOMMU  <----+     |  DEV1  |
    |        |    |        |  |         |    |     |        |
    +----+---+    +----+---+  +----+----+    |     +----+---+
         |             |           |         |          |
0x200000 |      0x1000 |    0x1000 |         |   0x8000 |
         |             |           |         |          |
         +-------------+-----------+         +----------+
         |
         |
+--------v----------------------------------------------------+
|                                                             |
|                          Address BUS                        |
|                                                             |
+-------------------------------------------------------------+

Signed-off-by: GuEe-GUI <2991707448@qq.com>
2024-09-13 17:33:29 -04:00
GuEe-GUI 117e6ed347 [FEATURE/FDT] Add bootargs select in early
Maybe use for memory/DMA buffer init before
ofw_node unflatten.

Signed-off-by: GuEe-GUI <2991707448@qq.com>
2024-09-13 17:33:29 -04:00
GuEe-GUI cb665f932e [FIXUP/OFW] ofw_parse_object fail
The ofw parse should:
1. Check obj_name EQU the current node's rt_data.
2. Find the next object name.
3. goto "2" until obj_name EQU the cmp_cell's obj_name.

Signed-off-by: GuEe-GUI <2991707448@qq.com>
2024-09-13 17:33:29 -04:00
GuEe-GUI 8c456c5e33 [FIXUP/OFW] remove the last empty string for bootargs
Signed-off-by: GuEe-GUI <2991707448@qq.com>
2024-09-13 17:33:29 -04:00
GuEe-GUI 06211b8be1 [FIXUP/OFW] DTS version header always v1.0
Signed-off-by: GuEe-GUI <2991707448@qq.com>
2024-09-13 17:33:29 -04:00
GuEe-GUI 43701ea1ed [FIXUP/OFW] Increase append child node's ref_count
rt_ofw_append_child append a new child node and return,
ref_get is necessary.

Signed-off-by: GuEe-GUI <2991707448@qq.com>
2024-09-13 17:33:29 -04:00
GuEe-GUI 9fd9c1ee45 [FIXUP/OFW] rt_ofw_foreach_node_by_compatible args
Signed-off-by: GuEe-GUI <2991707448@qq.com>
2024-09-13 17:33:29 -04:00
zms123456 140ca0d2ff
[components][sal]replace netdev's spin_lock_irqsave to spin_lock
netdev的函数不会在中断中调用,无需关中断
2024-09-13 17:32:35 -04:00
zms123456 fb02e7934d
[component][net]add more socket flag 2024-09-13 17:30:24 -04:00
Rbb666 49c39d4a8d [bsp][gd32]Fix the problem that uartv2 does not enable dma compilation error. 2024-09-13 17:29:23 -04:00
zms123456 f2dc4f13cb
[components][lwip]fix lwip poll macro conflict 2024-09-13 17:29:08 -04:00
heyuanjie87 6d39cdf836 [lwp] 取消脚本中限制rv的具体cpu类别
此目录中为rv64通用代码
2024-09-13 17:28:47 -04:00
Yilin Sun 779547d708 bsp: nxp/mcx/mcxc/mcxc444: Add SPI driver support.
Signed-off-by: Yilin Sun <imi415@imi.moe>
2024-09-12 18:15:32 -04:00
Supper Thomas a0e1f954c8
[action][cppcheck] add summary (#9426)
* [action][cppcheck] add summary

添加summary 方便查看出错信息
2024-09-12 09:41:22 +08:00
Supper Thomas c154c24319 [action][ci] add cppcheck new feature
'--check-level=exhaustive'
这个选项可以更深入的在分支中检测,但是会耗时比较久一些。
2024-09-11 20:55:55 -04:00
Shell c78a19ed26 feat: libcpu/risc-v: unify low-level bringups
This patch consolidates the separated architecture-specific code for
rv64 (virt64 and c906) under a more unified approach. The changes
aim to enhance maintainability and code reuse, reducing duplication
between these two architectures while adding small improvements in
porting compatibility.

Changes:
- Modified build scripts (SConscript) for both virt64 and c906 to
  remove ASID and vector dependencies when not required.
- Updated c906's sbi.c and sbi.h to use standard integer types
  (uint32_t) and include the missing <stdint.h> header.
- Unified inline function declaration for `sbi_call` across both
  c906 and virt64 using `rt_inline`.
- Disabled FPU and vector in c906's startup assembly file, aligning it
  with the virt64 handling.
- Corrected syscall handler type definitions in c906 for consistency.

Signed-off-by: Shell <smokewood@qq.com>
2024-09-11 18:06:51 -04:00
Shell e244c196c4 feat: libcpu/risc-v: unify interrupt & IO on rv64
This patch aims to unify the two currently separated RISC-V 64-bit
architecture ports, 'virt64' and 'c906', into a single generic
'common64' port. The changes include renaming files and updating
includes to use a unified 'interrupt.h' header, as well as making
adjustments to IO and trap handling to be more consistent between the
two architectures.

Changes:
- Renamed 'rt_interrupt.h' to 'interrupt.h' and updated includes accordingly.
- Unified IO register access functions in 'riscv_io.h'.
- Added 'opcode.h' for portable assembly support.
- Updated 'plic.c' and 'plic.h' to handle interrupts in a unified manner.
- Modified 'trap.c' to handle exceptions and interrupts consistently for 'rv64'.

Signed-off-by: Shell <smokewood@qq.com>
2024-09-11 18:06:51 -04:00
Shell a00aaab2ba feat: libcpu/risc-v: unify mmu related works
These changes are designed to standardize the memory management across
'virt64' and 'c906', ensuring efficient handling of address spaces and
page tables.

Changes:
- Creation of ASID management files (`asid.c`) for both 'c906' and
  'virt64' architectures, which is essential for maintaining stability.
- Extensive updates to the MMU configuration and handling in `mmu.c` and `mmu.h` files.
- Addition of functions to manage ASID allocation and switching of page tables.
- For c906, accommodated the early memory setup to the one from virt64.

Signed-off-by: Shell <smokewood@qq.com>
2024-09-11 18:06:51 -04:00
Shell 7528645f59 feat: libcpu/risc-v: unify context on c906, virt64
Changes:
- added config for NEW_CTX_SWITCH
- used new context on c906 sched switch routine
- update _rt_hw_stack_init to fit into NEW_CTX_SWITCH
- separated vector ctx from the generic

Signed-off-by: Shell <smokewood@qq.com>
2024-09-11 18:06:51 -04:00
Shell adbbd24ad7 feat: bsp: qemu risc-v64: fit into common64 2024-09-11 18:06:51 -04:00
zms123456 0edd2e7766
[utest]fix race in mutex tc & add recurse lock tc 2024-09-11 18:04:41 -04:00
zms123456 b423a6b1e3
[components][lwp]remove extra check in sys_bind 2024-09-11 18:04:05 -04:00
zms123456 08221b54d0
[kernel][mutex] fix bug of thread exit without releasing mutex & add error check log 2024-09-11 18:03:43 -04:00
GuEe-GUI f9b632d52d [DM/MISC] Add error no for ptr
When the driver request a API gets RT_NULL which return value is ptr,
they could not know why get a RT_NULL.

some API return RT_NULL, is not error internal maybe, it just not
supported for this platform, but the driver still could work ok,
the API can return (RT_NULL + -RT_EEMPTY) to driver.

on the other hand, the driver can do more behaviors by error no.
When the API return the -RT_EBUSY, driver can wait for a moment and retry.
When the API return the -RT_ENOSYS, driver can try the next mode or request's name.

Signed-off-by: GuEe-GUI <wusongjie@rt-thread.com>
2024-09-11 14:34:13 +08:00
Rbb666 0df9a9f0cc [bsp][hpmicro]添加utest相关段信息,修复scons编译问题 2024-09-10 23:59:59 -04:00
CYFS cb0b5b05ad
[components][sensor]增加电源检测类型 2024-09-10 19:54:03 -04:00
liangzohar 240172609c [bsp/n32] 修复每次上电都初始化RTC导致上电时间被重置的问题 2024-09-10 19:53:01 -04:00
ryancw 9de975fa93 [components][sal][at] _gethostbyname_by_device 添加注释 2024-09-09 18:07:41 -04:00
ryancw e9711d5640 [components][sal][at] netdb添加at_gethostbyname_r 2024-09-09 18:07:41 -04:00
ryancw bac9812cf9 [component][at_socket] udp一个socket跟多个地址通讯bug修复、DNS加锁防止多线程错乱、实现at_gethostbyname_r、稳定性优化 2024-09-09 18:07:41 -04:00
Supper Thomas 3943a3e163
[action] fix cppcheck build dir (#9406) 2024-09-09 14:13:43 +08:00
SeliverWang 66dd03f6c2 修复audio_pipe中函数在开启POSIX IPC时与 POSIX PIPE冲突问题 2024-09-06 23:18:09 -04:00
GuEe-GUI 2168ed8e7d [DM/Feature] Basic PCI/PCIe (Peripheral Component Interconnect Express) bus
PCI/PCIe have better performance and more devices support, such as
NVMe, GPU, Powerful NIC (Like RDMA). PCI/PCIe can access control by
IOMMU that the virtualiztion and userspace driver will more safety.
PCI/PCIe device could hot plugging, no design modifications SoC required,
PCI/PCIe on Embedded SoC is popular now.
We make a simple framework to support them.

Feature Lists:
1.PCI INTx: the INT[A-D] pin IRQ for legacy PCI, work with platform PIC.
2.MSI/MSI-X: the message write IRQ for PCIe, work with platform's PIC.
3.PME: we only support the D0, D1, D2, D3HOT, D3COLD init by framework.
4.Endpoint: a simple EP framework for PCI FPGA or NTB function.
5.OFW: we only support work on OFW SoC, ACPI support in the future maybe.

Host controller:
1. Common PCI host controller on ECAM.
2. Generic PCI host controller on ECAM.

Signed-off-by: GuEe-GUI <2991707448@qq.com>
2024-09-06 17:45:03 -04:00
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
zms123456 9631f04abe
[utest]add mutex_pi_tc
* add mutex_pi
* fix assertion error when thread wakeup while waiting mutex
2024-09-06 17:44:02 -04:00
Supper Thomas 0c16568387 [action] add cppcheck project and action debug 2024-09-05 23:39:30 -04:00
Chen Wang 6fc1fc72b7 bsp: cvitek: clean up useless variable assignments in SConstruct
CV18xx RISC-V C906L.

Configuration value for CPU and ARCH are already defined in rtconfig.py.
Remove these duplication from SConstruct.

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
2024-09-05 23:39:06 -04:00
zhangyan 5181857148
[bsp/phytium]默认配置修改 2024-09-05 18:18:27 -04:00
RyanCW 188b87f4d8
[components][at_socket] 添加errno设置 2024-09-05 17:54:50 -04:00
yandld 1cc0fb87df fix README typo 2024-09-05 13:04:16 +08:00
yandld ba7e469772 [bsp][mcxc444] update README and keil project 2024-09-05 13:04:16 +08:00
Supper Thomas 580f3146eb fix the cfg path 2024-09-04 23:35:27 +08:00
Yilin Sun b4165288fc bsp: nxp/mcx/mcxc: FRDM-MCXC444: Kconfig: Add I2C support. 2024-09-04 23:34:40 +08:00
Yilin Sun b76fd6ba0a bsp: nxp/mcx/mcxc: Add I2C driver support. 2024-09-04 23:34:40 +08:00
Shell d2160d352c
fixup: ipc: protect taken_list on shared lock
为什么提交这份PR (why to submit this PR)
Issue: using iperf server with sshd together and the kernel will get stuck occasionally.

taken_list is accessed from other mutex when updating priority.

你的解决方案是什么 (what is your solution)
protect taken_list on shared lock, but not on mutex local spinlock.

Signed-off-by: Shell <smokewood@qq.com>
2024-09-03 22:06:16 -04:00
Z8MAN8 cea7670e7f bsp: cvitek: fix cvitek uart driver can not repeat configure
After first called from uart open, the dw8250_uart_configure
API cannot be called again. Otherwise, this will mess up the
device, and uart will not act properly to interrupt again.

Analysis: Configure uart device will close recive interrupte,
causing uart device to malfunction.

Solution: After configure uart device, enable the device's
recive interrupte.

Signed-off-by: Shicheng Chu <1468559561@qq.com>
Reviewed-by: Chen Wang <unicorn_wang@outlook.com>
2024-09-03 20:50:50 -04:00
Supper Thomas 3174fcd77b [action] update cppcheck version 2024-09-03 20:50:31 -04:00
GuEe-GUI 175a2ff954 Fixup platform not free device in OFW
Signed-off-by: GuEe-GUI <2991707448@qq.com>
2024-09-03 19:49:47 -04:00
GuEe-GUI 2ec69c3ce4 Fixup bus remove device option
The bus should call driver's `remove` callback not
instead of `shutdown` in rt_bus_remove_device.

Signed-off-by: GuEe-GUI <2991707448@qq.com>
2024-09-03 19:49:47 -04:00