Commit graph

7762 commits

Author SHA1 Message Date
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
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 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
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
buxiasen
379f246625 mtdstream: use mtdsostream to support seek
Decrease memory cost, flush should not be called too frequency, for not
bytewrite mtd, will cause not able to write again in same block.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2025-06-17 20:58:13 +08:00
Matteo Golin
4ccc3d4c96 drivers/syslog: Add RFC 5424 protocol support
Initial implementation of RFC 5424 support (syslog protocol). Allows
users to force-format the syslog output in a RFC 5424 compatible way,
making NuttX systems 'originators' that are able to interface with
syslog 'collectors' and 'relays' (useful for logging to syslog servers).

In addition to regular formatting options for syslog output, users can
also add structured data (currently only timeQuality is implemented,
assuming no sync and no timezone is no known). Facilities and severities
now also follow RFC 5424. Support for additional features (like
more sdata elements, msgid, etc.) will need to be built into the syslog
implementation if desired.
2025-06-13 20:26:57 +08:00
Ville Juven
b8e30b54ec fs/vfs: Separate file descriptors from file descriptions
This patch is a rework of the NuttX file descriptor implementation. The
goal is two-fold:

1. Improve POSIX compliance. The old implementation tied file description
to inode only, not the file struct. POSIX however dictates otherwise.
2. Fix a bug with descriptor duplication (dup2() and dup3()). There is
an existing race condition with this POSIX API that currently results
in a kernel side crash.

The crash occurs when a partially open / closed file descriptor is
duplicated. The reason for the crash is that even if the descriptor is
closed, the file might still be in use by the kernel (due to e.g. ongoing
write to file). The open file data is changed by file_dup3() and this
causes a crash in the device / drivers themselves as they lose access to
the inode and private data.

The fix is done by separating struct file into file and file descriptor
structs. The file struct can live on even if the descriptor is closed,
fixing the crash. This also fixes the POSIX issue, as two descriptors
can now point to the same file.

Signed-off-by: Ville Juven <ville.juven@unikie.com>
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2025-06-12 18:12:42 +08:00
dongjiuzhu1
a12d21e830 fs/file: unify prefix about file_xxx api, like file_open, file_ioctl
old:
fs_getfilep, fs_putfilep, fs_reffilep
new:
file_get, file_put, file_ref

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2025-06-12 18:12:42 +08:00
dongjiuzhu1
9ca5c1d9c6 fs/file: unify prefix f_ for member locked
update locked to f_locked

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2025-06-12 18:12:42 +08:00
dongjiuzhu1
3bc3092e6a fs/fs: remove unnecessary FS_REFCOUNT config
Previously, this config was added to ensure that the size of the struct
file remained unchanged, thereby preventing the Flash memory of
resource-constrained MCUs from being unnecessarily increased.

However, we have now refactored the relationship between struct fd and struct file,
reducing their memory footprint in both Flash and RAM.
Consequently, this config can be removed.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2025-06-12 18:12:42 +08:00
Ville Juven
1e787ea280 nuttx/fs: Reorganize the code for close, dup, et. al.
Currently the code is dumped into one massive file; fs_files. Move the
different logical parts into their own files.

Signed-off-by: Ville Juven <ville.juven@unikie.com>
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2025-06-12 18:12:42 +08:00
Ville Juven
840ae60b60 nuttx/spinlock: Define empty macro for spin_unlock
So that the same code can be used with and without spinlocks.

Signed-off-by: Ville Juven <ville.juven@unikie.com>
Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2025-06-11 23:39:21 +08:00
ouyangxiangzhen
19eac98526 sched: Add comments for wd_start_next and work_queue_next.
This commit added comments for newly added APIs wd_start_next and
work_queue_next.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-06-10 11:02:45 -03:00
ouyangxiangzhen
df183b6682 sched/wqueue: Remove the work_queue_period.
For simplicity, better performance and lower memory-overhead, this commit replaced the periodical workqueue APIs with the more expressive work_queue_next. The work_queue_next restarts work based on the last expiration time.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-06-10 11:02:45 -03:00
ouyangxiangzhen
9d1b958524 sched/wdog: Remove the wd_start_period.
For better simplicity, this commit replaced the periodical wdog APIs with the more expressive wd_start_next. The wd_start_next restarts watchdog timer based on the last expiration time.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-06-10 11:02:45 -03:00
buxiasen
0b3cd35360 sched/spinlock: add recursive support(rspinlock_s) for spinlock
For drivers implement those possible recusive, native spinlock
will cause deadlock directly, critial_section is use globally,
will make lock parallel to serial, add API to keep recursive
support but isolate each other.

For race condition, we may get cpuid in stack and then thread moved
to other cpu. So we have to get cpuid with irq disabled.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2025-06-06 09:48:17 +08:00
buxiasen
225d6fb0a7 spinlock: add dummy compatible when CONFIG_SPINLOCK not enabled
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2025-06-06 09:48:17 +08:00
hujun5
907d77a056 spinlock: add spin_lock_irqsave_nopreempt/spin_unlock_irqrestore_nopreempt
reason:
By using these interfaces, the following usage can be replaced.
flags = spin_lock_irqsave(lock);
sched_lock();
.....
spin_unlock_irqrestore(lock, flags);
sched_unlock();

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2025-06-06 09:48:17 +08:00
George Poulios
67c7a4018a arm64/imx9: Support & configure RGMII-ID on RTL8211F
For the RTL8211F PHY, configuration of RX/TXDLY was missing.
At least on my i.MX93 EVK, this is necessary for transmission
to work (RXDLY defaults to true on the PHY).

This commit brings support for RGMII internal delay configuration
(on or off for both directions) and enables it on the i.MX93 EVK
board. The introduced Kconfig is set to default to 'n', to avoid
breaking the functionality of other, out-of-tree boards based on
i.MX93, running the RTL8211F PHY, or to avoid introducing
unnecessary code on boards running other PHYs.

Configuration of internal delay on other PHYs is not
implemented, and results in a warning (but no error).

Signed-off-by: George Poulios <gpoulios@census-labs.com>
2025-06-05 08:58:24 +02:00
raiden00pl
302ceb701b include: fix Private Types banners
unify Private Types banners according to NuttX coding standard

Signed-off-by: raiden00pl <raiden00@railab.me>
2025-05-28 10:17:15 +08:00
ouyangxiangzhen
947856efe0 sched/wdog: Add max delay tick limitation.
This commit changed the type of the delay ticks to the unsigned, which can reduce the useless branch conditions
Besides, this commit added max delay tick limitation to fix incorrect timing behavior if we delay SCLOCK_MAX in the SMP build.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-05-27 12:10:39 +02:00
ouyangxiangzhen
fce40edb6b sched/wqueue: Add max delay tick limitation.
This commit added max delay tick limitation for the workqueue.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-05-27 12:10:39 +02:00
wangzhi16
35a62b7d5e Revert "Reduce the size of tcb by four bytes."
This reverts commit 893c5e92c2.
2025-05-27 16:30:35 +08:00
dongjiuzhu1
4f57ebce66 fs/poll: remove poll_fdsetup
Allow users to operate poll in the kernel using the file_poll
approach, as file is protected with reference counting,
making it more secure.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2025-05-26 18:49:45 +08:00
Lars Kruse
3ce85ca54e style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
raiden00pl
3a31da9585 sensors: add support for BME688 sensor
Add support for BME688 sensor based on BME680 implementation.
The BME688 is nearly identical to the BME680, and this implementation
reuses much of the existing BME680 code. However, there are some differences
related to gas measurements that make it impractical to use the same driver
without significantly complicating it. BME688 also supports parallel mode
which isn't yet supported.

Signed-off-by: raiden00pl <raiden00@railab.me>
2025-05-17 12:16:54 +08:00
p-szafonimateusz
fab4f68b6f drivers/usbhost: add xHCI support
add xHCI PCI driver (usbhost).

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2025-05-15 21:58:57 +08:00