Commit graph

8020 commits

Author SHA1 Message Date
makejian
b11901ffaf crypto: add key management and RSA/ECDSA keypair generation
Add key management interfaces and support for generating key pairs in RSA and ECDSA cryptographic processes to the cryptodev module.

Signed-off-by: makejian <makejian@xiaomi.com>
2026-01-17 11:41:23 +08:00
guoshichao
57637e5927 net: make the sendmsg param type consistent with posix specification
To ensure consistency, in all places where the "sendmsg" function is used
either directly or indirectly, the type of the "struct msghdr *msg" parameter
needs to be modified to "const struct msghdr *msg".

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2026-01-16 21:11:39 +08:00
hujun5
f909c9205e notifier: remove critical section
The notifier doesn't need to hold the critical section for the entire
operation, allowing for better performance and reduced lock contention
on multi-core systems.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-16 20:34:13 +08:00
lipengfei28
54e6c0c1d9 irq: add api to config irq type
add api to config irq type

Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2026-01-16 20:26:14 +08:00
guoshichao
54ff28a47f sys/types.h: Fixed the conflict issue with the "OK" constant definition
When cross-compiling PSE52 VSX testcases based on Vela, VSX defines its
own "OK" constant as a macro, which conflicts with the "OK" constant
defined as an enum in <sys/types.h>. To ensure compatibility, we
have undef'd the macro version of "OK" in advance.

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2026-01-16 16:16:21 +08:00
guoshichao
b945c7b505 limits: add _POSIX_PTHREAD_ constant for pthread management
Add three POSIX‑required pthread‑related constants to limits.h:
- _POSIX_THREAD_DESTRUCTOR_ITERATIONS
- _POSIX_THREAD_KEYS_MAX
- _POSIX_THREAD_THREADS_MAX

These constants are needed for full POSIX pthread compatibility and are
required by certain PSE52 test suites and applications.

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2026-01-16 16:15:35 +08:00
guoshichao
71889ff22e ulimit: add ulimit implementation
implement the ulimit() based on getrlimit/setrlimit function.
the ulimit() function is requiredd by vsx testset

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2026-01-16 10:03:53 +08:00
daichuan
cf8dacde9c netinet/in.h: Rename imr_interface to imr_address in struct ip_mreqn.
Rename imr_interface to imr_address in struct ip_mreqn to match the Linux definition.
This ensures compatibility with standard socket APIs and existing Linux applications.

Signed-off-by: daichuan <daichuan@xiaomi.com>
2026-01-16 09:42:12 +08:00
zhanghongyu
be3ad13260 drivers/net/rpmsgdrv.c: add bidirectional data netdev support, server side
Server side: when ns_bind, create the netdev.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-16 09:42:01 +08:00
zhanghongyu
34b350e66e drivers/net/rpmsgdrv.c: add bidirectional data netdev support, clien side
It's the first simple version of rpmsg-net, include:
- Transfer command with data copy (maybe optimize later), no need to ack
- Control command with ack, but only ifup/ifdown no need to ack
- Client side: Another module can call `net_rpmsg_drv_alloc` to
  create netdev and register it.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2026-01-16 09:42:01 +08:00
zhanghongyu
f914bb8f03 drivers/net/rpmsgdrv.c: add response flag to distinguish message direction
control messages add a confirmation mechanism.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-16 09:42:01 +08:00
zhanghongyu
4ce3dac146 net: move the tool interface functions to the public directory
expose the query interface of the network card to the network card
driver so that the network card driver can support more features.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-01-16 09:42:01 +08:00
guoshichao
d78d94e1fa pthread: reorganized the locations of pthread-related functions and constants
1. According to the POSIX specification, the functions `pthread_kill`
and `pthread_sigmask` have been moved from `pthread.h` to `signal.h`.
2. As required by the POSIX standard, the pthread-related constants
have been relocated from `pthread.h` to `sys/types.h`.

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2026-01-15 16:23:04 -03:00
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