Commit graph

8007 commits

Author SHA1 Message Date
yintao
492abaa052 drivers/rpmsg: unitfy the rpmsg signals from transport to struct rpmsg_s
Now all the rpmsg transport use the signals in struct rpmsg_s instead
add element in its own private struct.

Signed-off-by: yintao <yintao@xiaomi.com>
2026-01-15 16:13:24 -03:00
makejian
539c8f4ab2 crypto: add support for AES-CBC with 192/256-bit key sizes
Extend AES-CBC algorithm support to include 192-bit and 256-bit key sizes in addition to the existing 128-bit support. This enables broader compatibility with cryptographic standards and provides applications with additional key length options for enhanced security requirements.

Signed-off-by: makejian <makejian@xiaomi.com>
2026-01-15 16:11:19 -03:00
guoshichao
117c28990a fpathconf: add _POSIX_PRIO_IO defintion
fix the /tset/rt.os/files/fpathconf/T.fpathconf{1}:
_POSIX_ASYNC_IO is not defined

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2026-01-15 16:10:51 -03:00
hujun5
92bbe4f6ac sched/tls: fix uninitialized argv pointer in task info
The TCB initializes the pid early, but the argvstack is not initialized
at that time. This may cause invalid addresses to be obtained when
nxsched_get_stackargs is called during task enumeration.
Initialize the argv pointer to NULL to enable safe validity checks.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-15 16:10:11 -03:00
zhangyu117
909e63b63b arch/tricore: upcsa/lowcsa process && dumpinfo
tricore csa is not continuous. when assert prints information, we need to handle the regs specially in order to dump all the registers.

Signed-off-by: zhangyu117 <zhangyu117@xiaomi.com>
2026-01-15 16:09:13 -03:00
guoshichao
2662473b83 sys/resouce: add RLIM_NLIMITS definition
Add the RLIM_NLIMITS macro with value 16 to sys/resource.h, indicating
the total number of supported resource limit types. This improves
POSIX header completeness and aids resource enumeration in applications.

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2026-01-15 16:08:23 -03:00
guoshichao
efa6c6823b libc: add creat function implementation
accoring to the PSE52 requirements, the creat() need to implementation
as a function.

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2026-01-16 01:38:20 +08:00
guoshichao
4ce802900f pthead: change the pthread_equal implementation from macro to function
During the build of PSE52 VSX testcases, the pthread_equal() is accessed
in the form of a function pointer. Therefore, we have changed the
implementation of pthread_equal() from a macro to an actual function.

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2026-01-16 01:37:38 +08:00
guoshichao
ebd4173a95 sys/wait: add WCOREDUMP defintion
Add the WCOREDUMP() macro to sys/wait.h to indicate whether a terminated
process produced a core dump. This resolves implicit declaration warnings
in LTP kernel testcases and improves POSIX compliance.

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2026-01-15 23:16:27 +08:00
guoshichao
d8717aab78 sys/wait: add WTERMSIG implementation
Update the WTERMSIG() macro to extract the signal number from the wait
status, changing from constant 'false' to '(((s) >> 8) & 0x7f)' to match
POSIX semantics for processes terminated by signals.

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2026-01-15 23:16:27 +08:00
daichuan
68a5732d9a stdio.h: Update TMP_MAX definition to match Linux.
Update TMP_MAX from 56800235584ull to 308915776 to align with the value used in Linux.
This ensures better compatibility for applications relying on this standard macro.

Signed-off-by: daichuan <daichuan@xiaomi.com>
2026-01-14 17:28:30 -08:00
guoshichao
80fcbf7aa8 fsetpos: makes the fsetpos function comply with POSIX standard
Change the 'pos' parameter of fsetpos() from 'fpos_t *' to 'const fpos_t *'
in both the prototype and implementation, aligning with POSIX specification
which requires the position parameter to be const-qualified.

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2026-01-15 02:22:46 +08:00
guoshichao
98eef560a3 fcntl: change the O_RSYNC definition from 0 to O_SYNC
fix the /tset/rt.os/files/open/T.open{2}:
O_RSYNC flag not set

According to the POSIX standard, when we set the oflags
for a file descriptor via open, retrieving these oflags
later via fcntl should yield the same values as those
passed during the open call.

Given this, if the value of O_RSYNC were zero, then even
if O_RSYNC were passed during the open call, it would not
be detectable in the oflags retrieved by fcntl.
Therefore, we need to define O_RSYNC as a non-zero value.

For this reason, we have chosen to set the value of
O_RSYNC to be the same as O_SYNC.

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2026-01-15 02:22:46 +08:00
guoshichao
ba8abb5643 sys/ioctl: extend the IOCTL defintion that compatible with linux kernel
Add the generic _IO() macro and aliases for FS_IOC_GETFLAGS and FS_IOC_SETFLAGS,
aligning the ioctl.h definitions with the Linux kernel API to improve source
compatibility when porting LTP linux kernel testcase code to NuttX

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2026-01-14 09:39:51 +08:00
liqinhui
3843f7b4fe wifi: Support the wifi operations based on the bss file.
Add support for BSS file-based WiFi simulation.

Signed-off-by: liqinhui <liqinhui@xiaomi.com>
2026-01-14 09:22:54 +08:00
liucheng5
bbda415412 drivers/sensors: add a new sensor type ENG
Add a new sensor type for ENG sensor.

Signed-off-by: liucheng5 <liucheng5@xiaomi.com>
Signed-off-by: likun17 <likun17@xiaomi.com>
2026-01-13 11:46:07 -03:00
ouyangxiangzhen
4514a11237 sched/sched: Update the comments and docs.
This commit updated the comments and docs after removing the
nxsched_tick_expiration.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2026-01-13 21:41:35 +08:00
ouyangxiangzhen
02aaa976fd sched/hrtimer: Simplify the declaration.
This commit simplifed the type declaration.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2026-01-13 21:41:35 +08:00
ouyangxiangzhen
a518c28add sched/hrtimer: Add callback pointer in hrtimer_start.
The hrtimer is designed to replace the wdog timer in future, so it
should have the callback function in its API. The evaluation results showed there is no any
performance degradation since the CPU pipeline can hide the latency.
This commit also decoupled the rb-tree implementation with the pending
state checking.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2026-01-13 21:41:35 +08:00
guoshichao
cd6a978ba9 arm64_head.S: fix the asm code build error
Add __ASSEMBLY__ protection in stddef.h and stdint.h to prevent assembly
files from attempting to parse C typedef statements, which causes
"unknown mnemonic" errors when assembly source includes these headers.

the following are the detailed build error:
/home/guoshichao/work_profile/vela_os/vela_open_source_trunk4/nuttx/include/stdint.h:167: Error: unknown mnemonic `typedef' -- `typedef _int8_t int8_t'
/home/guoshichao/work_profile/vela_os/vela_open_source_trunk4/nuttx/include/stdint.h:168: Error: unknown mnemonic `typedef' -- `typedef _uint8_t uint8_t'
/home/guoshichao/work_profile/vela_os/vela_open_source_trunk4/nuttx/include/stdint.h:170: Error: unknown mnemonic `typedef' -- `typedef _int16_t int16_t'
/home/guoshichao/work_profile/vela_os/vela_open_source_trunk4/nuttx/include/stdint.h:171: Error: unknown mnemonic `typedef' -- `typedef _uint16_t uint16_t'
/home/guoshichao/work_profile/vela_os/vela_open_source_trunk4/nuttx/include/stdint.h:178: Error: unknown mnemonic `typedef' -- `typedef _int32_t int32_t'
/home/guoshichao/work_profile/vela_os/vela_open_source_trunk4/nuttx/include/stdint.h:179: Error: unknown mnemonic `typedef' -- `typedef _uint32_t uint32_t'
/home/guoshichao/work_profile/vela_os/vela_open_source_trunk4/nuttx/include/stdint.h:193: Error: unknown mnemonic `typedef' -- `typedef _int8_t int_least8_t'
/home/guoshichao/work_profile/vela_os/vela_open_source_trunk4/nuttx/include/stdint.h:194: Error: unknown mnemonic `typedef' -- `typedef _uint8_t uint_least8_t'
/home/guoshichao/work_profile/vela_os/vela_open_source_trunk4/nuttx/include/stdint.h:196: Error: unknown mnemonic `typedef' -- `typedef _int16_t int_least16_t'
/home/guoshichao/work_profile/vela_os/vela_open_source_trunk4/nuttx/include/stdint.h:197: Error: unknown mnemonic `typedef' -- `typedef _uint16_t uint_least16_t'
/home/guoshichao/work_profile/vela_os/vela_open_source_trunk4/nuttx/include/stdint.h:203: Error: unknown mnemonic `typedef' -- `typedef _int32_t int_least24_t'

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2026-01-13 21:20:52 +08:00
chenzihan1
513673c11a drivers/ioexpander: add enable & disable macro for gpio SETDEBOUNCE and SETMASK
IOEXPANDER_DEBOUNCE_DISABLE (0): Disable debounce filtering
IOEXPANDER_DEBOUNCE_ENABLE (1): Enable debounce filtering
IOEXPANDER_MASK_DISABLE (0): Unmask the interrupter
IOEXPANDER_MASK_ENABLE (1): Mask the interrupter

Signed-off-by: chenzihan1 <chenzihan1@xiaomi.com>
2026-01-13 09:27:52 -03:00
zhanghongyu
cbc13cc8aa if_ether.h: add the definition of ETH_P_TSN
add macro definitions used by third-party libraries to resolve
compilation errors.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-13 02:17:06 +08:00
wangchengdong
51bcec53c4 nuttx/sched: rename nxsched_timer_expiration
rename nxsched_timer_expiration to nxsched_tick_expiration
    to align with nxsched_process_tick()

Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2026-01-12 16:20:42 +08:00
wangchengdong
9f44bff3cc sched/sched:merge tickless and tick process together
Merge tickless and tick process into  nxsched_process_timer
    to improve code level efficient

Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2026-01-12 16:20:42 +08:00
chenzihan1
664d2d7213 drivers/sensors: add get_info interface for gnss_uorb
Implement gnss_get_info callback function to support device information query for GNSS sensor devices through the sensor framework.

Signed-off-by: chenzihan1 <chenzihan1@xiaomi.com>
2026-01-10 17:30:33 +08:00
ouyangxiangzhen
df74d0c5b2 sched/wdog: Remove wd_restart API.
According to the test results, the restart interface offers no
performance improvement and requires additional state to encode the
non-pending state. This commit removed the wd_restart API to simplify
the wdog module.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2026-01-10 17:30:25 +08:00
dongjiuzhu1
148f0ce7dd fs/inode: use file_allocate,file_dup to avoid racecondition to allocate fd
issue description:
task A:                                            NSH:
1.open->                                           reboot->sync->task_fsfsync
2.nx_vopen->               context switch
3.fdlist_allocate:            ---->                4.fsync->file_sync->assert(inode or priv is empty)
(new fd with empty filep)
5.file_vopen:
(init empty filep)
6.return fd

Task A allocates a new fd with an empty filep in fdlist_allocate. Before
it can fully initialize the filep in file_vopen, the NSH task triggers a
file - system sync operation. The sync operation encounters the empty
filep associated with the newly allocated fd, causing the assertion to
fail and the system to crash.

To resolve this race condition, we should modify the fd allocation
process. Instead of allocating a new fd with an empty filep first and
then initializing it later, we should use the file_allocate_from_inode
function. This function allows us to initialize the file structure first
and then bind it to the new filep when allocating the fd. By doing so,
we ensure that the filep is always properly initialized before it is
used in any file - system operations, thus preventing the assertion
failure and the subsequent system crash.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-01-09 17:11:25 +08:00
xucheng5
f989860c4a timer: add timer operation support
Add basic timer operations to the kernel, including registration,
start/stop, and callback handling. This provides a consistent timer
interface for use by kernel components and drivers.

Signed-off-by: zhaohaiyang1 <zhaohaiyang1@xiaomi.com>
2026-01-09 17:10:43 +08:00
wangxiaoxin
87d74d141a LIN:adjust the LIN flag
Fix incorrect and non-existent flag usage in LIN handling:

- Replace undefined CANFD_FLAGS_BITS usage with valid bit definitions.
- Reassign CAN_TCF_FLAG to an available flag bit, as it is not defined in can.h.
- Add an identifier for LIN noise error frames.

Signed-off-by: wangxiaoxin <wangxiaoxin@xiaomi.com>
2026-01-08 23:15:31 +08:00
mazhuang
45f6d86f37 drivers/rpmsg: add rpmsg_test to test rpmsg hold/release rx buffer
rpmsg_test is a rpmsg api test service inside the kernel, and user
can use ioctl to start this test.

Signed-off-by: mazhuang <mazhuang@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Signed-off-by: wangshaoxin <wangshaoxin@xiaomi.com>
2026-01-08 22:44:35 +08:00
ouyangxiangzhen
6bd9ef6992 sched/hrtimer: Rename the callback type to hrtimer_entry_t.
This commit renamed the callback type to `hrtimer_entry_t`, aligning with
the `wdentry_t` in wdog..

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2026-01-08 22:26:11 +08:00
ouyangxiangzhen
740f518083 sched/hrtimer: Add const for hrtimer argument.
The callback function can not modify the hrtimer.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2026-01-08 22:26:11 +08:00
xucheng5
380bcabba8 sja1000: replace enter_critical_section with spinlock
Replace enter_critical_section() with spinlock-based protection to
avoid sleeping in atomic or interrupt contexts.

Signed-off-by: xucheng5 <xucheng5@xiaomi.com>
2026-01-08 09:15:04 -03:00
xucheng5
f215bf6c67 timer: rename tick_settimeouot to tick_settimeout
Fix the misspelling of the tick timeout API name
(tick_settimeouot -> tick_settimeout) for clarity and correctness.

This corrects a typographical error in the function/config name that
could lead to confusion and incorrect usage. No functional logic is
changed by this rename.

Signed-off-by: zhaohaiyang1 <zhaohaiyang1@xiaomi.com>
2026-01-08 08:16:21 -03:00
fangpeina
e4d4f7e2c3 drivers/math: use small lock to replace enter_critical_section
replace critical_section with spinlock

Signed-off-by: fangpeina <fangpeina@xiaomi.com>
2026-01-08 11:17:17 +08:00
Yongrong Wang
eac3cea465 sched/sem_rw.c: Add downgrade_write API for sem_rw
support downgrad a write lock to a read lock

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
2026-01-07 22:47:09 +08:00
wangchengdong
1020bc74e8 [EXPERIMENTAL]sched/hrtimr: Allow running/armed hrtimer to be restarted
Allow running/armed hrtimer to be restarted to
  fix hrtimer bug: #17567

Co-authored-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2026-01-06 23:14:04 +08:00
ouyangxiangzhen
2a1f24b817 compiler: Add PRAGMA and unroll_loop.
This commit added PRAGMA and unroll_loop to support compiler
loop-unrolling.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2026-01-06 19:46:30 +08:00
zhaohaiyang1
2a60b7e747 can: strict TX priority ordering to avoid priority inversion
Introduce a single configuration option to provide strict transmit
priority ordering based on CAN ID.

The intention is to expose the user-visible behavior (strict TX
priority ordering) rather than the underlying implementation details.
Strict priority ordering is only meaningful when hardware transmit
buffer cancellation is available, so splitting this functionality into
separate configuration options was misleading and could result in
partially effective or incorrect configurations.

Signed-off-by: zhaohaiyang1 <zhaohaiyang1@xiaomi.com>
2026-01-06 16:03:14 +08:00
chenzihan1
3c7999f996 drivers/sensors: fix mpu9250 register function comments
fix wrong function comments

Signed-off-by: chenzihan1 <chenzihan1@xiaomi.com>
2026-01-06 08:36:59 +01: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
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
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
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
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
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
f27a9bbc27 net/usrsock: replace net_lock with usrsock_lock
remove the use of net_lock in the usrsock module and decouple it from
other network modules.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-01 07:35:12 -03:00
zhanghongyu
24ee7cba86 net_lock: add net_sem_timedwait2, passing in rmutex that needs to be break
two rmutexes can be passed in, and later the wait scenarios that require
break the conn and netdev locks will be replaced.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-01 07:35:12 -03:00
dongjiuzhu1
da6a682abc drivers/i2c: add ioexpander-based lower-half implementation for I2C bit-bang
This commit adds a new lower-half driver implementation for I2C bit-bang
that uses IO expander pins as the GPIO backend, enabling I2C bit-bang
functionality on systems where direct GPIO access is not available or
when I2C needs to be implemented using IO expander pins.

Background:
The existing I2C bit-bang driver (i2c_bitbang.c) provides a generic
upper-half implementation that requires a platform-specific lower-half
to control the SDA and SCL GPIO lines. Previously, each platform had to
implement its own lower-half using direct GPIO access.

Usage Example:
FAR struct ioexpander_dev_s *ioe = /* get IO expander */;
FAR struct i2c_master_s *i2c;

/* Initialize I2C bit-bang using IO expander pins 10 (SCL) and 11 (SDA) */
i2c = i2c_bitbang_ioexpander_initialize(ioe, 10, 11, 0);
if (i2c)
  {
    /* Use i2c master device normally */
  }

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-01-01 17:08:47 +08:00