Commit Graph

6511 Commits

Author SHA1 Message Date
Huang Qi e09048cc88 style: Fix "is is" typo across the codebase.
Correct duplicate "is is" word found in 181 files throughout the
codebase.
In most cases "is is" was changed to "is", but in contexts like
"MCU is is sleep mode" it was corrected to "MCU in sleep mode".

Also fixes a "the the" typo in net/inet/inet_sockif.c.

This is a pure style/documentation fix that improves code readability.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2026-03-24 09:39:26 +08:00
Huang Qi e3eeaefd6d style: Fix "the the" typo across the codebase.
Fix 269 occurrences of duplicate "the" word typo found in 209 files
across source code, header files, and configuration.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2026-03-23 11:07:49 +01:00
Michal Lenc 600d0e413a ioexpander/iso1i813t: add option to check errors during read
This commit adds the possibility to check for expander errors when
reading the data. This is optional if glerr_check or interr_check
fields in configuration are not zero.

If not zero, read operation also reads ISO1I813T_GLERR and
ISO1I813T_INTERR register and returns error if there is some error.
The user can control which errors he wants to check with
glerr_check and interr_check masks.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2026-03-18 15:00:48 -03:00
Arjav Patel 10c75d2722 docs/sdio: clarify 136-bit R2 format
This update adds comprehensive documentation regarding the 136-bit response format for SDIO, including the structure of the response, CRC handling, and necessary byte-shifting for alignment. This information is crucial for developers implementing or maintaining SDIO drivers.

Signed-off-by: Arjav Patel <arjav1528@gmail.com>
2026-03-17 18:14:10 -03:00
wangjianyu3 fadfa85296 drivers/video: add GC0308 VGA CMOS image sensor driver
Add support for the GalaxyCore GC0308 VGA CMOS image sensor.
The driver implements the NuttX imgsensor interface and supports
VGA (640x480), QVGA (320x240), and QQVGA (160x120) resolutions
via Kconfig selection. Output format is RGB565X (big-endian).

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2026-03-16 17:26:27 -03:00
wangjianyu3 a07a6a00f4 video: add V4L2_PIX_FMT_RGB565X pixel format support
Add big-endian RGB565 (RGB565X) pixel format throughout the V4L2
video pipeline:
- IMGDATA_PIX_FMT_RGB565X in imgdata.h
- IMGSENSOR_PIX_FMT_RGB565X in imgsensor.h
- Format conversion and buffer size handling in v4l2_cap.c

This is needed by 8-bit DVP camera sensors that output RGB565 in
big-endian byte order (high byte first on the data bus).

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2026-03-16 17:26:27 -03:00
Chip L. 7bfd6ee33e wireless/cc1101: Add MSK/4-FSK, dynamic PATABLE ramping, and fix IOCTL safety
This commit overhauls the CC1101 RF driver to address physical hardware
constraints, prevent register wrap-around overflows, and support accurate
dBm power scaling via the standard IOCTL interface.

What this change does:
1. Adds WLIOC_MSK and WLIOC_4FSK modulation support in `ioctl.h` and driver.
2. Replaces static PATABLE initialization with a dynamic Ramp-up curve
   generator `cc1101_ioctl_apply_power()` based on lab calibration data.
3. Modifies WLIOC_SETTXPOWER and WLIOC_GETTXPOWER to process actual dBm
   values with a nearest-match algorithm instead of raw array indices.
4. Removes DEBUGASSERT on user-space IOCTL pointers and replaces them
   with strict -EFAULT checks.
5. Implements saturation clamping (e.g., mantissa to 256-511) to prevent
   bitrate and frequency deviation calculation overflows.
6. Rebuilds volatile PATABLE memory upon SLEEP mode wake-up.

Why it is necessary & what it fixes:
- Fixes severe OOK modulation distortion and FSK spectral splatter caused
  by statically assigned PATABLE indices.
- Fixes potential kernel panic in flat builds when IOCTL receives a NULL
  pointer from user space.
- Fixes register wrap-around (silent failures) when users pass
  out-of-bounds baud rate or FDEV values.
- Prevents RF silence after SLEEP mode due to PATABLE volatility.
- Resolves inaccurate power output when changing frequencies dynamically.

Impact:
Changes the behavior of CC1101 TX power and modulation IOCTLs to strictly
comply with standard `wlioc` definitions. Improves overall driver stability
and hardware safety.

Signed-off-by: Chip L. <chplee@gmail.com>
2026-03-11 16:05:19 +01:00
Chip L. 075215cd5b wireless/cc1101: migrate to wlioc_rx_hdr_s and add operation modes
This commit refactors the CC1101 driver's read interface to comply with
the standard NuttX wireless character driver API and introduces extended
hardware operation modes.

- Migrate `cc1101_file_read` to accept and populate the standard
  `struct wlioc_rx_hdr_s` instead of returning raw byte arrays.
- Implement `cc1101_calc_rssi_dbm_x100` to preserve the hardware's
  0.5 dBm RSSI precision when scaling to 1/100 dBm units, eliminating
  the integer truncation loss present in the legacy calculation.
- Add `CC1101IOC_SETOPMODE` and `CC1101IOC_GETOPMODE` IOCTLs.
- Introduce four RF operation modes (`enum cc1101_opmode_e`):
  1. NORMAL: Standard packet mode with hardware filtering.
  2. PROMISCUOUS: Packet mode bypassing address filtering and retaining
     packets with CRC errors.
  3. SYNC_SERIAL: Bypasses FIFO, routes clock and data to GDO0/GDO2.
  4. ASYNC_SERIAL: Bypasses FIFO, routes async data to GDO2.
- Fix the `GS2200M_FIRST` IOCTL block offset in `wireless/ioctl.h` and
  allocate a dedicated IOCTL block for CC1101.

Signed-off-by: Chip L. <chplee@gmail.com>
2026-03-11 02:25:50 +08:00
vrmay23 45651ea6e5 drivers/lcd: Refactor ST7796 to use Kconfig and add Power Management
Previously, the ST7796 driver required the board to pass a struct
st7796_config_s at initialization time, carrying display resolution,
color depth, orientation (MADCTL), BGR flag, SPI frequency, and
initial rotation.

All of these are chip-level properties, not board wiring details.
This created an awkward split: board code computed MADCTL values,
selected BPP, and derived effective resolution depending on orientation
(knowledge that belongs exclusively in the generic driver).

This commit removes that split entirely, following the same pattern used
by the ST7789 driver in drivers/lcd/Kconfig. It also implements the
getpower/setpower interface for standard framebuffer power management.

What was changed (per file):

drivers/lcd/Kconfig:
- Added a full 'if LCD_ST7796' ... 'endif # LCD_ST7796' block containing
  all chip-level configuration.
- Includes LCD_ST7796_XRES/YRES, LCD_ST7796_BPP, LCD_ST7796_FREQUENCY,
  LCD_ST7796_SPIMODE, LCD_ST7796_BGR, LCD_ST7796_INVCOLOR,
  and orientation/rotation choices.

drivers/lcd/st7796.c:
- Removed struct st7796_config_s from struct st7796_dev_s.
- Moved struct st7796_cmd_s from public header to Private Types.
- Added compile-time macros derived from Kconfig:
  ST7796_XRES/YRES (swapped for landscape),
  ST7796_MADCTL_BASE,
  ST7796_SPIMODE,
  ST7796_BYTESPP,
  ST7796_COLORFMT.

- Implemented st7796_getpower() and st7796_setpower() using the
  st7796_board_power() board callback.
- Registered power functions in st7796_fbinitialize() vtable.
- Updated st7796_init_display() to make INVON/INVOFF conditional on
  CONFIG_LCD_ST7796_INVCOLOR.
- Simplified st7796_fbinitialize() signature to only take
  'struct spi_dev_s *spi'.

include/nuttx/lcd/st7796.h:
- Removed legacy macros (ST7796_XRES_RAW, etc.) and configuration
  structures.
- Updated st7796_fbinitialize() prototype.
- Added st7796_board_power() callback prototype.
- Removed private implementation details from the public header.

boards/arm/stm32h7/nucleo-h753zi/Kconfig:
- Removed chip-level menus (settings, orientation) now handled by the
  generic driver.
- Retained only board-specific wiring concerns (pins and SPI bus).

boards/.../stm32_st7796.c:
- Removed g_st7796_config and associated board-side macros.
- Updated st7796_fbinitialize() call to the new signature.
- stm32_st7796_flush_fb() now queries effective resolution
  via g_fb_vtable->getvideoinfo().

Verified on nucleo-h753zi:
Orientation: Landscape (480x320),
Rotation: 180 deg,
BGR: enabled,
INVCOLOR: disabled,
BPP: RGB565,
Frequency: 40 MHz.
Making INVCOLOR a Kconfig option (default n) fixes cases where panels
previously showed inverted colors due to hardcoded INVON.

Signed-off-by: vrmay23 <vmay.sweden@gmail.com>
2026-03-08 15:46:52 -03:00
Arjav Patel e2f3950d45 libc: add support for C23 stdbit.h with bit manipulation macros
Build Documentation / build-html (push) Has been cancelled
- Introduced Kconfig options for stdbit.h, allowing architecture-specific and generic implementations.
- Added new documentation for stdbit.h, detailing its usage and configuration.
- Updated CMake and Makefile to handle the inclusion of stdbit.h based on configuration settings.

This enhances the NuttX library with optional C23 bit manipulation utilities, improving functionality for architectures that support it.

Signed-off-by: Arjav Patel <arjav1528@gmail.com>
2026-03-02 09:09:40 -03:00
chao an cfd1771981 serial/xlnx_ps: add common Xilinx UART Peripheral System (XUARTPS) support
This PR adds complete driver support for the Xilinx UART Peripheral System (XUARTPS)
in the NuttX serial driver framework. The implementation includes the core driver code
(uart_xlnx_ps.c), configuration files (Kconfig-xlnxps), header definitions (uart_xlnx_ps.h),
and integration with the existing NuttX build system (CMakeLists.txt, Make.defs, Kconfig).

The driver supports UART0 configuration with customizable parameters (base address,
clock frequency, IRQ number, baud rate, parity, data bits, stop bits), RX/TX buffer sizing,
hardware flow control (RTS/CTS), interrupt-driven data transfer, and console mapping for XUARTPS UART0.
It also provides standard serial driver operations (setup, shutdown, attach/detach, ioctl, send/receive)
and early serial initialization for boot-time console access.

Signed-off-by: chao an <anchao.archer@bytedance.com>
2026-02-27 08:14:03 -03:00
Yuran Wu 17bc7a36ce video/imgdata: fix IMGDATA_SET_BUF macro int-conversion warning
set_buf return type is not a pointer but an integer, this will cause -Wint-conversion error.

Signed-off-by: chao an <anchao.archer@bytedance.com>
2026-02-26 14:47:52 +01:00
wangchengdong 23d48da4bd sched/sched: add nxsched_abstick_sleep()
Add nxsched_abstick_sleep() and make nxsched_ticksleep()
a wrapper around it.

Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2026-02-26 17:04:47 +08:00
Maarten Zanders 65207ae1c5 serial/uart_rpmsg: add _raw version of driver
Mainline Linux doesn't use data encapsuation or flow control in its
tty_rpmsg driver. Create a NuttX counterpart which matches this
implementation.
This driver uses the static "rpmsg-tty" name to connect with the
remote service.

Signed-off-by: Maarten Zanders <maarten@zanders.be>
2026-02-23 09:19:57 -03:00
vrmay23 96a49bc7f7 drivers/lcd: Add ST7796 TFT LCD framebuffer driver
Add support for ST7796 TFT LCD controller (320x480). The driver
implements the NuttX framebuffer interface for SPI-connected displays.

Features:
- SPI interface with CONFIG_SPI_CMDDATA for D/C pin control;
- RGB565 (16-bit) and RGB666 (18-bit) color formats;
- Runtime rotation support (0, 90, 180, 270 degrees) via MADCTL;
- Board-provided configuration via st7796_config_s structure;
- Partial screen update via updatearea for efficient rendering;
- Persistent swap buffer to avoid per-frame allocations;
- Proper ST7796S initialization sequence with documented timing;

The driver uses a board-provided configuration structure allowing
flexible setup of resolution, SPI frequency, color depth, and
initial MADCTL value without requiring Kconfig options in the
generic driver.

Architecture changes in this revision as per request:

- Moved internal register commands to .c file (private)
- Moved MADCTL bit definitions to .c file (private)
- Moved struct st7796_cmd_s to .c file (private)
- Converted MADCTL orientation macros to absolute values
- Moved CONFIG_SPI_CMDDATA error check to beginning of file
- Removed duplicated CONFIG_SPI_CMDDATA guards
- Public header contains only board configuration API
- Changed the Kconfig auto-select FB from 'select' to 'depends on'

Tested with LVGL graphics library on STM32H753ZI board (my own port).

Signed-off-by: Vinicius May <vmay.sweden@gmail.com>
2026-02-19 09:19:13 -03:00
Felipe Moura ef71625ede input: add keyboard matrix driver
Add a generic kmatrix lower-half with polling/debounce, STM32 board adapters, Kconfig options, a public API header, and a test example/documentation.

Signed-off-by: Felipe Moura <moura.fmo@gmail.com>

decouple kbd / keypad.

Fix some comments

add documentation

fix rule issues

Update CMakeLists.txt

update documentation.

improve documentation
2026-02-10 08:15:01 -03:00
yangyalei 854cd0ca21 nuttx/audio: clear apb buffer when playback dequeue
memset apb buffer to zero when dequeue

Signed-off-by: yangyalei <yangyalei@xiaomi.com>
2026-02-05 08:22:18 -03:00
yangyalei 928b9368b4 nuttx/audio: Add compress audio macros
add compress audio macors and some subfmt

Signed-off-by: yangyalei <yangyalei@xiaomi.com>
2026-02-05 08:22:18 -03:00
yangyalei 8db9865a03 nuttx/audio: Add AUDIOIOC_RESETSTATUS ioctl
use AUDIOIOC_RESETSTATUS to reset application pointer

Signed-off-by: yangyalei <yangyalei@xiaomi.com>
2026-02-05 08:22:18 -03:00
yangyalei f8ab192285 nuttx/audio: Update app write head in enqueuebuffer
update aplication pointer in enqueuebuffer

Signed-off-by: yangyalei <yangyalei@xiaomi.com>
2026-02-05 08:22:18 -03:00
yangyalei d85c4db932 nuttx/audio: Add Hardware pointer
Add Hw pointer recored apb buffer read/write position

Signed-off-by: yangyalei <yangyalei@xiaomi.com>
2026-02-05 08:22:18 -03:00
yangyalei 2cc624a4c4 nuttx/audio: add AUDIOIOC_GETSTATE ioctl
support get lower driver state

Signed-off-by: yangyalei <yangyalei@xiaomi.com>
2026-02-05 08:22:18 -03:00
yangyalei 0af7c985b4 nuttx/audio: add AUDIOIOC_GETAUDIOINFO ioctl
use AUDIOIOC_GETAUDIOINFO get current audio format

Signed-off-by: yangyalei <yangyalei@xiaomi.com>
2026-02-05 08:22:18 -03:00
Bowen Wang 877a9af2d1 rpmsg_virtio/rptun: support fallback cpuname when VIRTIO_RPMSG_F_CPUNAME not set
When the VIRTIO_RPMSG_F_CPUNAME feature is not negotiated, the driver
previously would crash due to DEBUGASSERT. This commit adds support
for a fallback mechanism:

1. Add rpmsg_virtio_probe_cpuname() API that accepts an optional cpuname
   parameter to be used when VIRTIO_RPMSG_F_CPUNAME is not available.

2. Modify rptun driver to pass the cpuname from rptun device config
   to rpmsg_virtio_probe_cpuname().

3. Refactor rptun device register/unregister to prioritize RPMSG device
   handling before other virtio device types.

This ensures the system works correctly in scenarios where the remote
side does not support the VIRTIO_RPMSG_F_CPUNAME feature.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-02-04 20:01:13 -03:00
Bowen Wang 8d6eaae3d7 include/nuttx/virtio: allow common virtio helpers to be used by vhost
Move common virtio inline functions (virtqueue_kick_lock, virtio_malloc_buf,
virtio_zalloc_buf, etc.) from CONFIG_DRIVERS_VIRTIO guard to CONFIG_OPENAMP
guard. This allows vhost drivers to reuse these helper functions without
requiring the full virtio driver framework.

The virtio_driver structure and driver registration APIs remain under
CONFIG_DRIVERS_VIRTIO as they are specific to virtio device drivers.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-02-04 02:32:02 +08:00
Bowen Wang 2fc2f44b61 drivers/vhost: add vhost_get_vq_buffers() to collect scatter-gather buffers
Add vhost_get_vq_buffers() API to retrieve all chained buffers from a
virtqueue in one call. This simplifies handling of scatter-gather I/O
where data spans multiple descriptors.

The function populates an array of virtqueue_buf structures with buffer
pointers and lengths, returning the descriptor head index on success.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Signed-off-by: hongfengchen <hongfengchen@xiaomi.com>
2026-02-04 02:32:02 +08:00
Yongrong Wang 5051007bfa drivers/vhost: add vhost helper macros for feature and config access
Add vhost wrapper macros that map to the corresponding virtio helper
functions:
- vhost_has_feature: check if a feature is supported
- vhost_read_config_member: read a config structure member
- vhost_write_config_member: write a config structure member

Also include virtio-config.h header to support these macros.

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
2026-02-04 02:32:02 +08:00
fangxinyong a724a5f4f4 sched/cancelpt: Fix MISRA C 2012 Rule 10.4 violations
Fix violations of MISRA C:2012 Rule 10.4 (operand of unsigned and signed)
in cancellation point handling code.

Changed all CANCEL_FLAG_* macro definitions and their usage to use unsigned
literals (1u instead of 1) to ensure consistent unsigned arithmetic when
performing bitwise operations. This eliminates mixed signed/unsigned operand
violations in:

- CANCEL_FLAG_NONCANCELABLE
- CANCEL_FLAG_CANCEL_ASYNC
- CANCEL_FLAG_CANCEL_PENDING

The changes affect cancellation point entry/exit logic, cancellation state
management, and cancellation type handling across both kernel and libc
implementations.

Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2026-02-02 21:09:40 +08:00
ouyangxiangzhen dac48484ce sched/hrtimer: Update the comments.
This commit updated the comments.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2026-02-02 13:26:22 +08:00
ouyangxiangzhen ada6d14672 sched/hrtimer: Simplify the rbtree.
This commit simplified the rbtree in hrtimer and provided better
branchless compare function.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2026-02-02 13:26:22 +08:00
ouyangxiangzhen 7b67055150 sched/hrtimer: inline hrtimer_start.
This commit inlined the `hrtimer_start` to allow the compiler to optimize at least 1 branch in
hrtimer_start.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2026-02-02 13:26:22 +08:00
hujun5 5db4278173 protect: move us_heap to userspace_data_s
Refactor heap pointer storage by moving us_heap field from userspace_s
to the nested userspace_data_s structure, enabling future extensibility
of user-space data without modifying the core userspace_s interface across
all board-specific implementations.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-02-02 11:06:53 +08:00
liaoao 198a8fe108 drivers/rpmsg: add rpmsg_get_timestamp to retrieve buffer timestamps
Add rpmsg_get_timestamp() API to get the TX/RX timestamps of an rpmsg
buffer. This is useful for latency measurement and debugging purposes.

The new rpmsg_timestamp_s structure contains:
  - tx_nsec: timestamp when the buffer was transmitted
  - rx_nsec: timestamp when the buffer was received

Signed-off-by: liaoao <liaoao@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-02-01 01:14:49 +08:00
hujun5 0d25df7663 sched: fix code style violations in clock conversion macros (MISRA C-2012)
Add explicit type casts to uint32_t for time conversion macro divisors to
comply with MISRA C-2012 Rules 10.1, 10.3, 11.1, 11.3, and 11.4. This fixes
Coverity warnings and improves type safety in clock_time2ticks_floor and related
time conversion operations.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-02-01 01:14:01 +08:00
Bowen Wang fe5cf5b03e nuttx/clock.h: add USEC2MSEC macro for microsecond to millisecond conversion
Add USEC2MSEC macro to provide a convenient and consistent interface for
converting microseconds to milliseconds, complementing the existing SEC, USEC,
and NSEC conversion macros and improving code readability.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-02-01 01:14:01 +08:00
Bowen Wang 129955eb14 virtio/virtio-config: add virtio_read_config_bytes() api
Follow the virtio spec:
For the device-specific configuration space, the driver MUST use 8
bit wide accesses for 8 bit wide fields, 16 bit wide and aligned
accesses for 16 bit wide fields and 32 bit wide and aligned accesses
for 32 and 64 bit wide fields.

For a string in the virtio config space, we should should byte to
byte read operations to read this string, so add a api
virtio_read_config_bytes() for this.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-01-30 08:11:57 -03:00
yukangzhi 31b0d79b44 libs/crc: implement AUTOSAR-compatible CRC algorithm
This patch adds an AUTOSAR-style CRC library used by E2E functionality.
It introduces multiple CRC variants (CRC8, CRC16, CRC32, CRC64) and the
corresponding public headers and implementation files.

Key changes:
- Public headers: `include/nuttx/crc8.h`, `include/nuttx/crc16.h`,
  `include/nuttx/crc32.h`, `include/nuttx/crc64.h` with new APIs for
  specific polynomial variants and incremental (part) helpers.
- Implementations added under `libs/libc/misc/` for several polynomials:
  - `lib_crc16h1021.c` (CRC-16 CCITT-FALSE)
  - `lib_crc16h8005.c`
  - `lib_crc32h04c11db7.c`
  - `lib_crc32hf4acfb13.c`
  - `lib_crc64emac.c`
  - `lib_crc8h1d.c`
  - `lib_crc8h2f.c`
- Build files updated to include the new sources.

This addition provides low-level CRC primitives required by higher-level
protocols and test suites.

Signed-off-by: yukangzhi <yukangzhi@xiaomi.com>
2026-01-30 17:32:15 +08:00
dongjiuzhu1 3c486b98dd fs/timerfd: implement TFD_TIMER_CANCEL_ON_SET to detect clock changes
Implement Linux-compatible TFD_TIMER_CANCEL_ON_SET flag for timerfd to
allow applications to detect discontinuous changes to CLOCK_REALTIME.

Background:
According to Linux timerfd_create(2) man page, when a timerfd is created
with CLOCK_REALTIME and TFD_TIMER_CANCEL_ON_SET flag is specified, the
read() operation should fail with ECANCELED if the real-time clock
undergoes a discontinuous change. This allows applications to detect
and respond to system time changes.

Implementation:
1. Add clock notifier infrastructure (clock_notifier.h/c) to notify
   interested parties when system time changes
2. Implement TFD_TIMER_CANCEL_ON_SET flag support in timerfd
3. Register timerfd with clock notifier when flag is set
4. Cancel timer and return ECANCELED when clock change is detected
5. Notify clock changes in:
   - clock_settime()
   - clock_initialize()
   - clock_timekeeping_set_wall_time()
   - rpmsg_rtc time synchronization

Changes include:
- New files: include/nuttx/clock_notifier.h, sched/clock/clock_notifier.c
- Modified: fs/vfs/fs_timerfd.c to handle TFD_TIMER_CANCEL_ON_SET
- Modified: clock subsystem to call notifier chain on time changes
- Modified: rpmsg_rtc to notify time changes during sync

Use case example:
Applications using timerfd with absolute time can now detect when
system time is adjusted (e.g., NTP sync, manual time change) and
take appropriate action such as recalculating timeouts or updating
scheduled events.

Reference: https://man7.org/linux/man-pages/man2/timerfd_create.2.html

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-01-30 17:20:24 +08:00
lipengfei28 6526f2371a drivers/pci:write legacy num to config space when enable legacy irq
write legacy num to config sapce when enable legacy irq

Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2026-01-30 12:50:42 +08:00
xucheng5 500768c38b timer: add timer wdog
Add timer implemented by watchdog functionality.

Signed-off-by: xucheng5 <xucheng5@xiaomi.com>
2026-01-29 09:25:07 -03:00
chenzihan1 18731b509e drivers/sensors: add sensor monitor log.
debug patch to monitor some sensor topic.

Signed-off-by: chenzihan1 <chenzihan1@xiaomi.com>
2026-01-29 18:30:38 +08:00
hujun5 2df1ecca3c semaphore.h: fix ubsan error
Replace left-shift of 1 by 31 bits with direct hexadecimal constant
to eliminate undefined behavior warning when left-shifting signed values
beyond their bit width on platforms with strict sanitizer checking.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-28 12:45:11 -03:00
dongjiuzhu1 afaaa7b8cb include/notifier: fix undefined reference to spin_lock_irqsave_nopreempt
Fix linker error caused by including spinlock_type.h instead of
spinlock.h in notifier.h header file.

Error message:
  undefined reference to 'spin_lock_irqsave_nopreempt'
  in .text.clock_changed_notifier_call_chain

Root cause:
The notifier.h header was including <nuttx/spinlock_type.h> which only
provides type definitions, but the inline functions in notifier.h use
spinlock functions like spin_lock_irqsave_nopreempt(). These functions
are defined in <nuttx/spinlock.h>, not in spinlock_type.h.

Solution:
Change the include from <nuttx/spinlock_type.h> to <nuttx/spinlock.h>
to get both the type definitions and the function implementations.

This fixes the undefined reference error when using notifier chains
with spinlock protection.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-01-28 23:37:32 +08:00
pangzhen1 7b154402fb sched/irq: Consolidate IRQ bounds checking into IRQ_TO_NDX macro
Previously, IRQ bounds checking (irq >= 0 && irq < NR_IRQS) was duplicated
across multiple IRQ subsystem functions before calling IRQ_TO_NDX(). This
led to code duplication and inconsistency.

This patch consolidates all IRQ bounds checking into the IRQ_TO_NDX() macro
itself, which now returns -EINVAL for out-of-bounds IRQ numbers. This approach:

1. Eliminates duplicated bounds checking code
2. Ensures consistent error handling across all IRQ functions
3. Simplifies caller code - just check if IRQ_TO_NDX() returns negative
4. Makes the macro behavior more predictable and self-contained

Changes:
- Modified IRQ_TO_NDX() to check (irq < 0 || irq >= NR_IRQS) and return -EINVAL
- Removed redundant IRQ range checks in irq_attach(), irq_attach_thread(),
  irq_attach_wqueue(), and irqchain_detach()
- Simplified error handling to check ndx < 0 after IRQ_TO_NDX() call

This consolidation reduces code size and improves maintainability while
preserving all existing error checking functionality.

Signed-off-by: pangzhen1 <pangzhen1@xiaomi.com>
2026-01-28 13:35:30 +08:00
wangzhi16 30493d558a sched/spinlock: Add time statistics in func enter_critical_section().
Because enter_critical_section() changes from calling spin_lock() to calling spin_lock_wo_note(), it is necessary to count the busywait time in enter_critical_section() additionally.

Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2026-01-27 21:59:14 +08:00
wangzhi16 3116c19efc sched/spinlock: Add configuration to record busywait.
Add configuration "CONFIG_SCHED_CRITMONITOR_MAXTIME_BUSYWAIT", which can record the busy waiting time to get spinlock or enter critical section.

Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2026-01-27 21:59:14 +08:00
yukangzhi dea1bc1121 note: add NOTE_DUMP_BINARY support for binary log dumping
Add NOTE_DUMP_BINARY to the note_type_e enum and implement its handling
in noteram_dump_one. This enables the recording and dumping of binary
logs in hexadecimal format, improving traceability for binary event data.

Signed-off-by: yukangzhi <yukangzhi@xiaomi.com>
2026-01-27 21:56:03 +08:00
ganjing af3d5e2212 fs/procfs: Add mallinfo and memdump callback to procfs_meminfo_entry_s
so the implementation can do the customized action through hook

Signed-off-by: ganjing <ganjing@xiaomi.com>
2026-01-27 21:27:53 +08:00
ganjing e8bbf496ee mm: Call mm_free_delaylist in mm_mallinfo
and remove it from meminfo_read to enuse caller
always get get accuracy memory information.

Signed-off-by: ganjing <ganjing@xiaomi.com>
2026-01-27 21:27:53 +08:00
hujun5 5775037da6 coverity: Prevent cross-border access(OVERRUN)
Add defensive bounds validation before memory access operations to
prevent out-of-bounds access. This addresses Coverity OVERRUN defect
by ensuring array indices and buffer sizes stay within valid range.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2026-01-27 21:22:30 +08:00