Commit Graph

6710 Commits

Author SHA1 Message Date
Ville Juven
57de6484e9 task/pthread_cancelpt: Fix task_delete from another task group
PR #11165 causes an unnecessary regression; task_delete no longer works,
if the deleted task is from another group.

The logic that prevents this comes from:

nxnotify_cancellation() ->
tls_get_info_pid() ->
nxsched_get_stackinfo()

Which checks for permissions, which does not make sense in this case since
it is the kernel asking for the stack information.

Fix this by partially reverting 11165 and implementing a direct path for
the kernel to query for any tasks TLS.
2023-11-22 08:05:58 -08:00
Petteri Aimonen
0648a61668 sigaction: Expand si_user for non-kernel signals
Commit 9244b5a737 added support
for non-standard field si_user that is useful for passing context
pointers to signal handlers.

This commits makes it work for all signals, not just SA_KERNELHAND.
Previously si_user for normal signals was uninitialized garbage.
2023-11-22 08:00:43 -08:00
anjiahao
749655d785 tcbinfo:remove total_num form tcbinfo.
total_num is not required
test:

make -f tools/Makefile.host
cp tools/jlink-nuttx /opt/SEGGER/JLink_V786a/libnuttxplugin.so
JLinkGDBServer -if SWD -speed 5000 -device STM32F429ZI -NoGui 1 -rtos libnuttxplugin

can run normally

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-11-21 21:52:24 -08:00
liaoao
4446b34b2c list: search prev item in reverse order
Signed-off-by: liaoao <liaoao@xiaomi.com>
2023-11-21 07:59:42 -08:00
chenrun1
f12c4fb887 Revert "libc/lib_bzero:Add bzero prototype." 2023-11-21 07:56:52 -08:00
zhanghu5
6a6538c1b8 clock.h: use CONFIG_DEBUG_SCHED to test init ticks
Signed-off-by: zhanghu5 <zhanghu5@xiaomi.com>
2023-11-21 04:01:39 -08:00
Xiang Xiao
b2f75c2f3d spinlock: Move the inclusion of stdatomic.h to source file
to make rwlock work with c++ source code

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-11-19 20:22:50 +01:00
Xiang Xiao
f35ec7727d Fix syslog/ramlog.c:698:7: warning: implicit declaration of function ‘spin_lock_init’
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-11-19 20:22:50 +01:00
raiden00pl
9a51197523 drivers/foc: add support for drv8301 power-stage driver 2023-11-18 17:07:20 -08:00
raiden00pl
4bad6048f0 drivers/foc: add support for FOC power-stage driver
There are ICs available on the market that integrate various power inverter
features. The driver for such a device must be tightly coupled to a FOC device
as using it as a separate device doesn't make sense.
2023-11-18 17:07:20 -08:00
Petteri Aimonen
cb161940c2 udp: Add support for SO_TIMESTAMP
Adds support for timestamping received UDP packets, either in
hardware or in kernel. Builds on the existing support of SO_TIMESTAMP
for SocketCAN.

Implementation uses CLOCK_REALTIME for timestamping to match the
behavior of Linux. This could be made configurable in future if needed.
2023-11-18 03:10:29 -08:00
raiden00pl
90cf9f871c sensors/gps: define the number of items in the satellite info list 2023-11-16 20:32:41 -08:00
chao an
42427e9e29 sched/taskfiles: skip unnecessary file open/close operations to improve performance
The task files should consult the "spawn action" and "O_CLOEXEC flags"
to determine further whether the file should be duplicated.

This PR will further optimize file list duplicating to avoid the performance
regression caused by additional file operations.

Signed-off-by: chao an <anchao@xiaomi.com>
2023-11-16 07:30:36 -08:00
Ville Juven
0dedbcd4ae task/pthread_cancelpt: Move cancel point handling to libc, data to TLS
This moves task / thread cancel point logic from the NuttX kernel into
libc, while the data needed by the cancel point logic is moved to TLS.

The change is an enabler to move user-space APIs to libc as well, for
a coherent user/kernel separation.
2023-11-15 08:52:04 -08:00
Ville Juven
1e31ec8003 sched/tls_info: Add tl_ prefix to pthread cleanup stack / tos 2023-11-15 08:52:04 -08:00
chao an
64cf63475c arch/dumponexit: unify dump on exit to common code
remove arch implement and move to common code

Signed-off-by: chao an <anchao@xiaomi.com>
2023-11-15 08:28:25 -08:00
Petteri Aimonen
1825f9534c adjtime: Rewrite implementation to work for RTC and tickless kernel
Previous adjtime() implementation was limited to adjusting system
timer tick period. This commit reimplements the internals to use
a kernel watchdog timer. Platform-independent part of the code now
works also for adjusting hires RTC and tickless timer rate.

User code facing API is unchanged. Architecture code API has changed:
up_adj_timer_period() is replaced by up_adjtime().

Other improvements:

- Support query of remaining adjustment by passing NULL to first
  argument of adjtime(). This matches Linux behavior.

- Improve resolution available for architecture driver, previously
  limited to 1 microsecond per tick. Now 1 nanosecond per second.
2023-11-14 19:47:40 -08:00
rongyichang
52d516ab46 drivers/lcd: change lcd stride from pixel to bytes
In order to achieve better scalability, change the stride
from pixel mode to byte mode.For example, in the case of RGB888
mode with 466 pixels in width and a 4-byte aligned buffer,it is
only necessary to extend the buffer of one line from 1398 bytes
to 1400 bytes, instead of extending it to 1404 bytes.

Signed-off-by: rongyichang <rongyichang@xiaomi.com>
2023-11-14 07:30:29 -08:00
raiden00pl
99513ac23e drivers/foc: return scaling factor for phase currents and BEMF via ioctl
These values are board-specific properties that must be known on the application side.
Until now, these values had to be hardcoded on the application side.
2023-11-14 04:34:49 -08:00
raiden00pl
7d99f01cf7 drivers/foc: get hardware information via lower-half interface 2023-11-14 04:34:49 -08:00
yinshengkai
c3009d46e9 note: delete sched_note_flatten
When we record data and dump data, they are all executed within the system,
and there is no need to consider the issue of big or small endianness.

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-11-12 23:52:10 -08:00
chao an
74d698f439 spinlock: add __cplusplus check to avoid build break with C++
stdatomic.h is incompatible with C++

Signed-off-by: chao an <anchao@xiaomi.com>
2023-11-12 17:01:13 -08:00
chao an
3b2c585ab7 fs/inode: add common function to get file count from list
common function to get file count from file list

Signed-off-by: chao an <anchao@xiaomi.com>
2023-11-12 17:01:13 -08:00
chao an
0a567bbae4 fs/inode: improve the performance of get file pointer
Remove file locks and enter critical sections to protect file lists

Signed-off-by: chao an <anchao@xiaomi.com>
2023-11-12 17:01:13 -08:00
dongjiuzhu1
1fc3de4518 arch/textheap: add _heapmember declare for text and data heap
It was accidentally deleted on PR:#11043

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-11-10 09:03:04 +01:00
rongyichang
bc43c419f2 drivers/lcd: add stride support for LCD driver
support LCD stride for GET_AREA and PUT_AREA operation

Signed-off-by: rongyichang <rongyichang@xiaomi.com>
2023-11-09 09:52:00 +08:00
yinshengkai
bb5b5420ae mm: record the maximum system memory usage
Add the usmblks field to mallinfo to record the maximum space allocated historically in the system

https://man7.org/linux/man-pages/man3/mallinfo.3.html#:~:text=mmap(2).-,usmblks,-This%20field%20is

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-11-09 09:08:49 +08:00
Zhe Weng
3e4d847f42 net/netdev: Support managing multiple IPv6 addresses by ioctl
1. Supporting `SIOCSIFADDR` and `SIOCDIFADDR` with Linux in6_ifreq struct to manage ipv6 addresses.
   Ref: https://man7.org/linux/man-pages/man7/netdevice.7.html
2. Supporting alias like 'eth0:0' for multiple IPv6 addresses, to keep previous ioctl `SIOCGLIFADDR`, `SIOCSLIFADDR`, `SIOCGLIFNETMASK` and `SIOCSLIFNETMASK` working.
   Ref: https://man7.org/linux/man-pages/man8/ifconfig.8.html

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-11-07 19:30:36 +08:00
Zhe Weng
7f421a46ca net/procfs: Support printing multiple IPv6 address per netdev
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-11-07 19:30:36 +08:00
Zhe Weng
2b9633e652 net: Support multiple IPv6 address per netdev
Note that user-space related code, like procfs and lifreq related ioctl commands, are not touched in this commit.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-11-07 19:30:36 +08:00
Zhe Weng
96233e0c42 net/netdev: Support multiple IPv6 addresses per device
Compatible with previous usage, because may network drivers are using old member name to print logs, and there's no significant need to change them now.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-11-07 19:30:36 +08:00
zhanghongyu
c8f9e409dc ioctl: add definitions related to ethtool
We reuse the linux platform code when adapting the matter library, in order to compile through, so first add the ethtool related definition

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-11-03 22:37:50 +08:00
Zhe Weng
c95fd46be3 net: Simplify getting value for different domain
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-11-03 22:23:50 +08:00
Bowen Wang
2f9c082f8f fs_epoll: serveral epoll issues fix
1. fs_epoll: try again when epoll_teardown() return 0
when poll_notify() called larger than twice when epoll_wait() blocked
in the eph->sem, the semcount will be larger than 1 when epoll_wait()
unblocked and will return 0 directly at the next epoll_wait.
So retry to wait the eph->sem again when epoll_teardown return 0.

2. fs_epoll: poll_setup the fd again even this fd got non-expected event
Some poll implementations need call poll_setup again when their internal
states changed (e.g., local socket), so should add the fd to the epoll
teardown list and poll_setup again at the next epoll_wait even this fd
got the user non-expected event.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2023-11-02 00:44:52 +08:00
yinshengkai
d0a5489ac5 sched: explicitly select the cpuload clock source configuration
Different configurations require different dependencies.
Explicitly select dependencies to avoid automatically selecting inappropriate configurations.

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-11-01 09:27:56 +08:00
SPRESENSE
f49fa466b6 boards: cxd56xx: Add cxd5610 gnss driver
Add cxd5610 gnss driver as board-specific sensor driver.
2023-10-31 09:18:18 +01:00
Stuart Ianna
c1db9732c5 libs/libc/spawn: Add minimal implementation for posix_spawnattr_destory.
Add a minimal implementation to suppress warnings when building
application code shared with other operating systems.

For example:

When building with a c++ compiler and GCC 12.2.0, the following warning is emitted:

nuttx/include/spawn.h:178:40: warning: statement has no effect [-Wunused-value]
  178 | #define posix_spawnattr_destroy(attr) (0)
2023-10-31 13:42:00 +08:00
dongjiuzhu1
489bd15271 arch/arm64: support relocate for aarch64
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-10-30 18:20:22 +08:00
Xiang Xiao
f911d3a1c3 stdio: Implement [clearerr|putc|fflush]_unlocked
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-10-29 17:09:18 +02:00
Zhe Weng
3fd3612e4c net/netconfig: Enable SOCK_CLOEXEC for all ioctl sockets
`NET_SOCK_TYPE` is used for ioctl sockets only, they can set `O_CLOEXEC`
explicitly.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-10-28 15:22:13 +08:00
TimJTi
896727b576 Add new ioctls 2023-10-27 13:52:28 -03:00
dongjiuzhu1
18819b6b24 sched/task: close file descriptor with O_CLOEXEC before active task or exec
VELAPLATFO-18473

refs:
https://man7.org/linux/man-pages/man2/fcntl.2.html
If the FD_CLOEXEC bit is set, the file descriptor will automatically
be closed during a successful execve(2).
(If the execve(2) fails, the file descriptor is left open.)

modify:
1. Ensure that the child task copies all fds of the parent task,
   including those with O_CLOEXE.
2. Make sure spawn_file_action is executed under fd with O_CLOEXEC,
   otherwise it will fail.
3. When a new task is activated or exec is called, close all fds
   with O_CLOEXEC flags.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-10-27 21:15:07 +08:00
dongjiuzhu1
73dc8f84cc fs/dup3: impletement dup3/nx_dup3_from_tcb function
refs: https://man7.org/linux/man-pages/man2/dup.2.html

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-10-27 21:15:07 +08:00
Michal Lenc
65ae8a545c libc: add support for memory buffer stream with fmemopen()
Add support for POSIX interface fmemopen(). This interface open a memory
buffer as a stream and permits access to this buffer specified by mode.
This allows I/O operations to be performed on the memory buffer.

The implementation uses fopencookie() for custom stream operations and
callbacks.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2023-10-27 08:55:24 +08:00
chao an
fc80c70205 assert: rename __ASSERT to __ASSERT__ to avoid conflict
The definition of __ASSERT has special define in some OS and librarys,
rename to __ASSERT__ to avoid conflict

Signed-off-by: chao an <anchao@xiaomi.com>
2023-10-26 16:21:02 +08:00
dongjiuzhu1
e88a36fa92 libs/modlib: Adding architecture-specific memory allocator for dynamic data loading
Arch can specific the memory allocator for data to optimize access speed.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-10-26 01:53:38 +08:00
Ville Juven
ab78e3817a sched/task_[posix]spawn: Simplify how spawn attributes are handled
Handle task spawn attributes as task spawn file actions are handled.

Why? This removes the need for sched_lock() when the task is being
spawned. When loading the new task from a file the scheduler can be
locked for a VERY LONG time, in the order of hundreds of milliseconds!

This is unacceptable for real time operation.

Also fixes a latent bug in exec_module, spawn_file_actions is executed
at a bad location; when CONFIG_ARCH_ADDRENV=y actions will point to the
new process's address environment (as it is temporarily instantiated at
that point). Fix this by moving it to after addrenv_restore.
2023-10-25 11:55:44 -03:00
jinxiuxu
cd851b3144 audio: add amr format support
Signed-off-by: jinxiuxu <jinxiuxu@xiaomi.com>
2023-10-25 13:33:21 +08:00
Stuart Ianna
ac5800386c arch/risc-v/litex/litex_emac: Add support for KSZ8061 ethernet PHY.
Adds support for using the microchip KSZ8061 ethernet PHY instead of the default DP83848C.
2023-10-25 13:33:03 +08:00
Xiang Xiao
66db15437d libc/stdio: Change FILE buffer field from "unsigned char *" to "char *"
to avoid the unnecessary casting

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-10-22 21:18:46 +03:00