Commit Graph

59582 Commits

Author SHA1 Message Date
ouyangxiangzhen
996f110925 arch/arm: Add clkdev driver for generic timer.
This commit added clkdev driver for arm generic timer.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-24 19:43:07 +08:00
ouyangxiangzhen
d335cce43a arch/arm64: Add clkdev driver for generic timer.
This commit added clkdev driver for arm64 generic timer.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-24 19:43:07 +08:00
Karel Kočí
c61d7c7e8d nuttx/can: add message alignment
This adds ability for read and write operations to work with messages
aligned to configured number of bytes. This has few different use
cases.

The alignment is specified as unsigned integer and can be changed with
ioctl command CANIOC_SET_MSGALIGN. The current value can be queried by
CANIOC_GET_MSGALIGN command.

The default value for the message alignment is 1. This will provide
behavior consistent with current one. Thus messages are placed to the
buffer right after data of the previous one. The same applies for
writes.

The special alignment value 0 disables read and write of multiple frames. Thus
read will always return at most one message and write will always write
only one message even if larger buffer size is provided.

Another use case is if message alignment is set to exactly message
representation size (`sizeof(struct can_msg_s)`). This allows writing
and reading arrays of messages.

Other values provide even more advanced and specialized use cases, such
as optimizations if architecture has to emulate some non-aligned
accesses, there alignment of for example 4 bytes could provide
performance boost.

The original motivation behind this is was compatibility with socket
CAN. It is easier to port applications to NuttX's CAN driver if only one
frame is provided at the time. This solution was suggested by Pavel Pisa
<pisa@fel.cvut.cz> as a more versatile variant of plain boolean
disabling the multiple frame retrieval.

Signed-off-by: Karel Kočí <kkoci@elektroline.cz>
2025-11-24 14:11:41 +08:00
Karel Kočí
8230c44517 nuttx/can: fix two documented CANIOC names
This is just a simple typo (missing underscore) in the definition. I am
fixing the documentation instead to make it consistent instead of
breaking an API.

Signed-off-by: Karel Kočí <kkoci@elektroline.cz>
2025-11-24 14:11:41 +08:00
Karel Kočí
b9066e42bb include: add BSD rounding macros to sys/param.h
These macros are commonly provided on BSD systems. They are not part of
C nor POSIX but these types of operations can be required in drivers
implementation as well as in user space. The operations themself are
simple but kind of cryptic when placed in the code as is. Thus having
macro with an appropriate name is beneficial.

The use of BSD naming here is only to cling to at least some other
implementation instead of creating completelly NuttX specific one.

Kudos to @hartmannathan for the source code documentation.

Signed-off-by: Karel Kočí <kkoci@elektroline.cz>
2025-11-24 14:11:41 +08:00
wangchengdong
e758e92830 sched/signal: Unblock task waiting for event when a signal received
Some checks failed
Build Documentation / build-html (push) Has been cancelled
If the task is blocked waiting for a event, then that task must
 be unblocked when a signal is received.

Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2025-11-22 17:24:53 -03:00
Michal Lenc
cb5f47e56e documentation: add GPIO character device driver entry
This page describes GPIO character device driver and its API.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2025-11-22 14:12:19 -05:00
cuichaochao
d3021ffa87 tm32f746g-disco: fix lvgldemo failed
use external ram in lvgldemo

Signed-off-by: cuichaochao <cuichaochao916@gmail.com>
2025-11-21 11:13:11 -05:00
LuchianMihai
e09c8e510e Documentation/Make: add implementation/make_build_system.rst
Some checks failed
Build Documentation / build-html (push) Has been cancelled
This commit adds initial high level overview of the NuttX
make-based build system.  It documents:
* Tools used during the build process
* Mechanisms set in place during the build process

Signed-off-by: Luchian Mihai <luchiann.mihai@gmail.com>
2025-11-20 09:39:16 -05:00
SPRESENSE
b2b045252d arch: cxd56xx: Fix failure to get RTC time in multi-core environment
In multi-core environment where NuttX runs on each core, if one core
sets the RTC time, the RTC value gotten on other cores is incorrect.

This is caused by clock_gettime(CLOCK_MONOTONIC) function used to get
elapsed time, which uses a core-specific global varaiable g_basetime
as the base time.

To fix this, update the g_basetime from the backup SRAM that can be
shared between cores in setting/getting the RTC time.

Signed-off-by: SPRESENSE <41312067+SPRESENSE@users.noreply.github.com>
2025-11-20 20:56:05 +08:00
wangchengdong
c5f85f8275 CMake: Enable Kconfig generation for external directories
Currently, nuttx_generate_kconfig() can only parse subdirectories
under apps/. This patch extends its capability to also parse
external directories referenced from the apps tree.

Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2025-11-20 19:16:05 +08:00
wangchengdong
fd70e5f947 CMake: Enable both sub-Kconfig and generated menu Kconfig
Currently, nuttx_generate_kconfig() allows a subdirectory to have
either a handwritten sub-Kconfig or a generated menu Kconfig, but
not both.

This patch enables support for having both a sub-Kconfig and a
generated menu Kconfig within the same subdirectory.

Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
2025-11-20 13:29:02 +08:00
Jukka Laitinen
f641298d9e arch/imx9: Enable manual control for LPSPI PCS signals
Add a function imx9_lpspi_select_cs to assert CS at the start of
an SPI transfer and keep it asserted until called again to
de-assert it. This can be called by board-provided imx9_lpspi_select,
in case the CS needs to be controlled via the LPSPI block and not
GPIO.

The TCR register CONT (continue) bit is asserted to prevent CS toggling
during the transfer, and the PCS bits are set to mark the correct CS

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2025-11-19 12:28:32 -03:00
Jukka Laitinen
fbd27c045b arch/imx9: Correct LPSPI TCR register PCS bit definitions
According to the TRM, only bits 24-25 are reserved for chip select, and
the maximum number of internal chip selects is 3 (on LPSPI4 bus only).

Fix the TCR_PCS_MASK and remove extra definitions.

Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
2025-11-19 12:28:32 -03:00
ouyangxiangzhen
ff5944d8fc arch/tricore: Add the clkdev driver for tricore.
Some checks failed
Build Documentation / build-html (push) Has been cancelled
This commit added the clkdev driver for tricore.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-19 12:24:56 +08:00
ouyangxiangzhen
3b52763385 Documentation/componensts: Add doc for timers/oneshot.
This commit added doc for timers/oneshot.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-19 12:24:56 +08:00
ouyangxiangzhen
39d9eb2343 timers: Fix typo.
This commit fixed typo in clkcnt.h and oneshot.h

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-19 12:24:56 +08:00
ouyangxiangzhen
a5f5ab185c driver/timers: Fix coverity uninitialzed timespec.
This commit fixed uninitialized timespec.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-19 12:24:56 +08:00
ouyangxiangzhen
556b89bcdb timers/arch_alarm: Fix oneshot callback for non-tickless.
This commit fixed oneshot callback for non-tickless using tick-aligned
absolute oneshot interfaces.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-19 12:24:56 +08:00
ouyangxiangzhen
bbb4cc4f6f timers/arch_alarm: Replace relative oneshot API.
This commit replaced the relative oneshot API with the absolute API.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-19 12:24:56 +08:00
ouyangxiangzhen
4b31291043 timers/oneshot: Add clkdev fast-path.
This commit add fast-path for oneshot clkdev APIs.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-19 12:24:56 +08:00
ouyangxiangzhen
9569129862 timers/oneshot: Add new start_absolute interface.
Current timer hardware supports both absolute and relative count timers. Without an absolute count timer interface, setting an alarm timer might incur additional overhead in obtaining the current time, resulting in performance degradation and inaccurate timing.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-19 12:24:56 +08:00
ouyangxiangzhen
6dcb8270e3 timers/oneshot: Add new clkdev interfaces.
This commit introduce new clockdevice interfaces for oneshot.
- It can represent both `timer` and `alarm`.
- It simplifies the implementation of timer driver. Timer driver do not need considering the time conversion between clock count, tick and timespec.
- It sets timer align to the tick boundary to improve timer accuracy.
- It can avoid using 64-bit division during timer expiration interrupt, improves performance and reduces interrupt latency.
- It considers almost all multiplication overflow problems in time conversion without processing at the driver.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-19 12:24:56 +08:00
ouyangxiangzhen
06fe9f076e timers/oneshot: Introduce count-based interfaces.
This commit introduced count-based oneshot interfaces.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-19 12:24:56 +08:00
ouyangxiangzhen
c6139f89c8 timers/oneshot: Improve tick-compatiable interfaces.
This commit improved tick-compatiable interfaces.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-19 12:24:56 +08:00
v-tangmeng
a221df7175 arch/xtensa/esp32[-s2|-s3]: add USE_NXTMPDIR_ESP_REPO_DIRECTLY
Directly downloading the Git repository is inconvenient for local debugging.
This will allow to automatically download external packages from the Internet.
If not set, the repo need to be download will need to provide them manually,
otherwise an error will occur and the build will be aborted.

Add `USE_NXTMPDIR_ESP_REPO_DIRECTLY`, with this we can use
`USE_NXTMPDIR_ESP_REPO_DIRECTLY=y make` which can directly use esp-hal-3rdparty
under nxtmpdir without CLONE, CHECK_COMMITSHA, reset, checkout and update. Just
`cp -rf nxtmpdir/esp-hal-3rdparty chip/$(ESP_HAL_3RDPARTY_REPO)`.

Signed-off-by: v-tangmeng <v-tangmeng@xiaomi.com>
2025-11-18 21:46:50 +08:00
Antoine Juckler
224afcb77b drivers/eeprom/spi_xx25xx: Multi-device SPI bus support
Adds a device ID to ee25xx_initialize, which is stored in the
ee25xx_dev_s structure. This ID is used when calling SPI_SELECT.

The implementation is based on the handling of the chip select in
mtd/ramtron.c

This change is NOT backward compatible: the function signature has changed

Signed-off-by: Antoine Juckler <6445757+ajuckler@users.noreply.github.com>
2025-11-18 09:37:07 -03:00
Antoine Juckler
81550800d4 drivers/mtd/at25ee: Multi-device SPI bus support
Adds a device ID to at25ee_initialize, which is stored in the
at25ee_dev_s structure. This ID is used when calling SPI_SELECT.

The implementation is based on the handling of the chip select in
mtd/ramtron.c

This change is NOT backward compatible: the function signature has changed

Signed-off-by: Antoine Juckler <6445757+ajuckler@users.noreply.github.com>
2025-11-18 09:37:07 -03:00
Alan Carvalho de Assis
34febea2df drivers/sensors: Fix Kconfig
As reported by a user in Discord channel selection BMI160 with SPI
interface still showing the I2C configuration. This patch fixes it.

Signed-off-by: Alan C. Assis <acassis@gmail.com>
2025-11-18 09:16:12 -03:00
ouyangxiangzhen
7e7828b3f6 timers/oneshot: Remove oneshot tick API.
This commit removed all oneshot tick API for new clkdev API.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-18 13:02:29 +01:00
ouyangxiangzhen
fc28b93224 timers/oneshot: Remove all callback and args.
This commit remove all callback and args in the APIs.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-18 13:02:29 +01:00
ouyangxiangzhen
5c113f79b7 timers/oneshot: Remove all private callback.
This commit removed all private callback and handle it on the upperhalf
of oneshot.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-18 13:02:29 +01:00
ouyangxiangzhen
f70ec7384b arch/risc-v: revert oneshot drivers to timespec API.
This commit reverted oneshot drivers to timespec API.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-18 13:02:29 +01:00
ouyangxiangzhen
b53141049d arch/arm: revert oneshot drivers to timespec API.
This commit reverted oneshot drivers to timespec API.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-18 13:02:29 +01:00
ouyangxiangzhen
ec45923cbe arch/arm64: revert oneshot drivers to timespec API.
This commit reverted oneshot drivers to timespec API.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-18 13:02:29 +01:00
leocafonso
9e573371bb Documentation: Add GPT information to RA4M1 documentation
Some checks failed
Build Documentation / build-html (push) Has been cancelled
- Updated information about the RA4M1 microcontroller capabilities, including the General Purpose Timer (GPT).
- Added information about the PWM driver support for the Arduino R4 Minima board using the GPT timer.

Signed-off-by: leocafonso <leocafonso@gmail.com>
2025-11-17 09:01:31 -03:00
leocafonso
80b9fc30de boards/arduino-r4-minima: Add PWM support using GPT timer
- Added PWM support on Arduino R4 Minima board.
This board has 5 PWM channels available using the GPT timer from the RA4M1 microcontroller.
- Added a pwm config file to enable PWM supporting GTP2 GTIOCB on P102.

Signed-off-by: leocafonso <leocafonso@gmail.com>
2025-11-17 09:01:31 -03:00
leocafonso
2667f51c82 arch/ra4: Add PWM driver support for RA4M1
- Added PWM driver support for the RA4M1 microcontroller using the GPT timer.
- This driver supports Saw-wave mode and one of the two output channels (A or B).
- Added necessary configurations in CMakeLists.txt, Kconfig, and Make.defs.
- Created new header file for GPT.

Signed-off-by: leocafonso <leocafonso@gmail.com>
2025-11-17 09:01:31 -03:00
ouyangxiangzhen
dd88c99863 timers/clkcnt: Fix the assertion if max_tick > CLOCK_MAX.
This commit fixed the assertion if max_tick > CLOCK_MAX when the clock_t is
32-bit.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-17 14:15:44 +08:00
ouyangxiangzhen
575844ad39 clkcnt: Add clockcount abstraction.
This commit added the clkcnt abstraction.
Clkcnt is used to abstract the cycle counter of hardware timer, which can represent almost all existing timers. Time conversion through API provided by clkcnt can avoid any timing conversion problem (multiplication overflow, division precision loss, etc.).

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-17 14:15:44 +08:00
ouyangxiangzhen
152c66de05 compiler: Support pure function attributes and compile-time constant condition.
This commit added support for pure function attributes and compile-time
constant condition.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-17 14:15:44 +08:00
ouyangxiangzhen
d322bdb1ee arch/arm: Simplify arm_cpu_boot.
This commit simplified arm_cpu_boot.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-17 10:25:37 +08:00
ouyangxiangzhen
b2f1d2fee0 arch/arm: Simplify ARM generic timer drivers.
This commit simplified ARM generic timer drivers.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-17 10:25:37 +08:00
ouyangxiangzhen
44aac0c3db arm/armv8-r: Rename arm_arch_timer to arm_timer.
This commit renamed arm_arch_timer to arm_timer.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-17 10:25:37 +08:00
ouyangxiangzhen
c9f9e1e35f arch/intel64: add timer initialization for the secondary CPUs.
This commit added timer initialization for the secondary CPUs.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-17 10:25:37 +08:00
liwenxiang1
27959044c3 arch/intel64: Change the name of the global TSC variable.
This commit changed the name of the global TSC variable.

Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2025-11-17 10:25:37 +08:00
liwenxiang1
5697e4fabb arch/intel64: Macro definition use positive check
This commit added macro definition using positive checking.

Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2025-11-17 10:25:37 +08:00
liwenxiang1
62a2f5c2f6 arch/intel64: Add TSC adjust setting for SMP
This commmit added TSC adjust setting for SMP.

Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2025-11-17 10:25:37 +08:00
ouyangxiangzhen
946ac39c7a arch/intel64: Fix updating MSR_IA32_TSC_ADJUST.
If the initial value of the MSR_IA32_TSC_ADJUST register is not 0 (may be modified by BIOS or bootloader), it may cause timing errors. This commit addressed the issue.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-17 10:25:37 +08:00
ouyangxiangzhen
7185f41356 arch/intel64: Support MSR_IA32_TSC_ADJUST.
On newer x86 CPUs, the MSR_IA32_TSC_ADJUST register is utilized to fine-tune the offset of the Time Stamp Counter (TSC). This commit introduces support for MSR_IA32_TSC_ADJUST and enhances the TSC tickless
driver, optimizing its performance.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2025-11-17 10:25:37 +08:00