460 Commits

Author SHA1 Message Date
Matteo Golin 48db502daf !boards: Remove NSH_ARCHINIT and board_app_initialize
BREAKING: In an effort to simplify NuttX initialization, NSH_ARCHINIT is
removed. board_app_initialize is also removed. BOARD_LATE_INITIALIZE now
performs all board initialization logic, and is by default enabled. All
references to these symbols are removed. BOARDIOC_INIT remains, but will
result in -ENOTTY when called. It is to be removed in a later commit.

Quick fix: Boards relying on NSH_ARCHINIT should now enable
CONFIG_BOARD_LATE_INITIALIZE instead. If the application needs
fine-grained control over board initialization from userspace, the logic
performed by BOARDIOC_INIT may be copied to the board_finalinitialize
function and used instead via BOARDIOC_FINALINIT. All
board_app_initialize logic provided by NuttX is now moved to
board_late_initialize, and the same should be done for out-of-tree
boards.

Signed-off-by: Matteo Golin <matteo.golin@gmail.com>
2026-05-02 18:36:46 +08:00
Piyush Patle 0dccc8ba21 include/debug.h: Move to include/nuttx/debug.h
debug.h is a NuttX-specific, non-POSIX header. Placing it in the
top-level include/ directory creates naming conflicts with external
projects that define their own debug.h.
This commit moves the canonical header to include/nuttx/debug.h,
following the NuttX convention for non-POSIX/non-standard headers,
and updates all in-tree references.

A backward-compatibility shim is left at include/debug.h that
emits a deprecation #warning and re-includes <nuttx/debug.h>,
allowing out-of-tree code to continue building while migrating.

Signed-off-by: Piyush Patle <piyushpatle228@gmail.com>
2026-04-07 07:50:06 -03: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
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
wangchengdong 317a39a3e9 drivers/lcd: remove nxsig_notification when signal support is disabled
When all signals are disabled, nxsig_notification is not available and
should not be invoked. Remove the call to avoid build and runtime issues
in no-signal configurations.

Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2026-02-26 20:03:05 +08: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
Jiri Vlasak 65f8053305 lcd/ili9341: Improve putrun's checks
Improve checks for the position outside of the LCD's area. Fix the input
when possible.

Slightly improve the documentation.

Signed-off-by: Jiri Vlasak <jvlasak@elektroline.cz>
2026-02-06 14:15:36 -03:00
Jiri Vlasak 702e45155a lcd/ili9341: Improve initialization
Build Documentation / build-html (push) Has been cancelled
- Re-select LCD after soft reset during init. It looks that (soft) reset
  affects SPI communication.

- Clear display during the initialization.

Signed-off-by: Jiri Vlasak <jvlasak@elektroline.cz>
2025-12-10 23:54:44 +08:00
Jiri Vlasak 908ce01386 lcd/lcddrv: Implement 3-wire 9-bit SPI
Some display drivers, like ILI9341, support 3-wire 9-bit SPI. In
contrast to 4-wire 8-bit SPI, which uses dedicated CMD/DATA pin to
distinguish between CMD and DATA, 3-wire 9-bit SPI uses MSB of 9-bit
frame for this purpose.

Signed-off-by: Jiri Vlasak <jvlasak@elektroline.cz>
2025-12-10 23:54:44 +08:00
Jiri Vlasak 3a4b53b37c lcd/ili9341: Add config option for BGR
Display's BGR mode should not depend on the endianness.

Signed-off-by: Jiri Vlasak <jvlasak@elektroline.cz>
2025-12-10 23:54:44 +08:00
Jiri Vlasak c8ab1e3919 lcd/lcddrv: Fix warnings
- Log received param's value.
- uint32_t should be %lu in printf.

Signed-off-by: Jiri Vlasak <jvlasak@elektroline.cz>
2025-12-10 23:54:44 +08:00
Michal Lenc bf391cc2bc drivers/lcd/st7789.c: fix byte order in st7789_fill for 3 wires
The bytes of color should be sent in an opposite order in st7789_fill
function if the driver operates in 3 wire mode.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2025-12-03 14:36:46 +01:00
chao an 87f134cfaa sched/sleep: replace all Signal-based sleep implement to Scheduled sleep
Nuttx currently has 2 types of sleep interfaces:

1. Signal-scheduled sleep: nxsig_sleep() / nxsig_usleep() / nxsig_nanosleep()
Weaknesses:
a. Signal-dependent: The signal-scheduled sleep method is bound to the signal framework, while some driver sleep operations do not depend on signals.
b. Timespec conversion: Signal-scheduled sleep involves timespec conversion, which has a significant impact on performance.

2. Busy sleep: up_mdelay() / up_udelay()
Weaknesses:
a. Does not actively trigger scheduling, occupy the CPU loading.

3. New interfaces: Scheduled sleep: nxsched_sleep() / nxsched_usleep() / nxsched_msleep() / nxsched_ticksleep()
Strengths:
a. Does not depend on the signal framework.
b. Tick-based, without additional computational overhead.

Currently, the Nuttx driver framework extensively uses nxsig_* interfaces. However, the driver does not need to rely on signals or timespec conversion.
Therefore, a new set of APIs is added to reduce dependencies on other modules.

(This PR also aims to make signals optional, further reducing the code size of Nuttx.)

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-10-17 14:05:02 +08:00
Alan Carvalho de Assis 934b7b4bf5 drivers/lcd/st7735: Don't define st7735_rdram if write only mode
Signed-off-by: Alan C. Assis <acassis@gmail.com>
2025-07-29 08:18:30 -03:00
raiden00pl 98e2267297 drivers: unify 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
Lars Kruse 3ce85ca54e style: fix spelling in code comments and strings 2025-05-23 10:48:41 +08:00
Serg Podtynnyi 9566b2b908 drivers/lcd/ili9341: Add custom width/height display options
Add ability to set custom height/width for each two lcd ifaces

Signed-off-by: Serg Podtynnyi <serg@podtynnyi.com>
2025-04-27 08:37:54 -03:00
wangjianyu3 38652e19aa drivers/lcd/st7789: Support mirror V
Mirror X and V can rotate the screen 90 degrees.

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2025-04-02 09:51:32 +08:00
wangjianyu3 c5afcd78f1 drivers/lcd/st7789: Send RAMCTRL if little endian
Send RAMCTRL command only when RGB data in little endian.

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2025-04-02 01:03:48 +08:00
wangjianyu3 f42b784349 drivers/lcd/st7789: Add option for RGB data endian
Big endian by default.

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2025-03-31 10:06:45 -03:00
Michal Lenc 66f464936a drivers/lcd/st7789: add option for SPI delay control
It is now possible to configure SPI delays for st7789 controller if
CONFIG_SPI_DELAY_CONTROL is set. Default values for SPI peripheral
may be too long or too short, therefore the display controller set
its own values as required. The default values in configuration
are taken from the reference manual, but it is possible they may
require tuning for different revisions or temperatures for
example.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2025-03-05 09:18:56 +01:00
Michal Lenc 425ddc7f72 lcd/st7789: fix incorrect buffer count for 3 wire RAM write
If st7789_wrram is called with count = 1, then the entire buffer should
be sent. However, in 3 wire mode, the driver has to send the buffer
row by row because of additional data flag. The number of rows (count)
can't be ST7789_YRES in this case, but only the number of rows in
the buffer (this is write size / row size , where row size is
ST7789_XRES * ST7789_BYTESPP). This also applies only if we want to
write size larger than row size, because st7789_putrun allows to
write just a part of a row.

This fixes the incorrect behavior of the display in 3 wire mode if
the display is split into more buffer writes (as in LCD driver for
example, FB driver did not face this issue).

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
Co-authored-by: Martin Krasula <krasula@atlas.cz>
2025-02-24 09:51:13 +01:00
Michal Lenc a8d4ed910d st7789: add configuration option to set default background color
ST7789 fills the display with 0xffff color during its initialization.
This color may or may not be overwritten by a higher layer (framebuffer
or lcd driver for example). The color remains on the display until
application UI is started if not overwritten by the higher layer before.

This commit adds configuration option LCD_ST7789_DEFAULT_COLOR that
allows to set the default background color. This may avoid shining
display with, for example, white color for an extensive amount of time.
The default value is set to 0xffff previously hard-coded in the driver,
therefore current implementations will not notice the change.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2024-11-29 18:32:22 +08:00
YAMAMOTO Takashi 7ebe59022c Remove "dumprun" functions from various LCD drivers
* It seems that they assume up_putc() and syslog() outputs to the
  same device. Depending on the system and configurations, it's wrong.

* They are wrapped with "#if 0" and unused.

Fixes https://github.com/apache/nuttx/issues/14694
2024-11-12 17:25:31 +08:00
Alin Jerpelea 286d37026c drivers: migrate to SPDX identifier
Most tools used for compliance and SBOM generation use SPDX identifiers
This change brings us a step closer to an easy SBOM generation.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2024-11-06 18:02:25 +08:00
ouyangxiangzhen 17c51c0667 userspace: Exclude nuttx/arch.h
This patch fixed userspace headers conflict. Architecture-related definition and API should not be exposed to users.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2024-11-01 16:59:37 +08:00
YAMAMOTO Takashi 761ee81956 move readv/writev to the kernel
currently, nuttx implements readv/writev on the top of read/write.
while it might work for the simplest cases, it's broken by design.
for example, it's impossible to make it work correctly for files
which need to preserve data boundaries without allocating a single
contiguous buffer. (udp socket, some character devices, etc)

this change is a start of the migration to a better design.
that is, implement read/write on the top of readv/writev.

to avoid a single huge change, following things will NOT be done in
this commit:

* fix actual bugs caused by the original readv-based-on-read design.
  (cf. https://github.com/apache/nuttx/pull/12674)

* adapt filesystems/drivers to actually benefit from the new interface.
  (except a few trivial examples)

* eventually retire the old interface.

* retire read/write syscalls. implement them in libc instead.

* pread/pwrite/preadv/pwritev (except the introduction of struct uio,
  which is a preparation to back these variations with the new
  interface.)
2024-10-30 17:07:54 +08:00
Neo Xu b6d2dc6c54 lcd/st7735: add option to invert display color
Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2024-10-02 20:52:55 +08:00
lipengfei28 b18262d78f bits:rename __set_bit to set_bit __clear_bit to clear_bit
This used for add pci ep drver framework

Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-09-23 10:03:54 +02:00
liaoao d8d7f3c38e bits.h: replace all inline defination of __set_bit/__clear_bit
Signed-off-by: liaoao <liaoao@xiaomi.com>
2024-09-13 09:09:19 +08:00
Petro Karashchenko 1528b8dcca nuttx: resolve various 'FAR' and 'CODE' issues
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-08-26 10:21:03 +08:00
Petro Karashchenko d499ac9d58 nuttx: fix multiple 'FAR', 'CODE' and style issues
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-08-25 19:22:15 +08:00
Huang Qi e09a79ece9 driver/ssd1680: Add support for 1.54 inch e-paper display
Add configuration and driver support for the SSD1681 1.54 inch e-paper display,
including the necessary waveforms and settings for proper operation. This extends
the existing SSD1680 e-paper driver to accommodate the new display module.

The changes involve updates to the Kconfig file for additional configuration options,
modifications to the driver implementation in ssd1680.c to include SSD1681 specific
logic, and updates to the header file ssd1680.h to reflect the added support.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2024-08-04 23:14:55 +08:00
jianglianfang f4c8a17837 sim_lcd: add open & close
The opening and closing of the window has been associated with the opening and closing of fb, but the LCD has not yet been optimized. The window will only open when sim_x11openwindow is called, and similarly, the window will only close when sim_x11closewindow is called.

Signed-off-by: jianglianfang <jianglianfang@xiaomi.com>
2023-12-18 09:06:29 -08:00
Xiang Xiao eddd90de78 poll: pollsetup should notify only one fd passd by caller
since it's redundant to iterate the whole fds array in setup

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-11-21 09:07:17 +01:00
rongyichang 52d516ab46 drivers/lcd: change lcd stride from pixel to bytes
In order to achieve better scalability, change the stride
from pixel mode to byte mode.For example, in the case of RGB888
mode with 466 pixels in width and a 4-byte aligned buffer,it is
only necessary to extend the buffer of one line from 1398 bytes
to 1400 bytes, instead of extending it to 1404 bytes.

Signed-off-by: rongyichang <rongyichang@xiaomi.com>
2023-11-14 07:30:29 -08:00
rongyichang bc43c419f2 drivers/lcd: add stride support for LCD driver
support LCD stride for GET_AREA and PUT_AREA operation

Signed-off-by: rongyichang <rongyichang@xiaomi.com>
2023-11-09 09:52:00 +08:00
raiden00pl 5b87fdfb9d Documentation: remove all migrated READMEs 2023-10-29 21:03:54 -03:00
hujun5 061be5f18e refine: move BIT Macro to nuttx/bits.h
The BIT macro is widely used in NuttX,
and to achieve a unified strategy,
we have placed the implementation of the BIT macro
in bits.h to simplify code implementation.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2023-10-12 14:52:56 +08:00
Dong Heng ca03a92327 drivers/lcd/st7789: Add option to support set BGR mode 2023-09-25 12:51:43 +08:00
chao an 5026a96cfa nxstyle: cleanup UTF-8 Unicode to ASCII
Signed-off-by: chao an <anchao@xiaomi.com>
2023-09-18 11:54:17 -04:00
Daniel Appiagyei 5bfda12634 c++ compatibility: rename reserved c++ keywords 'public' and 'this' 2023-09-16 19:45:02 +08:00
jturnsek 4407aa148e Fixing row_size calculation when bpp is equal 1 2023-09-16 14:37:19 +08:00
jturnsek 6840b4444b Adding Byte-Per-Pixel Memory model option to memlcd 2023-09-16 14:34:32 +08:00
chao an 664927c86e mm/alloc: remove all unnecessary cast for alloc
Fix the minor style issue and remove unnecessary cast

Signed-off-by: chao an <anchao@xiaomi.com>
2023-08-30 14:34:20 +08:00
chao an b60f01a55b inode/i_private: remove all unnecessary cast for i_private
Signed-off-by: chao an <anchao@xiaomi.com>
2023-08-29 08:58:07 +02:00
chao an 7aa45305b7 fs/inode: remove all unnecessary check for filep/inode
Since VFS layer already contains sanity checks, so remove unnecessary lower half checks

Signed-off-by: chao an <anchao@xiaomi.com>
2023-08-29 09:47:11 +08:00
rongyichang 917634446e drivers/lcd : add ioctl passthrough for LCD driver
Some LCD vendors support unit test commands, we should passthrough the ioctl
commands to drivers.

Signed-off-by: rongyichang <rongyichang@xiaomi.com>
2023-08-19 01:50:41 +08:00
xuxin19 f2f0d7fbad cmake:fix drivers build block during cmake reforming
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2023-08-16 22:38:52 +08:00
Xiang Xiao abfe082a6f Kconfig: Simplify the conditional default statement
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-16 14:39:20 -03:00