Commit graph

60363 commits

Author SHA1 Message Date
Bowen Wang
aa0467057c qemu-armv8a/rpserver and rpproxy: support the rpmsg port uart
Use virtio-serial as the rpmsg-port-uart serial device, so we
can bringup the rpmsg-port-uart in qemu platform.

Server command:
qemu-system-aarch64 -cpu cortex-a53 -nographic \
-machine virt,virtualization=on,gic-version=3 \
-chardev stdio,id=con,mux=on -serial chardev:con \
-object memory-backend-file,discard-data=on,id=shmmem-shmem0,mem-path=/dev/shm/my_shmem0,size=4194304,share=yes \
-device ivshmem-plain,id=shmem0,memdev=shmmem-shmem0,addr=0xb \
-device virtio-serial-device,bus=virtio-mmio-bus.0 \
-chardev socket,path=/tmp/rpmsg_port_uart_socket,server=on,wait=off,id=foo \
-device virtconsole,chardev=foo \
-mon chardev=con,mode=readline -kernel ./out/nuttx_qemu-armv8a_rpserver_ivshmem/nuttx \
-gdb tcp::7775

Proxy command:
qemu-system-aarch64 -cpu cortex-a53 -nographic \
-machine virt,virtualization=on,gic-version=3 \
-chardev stdio,id=con,mux=on -serial chardev:con \
-object memory-backend-file,discard-data=on,id=shmmem-shmem0,mem-path=/dev/shm/my_shmem0,size=4194304,share=yes \
-device ivshmem-plain,id=shmem0,memdev=shmmem-shmem0,addr=0xb \
-device virtio-serial-device,bus=virtio-mmio-bus.0 \
-chardev socket,path=/tmp/rpmsg_port_uart_socket,server=off,id=foo \
-device virtconsole,chardev=foo \
-mon chardev=con,mode=readline -kernel ./out/nuttx_qemu-armv8a_rpproxy_ivshmem/nuttx \
-gdb tcp::7776

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-06 02:15:43 +08:00
liaoao
4cad404831 rpmsg_port: print remotes's running state in rpmsg_port_dump
Now rpmsg dump can print the remote core's running/sleep state

Signed-off-by: liaoao <liaoao@xiaomi.com>
2026-01-06 02:15:43 +08:00
liaoao
59d6263bec rpmsg_port: add rpmsg_port_get_signals api
And set signal_running when rpmsg devices registered

Now rpmsg port transport support to get the remote core's state
by api rpmsg_get_signals()

Signed-off-by: liaoao <liaoao@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-06 02:15:43 +08:00
Yongrong Wang
906d5a8204 rpmsg: Add rpmsg_get_signals API and rpmsg transport ops support
provide get_signals ops to the transport layer implementation.
add rpmsg_get_signals API for rpmsg service to get remote core's
status.

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-06 02:15:43 +08:00
yezhonghui
227d7237ab gpiochip: export ioexpander pointer to user
sim gpiochip ioexpander export to user

Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
2026-01-05 15:10:41 -03:00
yezhonghui
b11f669676 ioe_dummy: fix pinval always zero issue
fix gpio pinval issue

Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
2026-01-05 15:10:41 -03:00
yezhonghui
36f91643ae sim/gpiochip: add sim gpiochip for gpio autotest
add sim gpiochip driver

Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
2026-01-05 15:10:41 -03:00
ENJOU1224
e072356182 arch/risc-v: Fix incompatible pointer types in vector context switching
The riscv_savevpu/restorevpu functions were using 'uintptr_t *' for vector registers, but 'tcb->xcp.vregs' is defined as 'uintreg_t *'. This mismatch caused compilation errors on GCC 13+ due to incompatible pointer types. This patch aligns the parameter types to 'uintreg_t *'.

Signed-off-by: ENJOU1224 <enjou1224@outlook.com>
2026-01-05 15:08:03 -03:00
Alan Carvalho de Assis
76903ea636 drivers/sx126x: Fix typo in the Kconfig
This is a small fix just to true the github getting the new commits
after running git push -f

Signed-off-by: Alan C. Assis <acassis@gmail.com>
2026-01-05 14:59:32 -03:00
Alan Carvalho de Assis
cce61ea287 drivers/sx127x: Add RX Timeout support
This commit adds support to fix RX timeout for SX127x, it is done
leaving the RX mode, entering in stanby mode and returning to RX
mode. It is enough to fix the AFC and get communication working
again.

Signed-off-by: Alan C. Assis <acassis@gmail.com>
2026-01-05 14:59:32 -03:00
Alan Carvalho de Assis
667165db46 drivers/sx127x: Move Kconfig and add bitrate options
This commit moves sx127x Kconfig to lpwan/sx127x/ to follow the
same logic used by sx126x and adds the configuration to support
different bitrate (the default 4800 is fine tuned for LORA).

Signed-off-by: Alan C. Assis <acassis@gmail.com>
2026-01-05 14:59:32 -03:00
chenzihan1
258e81f248 gnss_uorb.c: update upper->parsebuffer every new line
When the last data sent by the driver does not contain \n\r,
it will cause a GAA parsing error

Signed-off-by: chenzihan1 <chenzihan1@xiaomi.com>
2026-01-05 12:43:34 -03:00
zhangkai25
daf5715810 drivers/adc: Use mutexlock to replace critical section protection
Use mutexlock to replace critical section protection when using adc_isr_thread

Signed-off-by: zhangkai25 <zhangkai25@xiaomi.com>
2026-01-05 22:03:12 +08:00
p-szafonimateusz
0721dfd171 boards/sabre-6quad/citest: migrate to NTFC
migrate sabre-6quad/citest to NTFC test cases

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2026-01-05 22:03:01 +08:00
p-szafonimateusz
cb87a19d7d boards/rv-virt/citest: migrate to NTFC
migrate rv-virt/citest to NTFC test cases

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2026-01-05 22:03:01 +08:00
p-szafonimateusz
5585b01636 boards/rv-virt/citest64: migrate to NTFC
migrate rv-virt/citest64 to NTFC test cases

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2026-01-05 22:03:01 +08:00
yangsong8
59f200ac4f arch/sim: Explicitly compare whether transfer is NULL in usbhost
if (!transfer)  ==>  if (transfer == NULL)

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2026-01-05 09:59:06 +08:00
v-tangmeng
2c24420a1c arch/sim: fix the compile error
USB_EP_MAXP_MASK ==> USB_EP_MAX_PACKET_MASK

Signed-off-by: v-tangmeng <v-tangmeng@xiaomi.com>
2026-01-05 09:59:06 +08:00
yangsong8
bc2daa48cc arch/sim: Optimize sim usbhost isoc endpoint transmission
The USB driver framework only implements a single ISOC transfer.
If multiple transfers are needed, the class driver can initiate
multiple urbs to meet the real-time requirements of the ISOC
 endpoint. The class driver's urb record the buf address, length,
and number of packets sent. The callback function calculates the
data location in the buf based on the callback number and length
returned.

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2026-01-05 09:59:06 +08:00
yangsong8
199290c0ee sim/usbhost: modify ctrlin return value
On success, zero (OK) is returned. On a failure, a negated errno value
is returned indicating the nature of the failure.

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2026-01-05 09:59:06 +08:00
yangsong8
96707bd967 sim/usbhost: fix usbhost async sending data exception
If the callback function is empty during asynchronous sending,
an exception will occur.

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2026-01-05 09:59:06 +08:00
yangsong8
9934dcef76 arch/sim: add usb host async function
add sim usb host async function

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2026-01-05 09:59:06 +08:00
yangsong8
216ceb9242 arch/sim: add usb host iso ep trans function
add sim usb host iso ep trans function

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2026-01-05 09:59:06 +08:00
Felipe Moura
4662ac5edf docs/applications/smf: added state machine framework example documentation
Update Doc - WIP

SFM doc updated - WIP

Finished first documentation release

Update documentation after source code changes

Signed-off-by: Felipe Moura <moura.fmo@gmail.com>
2026-01-05 09:47:23 +08:00
liaoao
d019a638ab rpmsg: call unbound_cb if service used as server/client when it is destroyed
Before this patch, the rpmsg services will not be destroied after
call the rpmsg_device_destory(). And will cause error after
call rpmsg_device_created() at the secound connecting witt peer.

Signed-off-by: liaoao <liaoao@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-04 21:06:10 +08:00
Bowen Wang
02ac99ae1c drivers/rpmsg: no need check held status after change to rmutex
metal_mutex has been changed to rmutex_t, so do not need check
the held status again.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-04 21:06:10 +08:00
Bowen Wang
b4a10fc63c openamp/libmetal: change the libmetal mutex to rmutex to avoid carsh
To avoid the crash when lock are acquired twice, one case is in the
destory process:
we hold the rpdev->lock to iterate the rpdev->endpoints to destory all
the endpoints, but rpmsg_destroy_ept() may send the name service message,
and need acquire the rpdev->lock again to lead crash.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-04 21:06:10 +08:00
p-szafonimateusz
e1fb0498b2 doc: update citests.rst and move to Testing
update citests.rst and move page from Guides to Testing

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2026-01-04 09:40:12 -03:00
p-szafonimateusz
b88f86ba5d boards/citest: rename run scripts to run.sh
Executable files called "run" don't pass checkpath verification,
so we change the name to "run.sh"

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2026-01-04 09:40:12 -03:00
p-szafonimateusz
1e82af9352 boards/sim/citest: migrate to NTFC
migrate sim/citest to NTFC test cases

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2026-01-04 09:40:12 -03:00
p-szafonimateusz
16d7fcb26c tools/testbuild.sh: export some variables for NTFC run script
export currently build configuration and path to artifacts
so these can be used by NTFC run script

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2026-01-04 09:40:12 -03:00
p-szafonimateusz
4449a67975 github/ci: add support for NTFC
Add support for NTFC testing framework.

At the moment NTFC is downloaded from a private repo,
and installed with pip and venv. In the future NTFC repositories
will be migrated to Apache organization.

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2026-01-04 09:40:12 -03:00
chenzihan1
1528db236a sensor_monitor: add /proc/sensor_monitor
"Sensor procfs - Dynamic sensor debugging tool\n"
  "\n"
  "Usage:\n"
  "  cat /proc/sensor_monitor - Show currently monitored topics\n"
  "  echo <level> <topic> > /proc/sensor_monitor - Add topic(s)\n"
  "  echo rm <topic> > /proc/sensor_monitor - Remove topic(s)\n"
  "  echo add <topic> <topic> > /proc/sensor_monitor"
  " - add/remove topics\n"
  "  echo clean > /proc/sensor_monitor      - Remove all topics\n"
  "\n"
  "Examples:\n"
  "  echo sensor_accel > /proc/sensor_monitor\n"
  "  echo \"sensor_accel sensor_compass\" > /proc/sensor_monitor\n"
  "  echo \"1 sensor_accel sensor_compass\" > /proc/sensor_monitor\n"
  "  echo \"2 sensor_accel sensor_compass\" > /proc/sensor_monitor\n"
  "  echo \"rm sensor_accel\" > /proc/sensor_monitor\n"
  "  echo \"rm sensor_accel sensor_compass\" > /proc/sensor_monitor\n"
  "  echo clean > /proc/sensor_monitor\n"
  "  echo \"add 1 sensor_a rm sensor_b\" > /proc/sensor_monitor\n"
  "\n"
  "Note:\n"
  "  If <level> is not specified, it defaults to 1.\n";

Signed-off-by: chenzihan1 <chenzihan1@xiaomi.com>
2026-01-04 09:24:30 -03:00
Xoris
090860a348 esp32s3: Remove redundant I2S include directive
remove redundant I2S include directive

Signed-off-by: Xoris <xmingwp@gmail.com>
2026-01-03 20:02:10 -03:00
dongjiuzhu1
12079a213d fs/eventfd/timerfd: update sem next to avoid busy loop
fix bug about busy loop

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-01-02 07:55:37 -03:00
dongjiuzhu1
50c78843b4 fs/inode: Fix fd_tag_san/fd_tag_fdcheck loss during parent-to-child inheritance
When a child process inherits file descriptors from its parent via
fdlist_copy(), the fd tags (fd_tag_fdsan and fd_tag_fdcheck) were not
being copied. This caused assertion failures when the child process
closed inherited file descriptors, because the fdcheck/fdsan subsystems
expected the tags to match.

Root Cause:
----------
The fdlist_install() function was not preserving the fd tags during
fd duplication. When copying fds from parent to child in fdlist_copy(),
the tags were lost, resulting in:
- fd_tag_fdsan: Used for file descriptor ownership tracking (FDSAN)
- fd_tag_fdcheck: Used for fd validity checking (FDCHECK)

Both tags being reset to 0/NULL instead of copied from parent.

Symptom:
--------
Child processes would crash with assertion failure in fdcheck_restore()
when closing inherited file descriptors:

  fdcheck_restore+0x69/0xa0
  fdlist_get2+0x11/0x48
  fdlist_close+0xd/0x94
  close+0x15/0x30

This occurred because fdcheck_restore() validates that the fd_tag_fdcheck
matches the expected value, and the mismatch triggered an assertion.

Solution:
---------
1. Add a 'copy' parameter to fdlist_install() to distinguish between:
   - New fd allocation (copy=false): Initialize fresh tags
   - Fd duplication (copy=true): Preserve tags from source fd

2. Add fdp parameter to fdlist_install() to access source fd tags

3. In fdlist_copy(), pass copy=true to preserve parent's fd tags

4. In fdlist_dup3(), pass copy=false since dup operations should
   create independent fd tracking (not copy parent tags)

Changes:
--------
- fdlist_install(): Added 'fdp' and 'copy' parameters
- When copy=true, preserve fd_tag_fdsan and fd_tag_fdcheck from source
- fdlist_copy(): Pass copy=true to preserve parent tags
- fdlist_dup3(): Pass copy=false for normal dup behavior

Impact:
-------
This fix ensures that file descriptor ownership tracking and validity
checking work correctly across fork/clone operations, preventing
crashes when child processes close inherited file descriptors.

Without this fix, any program using fork() with inherited fds would
crash if CONFIG_FDSAN or CONFIG_FDCHECK were enabled.

Issue backtrace:
backtrace_unwind+0x105/0x108
sched_backtrace+0x6f/0x80
sched_dumpstack+0x33/0x80
_assert+0x229/0x510
arm_syscall+0x81/0x98
up_assert+0xd/0x18
__assert+0x1d/0x24
fdcheck_restore+0x69/0xa0
fdlist_get2+0x11/0x48
fdlist_close+0xd/0x94
close+0x15/0x30
closefd+0x5/0x30
notify_parent_process+0x2b/0x40
run_helper_tcp4_echo_server+0x75/0x114
run_test_part+0x5f/0x68
uv_run_tests_main+0x35/0x60
run_test_part+0x5f/0x68
uv_run_tests_main+0x35/0x60
nxtask_startup+0x13/0x2c
nxtask_start+0x4d/0x64

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-01-02 07:55:37 -03:00
dongjiuzhu1
e399c93cf3 fs/inode: Fix fd allocation succeeding when exceeding OPEN_MAX
Before this fix, the check for OPEN_MAX was performed using orig_rows
instead of the new row count after extension. This caused the check to
pass even when the allocation would exceed OPEN_MAX limit.

For example:
- OPEN_MAX = 256
- CONFIG_NFILE_DESCRIPTORS_PER_BLOCK = 32
- orig_rows = 8 (8 * 32 = 256, at the limit)

The old code checked: 32 * 8 > 256 (false, allows extension)
The new code checks: 32 * (8 + 1) > 256 (true, correctly blocks)

Without this fix, the system could allocate more file descriptors than
OPEN_MAX allows, potentially causing memory corruption or exceeding
system limits.

This fix ensures the check evaluates the new total count (orig_rows + 1)
before allowing the extension to proceed.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-01-02 07:55:37 -03:00
zhanghongyu
8f41613374 net: replace net_sem*wait with conn_dev_sem*wait to simplify code logic
optimize the current code format according to the previous net_xxx_wait
implementation to reduce multiple calls of similar code

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-02 07:48:06 -03:00
zhanghongyu
aee7ea0d7d net/utils: conn_dev_sem_timedwait supports the input parameter sconn being NULL
thus supporting scenarios that only require break netdev_lock.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-02 07:48:06 -03:00
zhanghongyu
efd8e1be2b net/ieee802154: replace net_lock with conn_lock and conn_lock_dev
decouple lock dependencies from other modules.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-02 07:48:06 -03:00
zhanghongyu
92b3357182 net/bluetooth: replace net_lock with conn_lock and conn_lock_dev
decouple lock dependencies from other modules.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-02 07:48:06 -03:00
zhanghongyu
11c4bb7f31 utils.h: add conn_dev_sem_timedwait interface to simplify code logic
the following code can be modified

  conn_dev_unlock(&conn->sconn, conn->dev);
  ret = net_sem_timedwait_uninterruptible(&conn->snd_sem,
    tcp_send_gettimeout(start, timeout));
  conn_dev_lock(&conn->sconn, conn->dev);
to

  ret = conn_dev_sem_timedwait(&conn->snd_sem, false,
    tcp_send_gettimeout(start, timeout), &conn->sconn, conn->dev);

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-02 07:48:06 -03:00
zhanghongyu
b8850e4eb3 conn_lock: inline conn_lock/conn_dev_lock
modify functions that are simple but frequently called into inline
functions, thereby reducing CPU loading without significantly changing
the code size.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-02 07:48:06 -03:00
dongjiuzhu1
5ca6581353 Documentation: update capture.rst with notification and fake driver
These documentation updates correspond to commits:
- drivers/capture: add signal notification support for edge capture events
- drivers/capture: add fake capture driver for testing and development

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-01-02 07:46:52 -03:00
dongjiuzhu1
57217a7983 drivers/capture: add fake capture driver for testing and development
This commit introduces a software-based fake capture driver that simulates
a 10Hz square wave with 50% duty cycle, enabling development and testing
of capture-related applications without requiring real hardware.

Background:
The capture driver subsystem requires hardware support (timers with input
capture functionality) to measure external signal frequency and duty cycle.
During development, testing, or on platforms without capture hardware, it's
difficult to develop and test applications that use the capture API.

Problem:
Without a fake/simulator driver:
- Developers cannot test capture applications without specific hardware
- Continuous Integration (CI) systems cannot run capture-related tests
- Applications cannot be developed on platforms lacking capture hardware
- Testing edge notification features requires complex hardware setup
- Difficult to reproduce specific timing scenarios for debugging

Solution:
This commit provides a software-simulated capture driver that generates
predictable capture events using a watchdog timer. The fake driver
produces a square wave signal at 10Hz frequency with 50% duty cycle,
allowing applications to test the full capture API without hardware.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-01-02 07:46:52 -03:00
dongjiuzhu1
f6a9f8239d drivers/capture: add signal notification support for edge capture events
This commit adds comprehensive signal notification support to the capture
driver, enabling applications to be asynchronously notified when capture
edge events occur on any channel, rather than having to poll for events.

Background:
The capture driver is used to measure frequency and duty cycle of external
signals by detecting edges (rising/falling). Previously, applications could
only retrieve captured values through periodic polling via CAPIOC_GETDUTY
and CAPIOC_GETFREQ ioctl commands, which is inefficient for event-driven
applications.

Problem:
Without event notification, applications must:
- Continuously poll the capture device to check for new events
- Waste CPU cycles in polling loops
- Experience higher latency in responding to capture events
- Cannot efficiently handle multiple capture channels simultaneously

Solution:
This commit adds a signal-based notification mechanism that allows
applications to register callbacks for specific capture channels and
edge types (rising, falling, or both). When the hardware detects the
configured edge, a signal is sent to the registered task.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-01-02 07:46:52 -03:00
zhanghongyu
2f3b8255e0 devif_poll.c: inline the small or single caller function
reduce stack operations to lower CPU loading.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-02 00:04:16 +08:00
zhanghongyu
c481374fb8 devif_poll: only call the corresponding xxx_poll when there is data to be sent
reduce the execution consumption of irrelevant code

testing the TX rates of TCP and UDP based on the Infineon board can
increase them by 13%.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-02 00:04:16 +08:00
zhanghongyu
a0b847bf1b net/devif_callback: change flags type from uint16_t to uint32_t
increase the size of the flag to prepare for precise xxx_POLL.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-02 00:04:16 +08:00
zhanghongyu
d377f6b788 net: use netdev_lock to protect netdev_txnotify_dev
since the type of sconn lock is rmutex, there is no need to release
sconn lock before TX

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-02 00:04:16 +08:00