Commit Graph

6996 Commits

Author SHA1 Message Date
chao an f12c88d287 assert: check COMPILE_TIME_ASSERT before define
check COMPILE_TIME_ASSERT before define

Signed-off-by: chao an <anchao@lixiang.com>
2024-08-20 02:42:35 +08:00
guoshichao 64176214a0 assert: add compile_assert macro
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-08-19 22:16:04 +08:00
jinxiuxu e88e3cd527 nuttx/audio: add AUDIOIOC_GETPOSITION ioctl
Signed-off-by: jinxiuxu <jinxiuxu@xiaomi.com>
2024-08-19 11:14:08 -03:00
chenrun1 97338c9f3d idr:New idr_find interface
Different from idr_get_next, if idr_find directly when could not find the node id return an error

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-19 11:05:40 -03:00
chenrun1 a1ccf15e39 idr:Tool for associating discrete ids with addresses
This is a tool for associating discrete IDs with addresses.
This tool is implemented through the red-black tree method provided by <sys/tree.h>, and the time complexity when calling, searching, and deleting is optimized to O(logn)
The implementation is the moving node operation of two red-black trees
1. When applying for a node, it will first check whether there is an available node in the "removed" tree. If so, the memory address of the node will be reused and moved to the "alloced" tree.
2. If the "removed" tree is an "empty tree", then the node will be requested from the memory and added to the "alloced" tree
3. Similarly, when removing a node, we set the address pointed to in the node to "NULL" and move it to the "removed" tree. Next time we alloc the node, we can reduce the overhead caused by memory application
For now, we still have something that can be optimized, and that is the memory elimination mechanism of the "removed tree". The current implementation will only release all the content under the "removed" tree when the idtree is destroyed.

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-19 11:05:40 -03:00
chenrun1 aee9125350 v9fs:File system based on 9P2000L.
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-19 11:05:40 -03:00
chenrun1 af5d679e18 fs.h:Added definition CH_STAT_SIZE
Define a CH_STAT_SIZE in fs.h

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-19 11:05:40 -03:00
Windrow14 49cbcfb5e6 drivers/mmcsd/mmcsd.h|mmcsd_sdio.c|mmcsd_sdio.h: support MMC high speed SDR mode
According to the eMMC specification, in Backwards Compatibility
with legacy MMC card mode, the frequency of the SD clock must be
0-26 MHZ; in high speed SDR mode, it must be 0-52MHZ. So we should
switch to high speed SDR mode if the clock frequency is higher than
26MHZ.

Signed-off-by: Yinzhe Wu <Yinzhe.Wu@sony.com>
Reviewed-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
Reviewed-by: Jacky Cao <Jacky.Cao@sony.com>
Tested-by: Yinzhe Wu <Yinzhe.Wu@sony.com>
2024-08-19 19:52:39 +08:00
zhanghongyu 986ddc83ce netinet/in.h: add macro definitions to resolve compilation errors
solve the compiling problem of the third-party library,
add IN6_IS_ADDR_MC_LINKLOCAL and IN6_IS_ADDR_SITELOCAL definitions.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-08-19 19:49:42 +08:00
guoshichao c95a9fc304 greenhills: add empty "__extension__" definition to fix build error
"libcxxmini/libxx_cxa_guard.cxx", line 47: error #77-D: this declaration has
          no storage class or type specifier
  __extension__ typedef int __guard __attribute__((mode(__DI__)));
  ^

"libcxxmini/libxx_cxa_guard.cxx", line 47: error #65: expected a ";"
  __extension__ typedef int __guard __attribute__((mode(__DI__)));
                ^

"libcxxmini/libxx_cxa_guard.cxx", line 64: error #20: identifier "__guard" is
          undefined
    int __cxa_guard_acquire(FAR __guard *g)
                                ^

"libcxxmini/libxx_cxa_guard.cxx", line 64: error #20: identifier "g" is
          undefined
    int __cxa_guard_acquire(FAR __guard *g)
                                         ^

"libcxxmini/libxx_cxa_guard.cxx", line 65: error #65: expected a ";"
    {
    ^

"libcxxmini/libxx_cxa_guard.cxx", line 93: warning #12-D: parsing restarts
          here after previous syntax error
  }

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-08-19 10:37:54 +08:00
guoshichao b2a739a67a greenhills: fix the can.h build error
CC:  src/algslib_sha256.c "comlin.c", line 189: error #1982-D: target stack alignment is insufficient to
          guarantee alignment of this variable
      struct can_frame lin_err_frame = comlin_rx_frame[chlId];
                       ^

"comlin.c", line 282: error #1982-D: target stack alignment is insufficient to
          guarantee alignment of this variable
      struct can_frame frame;
                       ^

"comlin.c", line 321: error #1982-D: target stack alignment is insufficient to
          guarantee alignment of this variable
      struct can_frame frame;

"DiagServer_IsoTp.c", line 220: error #1982-D: target stack alignment is
          insufficient to guarantee alignment of this variable
      struct canfd_frame frame = {0};
                         ^

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-08-19 10:37:54 +08:00
liuhongchao 7495014b17 drivers/input: Add goldfish events driver
Signed-off-by: liuhongchao <liuhongchao@xiaomi.com>
2024-08-18 10:54:22 -03:00
chenrun1 a1e3444df0 rpmsgfs:Support cross-core access using file locks on the same file
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-18 19:56:49 +08:00
guoshichao 61cd8c379e mm/mempool: rename the mempool_alloc and mempool_free function
the mempool_alloc and mempool_free function are duplicate with the
mempool method that provided in optee_os, in order to port optee_os, so
we rename the mempool related functions in nuttx

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2024-08-18 19:46:54 +08:00
rongyichang 8c3872b919 drivers/video: add goldfish gpu fb
In order to better use the Android goldfish emulator,
a GPU FB driver has been added. This allows the goldfish
emulator  side to achieve more flexible display effects,
such as UI skins.

Signed-off-by: rongyichang <rongyichang@xiaomi.com>
2024-08-18 10:15:00 +08:00
Xiang Xiao cd1f8f1fea fs/epoll: Map EPOLLRDHUP from 0x2000 to POLLRDHUP
maintain consistency within nuttx definitions

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-08-17 00:19:15 +02:00
Zhe Weng 504af7a1fa drivers/virtio-net: Support VIRTIO_F_ANY_LAYOUT
According to Virtual I/O Spec:
When using legacy interfaces, transitional drivers which have not negotiated VIRTIO_F_ANY_LAYOUT MUST use a single descriptor for the struct virtio_net_hdr on both transmit and receive, with the network data in the following descriptors.

https://docs.oasis-open.org/virtio/virtio/v1.2/cs01/virtio-v1.2-cs01.html#x1-2280006 (Section 5.1.6.6)

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-08-16 21:15:31 +08:00
Jinliang Li 0fddb71478 serial/uart_16550: include stdint.h in uart_16550.h
stdint.h is needed in uart_16550.h for some types, e.g. uint32_t,
uintptr_t. Otherwise there will be building issue unless that stdint.h
is added before uart_16550.h by all files which needs uart_16550.h.

Signed-off-by: Jinliang Li <lijinliang1@lixiang.com>
2024-08-16 13:26:40 +08:00
chenxiaoyi 363cd1c17a windows sim:convert pointer type to char* fix windows net build error
nuttx\include\nuttx\net\netfilter\ip6_tables.h(299,24): error C2036: 'void *': unknown size

Co-authored-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
Co-authored-by: xuxin19 <xuxin19@xiaomi.com>
2024-08-14 22:36:57 +08:00
chenxiaoyi cedb7f97de compiler.h: fix windows netfilter build error
nuttx\net\netfilter\ipt_sockopt.c(389,7): error C2059: syntax error: ')'
nuttx\net\netfilter\ip6t_sockopt.c(387,7): error C2059: syntax error: ')'

Co-authored-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
Co-authored-by: xuxin19 <xuxin19@xiaomi.com>
2024-08-14 22:36:57 +08:00
chenxiaoyi 7ce5241f0e types.h: fix windows build error
Windows Kits\10\Include\10.0.22621.0\ucrt\corecrt.h(605,39): error C2371: 'wint_t': redefinition; different basic types
Windows Kits\10\Include\10.0.22621.0\ucrt\corecrt.h(606,39): error C2371: 'wctype_t': redefinition; different basic types

Co-authored-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
Co-authored-by: xuxin19 <xuxin19@xiaomi.com>
2024-08-14 22:36:57 +08:00
chenxiaoyi 46f3477d2f compiler.h: fix windows build error
warning C5101: use of preprocessor directive in function-like macro argument list is undefined behavior

Co-authored-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
Co-authored-by: xuxin19 <xuxin19@xiaomi.com>
2024-08-14 22:36:57 +08:00
anjiahao 2ff2b82437 coredump:coredump_set_memory_region to set memory region
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-08-12 02:02:25 +08:00
anjiahao 5f4c1721ff coredump:support coredump aligned access registers
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-08-12 02:02:25 +08:00
Saurav Pal 0be6dfb552 fs/mnemofs: Refactor path logic, direntry size bug fix, open free bug fix
Refactoring path logic to prevent logic flaws, direntry size bug fix to allow proper direntry traversal, open free bug fix to prevent memory leak after close.

Signed-off-by: Saurav Pal <resyfer.dev@gmail.com>
2024-08-09 09:00:17 +02:00
rongyichang bb29c39d50 drivers/touchscreen: add grab for touchscreen
Providing the capability for applications to exclusively
handle touch events

Signed-off-by: rongyichang <rongyichang@xiaomi.com>
2024-08-08 18:30:32 +08:00
chao an 9cc25523b1 spinlock: add support of spin_trylock_irqsave()
trylock spinlock in critical section:

bool spin_trylock_irqsave(FAR volatile spinlock_t *lock, irqstate_t flags);
bool spin_trylock_irqsave_wo_note(FAR volatile spinlock_t *lock, irqstate_t flags);

Signed-off-by: chao an <anchao@lixiang.com>
2024-08-08 18:26:59 +08:00
Shoukui Zhang 4e6f3e9360 I2c slave: Add POLLOUT event for notifie slave write success
Signed-off-by: Shoukui Zhang <zhangshoukui@xiaomi.com>
2024-08-07 12:13:38 -03:00
Shoukui Zhang 2093038315 add setup and shutdown for i2c master and slave
Signed-off-by: Shoukui Zhang <zhangshoukui@xiaomi.com>
2024-08-07 12:13:38 -03:00
Shoukui Zhang f4a234613e Add I2C Slave driver
Signed-off-by: Shoukui Zhang <zhangshoukui@xiaomi.com>
2024-08-07 12:13:38 -03:00
chao an 0801adb08f spinlock: compile spinlock only if CONFIG_SPINLOCK is enabled
Regression by: #12599

Signed-off-by: chao an <anchao@lixiang.com>
2024-08-05 16:20:47 +08:00
chao an 555dab3da3 spinlock: inline irqsaved spinlock
Reference pull request: #12599

Signed-off-by: chao an <anchao@lixiang.com>
2024-08-05 16:20:47 +08:00
chao an 500ebd6498 spinlock: fix unused parameter
fix unused parameter if unlock spinlock from different function

Signed-off-by: chao an <anchao@lixiang.com>
2024-08-05 16:20:47 +08:00
chao an 3374e82c4c spinlock: inline no trace implement to remove duplicate logic
minor changes to remove duplicate logic

Signed-off-by: chao an <anchao@lixiang.com>
2024-08-05 16:20:47 +08:00
chao an fb0e46660a spinlock: fix typo of sched_note_spinlock_unlock()
should be sched_note_spinlock_unlock() not sched_note_spinlock_unlocked()

Signed-off-by: chao an <anchao@lixiang.com>
2024-08-05 16:20:47 +08:00
Yanfeng Liu cafee0e086 mm/mm.h: add mm_free_delaylist interface
This adds explicit `void mm_free_delaylist(heap)` interface so that
to force freeing the heap's delaylist.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-08-03 01:30:04 +08:00
Huang Qi cac3d43ed8 Fix a typo in include/nuttx/arch.h
Function name should be `up_debugpoint_add`,
not `up_debugpoint`.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2024-08-01 13:57:51 +08:00
Tiago Medicci c99c3ceec2 up_copy_section: Improve function description
Add "Input Parameters" section to already existing definitions
and declarations of `up_copy_section` function.
2024-07-31 02:33:12 +08:00
Huang Qi 78743e4055 Fix some style issues
Modified files:
- boards/arm/cxd56xx/spresense/src/cxd56_clock.c
- boards/arm/sama5/giant-board/include/board.h
- boards/arm/stm32l4/b-l475e-iot01a/include/board.h
- boards/risc-v/esp32c3-legacy/esp32c3-devkit-rust-1/src/esp32c3-devkit-rust-1.h
- boards/sim/sim/sim/src/dummy.c
- drivers/wireless/spirit/lib/spirit_radio.c
- include/nuttx/modem/u-blox.h

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2024-07-27 22:57:32 +08:00
Huang Qi d7f82fb14c Correct comment blocks
Fix wrong comment blocks in the following files:
- arch/arm/src/stm32f0l0g0/stm32_pwr.c
- include/nuttx/mtd/nand_config.h

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2024-07-27 03:11:39 +08:00
Huang Qi f714669da4 dlfcn: Add stub for dladdr
Implement a stub for dladdr() to avoid build errors
with some applications that use dladdr().

The API definition is from:
1. https://man7.org/linux/man-pages/man3/dladdr.3.html
2. https://pubs.opengroup.org/onlinepubs/9799919799.2024edition/functions/dladdr.html

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2024-07-26 14:39:10 -03:00
buxiasen f5021021ae up_backtrace: fix maybe backtrace the exiting thread
when the thread to backtrace is exiting, get_tcb and up_backtrace in
different critical section may cause try to dump invalid pointer, have
to ensure the nxsched_get_tcb and up_backtrace inside same critical
section procedure.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-07-26 12:03:43 +08:00
Matteo Golin 1fba2ec0df Add support for the Sensirion SHT4x temperature and humidity sensor family.
This driver implements `read`, `write`, `open`, `close` and `ioctl`
interfaces to the SHT4X temperature and humidity sensor on an I2C bus.
The read implementation is that of a character driver for easy
debugging, while `ioctl` provides an interface to the sensor's raw data
collection and heating functionality.
2024-07-22 14:24:20 -03:00
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