Commit graph

7543 commits

Author SHA1 Message Date
ligd
1463a49396 sched/clock: call up_timer_gettime() to get higher resolution
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-12-13 18:19:44 +08:00
simbit18
eec97064d7 fix nxstyle
Removed extra spaces from .h and .c files
2024-12-10 21:57:22 +08:00
lipengfei28
aa1df4e9a9 pci: fix pci dev alloc bridge mem error
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-12-06 21:12:24 +08:00
Anner J. Bonilla
497c9b9309 Update cdc.h typo
Fixed typo
2024-12-06 09:23:55 +08:00
zhangyuan29
060fda032b drivers/net: change netdev_lower_quota_load to macro.
Signed-off-by: zhangyuan29 <zhangyuan29@xiaomi.com>
2024-12-05 13:26:22 +08:00
zhangyuan29
1dc1e65202 arch/xtensa: use arch atomic when enable iram heap
S32C1I instructions may target cached, cache-bypass,
and data RAM memory locations. S32C1I instructions
are not permitted to access memory addresses in data ROM,
instruction memory or the address region allocated to
the XLMI port. Attempts to direct the S32C1I at these
addresses will cause an exception.

Signed-off-by: zhangyuan29 <zhangyuan29@xiaomi.com>
2024-12-05 00:05:15 +08:00
zhangyuan29
dcea1b90e7 arch_atomic: only support atomic_xx and atomic64_xx function
Modify the kernel to use only atomic_xx and atomic64_xx interfaces,
avoiding the use of sizeof or typeof to determine the type of
atomic operations, thereby simplifying the kernel's atomic
interface operations.

Signed-off-by: zhangyuan29 <zhangyuan29@xiaomi.com>
2024-12-04 14:03:14 +01:00
chao an
93a34b1992 drivers/timers: export arch timer api to support higher resolution
Before:
[  384.149000] [CPU0] [ 5] Hello World!
After:
[  384.149947] [CPU0] [ 5] Hello World!

Signed-off-by: chao an <anchao@lixiang.com>
2024-12-04 10:52:26 +01:00
Tiago Medicci Serrano
1dd8178bdc float.h: Define FLT_ROUNDS if not defined by toolchain previously
This value is necessary to build third-party applications on NuttX.
If not defined previously by the toolchain, define it at NuttX's
`lib/float.h`.
2024-12-03 08:38:58 +08:00
wangjianyu3
d59e6d98d5 include/usbdev_trace: Fix argument and return value of macro usbtrace_enumerate()
Errors

  1. Not return int value

     usbmsc_main.c: In function 'msconn_main':
     usbmsc_main.c:645:55: error: expected expression before ';' token
       645 |       ret = usbtrace_enumerate(usbmsc_enumerate, NULL);

  2. Error argument number

     CC:  usbmsc_main.c usbmsc_main.c: In function 'msconn_main':
     usbmsc_main.c:645:54: error: macro "usbtrace_enumerate" passed 2 arguments, but takes just 1
       645 |       ret = usbtrace_enumerate(usbmsc_enumerate, NULL);

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-12-02 22:43:51 +08:00
Simon Filgis
6135892d66 driver for STUSB4500
right now it is only possible to change the delivered power on the fly
by
1. selecting PDO2 slot
2. write to POO2
3. renegotiate power delivery by sw reset command
2024-11-30 08:40:08 -03:00
wangjianyu3
d2dd747e09 drivers/sensors/gnss: Different nbuffer for each topic
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-11-30 14:10:57 +08:00
hujun5
16f39fbb56 fs: use small lock to protect filelist
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-11-30 03:25:17 +08:00
hujun5
fe2af95222 add spinlock_type.h
reason:
Due to incomplete handling of spinlock_t in arch/spinlock.h,
it should not be used directly by external code.
Furthermore, because pthread.h and nuttx/spinlock.h have a circular
dependency, pthread.h cannot successfully include nuttx/spinlock.h.
Therefore, we have split spinlock_type.h from spinlock.h.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-11-30 03:25:17 +08:00
buxiasen
7a4fac0df6 coredump: add BOARD_CRASHDUMP_CUSTOM support
For only board specific crashdump and no syslog/blk/mtd coredump

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-11-30 03:08:35 +08:00
buxiasen
eca83c4a73 blk/mtdoutstream: use lib_sostream_s to support seek
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-11-30 03:08:35 +08:00
lipengfei28
f589d5a4c7 pci: pci res have pci addr and cpu addr, ecam use map translation pci
addr to cpuaddr

Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-11-29 11:12:54 +08:00
wangmingrong1
cdbf5c6ebe Fix compilation errors
CC:  gcov.c gcov.c: In function 'gcov_stdout_dump':
gcov.c:146:50: error: passing argument 3 of '__gcov_info_to_gcda' from incompatible pointer type [-Werror=incompatible-pointer-types]
  146 |       __gcov_info_to_gcda(info, stdout_filename, stdout_dump, NULL, &arg);
      |                                                  ^~~~~~~~~~~
      |                                                  |
      |                                                  void (*)(const void *, size_t,  void *) {aka void (*)(const void *, long unsigned int,  void *)}
In file included from gcov.c:25:
/mnt/vela/github/NX/nuttx/include/gcov.h:139:44: note: expected 'void (*)(const void *, unsigned int,  void *)' but argument is of type 'void (*)(const void *, size_t,  void *)' {aka 'void (*)(const void *, long unsigned int,  void *)'}
  139 |                                 FAR void (*dump)(FAR const void *,
      |                                     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
  140 |                                                  unsigned int, FAR void *),
      |                                                  ~~~~~~~~~~~~~~~~~~~~~~~~~

libgcc/gcov.c: In function 'gcov_process_path.constprop':
libgcc/gcov.c:235:29: error: 'filename' may be used uninitialized [-Werror=maybe-uninitialized]
  235 |       tokens[token_count++] = filename;
      |       ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
libgcc/gcov.c:189:13: note: 'filename' was declared here
  189 |   FAR char *filename;

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-11-26 19:25:24 +08:00
buxiasen
3e24aab208 stream_getc: use lib_stream_eof instead of EOF
Will case scanftest break #14778, at " %4c%n" case.
scanf use INT_MAX cause EOF break.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-11-26 10:25:36 +08:00
hujun5
f5136b2afa spinlock: remove recursive locks with write_lock_irqsave/read_lock_irqsave
reason:
1 There is a similar PR, https://github.com/apache/nuttx/pull/14079,
2 Currently, no one is using recursive locks with write_lock_irqsave/read_lock_irqsave.
3 Nested spinlock is harmful, prone to abuse and leading to a decline in code quality and performance
4 Nested spinlock is also not available in Linux.
5 In our future plans, nested usage of enter_critical_section and spin_lock_irqsave will also be removed.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-11-26 10:21:04 +08:00
hujun5
34e79f9618 spinlock: use spin_lock_init replace spin_initialize
reason:
1: spin_lock_init and spin_initialize have similar functionalities.
2: spin_lock and spin_unlock should be called in matching pairs.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-11-26 00:02:44 +08:00
chao an
24add5eeaf spelling: fix spelling typo premp -> preemp
Signed-off-by: chao an <anchao@lixiang.com>
2024-11-25 22:05:05 +08:00
chao an
6ffb001fdf spelling: fix spelling typo premption -> preemption
Signed-off-by: chao an <anchao@lixiang.com>
2024-11-25 22:05:05 +08:00
wangmingrong1
47e33c6433 clang/gcov: Add a way to directly dump memory address
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-11-25 18:03:19 +08:00
hujun5
f4d212fd6d arm64: remove up_set_current_regs/up_current_regs
reason:
up_set_current_regs initially had two functions:

1: To mark the entry into an interrupt state.
2: To record the context before an interrupt/exception. If we switch to
a new task, we need to store the upcoming context regs by calling up_set_current_regs(regs).

Currently, we record the context in other ways, so the second function is obsolete. Therefore,
we need to rename up_set_current_regs to better reflect its actual meaning, which is solely to mark an interrupt.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-11-23 02:05:56 +02:00
yinshengkai
0413d74f31 libs: add gcov framework support
In devices without storage media, you can export data to the
command line and then generate the corresponding gcda file

It can save the result output by calling __gcov_info_to_gcda
The usage is similar to:
https://gcc.gnu.org/onlinedocs/gcc/Freestanding-Environments.html#Profiling-and-Test-Coverage-in-Freestanding-Environments

Usage:
 ./tools/configure.sh qemu-armv7a:nsh
Modify the configuration
+CONFIG_COVERAGE_ALL=y
+CONFIG_COVERAGE_MINI=y
+CONFIG_SYSTEM_GCOV=y
Run:
qemu-system-arm -cpu cortex-a7 -nographic -smp 4 \
     -machine virt,virtualization=off,gic-version=2 \
     -net none -chardev stdio,id=con,mux=on -serial chardev:con \
     -mon chardev=con,mode=readline -kernel ./nuttx/nuttx -semihosting -s | tee gcov.txt
./nuttx/tools/gcov_convert.py -i ./gcov.txt
./nuttx/tools/gcov.sh -t arm-none-eabi-gcov

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-11-22 19:08:08 +08:00
Zhe Weng
752245aca4 net: Move NET_TCP/UDP_HAVE_STACK to netconfig.h
Now the HAVE_PFINET(6)_SOCKETS depends on NET_TCP/UDP_HAVE_STACK, which
is previously defined in net/ folder and cannot be included.
Considering many places use this check, maybe moving them to netconfig.h
could be better.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-11-21 23:07:30 +08:00
meijian
d86d902392 netinet/in.h: add IN6_IS_ADDR_GLOBAL macro
Signed-off-by: meijian <meijian@xiaomi.com>
2024-11-20 20:42:21 +08:00
meijian
5ff98f65a8 netinet/in.h: fix LINKLOCAL macro bug
Signed-off-by: meijian <meijian@xiaomi.com>
2024-11-20 20:42:21 +08:00
hujun5
9f835f63bd mm/iob: fix some comment in https://github.com/apache/nuttx/pull/14764
reason:
Since we decoupled counting and sem count,
we changed the meanings of three key global variables:

g_iob_count: A positive number indicates the available number
  of IOBs, while a negative number indicates the number of waiters in iob_alloc (when throttle == false).
g_throttle_wait: Represents the number of waiters in
  iob_alloc (when throttle == true), and it will not be negative.
g_qentry_wait: Represents the number of waiters for
  qentry, and it will not be negative.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-11-19 15:39:00 +08:00
Xiang Xiao
f2693004b8 drivers/adc: Rename up_ads1255initialize to ads1255_initialize
since the common driver shouldn't have the prefix 'up_'

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-11-16 17:39:27 +01:00
hujun5
dcc75048be Revert "system: pthread_barrierwait should be moved to kernel space"
reason:
new implementation does not requires the use of enter_critical_section,
so the source code needs to be moved to user space

This reverts commit d189a86a35.
2024-11-15 22:07:25 +08:00
chao an
238cddde3a drivers/syslog: remove implement of syslog_putc()
syslog_putc() have a lot of duplicate logic with syslog_write().
remove syslog_putc() and reuse syslog_write() to simplify syslog printing.

Signed-off-by: chao an <anchao@lixiang.com>
2024-11-15 19:46:36 +08:00
hujun5
19b4911d7f arch: remove up_current_regs in common code
reason:

When entering an exception or interrupt, there are two sets of registers:
one is the "running regs", which we need to save,
and the other is the "ready to running regs", which we may soon use.
For consistency in logic, we can always store the "running regs" in the regs field of g_running_tasks,
otherwise it may lead to errors in the storage location of the "running regs."

When we need to access the "running regs," we should uniformly retrieve them from the regs field of g_running_tasks.

As the next step, we will rename the set_current_regs/up_current_regs functions
for each architecture to more appropriate names, solely for the purpose of identifying interrupts.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-11-15 18:25:35 +08:00
hujun5
7ba0f11d70 pthread: remove enter_critical_section in pthread_barrier_wait
reason:
We decouple semcount from business logic by using an independent counting variable,
which allows us to remove critical sections in many cases.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-11-15 14:03:03 +08:00
Takuya Miyasita
2275138dcf arch_atomic : Introduce CONFIG_LIBC_ARCH_ATOMIC
Some armv7-m-based SoCs do not work with atomic instructions,
even though armv7-m supports them.

To avoid using atomic instructions generated by gcc,
CONFIG_LIBC_ARCH_ATOMIC is newly introduced with which
arch_atomic.c is linked explicitly.

However, the function names need to be changed to avoid
build errors, since the functions described in stdatomic.h
are gcc built-in and inlined when the code is compiled.

About libcxx with CONFIG_LIBC_ARCH_ATOMIC, it still
does not work. It is also needed to call nx_atomic_ ver
instead of __atomic ver in
libcxx/include/__atomic/cxx_atomic_lmpl.h.

Signed-off-by: Takuya Miyasita <Takuya.Miyashita@sony.com>
2024-11-15 14:01:56 +08:00
buxiasen
a5459cdaca stream: reduce int use, handle FS_LARGEFILE correctly.
offset int -> offset, len int -> size_t, ret int -> ssize_t

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-11-15 01:05:04 +08:00
raiden00pl
547cbf3ba6 drivers/sensors: fix style issues in function headers
fix style issues in function headers, add missing new lines
2024-11-15 01:04:10 +08:00
raiden00pl
6fcfe7cf03 drivers/pci: fix style issues in function headers
fix style issues in function headers, add missing new lines
2024-11-15 01:04:10 +08:00
fangpeina
3518c69e6c input/ff: extend ioctrl to support factory calibration
Signed-off-by: fangpeina <fangpeina@xiaomi.com>
2024-11-14 23:35:07 +08:00
fangpeina
a719db1b58 drivers/input: support RTP file simulation in RAMLOOP mode
For resource-constrained devices, simulate RTP
playback effects using preset custom RAMLOOP
combinations instead of using RTP files to play
custom vibration effects.

Signed-off-by: fangpeina <fangpeina@xiaomi.com>
2024-11-14 23:35:07 +08:00
hujun5
ea20ae588a pthread_cond_broadcast use wait_count for judement
This commit fixes the comment from https://github.com/apache/nuttx/pull/14581

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-11-14 23:22:52 +08:00
Masayuki Ishikawa
bbf2bbf37d Revert "arch_atomic : Introduce CONFIG_LIBC_ARCH_ATOMIC"
This reverts commit 81e7b13a05.
2024-11-13 10:45:12 +09:00
hujun5
a72f1820af Fix typo errors in include/nuttx/clock.h
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-11-12 17:24:23 +08:00
chenrun1
0bad7f814a rammtd:add rammtd_uninitialize
Summary:
  Added rammtd_uninitialize to manage rammtd

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-11-12 14:58:01 +08:00
Takuya Miyasita
81e7b13a05 arch_atomic : Introduce CONFIG_LIBC_ARCH_ATOMIC
Some armv7-m-based SoCs do not work with atomic instructions,
even though armv7-m supports them.

To avoid using atomic instructions generated by gcc,
CONFIG_LIBC_ARCH_ATOMIC is newly introduced with which
arch_atomic.c is linked explicitly.

However, the function names need to be changed to avoid
build errors, since the functions described in stdatomic.h
are gcc built-in and inlined when the code is compiled.

Signed-off-by: Takuya Miyasita <Takuya.Miyashita@sony.com>
2024-11-12 14:27:42 +09:00
guoshichao
f94e092fad ghs: fix the naked_function attr cannot handle warning
with greenhills version older than 202354, the __attribute__((naked))
cannot handled by greenhills compiler, and will report warning:

"/home/guoshichao/work_profile/vela_os/vela_car_6/nuttx/arch/arm/src/armv7-m/arm_svcall.c", line 79: warning #1097-D:
          unknown attribute "naked"
  static void dispatch_syscall(void) naked_function;
                                     ^

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-11-11 22:32:26 +08:00
hujun5
55dbf37017 fix compiler error
reason:
when CONFIG_CLOCK_TIMEKEEPING=y, compiler error may report

In file included from /home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/sched.h:42,
                 from /home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/arch.h:89,
                 from boardctl.c:33:
/home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/irq.h:261:12: error: conflicting types for 'enter_critical_section'; have 'irqstate_t(void)' {aka 'long unsigned int(void)'}
  261 | irqstate_t enter_critical_section(void) noinstrument_function;
      |            ^~~~~~~~~~~~~~~~~~~~~~
In file included from /home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/wqueue.h:37,
                 from /home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/addrenv.h:39,
                 from /home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/sched.h:40:
/home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/wdog.h:267:11: note: previous implicit declaration of 'enter_critical_section' with type 'int()'
  267 |   flags = enter_critical_section();
      |           ^~~~~~~~~~~~~~~~~~~~~~
hujun5@hujun5-OptiPlex-7070:~/downloads1/vela_sim/nuttx$ make -j12
sched/sched_processtimer.c: In function 'nxsched_process_timer':
sched/sched_processtimer.c:178:3: error: implicit declaration of function 'clock_update_wall_time' [-Werror=implicit-function-declaration]
  178 |   clock_update_wall_time();

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-11-11 19:48:38 +08:00
robert
5e8f1eefb0 Bluetooth: improved pairing process and host layer now successfully receives ACL packets 2024-11-10 14:33:52 -03:00
hujun5
6611480904 isrthread: add configuring the stack of an isrthread as static
reason:
we configure the isr thread stack as static to allow for more flexible placement of the stack.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-11-08 01:49:14 +08:00