Commit Graph

6953 Commits

Author SHA1 Message Date
hujun5
d708edab76 fix compile error
/home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/spinlock.h: In function 'bool spin_trylock_wo_note(volatile spinlock_t*)':
/home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/spinlock.h:401:22: error: 'atomic_ushort' was not declared in this scope; did you mean 'std::__1::atomic_ushort'?
  401 |     atomic_load((FAR atomic_ushort *)&lock->tickets.next);
      |                      ^~~~~~~~~~~~~
      |                      std::__1::atomic_ushort
/home/hujun5/downloads1/vela_sim/nuttx/include/libcxx/__atomic/aliases.h:33:7: note: 'std::__1::atomic_ushort' declared here
   33 | using atomic_ushort = atomic<unsigned short>;
      |       ^~~~~~~~~~~~~
/home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/spinlock.h:401:37: error: expected primary-expression before ')' token
  401 |     atomic_load((FAR atomic_ushort *)&lock->tickets.next);
      |                                     ^
/home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/spinlock.h:410:14: error: expected unqualified-id before 'new'
  410 |   spinlock_t new =
      |              ^~~
/home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/spinlock.h:417:44: error: 'atomic_uint' was not declared in this scope; did you mean 'std::__1::atomic_uint'?
  417 |   if (!atomic_compare_exchange_strong((FAR atomic_uint *)&lock->value,
      |                                            ^~~~~~~~~~~
      |                                            std::__1::atomic_uint
/home/hujun5/downloads1/vela_sim/nuttx/include/libcxx/__atomic/aliases.h:35:7: note: 'std::__1::atomic_uint' declared here
   35 | using atomic_uint   = atomic<unsigned int>;
      |       ^~~~~~~~~~~
/home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/spinlock.h:417:57: error: expected primary-expression before ')' token
  417 |   if (!atomic_compare_exchange_strong((FAR atomic_uint *)&lock->value,
      |                                                         ^
/home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/spinlock.h:418:54: error: expected type-specifier before '.' token
  418 |                                       &old.value, new.value))

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-07-19 09:54:21 +02:00
chao an
532c437dc9 compiler/tasking: fix build break after inline spinlock change
Regression by:
| commit a4fece3450
| Author: hujun5 <hujun5@xiaomi.com>
| Date:   Wed Jul 3 15:10:49 2024 +0800
|
|     spin_lock: inline spin_lock

Signed-off-by: chao an <anchao@lixiang.com>
2024-07-16 21:13:13 +08:00
Huang Qi
6acb4532d4 sched.h: Update doc link for tcbinfo_s
Original documentation link for riscv is broken,
so update to the correct link for all architectures.

Put the link around `reg_off` to avoid the long line warning
from nxstyle.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2024-07-16 14:46:57 +08:00
chenwen@espressif.com
e0b99216b0 driver/net/lan9250: Add lan9250_ioctl and lan9250_uninitialize APIs
- use 'lan9250_ioctl' to set and get the value of lan9250 phy register
    - use `lan9250_uninitialize` to un-initialize the ethernet driver

Signed-off-by: chenwen@espressif.com <chenwen@espressif.com>
2024-07-15 19:41:15 +08:00
hujun5
a4fece3450 spin_lock: inline spin_lock
test:
We can use qemu for testing.
compiling
make distclean -j20; ./tools/configure.sh -l qemu-armv8a:nsh_smp ;make -j20
running
qemu-system-aarch64 -cpu cortex-a53 -smp 4 -nographic -machine virt,virtualization=on,gic-version=3 -net none -chardev stdio,id=con,mux=on -serial chardev:con -mon chardev=con,mode=readline -kernel ./nuttx
2024-07-15 02:29:30 +08:00
zhanghongyu
84f4bd6ec1 sysinfo.h: add get_nprocs_conf/get_nprocs definition
This definition was added in order to solve some compilation problems
encountered when porting tripartite libraries

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-07-14 15:09:04 -03:00
zhanghongyu
d53d7d6c34 sched.h: add SCHED_BATCH and SCHED_IDLE definition
Resolve undefined compile-time issues encountered when porting
third-party libraries.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-07-14 13:20:53 -03:00
zhanghongyu
4245da43ca ioctl.h: add SIOCATMARK definition to resolve compilation errors
This definition was added in order to solve some compilation problems
encountered when porting third-party libraries

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-07-14 10:53:45 -03:00
zhanghongyu
bcd64bf2bf libc/unistd: added an implementation of the lib_flock function
To solve some compilation issues encountered during the porting of
third-party libraries, this function has been added.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-07-14 10:51:41 -03:00
geniusdo
dde3b1b226 add rint and expm1 function to cmath from libm 2024-07-12 12:05:54 +08:00
Michal Lenc
e16ee4dba3 can: enhance bit timing ioctl to set both nominal and data bit timing
This adds field type to canioc_bittiming_s structure that allows
to set/obtain bit timing for both CAN CC and CAN FD.
CANIOC_GET_BITTIMING is now bidirectional: user specifies type field
and gets other fields from the controller.

The commit also updates current CAN FD capable controllers using the
ioctl. The type is not checked for classical CAN only controllers
and nominal bit timing is returned regardless of type value.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2024-07-10 11:33:03 -03:00
Michal Lenc
816b1b28a0 can: enhance API to allow better CAN FD handling
This commit moves can_bytes2dlc and can_dlc2bytes from kernel internal
functions to API. These functions are necessary to convert bytes to
dlc for CAN FD frames and has to be accessible from the application
since can_hdr_s does not store message length in bytes but directly in
dlc.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2024-07-10 11:33:03 -03:00
Saurav Pal
23b7dc0651 fs/mnemofs: Setup and VFS methods
The Setup and VFS methods for mnemofs, a NAND Flash File System.

Signed-off-by: Saurav Pal <resyfer.dev@gmail.com>
2024-07-10 09:25:23 -03:00
xuxingliang
bbc31d70f4 drivers: add API for drivers early initialization
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-07-09 16:05:59 +08:00
chao an
f857004227 fs/procfs: refine file backtrace
remove backtrace arrary in stack

Signed-off-by: chao an <anchao@lixiang.com>
2024-06-30 17:30:42 +08:00
yinshengkai
5a31d52fd8 files: add files_dumplist api, replace dumponexit implementation
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-06-30 17:30:42 +08:00
fangpeina
242b50f921 libc/execinfo: extract a common backtrace format function
Add a common method to format backtrace to buffer, so it can be used by both mm, fs and other possoble modules.

Signed-off-by: fangpeina <fangpeina@xiaomi.com>
2024-06-29 22:44:39 +08:00
yanghuatao
87dfcd1020 include/sched.h: CPU_XXX macros can also be used without CONFIG_SMP
Allow CPU_XXX macros to be used without CONFIG_SMP=y

Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
Co-authored-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-06-28 20:35:54 +08:00
Jani Paalijarvi
92747b7529 drivers/net/ksz9477: Add port mirroring support
Signed-off-by: Jani Paalijarvi <jani.paalijarvi@unikie.com>
2024-06-27 18:09:57 +08:00
zhanghongyu
e14ae3e681 pthread: add pthread_self/pthread_gettid_np function
explicitly defined functions can support assignment as function pointers

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-06-26 17:40:55 +08:00
raiden00pl
e01fb50541 compiler.h: rename CMSE extension attribute macros
rename CMSE extension attribute macros to avoid conflicts with 3rd party code:

  cmse_nonsecure_entry -> tz_nonsecure_netry
  cmse_nonsecure_call -> tz_nonsecure_call
2024-06-25 14:58:36 +02:00
buxiasen
cf574fa466 mm: add mm_initialize_pool, make pool more flexible
now allow enable pool for extra heap, and disable umm/kmm pool.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-06-25 16:42:06 +08:00
Xu Xingliang
69d8a17dda fs: add backtrace to where file opens
Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
2024-06-24 23:53:59 +08:00
anjiahao
3c7162338d gdbstub:support gdbstub_debugpoint_add/remove smp call
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-06-24 23:51:43 +08:00
Xiang Xiao
e9558a88cd gdbstub: Change GDBSTUB_ to GDB_
Make the naming convention more consistent

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-06-24 23:51:43 +08:00
Yanfeng Liu
3b1f4562a0 sched/tls: drop ta_argv and g_idleargv
- replaces `ta_argv` with `stackargs`
- drops `ta_argv` from `task_info_s`
- drops `g_idleargv` and checks idle accordingly

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-06-23 22:24:19 +08:00
Yanfeng Liu
1d169fe325 sched/tls: add nxsched_get_stackargs
Thread args have already been saved to stack after the TLS section by
nxtask_setup_stackargs. This is to retrieve it for use.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-06-23 22:24:19 +08:00
buxiasen
870d989d6c mm: seperate mm_pool and mm_pool init
make possible enable pool, but disabled in system heap.
also compatible for further extra heap use/not use pool.
Now use MM_HEAP_MEMPOOL_THRESHOLD -1 to indicate pool disabled.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-06-23 11:09:39 +08:00
Peter Bee
c429438f0d arch/arm: add up_systempoweroff()
Co-authored-by: Neo Xu <neo.xu1990@gmail.com>

Signed-off-by: Peter Bee <bijunda1@xiaomi.com>
2024-06-21 22:44:09 +08:00
hujun5
f7843e2198 sched:remove g_cpu_schedlock g_cpu_irqsetlock g_cpu_locksetlock
we can use g_cpu_lockset to determine whether we are currently in the scheduling lock,
and all accesses and modifications to g_cpu_lockset, g_cpu_irqlock, g_cpu_irqset
are in the critical section, so we can directly operate on it.

test:
We can use qemu for testing.

compiling
make distclean -j20; ./tools/configure.sh -l qemu-armv8a:nsh_smp ;make -j20
running
qemu-system-aarch64 -cpu cortex-a53 -smp 4 -nographic -machine virt,virtualization=on,gic-version=3 -net none -chardev stdio,id=con,mux=on -serial chardev:con -mon chardev=con,mode=readline -kernel ./nuttx

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-06-21 11:11:07 +09:00
Zhe Weng
2c303f213f net/netfilter: Add filter table in ip6tables
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-06-20 09:43:05 +08:00
Zhe Weng
c72edb0637 net: Add set/getsockopt options compatible with ip6tables
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-06-20 09:43:05 +08:00
Zhe Weng
9637c10696 net/netfilter: Add filter table in iptables.
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-06-20 09:43:05 +08:00
zhanghongyu
dab55ef6e2 unistd.h: Adds some posix supported definitions.
resolve compilation and functional errors caused by posix definitions
check of third-party libraries.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-06-19 20:47:49 +08:00
gaohedong
dc651e090e net/can: Add SO_RCVBUF option for can socket
If the CAN stack receiving packets fast, but the application layer reading packets slow. Then `conn->readahead` will continue to grow, leading to memory leaks. Finally CAN stack potentially starve out all IOB buffers. To prevent memory leaks, users can restrict can socket buffer length.

Signed-off-by: gaohedong <gaohedong@xiaomi.com>
2024-06-14 19:54:07 +08:00
raiden00pl
3345e0caf9 include/nuttx/timers/oneshot.h: fix gcc14 errors
/home/raiden00/git/RTOS/nuttx/nuttx/include/nuttx/timers/oneshot.h: In function 'oneshot_max_delay':
/home/raiden00/git/RTOS/nuttx/nuttx/include/nuttx/timers/oneshot.h:272:3: error: implicit declaration of function 'timespec_from_tick' [-Wimplicit-function-declaration]
  272 |   timespec_from_tick(ts, tick);
      |   ^~~~~~~~~~~~~~~~~~
/home/raiden00/git/RTOS/nuttx/nuttx/include/nuttx/timers/oneshot.h: In function 'oneshot_start':
/home/raiden00/git/RTOS/nuttx/nuttx/include/nuttx/timers/oneshot.h:285:10: error: implicit declaration of function 'timespec_to_tick'; did you mean 'timespec_get'? [-Wimplicit-function-declaration]
  285 |   tick = timespec_to_tick(ts);
      |          ^~~~~~~~~~~~~~~~
      |          timespec_get
2024-06-13 02:21:29 +08:00
chao an
e081892316 compiler: fix build break on niche platform
ctc E208: ["include/stdlib.h" 236/52] syntax error - token ";" inserted before "realloc_like2"

Signed-off-by: chao an <anchao@lixiang.com>
2024-06-12 23:36:11 +08:00
Yanfeng Liu
caff9eba28 lib/math32.h: add IS_POWER_OF_2 macro
This adds IS_POWER_OF_2 macro to help catching config errors at
build time.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-06-12 16:10:35 +08:00
buxiasen
b53b449847 pm: make compile dummy when PM not enabled.
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-06-08 12:04:18 +08:00
chao an
e456c88c09 Revert "sched: replace some global variables to macro"
sched implementation not depends on macro abstraction, so revert below commit:

This reverts commit 4e62d0005a
This reverts commit 0f0c370520
This reverts commit ad0efd04ee

Signed-off-by: chao an <anchao@lixiang.com>
2024-06-06 22:00:25 +08:00
zhanghongyu
ee4c25f34e sem_open: return error code, sem returned by parameter
pointer comparison is unsigned, when returning -errno will be converted
to a large positive number, can not enter the error handling branch,
therefore, the error code is returned directly and the sem is returned
through the parameters.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-06-06 02:40:50 +08:00
zhanghongyu
9472426f69 net/inet: Rename ttl to s_ttl in sconn.
uniform naming convention

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-06-05 23:22:15 +08:00
buxiasen
1933f9648d pm: remove pm global, make per domain isolated
After change, when CONFIG_PM_NDOMAINS > 1,
the pm_register will not able to get notificaion
from not PM_IDLE_DOMAIN.
Should use pm_domain_register as a replacement.

Isolate domains from global callbacks can decrease
not necessary execution, and reduce the
lock instruction requirements.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-06-04 22:04:25 +08:00
Stuart Ianna
39e6e25565 drivers/devicetree/fdt: add additional fdt parsing utilities.
These utilities remove some of the boilerplate needed for FDT parsing and device initialization.
2024-06-03 22:05:00 +08:00
TakuyaMiyasita
c93383407b drivers/serial/uart_pl011.c : add the interface about clock and reset control for reducing power consumption. 2024-06-03 21:18:44 +08:00
liqinhui
05b101134a net:Support jumbo frame prealloc the iob for the ICMP/UDP/TCP.
For the ICMP, UDP and TCP, pre-alloc an iob for a jumbo frame.

Signed-off-by: liqinhui <liqinhui@xiaomi.com>
2024-06-02 09:31:37 -03:00
raiden00pl
105e4f44d4 libdsp: fix gcc14 error and clean up includes 2024-06-02 09:27:36 -03:00
raiden00pl
e062f4591c sched/task/task_exithook.c: fix gcc14 error
umm_memdump() should be always declared otherwise we get error when DEBUG_MM=n:

sched/task/task_exithook.c:468:7: error: implicit declaration of function ‘umm_memdump’; did you mean ‘mm_memdump’? [-Wimplicit-function-declaration]
2024-06-02 09:27:36 -03:00
raiden00pl
394de18316 netfilter/ip_tables.h: fix gcc14 error
/home/raiden00/git/RTOS/nuttx/nuttx/include/nuttx/net/netfilter/ip_tables.h:281:24: error: returning 'char *' from a function with incompatible return type 'struct xt_entry_target *' [-Wincompatible-pointer-types]
  281 |   return (FAR char *)e + e->target_offset;
      |          ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
2024-05-31 18:14:11 -03:00
raiden00pl
3ce9e34ec9 include/crypto/curve25519.h: fix gcc14 error
/home/raiden00/git/RTOS/nuttx/nuttx/include/crypto/curve25519.h:42:5: error: implicit declaration of function 'arc4random_buf' [-Wimplicit-function-declaration]
   42 |     arc4random_buf(secret, CURVE25519_KEY_SIZE);
2024-05-31 18:14:11 -03:00