Commit graph

7651 commits

Author SHA1 Message Date
chao an
5a64967ce7 nuttx/compiler: fix build warning on GCC14
nuttx/include/arch/armv8-m/irq.h:496:36: warning: 'always_inline' function might not be inlinable unless also declared 'inline' [-Wattributes]
  496 | static always_inline_function bool up_interrupt_context(void)
      |                                    ^~~~~~~~~~~~~~~~~~~~
nuttx/include/arch/armv8-m/irq.h:490:41: warning: 'always_inline' function might not be inlinable unless also declared 'inline' [-Wattributes]
  490 | static always_inline_function uintptr_t up_getusrsp(void *regs)
      |                                         ^~~~~~~~~~~
nuttx/include/arch/armv8-m/irq.h:477:40: warning: 'always_inline' function might not be inlinable unless also declared 'inline' [-Wattributes]
  477 | static always_inline_function uint32_t up_getsp(void)
      |                                        ^~~~~~~~
nuttx/include/arch/armv8-m/irq.h:451:40: warning: 'always_inline' function might not be inlinable unless also declared 'inline' [-Wattributes]
  451 | static always_inline_function uint32_t getpsp(void)
      |                                        ^~~~~~
nuttx/include/arch/armv8-m/irq.h:441:36: warning: 'always_inline' function might not be inlinable unless also declared 'inline' [-Wattributes]
  441 | static always_inline_function void setcontrol(uint32_t control)
      |                                    ^~~~~~~~~~
nuttx/include/arch/armv8-m/irq.h:428:40: warning: 'always_inline' function might not be inlinable unless also declared 'inline' [-Wattributes]
  428 | static always_inline_function uint32_t getcontrol(void)
      |                                        ^~~~~~~~~~

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-02-18 09:04:54 -05:00
wangjianyu3
0b633946c0 drivers/thermal: Add support for passive trip point
Spliting `THERMAL_NORMAL` to `THERMAL_ACTIVE` and `THERMAL_PASSIVE`,
to support different update intervals for thermal zone.

Active/Passive from [kernel.org](https://www.kernel.org/doc/Documentation/devicetree/bindings/thermal/thermal.txt):

  * Cooling device nodes

  Cooling devices are nodes providing control on power dissipation. There
  are essentially two ways to provide control on power dissipation. First
  is by means of regulating device performance, which is known as passive
  cooling. A typical passive cooling is a CPU that has dynamic voltage and
  frequency scaling (DVFS), and uses lower frequencies as cooling states.
  Second is by means of activating devices in order to remove
  the dissipated heat, which is known as active cooling, e.g. regulating
  fan speeds. In both cases, cooling devices shall have a way to determine
  the state of cooling in which the device is.

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2025-02-16 11:22:41 -03:00
Alan Carvalho de Assis
5a6e5a8fb4 serial: Add struct serial_icounter_s and CONFIG_SERIAL_TIOCGICOUNT
This commit add support to the serial_icounter_s struct used with
TIOCGICOUNT to report U[S]ART errors such as frame, parity, overrun,
etc.

Signed-off-by: Alan C. Assis <acassis@gmail.com>
2025-02-14 18:24:47 +01:00
hujun5
f22b93b337 sched/spin_lock: rename raw_spin_lock to spin_lock_notrace
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2025-02-13 20:48:15 +08:00
hujun5
42e6825cbc Revert "spinlock: add sched_lock to spin_lock_irqsave"
This reverts commit edc049117bcf3180d74d93a0c6ae63695d1bcd91.
2025-02-13 20:48:15 +08:00
Jacob Dahl
3dcedd507b h7: eth: add checks for PHYID in stm32_phyinit
Fixes bug where stm32_phyinit will succeed even when no PHY is connected. This is because there is no check that a PHY is actually communicating and returning data.

Update include/nuttx/net/mii.h

Co-authored-by: Xiang Xiao <xiaoxiang781216@gmail.com>
2025-02-12 15:00:19 -03:00
Matteo Golin
729f8a75f7 drivers/sensors: Added uORB driver for LSM6DSO32 IMU.
Adds support for the LSM6DSO32 IMU by STM using the uORB framework. This
only contains limited support for the I2C interface, interrupt and
polling driven measurement and standard modes of operation (high
performance ODRs). Features like interrupts besides DRDY, filtering,
gesture recognition and acting as a bus master are not implemented.
2025-02-12 10:44:15 -03:00
zhaohaiyang1
e657b35720 nuttx/can: Modify poll logic to bind can_reader_s and pollfd.
For clearing some variables corresponding with the pollfds of the felip in can_close API, we modify poll logic by binding can_reader_s and pollfd.

Signed-off-by: zhaohaiyang1 <zhaohaiyang1@xiaomi.com>
2025-02-12 10:28:21 -03:00
dongjiuzhu1
34bde7b80a qemu/armv7a: register cfi flash
search the device tree and register cfi flash

test flowchart:
mount -t littlefs -o autoformat /dev/cfi-flash1 /data
fstest -m /data

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2025-02-11 17:23:44 +08:00
zhengyu9
2c4285d9ac mtd/mtd_cfi: cfi flash bind to mtd interface
Bind cfi flash driver with the existing mtd interface

Signed-off-by: zhengyu9 <zhengyu9@xiaomi.com>
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2025-02-11 17:23:44 +08:00
Tiago Medicci Serrano
2ebdd72487 include/stdlib.h: define system()'s prototype for the flat build
The `$(APPDIR)` folder is added to the `$(KERNDEPDIRS)` when
`CONFIG_BUILD_KERNEL=y`. The `depend` phase iterates over the
`$(KERNDEPDIRS)` folders and executes the `depend` recipe of these
folders (including the apps' recipes) with the `__KERNEL__` macro
defined, which prevents `system()`'s prototype from being declared.
2025-02-07 09:03:14 +08:00
Javier Casas
d52ff33e78 net/can/: add statistics for recv, sent and drop
Add support for network statistics for CAN.
It includes counters for receive, sent
and drop frames.

Signed-off-by: Javier Casas <javiercasas@geotab.com>
2025-01-30 11:37:29 -03:00
Matteo Golin
044879e7a3 sensors/lis2mdl: Create a UORB driver for the LIS2MDL magnetometer. 2025-01-28 16:34:17 +08:00
wanggang26
f6b9a8f577 coredump: fix issue that nvic region overlapped by board memory region
Firstly call arm_coredump_add_region in up_initialize to add nvic region, then call
coredump_set_memory_region to add board mem region, at this moment, an overlap occurs.

Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2025-01-24 09:15:56 +08:00
xuxingliang
ba18502b93 misc/coredump: move coredump info to note
Add a custom note for NuttX information including magic and coredump
file data size, so when system reboots, we can check if the block device
contains valid coredump file, and save it to file system.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2025-01-24 09:12:59 +08:00
buxiasen
7a94a4553d syscall: add missing epoll API
Add missing epoll syscall API for kernelbuild
epoll_create, epoll_pwait, epoll_close

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2025-01-24 01:30:02 +08:00
hujun5
b69111d16a spinlock: add sched_lock to spin_lock_irqsave
reason:
We aim to replace big locks with smaller ones. So we will use spin_lock_irqsave extensively to
replace enter_critical_section in the subsequent process. We imitate the implementation of Linux
by adding sched_lock to spin_lock_irqsave in order to address scenarios where sem_post occurs
within spin_lock_irqsave, which can lead to spinlock failures and deadlocks.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2025-01-23 19:58:49 +08:00
hujun5
914ae532e6 sched: remove csection and reduce the interrupt disabling time in sched_[un]lock
reason:
1 Accelerated the implementation of sched_lock, remove enter_critical_section in sched_lock and
only enter_critical_section when task scheduling is required.
2 we add sched_lock_wo_note/sched_unlock_wo_note and it does not perform instrumentation logic

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2025-01-23 19:58:49 +08:00
hujun5
b49f4286fb spinlock: Due to semantic inconsistency, remove/rename some functions with the _wo_note suffix.
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2025-01-23 19:58:49 +08:00
Michal Lenc
d9270f9ea8 bch: add BIOC_DISCARD ioctl that discards cached sector
This forces the bch layer to read the sector from the physical device
instead of using the cached values. It is necessary to call when the
device is updated from the different source than bch, for example
erased by the MTD ioctl command.

It also has to invalidate readahead buffer from FTL if option
CONFIG_DRVR_READAHEAD is set.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2025-01-23 02:35:46 +08:00
chao an
2c9b287b2e fs/vfs: initialize uio only if lower implement readv/writev
to simple signle read/write logic, initialize uio only if lower implement readv/writev

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-01-22 16:45:46 +08:00
Matteo Golin
1d205e9ae2 sensors/mcp9600: Converted MCP9600 legacy driver to UORB driver as per suggestions on PR #15525. 2025-01-21 09:09:43 +08:00
paolo
11e3b8167c This patch fix mcp23x08 support. Issue #15592 2025-01-21 01:59:25 +08:00
Ville Juven
bb85ad849e pthread_cond_wait: Use atomic_t to protect the waiter count
The load/compare and RMW to wait_count need protection. Using atomic
operations should resolve both issues.

NOTE:
The assumption that the user will call pthread_cond_signal /
pthread_cond_broadcast with the mutex given to pthread_cond_wait held is
simply not true. It MAY hold it, but it is not forced. Thus, using the
user space lock for protecting the wait counter as well is not valid!

The pthread_cond_signal() or pthread_cond_broadcast() functions may be called by a thread whether or not it currently owns the mutex that threads calling pthread_cond_wait() or pthread_cond_timedwait() have associated with the condition variable during their waits; however, if predictable scheduling behaviour is required, then that mutex is locked by the thread calling pthread_cond_signal() or pthread_cond_broadcast().

[1] https://pubs.opengroup.org/onlinepubs/7908799/xsh/pthread_cond_signal.html
2025-01-20 23:55:26 +08:00
lipengfei28
2d1af01d44 mem barrier: use UP_DMP UP_DSP as barriers standard API
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2025-01-20 20:13:07 +08:00
Neo Xu
afe90db5c4 gdbstub: change send buffer to const char
Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2025-01-20 20:07:13 +08:00
dongjiuzhu1
e7f38fe6fa drivers/sensor: add new sensot type to align android sensor type
new sensor type:
SENSOR_TEMPERATURE
SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED
SENSOR_TYPE_GYROSCOPE_UNCALIBRATED
SENSOR_TYPE_MAGNETIC_FILED_UNCALIBRATED

refs:
https://cs.android.com/android/_/android/platform/hardware/libhardware/+/
0e67aa0caee9500b61b9c1c8b6e5cab18301364c:include_all/hardware/sensors-base.h

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2025-01-20 19:57:42 +08:00
hujun5
fcfc300f7a group: use tg_mutex to replace tg_joinlock
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2025-01-19 17:08:32 +08:00
Yanfeng Liu
1b369544ca modlib/gnu-elf.ld.in: fix regression with armv7a
As armv7-a addrenv layout is not in line with other archs, we need
align it with others by defining ARCH_DATA_RESERVE_SIZE as same as
MM_PGSIZE for now to keep gnu-elf.ld.in unified.

Signed-off-by: Yanfeng Liu <p-liuyanfeng9@xiaomi.com>
2025-01-17 23:16:26 +08:00
liuhongchao
1e2c002a10 nuttx: add open and close callback functions for the mouse.
Signed-off-by: liuhongchao <liuhongchao@xiaomi.com>
2025-01-17 09:19:18 +08:00
liuhongchao
41688a8f13 nuttx: Support for rpmsgdev custom ioctl
Signed-off-by: liuhongchao <liuhongchao@xiaomi.com>
2025-01-17 09:19:18 +08:00
liuhongchao
6dbd355c1f nuttx: Support for the mouse ioctl interface
Signed-off-by: liuhongchao <liuhongchao@xiaomi.com>
2025-01-17 09:19:18 +08:00
Matteo Golin
c15b900a88 sensors/sht4x: Converted SHT4X driver to UORB framework. 2025-01-17 09:08:21 +08:00
Tim Hardisty
acd7e44cad Add GD55 QSPI NOR Flash support 2025-01-17 09:07:22 +08:00
Matteo Golin
5de7e240af sensors/msxxxx-crc4: Modify CRC calculation so that it passes with MS5611. 2025-01-17 09:05:54 +08:00
chao an
8877366c0e sched/wdog: remove wd_cancel_irq() implement
we do not need this implement after change the lock from csec to spin_lock

Signed-off-by: chao an <anchao.archer@bytedance.com>
2025-01-17 09:05:11 +08:00
Matteo Golin
36507cc7b2 drivers/sensors: Wrote a driver for the MCP9600 thermocouple amplifier. 2025-01-14 23:04:18 +08:00
YAMAMOTO Takashi
30ad31e9d7 uio api tweaks
* Make readv/writev implementations update struct uio
  This can simplify partial result handling.

* change the error number on the overflow from EOVERFLOW to EINVAL
  to match NetBSD

* add a commented out uio_offset field. I used "#if 0" here as
  C comments can't nest.

* add a few helper functions

Note on uio_copyfrom/uio_copyto:
although i'm not quite happy with the "offset" functionality,
it's necessary to simplify the adaptation of some drivers like
drivers/serial/serial.c, which (ab)uses the user-supplied buffer
as a line-buffer.
2025-01-14 20:18:21 +08:00
hujun5
299136bdc7 rptun_bmp: add remote_cpu to rptun_secure_init
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2025-01-14 13:34:35 +08:00
hujun5
1600a44d69 rptun_secure:change rptun_secure to rptun_bmp
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2025-01-14 13:34:35 +08:00
hujun5
684ddc6ada irq: enter_critical_section_wo_note/leave_critical_section_wo_note
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2025-01-14 12:29:29 +08:00
jerryslhao
f1b7d7d641 drivers/sensors/bmi088: add driver for Bosch BMI088 IMU
This adds a driver for the Bosch BMI088 IMU sensor.
The driver supports spi.

Signed-off-by: jerryslhao <jerryslhao@gmail.com>
2025-01-14 10:29:48 +08:00
hujun5
5f4a15b690 pthread: remove enter_critical_section in pthread_mutex
reason:
We would like to replace the critical section with a small lock.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2025-01-12 22:30:35 +08:00
yaojiaqi
43797ea6cc drivers/timers/watchdog: add watchdog timer notifier chain
Add support for watchdog timer notifer chain so that users
can customize the callback function when the watchdog timer
times out which enabled by Auto-monitor

Signed-off-by: yaojiaqi <yaojiaqi@lixiang.com>
2025-01-12 11:15:42 +08:00
Yanfeng Liu
be40c01ddd nuttx/addrenv.h: revise assembly guard
This allows the header file to be useful from non-C sources such as
assembly code or linker scripts.

Signed-off-by: Yanfeng Liu <p-liuyanfeng9@xiaomi.com>
2025-01-11 18:54:36 +08:00
wangmingrong1
1d8ce18d7f macro/align: Fix ALIGN_UP and ALIGN_DOWN
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2025-01-11 12:13:10 +08:00
hujun5
4bd8d9eac7 sched: remove spin_lock_irqsave(NULL) support
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2025-01-10 22:35:14 +08:00
Huang Qi
cfd0cc0d1a Remove duplicate includes across multiple files
This commit cleans up redundant header file includes throughout the codebase.
 The changes include:

 - Removing duplicate #include directives that were present in the same file
 - Consolidating includes that were split across multiple lines unnecessarily
 - Removing unused includes that were no longer needed
 - Fixing some formatting issues with includes

 The changes improve code organization and maintainability by:
 - Reducing unnecessary dependencies
 - Making include dependencies more explicit
 - Following consistent include patterns
 - Removing dead code

 No functional changes are made - this is purely a code cleanup commit.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2025-01-09 23:30:23 +08:00
wangmingrong1
11d54b34a7 Revert "mm_heap: double malloced memory default alignment (4 -> 8, 8 -> 16)"
This reverts commit 3e971d2e6d.
2025-01-09 00:00:11 +08:00
hujun5
428c2bfb91 Remove duplicate code
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2025-01-08 22:48:12 +08:00