Commit Graph

7785 Commits

Author SHA1 Message Date
Tiago Medicci Serrano
70b5aa4df0 include/nuttx/spi/spi_bitbang: Fix incompatible pointer type issue
This commit fixes the incompatible pointer type issue due to
incompatible types of the `bitexchange_t` callback.

Signed-off-by: Tiago Medicci Serrano <tiago.medicci@espressif.com>
2025-09-27 21:40:43 +08:00
wangchengdong
8cfb9d7053 libs/libc/semaphore: allow nxsem_init to negative value
Allow user to init semaphore value to negative value, this is needed in some use cases
2025-08-31 18:38:03 +08:00
Zik Saleeba
835c535e18 drivers/ioexpander/aw9523b: New driver for AW9523B i/o expander
This is an I2C driver for the Awinic AW9523B I/O expander. As well
as the supporting usual digital I/Os, this device features the
ability to drive LEDs directly, and can control the drive current
to each LED individually. The driver was derived from the PCA9555
driver, provides all the standard interfaces of an i/o expander
driver. It also features support for the special features of the
AW9523B through pin direction IOEXPANDER_DIRECTION_OUT_LED and
IOEXPANDER_OPTION_NONGENERIC with AW9523B_OPTION_* options.

The driver has a number of configurable features including interrupt
handling and a shadow register mode based on the PCA9555 driver,
plus new LED/dimming support.

Testing was done using an ESP32S3 host and I2C connection to the
Adafruit AW9523 breakout board.

Signed-off-by: Zik Saleeba <zik@zikzak.net>
2025-08-29 09:10:50 -03:00
michal matias
8fc63aaa10 include/net/if.h: Add mechanism for MMD access with SIOCxMIIREG ioctls
Add mdio_phy_id_c45 macro. This macro allows encoding of additional information
needed for MMD access into the phy_id field of the mii_ioctl_data_s structure.
This macro is intended for use by user applications.

Add macros for decoding the phy_id encoded with the mdio_phy_id_c45 macro.
These macros are intended for use by network drivers implementing
SIOCxMIIREG commands.

Signed-off-by: michal matias <mich4l.matias@gmail.com>
2025-08-29 06:45:37 +02:00
Tiago Medicci Serrano
6f5a8c6b25 drivers/i2s/i2schar: Implement ioctl commands for i2schar
This commit implements a set of commands to the i2s character
driver. The implemented commands allows getting and setting
parameters like data width, sample rate and number of channels for
both receiver and transmitter. If no ioctl is found, the command
is redirected to the lower driver implementation if it has the
ioctl callback registered.

Signed-off-by: Tiago Medicci Serrano <tiago.medicci@espressif.com>
2025-08-27 11:07:05 +08:00
Jouni Ukkonen
9b8c8bdd7b drivers/tca64xx: Add support for PCAL6416
- Added new part support for PCAL6416
- Added pullup/pulldown configuration support

Signed-off-by: Jouni Ukkonen <jouni.ukkonen@unikie.com>
Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2025-08-26 09:46:09 +08:00
michal matias
4a4235b5a2 drivers/net: Remove the NCV7410 10BASE-T1S MAC-PHY driver
This commit removes existing support for the NCV7410 10BASE-T1S MAC-PHY.
The driver will be replaced by its generalized version with different organization.
The new driver has naming clashes with the old, therefore the old has to be removed first.

Signed-off-by: michal matias <mich4l.matias@gmail.com>
2025-08-25 20:32:35 +08:00
p-szafonimateusz
9fd1478a99 pthread: add pthread_{get|set}concurrency support
Add support for pthread_{get|set}concurrency support.

NuttX uses 1:1 threading model (every pthread is a kernel-managed thread),
so this function has no real effect on the scheduling behavior.

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2025-08-22 20:50:13 +08:00
p-szafonimateusz
b1e03bca0c libc: add support for sigsetjmp() and siglongjmp()
Add support for sigsetjmp() and siglongjmp().

This implementation is build on top of setjmp() and longjmp().
sigsetjmp() in that case must be implemented as a macro otherwise
we lose setjmp context.
siglongjmp() is kept as inline function to satisfy the PSE52 VSX
tests requirement.

An alternative implementation requires writing these function in
assembly code for each architecture.

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2025-08-22 20:50:13 +08:00
p-szafonimateusz
396f5b40ce unistd: add support for confstr()
add support for POSIX defined confstr()

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2025-08-22 20:50:13 +08:00
p-szafonimateusz
8108aad1a4 pthread: add pthread_attr_{get|set}guardsize support
This commit adds simple implementation of guardsize for pthreads.
At this moment this option simply increases the size of allocated pthread stack.

At default pthread guard size is set to 0.

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2025-08-22 20:50:13 +08:00
Niccolò Maggioni
7a2343f1be drivers/analog/ads7046: Add support for ADS7046 ADC
Add support for the Texas Instruments ADS7046 12-bit, SPI-compatible ADC.

Signed-off-by: Niccolò Maggioni <nicco.maggioni+nuttx@gmail.com>
2025-08-22 00:29:55 +08:00
“wangchengdong”
057b483350 include/nuttx/compiler.h:
fix nooptimiziation_function definition problem for tricore gnu compiler
arch/tricore:
	move tricore_csa2addr and tricore_addr2csa definition from include/arch.h to include/irq.h to fix build error
2025-08-21 08:34:13 -03:00
Niccolò Maggioni
3ba6047e29 drivers/sensors/tmp112: Add support for TMP112 temperature sensor
Some checks failed
Build Documentation / build-html (push) Has been cancelled
Docker-Linux / push (push) Has been cancelled
Add support for the Texas Instruments TMP112 I2C/SMBus digital
temperature sensor. Also add a new defconfig that includes
support for a TMP112 sensor and extend the existing documentation
to include its description.

Signed-off-by: Niccolò Maggioni <nicco.maggioni+nuttx@gmail.com>
2025-08-19 19:45:32 -03:00
nuttxs
7470fd9274 sys/socket.h: Since ss_family is of type uint16_t (2-byte alignment),
packing the internal substructures will reduce the overall alignment of
`sockaddr_storage` to 2, which triggers an unaligned access warning
in 32-bit systems.
Add an overall 8-byte alignment to the outermost layer of the structure.

Related commit: 855336bf
Refer to https://datatracker.ietf.org/doc/html/rfc2553#section-3.10

Signed-off-by: nuttxs <zhaoqing.zhang@sony.com>
2025-08-15 09:59:19 +08:00
Niccolò Maggioni
83dd57a488 crypto/hmac: Fix typo in function implementation names
"hmac" was mistyped as "hmca", breaking linking to some prototype
functions. Also, a couple of includes were missing.

Signed-off-by: Niccolò Maggioni <nicco.maggioni+nuttx@gmail.com>
2025-08-13 23:11:02 +08:00
Jukka Laitinen
2fa607796d include/nuttx/atomic.h: Fix C++ compilation with -nostdinc++
Without c++ standard includes, the <atomic> library is not available.
GCC may use __auto_type for the C-style atomic oprations, and this
is not available for C++. Just define the __auto_type to auto for C++.

Also, the built-in _atomic functions for GCC expect "volatile" parameters
in C, but don't allow that in C++. So selecting the atomic_t and atomic64_t
types according to that.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2025-08-08 01:09:34 +08:00
Theodore Karatapanis
707cdaf42e drivers/misc/optee: Expanded RPC support.
This commit expands RPC support for the OP-TEE driver using 2 files:
1) drivers/misc/optee_rpc.c
   * Add support for RPCs that can be handled directly by the kernel.
   * Can delegate RPC handling to optee_supplicant.c for RPCs that
     need userspace interaction.
2) drivers/misc/optee_supplicant.c
   * Enable communication between the userspace TEE supplicant and the
     kernel driver.

Additional changes were needed to the following files:
1) drivers/misc/optee.c
   * Add ioctls used SOLELY by the userspace TEE supplicant.
   * Register /dev/teepriv0 if the supplicant is enabled in Kconfig
   * Add OPTEE_ROLE_CA and OPTEE_ROLE_SUPPLICANT conditionals to
     differentiate paths, between a normal Client Application (CA)
     and the TEE supplicant.
   * Change some functions from static to "public" to reuse them
     in other C files.
   * Adjust optee_to/from_msg_param() to work with RPCs.

2) drivers/misc/optee_smc.c
   * Call the RPC handler from optee_rpc.c

3) drivers/misc/optee_msg.h
   * Add definition needed for RPCs

4) drivers/misc/tee.h
   * Add ioctl definitions
   * Add TEE_SHM_SUPP flag, checked when unregistering supplicant
     memory.

5) Documentation/guides/optee.rs
   * Add documentation for RPCs and the supplicant.

6) drivers/misc/{CMakeLists.txt, Make.defs}
   * Account for the new files.

7) drivers/misc/Kconfig
   * Add DEV_OPTEE_SUPPLICANT option to enable/disable the supplicant
     driver.

Signed-off-by: Theodore Karatapanis <tkaratapanis@census-labs.com>
2025-08-06 02:29:33 +08:00
Theodore Karatapanis
95ca3e7ca5 drivers/misc/optee: Add mmap shm op + remove memfd
The previous approach with memfd has 3 problems:
1) The close operation on the memfd isn't tied with optee_shm_close,
   therefore close(fd) doesn't free the optee_shm struct allocated
   by the kernel.

2) The kernel unnecessarily maps the file descriptor to its memory,
   however only userspace should need to do that.

3) Since the kernel doesn't need to map the file descriptor we
   don't need to unmap it.

To use anonymous mapping, the prototype of map_anonymous() was
moved from fs/mmap/fs_anonmap.h to include/nuttx/fs/fs.h. Since
fs_anonmap.h didn't contain any other information it is deleted.

A type from fs/mmap/fs_rammap.h was moved to the public :
include/nuttx/fs/fs.h as well.

Signed-off-by: Theodore Karatapanis <tkaratapanis@census-labs.com>
2025-08-06 02:29:33 +08:00
Laczen JMS
c506c25f19 drivers/mtd: introduce nvblk
NVBLK provides a block device that operates on top of a non volatile
memory (as a mtd device) that enables wear levelling for non volatile
memory. It's operation is similar to the dhara wear levelling library,
but nvblk is meant to be used on smaller (nor, mram, rram) memory.

I am also the author and maintainer of the nvblk library.

A block device can be created during startup by using:
```
nvblk_initialize(0, mtd, CONFIG_MTD_NVBLK_DEFAULT_LBS,
                         CONFIG_MTD_NVBLK_DEFAULT_IOBS,
                         CONFIG_MTD_NVBLK_DEFAULT_SPEB);
```
and a fat filesystem on top of this as:
```
nsh> mkfatfs /dev/mtdblock0
nsh> mount -t vfat /dev/mtdblock0 /mnt
```
this fat filesystem can then be used:
```
nsh> echo "test" > /mnt/test.txt
nsh> cat test.txt
test
nsh>
```

Signed-off-by: Laczen JMS <laczenjms@gmail.com>
2025-08-06 01:53:56 +08:00
wangjianyu3
508418917e drivers/sensor: Add flags for GNSS satellite
Some applications require satellite information for positioning using the flag USED_IN_FIX.

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2025-08-03 10:41:06 +08:00
lipengfei28
4fa6d4b791 drivers/pci: epc add dma heap
The PCI inbound address space and the CPU cache need to maintain cache coherence

Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2025-08-01 20:47:43 +08:00
ligd
1bfe705226 libc: fix assert "Free memory from the wrong heap" with flat mode and user separated heap enabled mode
In flat mode:
kernel code, like net driver...
strdup    -> nx_strdup -> kmm_malloc
lib_free  -> kmm_free

app code, like stdlib...
strdup -> malloc
free   -> free

Signed-off-by: ligd <liguiding1@xiaomi.com>
2025-07-28 16:04:03 -03:00
jingfei
c3e87dd3d1 drivers/fs: Control the behavior of FTL by passing oflags during the open process.
To save more space (equivalent to the size of one erase sector of
MTD device) and to achieve faster read and write speeds, a method
for direct writing was introduced at the FTL layer.
This can be accomplished simply by using the following oflags during
the open operation:

1. O_DIRECT. when this flag is passed in, ftl internally uses
   the direct write strategy and no read cache is used in ftl;
   otherwise, each write will be executed with the minimum
   granularity of flash erase sector size which means a
   "sector read back - erase sector - write sector" operation
   is performed by using a read cache buffer in heap.

2. O_SYNC. When this flag is passed in, we assume that the
   flash has been erased in advance and no erasure operation
   will be performed internally within ftl. O_SYNC will take
   effect only when both O_DIRECT and O_SYNC are passed in
   simultaneously.

3. For uniformity, we remapped the mount flag in mount.h and
   unified it with the open flag in fcntl.h. The repetitive
   parts of their definitions were reused, and the remaining
   part of the mount flag redefine to the unused bit of open
   flags.

Signed-off-by: jingfei <jingfei@xiaomi.com>
2025-07-16 14:11:41 +08:00
Alan Carvalho de Assis
54b2381c42 drivers/input: Create Single Button Multi Actions
This commit creates a sbutton device that uses a single button to
create a keyboard driver that returns TAB or ENTER depending how
long the user keeps the button pressed.

Signed-off-by: Alan C. Assis <acassis@gmail.com>
2025-07-15 18:39:59 -03:00
Daniel Byshkin
4030eb892e drivers/analog/ads1115.h: Add ioctl for conversion trigger
Since the ADS1115 has a relative slow conversion rate, this additional
ioctl command makes it possible to trigger a conversion before reading
the reading the conversion result, allowing the user to perform other
computation in between instead of waiting for the conversion time to
complete. It improves sampling time.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2025-07-14 10:22:33 -04:00
p-szafonimateusz
880c8e5d26 drivers/net: add IGB network card support
Some checks failed
Build Documentation / build-html (push) Has been cancelled
Add support for Intel IGB type of network cards.

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2025-07-08 10:02:15 +02:00
Elias Hawa
0ce9e82d73 drivers/sensors: add Quectel L86-XXX GNSS uORB sensor driver
Some checks failed
Build Documentation / build-html (push) Has been cancelled
2025-07-07 21:18:15 -03:00
Joshua Lange
d5eda10cad drivers/leds: Add support for KTD2052
This commit adds support for the KTD2052 LED driver chip.

Signed-off-by: Tyler Bennett <tbennett@2g-eng.com>
2025-07-07 09:49:51 -03:00
wangjianyu3
770d4a6c86 drivers/input/ft5x06: Adapt to touchscreen frame
Calling touch_register() to register touchscreen driver instead of
registering generic driver.

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2025-07-07 08:46:58 -03:00
wangjianyu3
ed1384fc81 driver/touchscreen: Add support for mirror/swap
Add support for mirror/swap coordinates.
There are some touchscreen drivers not support mirror or swap coordinates.
For example, drivers/input/ft5x06 does not support mirror.

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2025-07-07 08:46:58 -03:00
wangjianyu3
7cd5d3db72 include: fix typo of touch lowerhalf comment
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2025-07-07 08:46:58 -03:00
wangjianyu3
9f6666b75b driver/touchscreen: add custom open/close
Add custom open/close for lower to init/deinit device.

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2025-07-07 08:46:58 -03:00
wangmingrong1
3648e5db3f gcov: Refactoring the implementation framework of gcov
All implementations of gcov are sunk to the kernel implementation
1. Support three dump modes: serial port output, single file output, standard output

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-07-03 00:17:58 +08:00
wangmingrong1
0a71cbe542 fix kasan_bypss compile unused error
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-06-30 18:19:38 +08:00
buxiasen
c5bfc4d233 mm/kasan: fix wanring expression result unused
nuttx/mm/mm_heap/mm_malloc_size.c:77:16: error: expression result unused [-Werror,-Wunused-value]
  kasan_bypass(flag);
               ^~~~
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2025-06-30 18:19:38 +08:00
wangmingrong1
8f541d2ef2 mte/kasan: Implementing KASAN memory protection for ARM64 hardware MTE
1. Add hw_tags.c, which will call arm64_mte to implement tagging of memory blocks by operating registers
2. It has been able to run normally on the default NX memory allocator, excluding mempool and tlsf
3. On more complex configurations, memory tests such as memstress can run normally without system crashes

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-06-30 18:19:38 +08:00
wangmingrong1
448ace4761 kasan: fix realloc memcpy tags check error
When the size of the new realloc is larger than the old one and can be expanded forward and backward, the tag of oldmem needs to be set to the same as newmem, otherwise memcpy will report a kasan error.

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-06-30 18:19:38 +08:00
wangmingrong1
c6da553788 kasan: kasan_reset_tag rename kasan_clear_tag
The clear tag is more explicit than the reset tag.

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-06-30 18:19:38 +08:00
michal matias
c5a3089e87 drivers/net: Add support for the NCV7410 10BASE-T1S MAC-PHY
Some checks failed
Docker-Linux / push (push) Has been cancelled
This commit adds driver for the Onsemi NCV7410 10BASE-T1S
Ethernet MAC-PHY.

Signed-off-by: michal matias <mich4l.matias@gmail.com>
2025-06-28 08:49:46 -03:00
SPRESENSE
74d52767e9 drivers/sensors: Add a header file as a dependency
Add a dependent header file required to use cxd5602pwbimu.

Signed-off-by: SPRESENSE <41312067+SPRESENSE@users.noreply.github.com>
2025-06-27 21:45:02 +08:00
Xiang Xiao
4e4cd77fd1 libc: Change atomic_fetch_cxx to macro
to align with atomic64_fetch_cxx function prototype

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2025-06-26 23:47:10 +08:00
wangmingrong1
66260f81f4 UNUSED: UNUSED may be defined elsewhere.
Give priority to using macros defined by third-party libraries

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-06-26 20:31:19 +08:00
ouyangxiangzhen
42ebe289b0 spinlock: Remove atomic.h inclusion in spinlock_type.h
Since the spinlock_type.h is designed to avoid including atomic.h in
the userspace, we should remove `atomic.h` inclusion in spinlock_type.h.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-06-25 22:13:00 +08:00
ouyangxiangzhen
d9bbdeb6fe spinlock: Better recursive spinlock implementation.
This commit provided a better recursive spinlock implementation with
less memory-overhead and better performance.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-06-25 22:13:00 +08:00
ouyangxiangzhen
0717928b0e spinlock: Fix compilation error with atomic.h.
This commit fixed compilation error with atomic.h included.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-06-25 22:13:00 +08:00
Xiang Xiao
4b8a738141 libc/stream: Add support for lib_scanf
This commit adds support for the `lib_scanf` function, which
is a stream-oriented version of the `scanf` function.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2025-06-20 09:48:39 +08:00
Kerogit
a3f8b55143 drivers/serial/serial: prevent race conditions on 8-bit architectures
Some code paths in drivers/serial/serial.c load head and tail values
of receive and transmit circular buffers with interrupts enabled,
making it possible that the interrupt handler changes the value.
As noted in the code, this is safe as long as the load itself is atomic.

That is not true for 8bit architectures which fetch the 16-bit values
using two load instructions. If interrupt handler runs between those
two instructions and changes the value, the read returns corrupted data.

This patch introduces CONFIG_ARCH_LDST_16BIT_NOT_ATOMIC configuration
option which is automatically selected for AVR architecture. Based
on this option, head and tail values are reduced to 8-bit length
so the read remains atomic.

Patch was tested by building on rv-virt:nsh - disassembly of functions
from serial.c showed no difference which is correct as Risc-V does
not need to protect reads of these values. There should be no impact
for architectures that do not set the new configuration option.

It was also tested by by custom echo application running on AVR128DA28.

Signed-off-by: Kerogit <kr.git@kerogit.eu>
2025-06-19 10:01:24 -03:00
yangao1
c560db04a6 stream/fileoutstream: Add open interface for coredump
Signed-off-by: yangao1 <yangao1@xiaomi.com>
2025-06-17 20:58:13 +08:00
yangao1
47dd21c3c1 stream: Add fileinstream support
This commit introduces a new fileinstream implementation
in the NuttX stream library.

Signed-off-by: yangao1 <yangao1@xiaomi.com>
2025-06-17 20:58:13 +08:00