Instead, use direct return, because in non-build targets,
such as savedefconfig, menuconfig, this check is unnecessary
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
According to MISRA C-2004 Rule 14.7, Every function must have exactly one entry point and one exit point.
Signed-off-by: pangzhen1 <pangzhen1@xiaomi.com>
Add support for running the OS in tickless mode with hrtimer, allowing
the scheduler to operate without periodic ticks while maintaining
high-resolution timer functionality.
Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
The hrtimer subsystem is independent of the OS tick mechanism and tickless
mode. It must always be able to reprogram the hardware timer to achieve
nanosecond-level resolution.
A recent update restricted hardware timer reprogramming to tickless mode
only. As a result, hrtimer no longer functions correctly when the scheduler
is running in tick-based mode.
This change removes the incorrect dependency on tickless mode and restores
proper hrtimer operation.
Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
Correct timer initialization issue in SMP mode using mtimer to ensure
per-hart timers are properly set up during boot.
Signed-off-by: Chengdong Wang <wangchengdong@lixiang.com>
Using spin_lock_irqsave_nopreempt and spin_unlock_irqrestore_nopreempt to replace the following case.
flags = spin_lock_irqsave(lock);
sched_lock();
.....
spin_unlock_irqrestore(lock, flags);
sched_unlock();
Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
IRQ_TO_NDX() may return a negative value when the IRQ number is invalid
or not mapped. Using this negative value directly as an array index for
g_irqvector causes undefined behavior and potential memory corruption.
This patch adds a bounds check to ensure ndx is non-negative before
accessing the g_irqvector array, returning the error code if invalid.
Signed-off-by: pangzhen1 <pangzhen1@xiaomi.com>
The callback parameters are currently passed in by the upper layer, so the release process in close should not be performed here.
This prevents double-free issues and ensures proper resource management.
Signed-off-by: makejian <makejian@xiaomi.com>
Fix incorrect memory management for asynchronous process callbacks.
Ensure callback memory is self-managed to prevent leaks or use-after-free issues.
Signed-off-by: makejian <makejian@xiaomi.com>
Fix issue where input buffer pointer was modified during crypto operations.
Ensures original buffer pointer remains valid for the caller.
Signed-off-by: makejian <makejian@xiaomi.com>
Add support for exporting RSA operations with PKCS#1 v1.5 and PSS padding schemes through the cryptodev interface.
This enables both traditional and modern RSA signature schemes:
- CRK_RSA_PKCS15_SIGN/VERIFY for PKCS#1 v1.5 padding
- CRK_RSA_PSS_SIGN/VERIFY for PSS padding
Signed-off-by: makejian <makejian@xiaomi.com>
The sched_resumescheduler support was already removed in prior commits.
This change cleans up the now unused legacy source file.
Signed-off-by: chao an <anchao.archer@bytedance.com>
Add try-lock variants for rspinlock_t to support non-blocking spinlock
acquisition with optional IRQ save/restore and preemption control.
These variants enable fine-grained synchronization patterns in nested
contexts with maximum nesting depth support (UINT16_MAX).
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
This patch adds support for the FIOC_FILEPATH ioctl command in the
FAT filesystem, allowing applications to retrieve the full path of
an open file descriptor.
Key features:
- Implements fat_getfilepath() to construct file paths by traversing
parent directories using ".." entries
- Adds fat_findlfnstart() helper to locate the start of LFN sequences
- Supports both FAT12/16 and FAT32 filesystem types
- Handles both regular directories and root directory traversal
This functionality is useful for debugging, logging, and applications
that need to track file paths at runtime.
Signed-off-by: yinshengkai <yinshengkai@bytedance.com>
- Add c++config.h to improve libstdc++ configuration support
- Update CMakeLists.txt and libsupc++.defs to integrate the new config header
- Remove the obsolete 0001-libsupc-Add-missing-header-files.patch to clean up the codebase
These changes enhance the maintainability and portability of the C++ standard library and simplify the build process.
* Remove `tools/` from the section name.
* Generate local TOC that lists described tools.
* Update new parsetrace.py toctree location to fix indexing and display.
Signed-off-by: Tomasz 'CeDeROM' CEDRO <tomek@cedro.info>
* Update previous `-j 1` and `-j 8` switch to `-j auto` to use all CPUs.
* This improves doc build time 62s -> 25s on 24 core CPU.
* Add information about `make autobuild` to `make help`.
* Auotbuild is very handy for quick edits preview and was not in help before.
Signed-off-by: Tomasz 'CeDeROM' CEDRO <tomek@cedro.info>
For the following code, we need to check 'type_attr.form'.
type_attr = DIE.attributes["DW_AT_type"]
base_type_die = dwarfinfo.get_DIE_from_refaddr(xxx)
When type_attr.form==DW_FORM_ref_addr, 'type_attr.value' means
global reference (across compilation units).
When type_attr.form==DW_FORM_ref4, 'type_attr.value' means
local reference (within the same compilation unit).
Signed-off-by: yukangzhi <yukangzhi@xiaomi.com>
boot mode is configured
1. Explicitly define the .rtc_reserved section to ensure RTC data
that requires fixed address is correctly placed and does not
conflict with other sections
2. When legacy boot is configured, vecbase must also be set and
clear the BSS section
3. Cache must be disabled during Flash operations, so all
Flash-operation-related functions must be placed in IRAM
(internal RAM). Update the linker script for legacy boot mode
Signed-off-by: nuttxs <zhaoqing.zhang@sony.com>
Added stm32_cap_rstcounter() function to reset the capture counter
by generating an update event. The function is integrated into the
capture operations structure and exposed via STM32_CAP_RSTCOUNTER
macro. Also added TI3 and TI4 input mappings for extended capture
channel support.
Signed-off-by: Alexey Matveev <tippet@yandex.ru>
Move rpmsg internal APIs from public header include/nuttx/rpmsg/rpmsg.h
to private header drivers/rpmsg/rpmsg.h. These APIs are only used within
the rpmsg driver implementation and should not be exposed to external
modules.
Moved APIs:
- rpmsg_modify_signals()
- rpmsg_ns_bind() / rpmsg_ns_unbind()
- rpmsg_device_created() / rpmsg_device_destory()
- rpmsg_register() / rpmsg_unregister()
Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Add trace points to record transitions of g_nx_initstate and to mark
board early/late initialization boundaries. Also add trace marks for
RESET and PANIC to improve boot-time diagnostics and failure analysis.
Add OSINIT_RESET to indicate system is in reset process.
Signed-off-by: yukangzhi <yukangzhi@xiaomi.com>
The dhtxx driver previously returned 0 on success, which violates standard
character device behavior where the number of bytes read should be returned.
It also used non-standard error codes like -1 or -ENOSYS for operational
errors.
This commit fixes the following behavior to comply with POSIX standards:
* Return sizeof(struct dhtxx_sensor_data_s) on success instead of 0.
* Return -EINVAL instead of -ENOSYS/-1 for invalid buffer arguments.
* Return -ETIMEDOUT instead of -1 for sensor timeouts.
* Return -EIO instead of -1 for checksum or parsing errors.
Signed-off-by: jklincn <jklincn@foxmail.com>
Enable SYSCALL_HOOKS architecture capability for TriCore platform.
This allows runtime interception and hooking of system calls on
TriCore architecture, enabling profiling, tracing, and debugging features.
Signed-off-by: hujun5 <hujun5@xiaomi.com>
Add a new getrecvbuf callback to the SPI slave device operations
that allows the slave device to provide a pre-allocated receive
buffer directly to the controller. This enables zero-copy data
transfer by allowing the controller to receive data directly into
the device's buffer instead of copying.
Changes:
- Add SPIS_DEV_GETRECVBUF macro and getrecvbuf callback to
spi_slave_devops_s structure in include/nuttx/spi/slave.h
- Implement getrecvbuf in rpmsg_port_spi_slave driver
- Update getdata to return 0 as it's no longer used for this path
Signed-off-by: liaoao <liaoao@xiaomi.com>
The cmdhdr->len was uninitialized before being used in SPI exchange
operations. This caused incorrect transfer lengths.
Changes:
- Initialize cmdhdr->len to sizeof(struct rpmsg_port_header_s) during
initialization for both SPI master and slave drivers
- Use port.txq.len instead of cmdhdr->len for TX exchange length
- Use port.rxq.len instead of cmdhdr->len for RX getdata length
Signed-off-by: liaoao <liaoao@xiaomi.com>
CC: vfs/fs_unlink.c rpmsg/rpmsg_port_spi.c: In function ‘rpmsg_port_spi_complete_handler’:
rpmsg/rpmsg_port_spi.c:415:11: warning: implicit declaration of function ‘rpmsg_port_spi_drop_packets’; did you mean ‘rpmsg_port_drop_packets’? [-Wimplicit-function-declaration]
415 | rpmsg_port_spi_drop_packets(rpspi, RPMSG_PORT_SPI_DROP_ALL);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
| rpmsg_port_drop_packets
rpmsg/rpmsg_port_spi.c:415:46: error: ‘RPMSG_PORT_SPI_DROP_ALL’ undeclared (first use in this function); did you mean ‘RPMSG_PORT_DROP_ALL’?
415 | rpmsg_port_spi_drop_packets(rpspi, RPMSG_PORT_SPI_DROP_ALL);
| ^~~~~~~~~~~~~~~~~~~~~~~
| RPMSG_PORT_DROP_ALL
rpmsg/rpmsg_port_spi_slave.c:292:5: warning: implicit declaration of function ‘container_of’; did you mean ‘list_container_of’? [-Wimplicit-function-declaration]
292 | container_of(port, struct rpmsg_port_spi_s, port);
| ^~~~~~~~~~~~
| list_container_of
Signed-off-by: liaoao <liaoao@xiaomi.com>
The default stack size should be large enough to avoid the stack
overflow:
0x18551ad8 1968 1968 100.0%! 24.2% rpmsg-spi
Signed-off-by: liaoao <liaoao@xiaomi.com>
Use pm wakelock is enough to make sure system will not suspend
when there is a transfer in process, and it can actually sleep when
there is buffer to send but peer side not response in 1ms which is
the timeout we set.
Signed-off-by: liaoao <liaoao@xiaomi.com>
Unbind the spictrl to close the spi controller, and bind it again
when peer boots.
This can help to reduce the leak current caused by the spi gpio.
Signed-off-by: liaoao <liaoao@xiaomi.com>
Only call rpmsg_port_spi_pm_action(false) when no more data to
transfer to avoid unnecessary pm unlock/lock operations.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>