Commit graph

6749 commits

Author SHA1 Message Date
wangmingrong1
75fc19d729 virtio: Fix the problem of incorrect setting of virtio queue address under tags kasan
There is also a printing error due to https://github.com/apache/nuttx/pull/15043:
Configuration/Tool: rv-virt/virt_nsh
In file included from virtio/virtio-mmio.c:29:
virtio/virtio-mmio.c: In function 'virtio_mmio_init_device':
Error: virtio/virtio-mmio.c:826:14: error: format '%d' expects argument of type 'int', but argument 3 has type 'uint32_t' {aka 'long unsigned int'} [-Werror=format=]
  826 |       vrterr("Version %d not supported!\n", vdev->id.version);
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~~~~~~~~~~~~~~
      |                                                     |
      |                                                     uint32_t {aka long unsigned int}
virtio/virtio-mmio.c:826:24: note: format string is defined here
  826 |       vrterr("Version %d not supported!\n", vdev->id.version);
      |                       ~^
      |                        |
      |                        int
      |                       %ld
cc1: all warnings being treated as errors
make[1]: *** [Makefile:109: virtio-mmio.o] Error 1
make[1]: Target 'libdrivers.a' not remade because of errors.

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-12-05 21:23:30 +08:00
hujun5
1ab1dbc0f0 wm8776: use small lock in drivers/audio/wm8776.c
reason:
We hope to remove all instances of spin_lock_irqsave(NULL).

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-12-05 21:22:32 +08:00
zhangyuan29
060fda032b drivers/net: change netdev_lower_quota_load to macro.
Signed-off-by: zhangyuan29 <zhangyuan29@xiaomi.com>
2024-12-05 13:26:22 +08:00
zhangyuan29
dcea1b90e7 arch_atomic: only support atomic_xx and atomic64_xx function
Modify the kernel to use only atomic_xx and atomic64_xx interfaces,
avoiding the use of sizeof or typeof to determine the type of
atomic operations, thereby simplifying the kernel's atomic
interface operations.

Signed-off-by: zhangyuan29 <zhangyuan29@xiaomi.com>
2024-12-04 14:03:14 +01:00
wangmingrong1
eed302b8bb virtio: Add virtio version check
In the source code of qemu or linux, there is a check for the virtio version
/* Check device version */
priv->version = readl(priv->base + VIRTIO_MMIO_VERSION);
if (priv->version < 1 || priv->version > 2) {
	debug("(%s): version %d not supported!\n",
	udev->name, priv->version);
	return 0;
}
/* Check device ID */
uc_priv->device = readl(priv->base + VIRTIO_MMIO_DEVICE_ID);
if (uc_priv->device == 0) {
	/*
	* virtio-mmio device with an ID 0 is a (dummy) placeholder
	* with no function. End probing now with no error reported.
	*/
	return 0;
}

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2024-12-04 19:49:26 +08:00
chao an
93a34b1992 drivers/timers: export arch timer api to support higher resolution
Before:
[  384.149000] [CPU0] [ 5] Hello World!
After:
[  384.149947] [CPU0] [ 5] Hello World!

Signed-off-by: chao an <anchao@lixiang.com>
2024-12-04 10:52:26 +01:00
gaohedong
9fb84700a8 com/can: Remove unnecessary judgment logic
The feature of preventing the same ID frame rotation should be done in the lowerhalf, not in the upperhalf.

Signed-off-by: gaohedong <gaohedong@xiaomi.com>
2024-12-03 08:48:18 +08:00
Jukka Laitinen
140b3080c5 drivers/audio/wm8994.c: Include nuttx/arch.h to fix compilation (up_mdelay prototype)
Fix the compilation error:

  audio/wm8994.c: In function 'wm8994_audio_output':
  Error: audio/wm8994.c:1898:3: error: implicit declaration of function 'up_mdelay' [-Werror=implicit-function-declaration]
   1898 |   up_mdelay(40);
        |   ^~~~~~~~~

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-12-02 13:14:22 +02:00
pengyiqiang
257339a442 video/fb: fix integer overflow issue
Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>
2024-12-02 13:30:50 +08:00
Simon Filgis
6135892d66 driver for STUSB4500
right now it is only possible to change the delivered power on the fly
by
1. selecting PDO2 slot
2. write to POO2
3. renegotiate power delivery by sw reset command
2024-11-30 08:40:08 -03:00
wangjianyu3
5fbf377214 sensors/fakesensor_uorb: Using different nbuffer for each topic of GNSS
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-11-30 14:10:57 +08:00
wangjianyu3
d2dd747e09 drivers/sensors/gnss: Different nbuffer for each topic
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-11-30 14:10:57 +08:00
wangjianyu3
f1a57f4265 drivers/sensors/gnss: Add suffix to macro of geofence index
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-11-30 03:16:25 +08: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
lipengfei28
f589d5a4c7 pci: pci res have pci addr and cpu addr, ecam use map translation pci
addr to cpuaddr

Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-11-29 11:12:54 +08:00
lipengfei28
b44fb53b61 pci:map bar should not be zaro len
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-11-29 11:12:54 +08:00
lipengfei28
c2cd503f66 pci: add /dev/pci,used for pciutils
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-11-29 11:12:54 +08:00
simbit18
9c9b945876 fix nxstyle
Removed extra spaces from .h and .c files
2024-11-28 20:40:13 +08:00
zhanghongyu
ba419cc894 drivers/net/{e1000|igc}: limit no packet is transmit after carrier off
if the drvier tx queue is full up during the network cable unplugging,
there will be no txdone interrupt after inserting the network cable,
transmit cannot be recovered.

Modified to no longer fill the driver with packet when link down.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-11-27 02:46:04 +08:00
p-szafonimateusz
0932fccfb2 drivers/net/{e1000|igc}: reset TX ring when disconnected
drivers/net/{e1000|igc}: reset TX ring when disconnected

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-11-27 02:46:04 +08:00
p-szafonimateusz
ada47439bd drivers/net/{e1000|igc}: fix link status crash
netdev_lower_carrier_xxx API can't be used in interrupt context

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-11-27 02:46:04 +08:00
p-szafonimateusz
5e48f2a3d8 drivers/net/igc: make Interrupt Throttle configurable
make Interrupt Throttle configurable for igc

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-11-27 02:46:04 +08:00
p-szafonimateusz
bf4eadf735 drivers/net/{e1000|igc}: configure RX/TX descriptors from Kconfig
configure E1000/IGC RX/TX descriptors from Kconfig

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-11-27 02:46:04 +08:00
Xiang Xiao
573115734d Revert "drivers/pipes: return after short write if buffer is full"
This reverts commit d0680fd1bc.
2024-11-26 11:08:02 -03:00
hujun5
eb65c5a8cd note: Remove enter_critical_section from the sched_note module to avoid recursive calls.
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-11-26 10:14:02 +08:00
chao an
6ffb001fdf spelling: fix spelling typo premption -> preemption
Signed-off-by: chao an <anchao@lixiang.com>
2024-11-25 22:05:05 +08:00
simbit18
7df0e945ad Fix Kconfig style
Remove spaces from Kconfig files
Add TABs
Replace help => ---help---
Remove extra TABs
Add comments
2024-11-20 16:45:40 -03:00
Huang Qi
fd1b52579b Fix some minor style issues
Fix typo and comment style in:
* audio/audio_comp.c
* drivers/drivers_initialize.c
* drivers/pipes/fifo.c

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2024-11-20 10:51:07 +01:00
liamHowatt
27e587b179 arch/esp32s3: fb add pandisplay
Signed-off-by: liamHowatt <liamjmh0@gmail.com>
2024-11-19 20:51:50 +08:00
YAMAMOTO Takashi
aa8aa444c2 drivers/syslog/syslog_channel.c: remove a duplicated comment 2024-11-18 19:10:24 +08:00
buxiasen
f0185cf4db Revert "drivers/pm: pm_smp remove sched_lock"
Now we already support sched_lock for per cpu/tcb

This reverts commit 731af5b42f.
2024-11-18 19:10:14 +08:00
YAMAMOTO Takashi
637a0f5af2 SYSLOG_DEFAULT: avoid using critical section in certain cases
Note that SYSLOG_DEFAULT can be used in extreme situations,
including very early in the boot.
2024-11-18 13:52:53 +08:00
YAMAMOTO Takashi
b990b25b8e Reapply "SYSLOG_DEFAULT: wrap up_putc/up_nputs calls with critical section"
This reverts commit 35240d77fa.
2024-11-18 13:52:53 +08:00
p-szafonimateusz
1b303c2888 drivers/reset/core.c: fix gcc14 error
Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-11-17 08:31:08 -03:00
Xiang Xiao
50de39acd5 note/noteram_driver: Remove the unused variable j
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-11-17 08:31:08 -03:00
Xiang Xiao
72fbbbdbf3 sensors/bmi160_uorb.c: Fix the typo error
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-11-17 08:31:08 -03:00
Xiang Xiao
2c9d412d1c serial/pci: Remove the product specific config
since the driver could detect them automatically

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-11-17 08:40:26 +01:00
Xiang Xiao
d7209fabf4 pci: Remove igc produt config
to simplify the configuration since the driver could detect the device correctly

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-11-17 08:40:26 +01:00
yezhonghui
775ff286a4 pci e1000 net delete produce config
Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
2024-11-17 08:40:26 +01:00
Bowen Wang
eede50f465 pci_ivshmem: return back to polling mode when interrupt mode invalid
Improve the pci ivshmem device compatibility, do not return error when
irq mode init failed, fallback to the polling mode as mush as possible.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-11-17 08:40:26 +01:00
Xiang Xiao
87d57d283e Fix timers/arch_alarm.c:109:3: error: 'now' may be used uninitialized
and timers/arch_alarm.c:150:51: error: 'ticks' may be used uninitialized

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-11-16 17:41:15 +01:00
Xiang Xiao
f2693004b8 drivers/adc: Rename up_ads1255initialize to ads1255_initialize
since the common driver shouldn't have the prefix 'up_'

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-11-16 17:39:27 +01:00
chao an
238cddde3a drivers/syslog: remove implement of syslog_putc()
syslog_putc() have a lot of duplicate logic with syslog_write().
remove syslog_putc() and reuse syslog_write() to simplify syslog printing.

Signed-off-by: chao an <anchao@lixiang.com>
2024-11-15 19:46:36 +08:00
chao an
5cc5decd64 can/sja100: leave critical section properly
leave critical section properly before return

Signed-off-by: chao an <anchao@lixiang.com>
2024-11-15 18:24:51 +08:00
buxiasen
f1e1aab3b7 segger/stream_rtt: fix warning after stream update
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-11-15 15:54:26 +08:00
Yongrong Wang
07c986905d sim/configs/rpserver/rpproxy_virtio: Change the sim 32bit to 64bit compilation
1.macOS doesn't support 32bit anymore(CONFIG_SIM_M32=y)
2.fix b4bit compile warning:
CC:  ioexpander/ioe_rpmsg.c ioexpander/ioe_rpmsg.c:368:14: warning:
cast to 'void *' from smaller integer type 'int' [-Wint-to-void-pointer-cast]
      return (FAR void *)(ret + 1);
             ^~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
2024-11-15 14:01:11 +08:00
raiden00pl
547cbf3ba6 drivers/sensors: fix style issues in function headers
fix style issues in function headers, add missing new lines
2024-11-15 01:04:10 +08:00
raiden00pl
6fcfe7cf03 drivers/pci: fix style issues in function headers
fix style issues in function headers, add missing new lines
2024-11-15 01:04:10 +08:00
fangpeina
66976c46ba drivers/input: fix compliation warn in aw86225
input/aw86225.c: In function 'aw86225_ram_work_routine':
input/aw86225.c:1976:27: warning: 'rtp_file.data' may be used uninitialized [-Wmaybe-uninitialized]
 1976 |   struct aw86225_firmware rtp_file;
      |                           ^~~~~~~~
In function 'aw86225_ram_loaded',
    inlined from 'aw86225_ram_work_routine' at input/aw86225.c:1982:3:
input/aw86225.c:1445:17: warning: 'rtp_file.size' may be used uninitialized [-Wmaybe-uninitialized]
 1445 |   for (i = 2; i < cont->size; i++)
      |               ~~^~~~~~~~~~~~
input/aw86225.c: In function 'aw86225_ram_work_routine':
input/aw86225.c:1976:27: note: 'rtp_file.size' was declared here
 1976 |   struct aw86225_firmware rtp_file;

Signed-off-by: fangpeina <fangpeina@xiaomi.com>
2024-11-14 23:35:07 +08:00
fangpeina
3518c69e6c input/ff: extend ioctrl to support factory calibration
Signed-off-by: fangpeina <fangpeina@xiaomi.com>
2024-11-14 23:35:07 +08:00
fangpeina
dcf6dd8c8b drivers/input: fix the issue of unable to replay in RTP mode
Signed-off-by: fangpeina <fangpeina@xiaomi.com>
2024-11-14 23:35:07 +08:00
fangpeina
a719db1b58 drivers/input: support RTP file simulation in RAMLOOP mode
For resource-constrained devices, simulate RTP
playback effects using preset custom RAMLOOP
combinations instead of using RTP files to play
custom vibration effects.

Signed-off-by: fangpeina <fangpeina@xiaomi.com>
2024-11-14 23:35:07 +08:00
Michal Lenc
ec243f0f6b icjx: disable interrupts in interrupt worker
Interrupts have to be disabled if interrupt worker processes them,
otherwise assertion may occur as another interrupt tries to queue
worker that is not available (because it processes previous interrupts).
Interrupts are re-enabled after the worker leaves the loop processing
previous interrupts.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2024-11-14 01:16:48 +08:00
YAMAMOTO Takashi
35240d77fa Revert "SYSLOG_DEFAULT: wrap up_putc/up_nputs calls with critical section"
This reverts commit f2aeb5e56f.

Because regressions are reported:
* https://github.com/apache/nuttx/pull/14722#issuecomment-2470710236
* https://github.com/apache/nuttx/pull/14722#issuecomment-2470778673
* https://github.com/apache/nuttx/issues/14749
2024-11-13 11:15:34 +08:00
xuxin19
ac39d087f5 cmake(bugfix):add missing driver/serial CMake build source
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-11-13 02:36:18 +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
chenrun1
2cf26036a5 Use lib_get_pathbuffer instead of stack variables
Summary:
  Modified the usage logic, mainly introduced lib_get_pathbuffer and lib_put_pathbuffer

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-11-12 17:21:42 +08:00
rongyichang
d73815e3e9 drivers/misc: fix rpmsg dev poll assert crash
when client read and poll wait buffer from server side and server side may
poll notify more than one times, then rpmsgdev in client side will call
"rpmsgdev_poll_setup(priv, 0, false);" twice which will cause crash in
vela rpmsgdev_server.c

Signed-off-by: rongyichang <rongyichang@xiaomi.com>
2024-11-12 14:58:53 +08:00
chenrun1
0bad7f814a rammtd:add rammtd_uninitialize
Summary:
  Added rammtd_uninitialize to manage rammtd

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-11-12 14:58:01 +08:00
rongyichang
ee6e62c3ce drivers/misc: fix rpmsgdev read overflow
the msg count is not changed while iov len is increased.
which may cause the buffer reply by server is bigger than
msg count

Signed-off-by: rongyichang <rongyichang@xiaomi.com>
2024-11-12 14:56:52 +08:00
YAMAMOTO Takashi
f2aeb5e56f SYSLOG_DEFAULT: wrap up_putc/up_nputs calls with critical section
This would avoid the undesirable intertactions with the serial driver
described in https://github.com/apache/nuttx/issues/14662.

Although I'm not entirely happy with this fix because it assumes
the particular implementations of up_putc/up_nputc and its association
to the serial devices, I haven't come up with better ideas for now.

An alternative is to place some serializations inside the target
specific serial (and/or whatever provides up_putc api) implementaitons.
But it isn't too attractive to put potentially complex logic into the
low-level machinaries, especially when we have a lot of similar copies
of it.

Another alternative is to deprecate up_putc. (at least for the purpose
of syslog.) But it seems at least some of users are relying on what
the current implementation provides heavily.

This commit also removes g_lowputs_lock because the critical section
would serve the purpose of the lock as well.
2024-11-12 09:49:57 +08:00
Andre Heinemans
4a6548e2d8 crypto/se05x: Allow set_enable_pin to be NULL and fix error handling
- set_enable_pin can be set to NULL when the enable
  pin(ENA) of the SE05x cannot be controlled

- Fixed error handling in se05x_register()
2024-11-07 11:37:58 +08:00
Karel Kočí
d0680fd1bc drivers/pipes: return after short write if buffer is full
The write should return even in case of O_NONBLOCK if at least some
bytes were written.

The previous state where always all bytes were written was breaking a
common combination with poll, because poll would signal POLLOUT and some
bytes would really be consumed but write could still block afterwards.
That would prevent from execution returning to the poll loop again.

None the less it is also the standard C library behavior for the write
function.
2024-11-07 01:10:20 +08:00
Alin Jerpelea
35d8e1ed61 drivers/rf: migrate license to ASF
Augusto Fraga Giachero has sumitted the ICLA and the license can be
replaced by the ASF License

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2024-11-06 19:46:13 +08:00
Alin Jerpelea
70c3e46ef6 drivers/sensors/adt7320 : migrate license to ASF
Augusto Fraga Giachero has sumitted the ICLA and the license can be
replaced by the ASF License

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2024-11-06 19:46:13 +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
huangcaihua
56f292fcfa Enable DEV_PIPE_NPOLLWAITERS default value 4 for adapte APP
Such as DBus, it maybe more than 1 thread to poll one dev, if that will make poll fail

Signed-off-by: huangcaihua <huangcaihua@xiaomi.com>
2024-11-05 20:10:49 +08:00
ouyangxiangzhen
5450b50951 net/igc: Support Intel I226V.
This commit supported Intel I226V.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2024-11-05 14:03:02 +08:00
Xiang Xiao
bce5dee0da Fix error: implicit declaration of function 'up_mdelay'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-11-03 21:08:50 +08:00
raiden00pl
6ba8c1e9f9 cmake: don't include syslog files if CONFIG_SYSLOG=n
don't include syslog files if CONFIG_SYSLOG=n
2024-11-03 20:54:49 +08:00
hujun5
a1bb967941 remove nxsched_lock_irq/nxsched_unlock_irq
reason:
nxsched_lock_irq has the same functionality as sched_lock

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-11-03 16:00:17 +08:00
Xiang Xiao
c5381c3eb2 Replace __attribute__((packed)) with [begin|end]_packed_struct
since the different compiler express the packed structure in the different way
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-11-03 10:20:38 +08:00
ouyangxiangzhen@xiaomi.com
b5a215879c drivers: Fix the missing headers.
This commit added the missing headers for some drivers.

Signed-off-by: ouyangxiangzhen@xiaomi.com <ouyangxiangzhen@xiaomi.com>
2024-11-02 09:23:46 -03: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
Xiang Xiao
32784b0898 libc: Refine the arc4random_buf implementation
fill the buffer with getrandom instead random pool
and move the implementation to from crypto to libc

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-26 18:04:21 -03:00
chao an
c6591c0f49 driver/serial: remove return value of up_putc()
modify the prototype of up_putc(): remove the return value

The architecture code does not care about the return value of up_putc(), so removing it saves two statements:

Before:                                                    After:
de4c: e52de004  push  {lr}    @ (str lr, [sp, #-4]!)    |  de4c: e52de004  push  {lr}    @ (str lr, [sp, #-4]!)
de50: e24dd014  sub sp, sp, #20                         |  de50: e24dd014  sub sp, sp, #20
de54: e58d0004  str r0, [sp, #4]                        |  de54: e58d0004  str r0, [sp, #4]
de58: e30030f8  movw  r3, #248  @ 0xf8                  |  de58: e30030f8  movw  r3, #248  @ 0xf8
de5c: e3423000  movt  r3, #8192 @ 0x2000                |  de5c: e3423000  movt  r3, #8192 @ 0x2000
de60: e58d300c  str r3, [sp, #12]                       |  de60: e58d300c  str r3, [sp, #12]
de64: e59d1004  ldr r1, [sp, #4]                        |  de64: e59d1004  ldr r1, [sp, #4]
de68: e59d000c  ldr r0, [sp, #12]                       |  de68: e59d000c  ldr r0, [sp, #12]
de6c: ebfffe66  bl  d80c <pl011_putc>                   |  de6c: ebfffe66  bl  d80c <pl011_putc>
de70: e59d3004  ldr r3, [sp, #4]                        |  de70: e28dd014  add sp, sp, #20
de74: e1a00003  mov r0, r3                              |  de74: e49df004  pop {pc}    @ (ldr pc, [sp], #4)
de78: e28dd014  add sp, sp, #20                         |
de7c: e49df004  pop {pc}    @ (ldr pc, [sp], #4)        |

Signed-off-by: chao an <anchao@lixiang.com>
2024-10-26 13:21:29 +08:00
Tim Hardisty
bc0f90659f Fix cdcncm printf formatter compiler warning 2024-10-25 00:52:29 +08:00
zhangshoukui
1af82ba979 mmcsd: SDIO_CAPS_4BIT_ONLY set buswidth MMCSD_SCR_BUSWIDTH_4BIT
uint8_t buswidth:4;              /* Bus widths supported (SD only) */

Signed-off-by: zhangshoukui <zhangshoukui@xiaomi.com>
2024-10-24 18:06:22 +08:00
anjiahao
f307c1587c serial/gdbstub:Adjust serial port gdbstub Kconfig dependencies
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-24 08:45:21 +08:00
Ville Juven
7a137f0353 syslog: Don't allow blocking when in signal handler
Blocking while running a signal handler is not advisable, instead write
the log string character by character.

There is also a potential for a deadlock, as discussed in #6618

Note: querying for rtcb->sigdeliver is not 100% ideal, as it only tells
_if_ a signal handler has been queued, not if it is running. However, it
makes syslog safe / usable which is a debug feature anyhow.
2024-10-23 21:14:44 +08:00
ligd
662bbeb33e container_of: fix compile failed cause of list.h not support container_of
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-23 20:10:43 +08:00
ligd
4845b9e6e5 bluetooth: fix bt missing header files nuttx/wqueue.h
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-23 20:10:43 +08:00
Jukka Laitinen
1a267dc62d drivers/timers/arch_alarm.c: Remove ndelay_accurate
Using ONESHOT_CURRENT retrieves the tick number multiplied by tick time; thus
it doesn't give the accurate monotonic time - it is quantized by
the tick time. This cannot be used as a ndelay timer, it would always loop
at least to the end of the ongoing tick.

Revert the up_udelay to use the original "coarse" looping. The "accurate" udelay,
if such is needed, should either be done under arch specific code, or there should be
a function for getting the accurate time that is available for all the platforms.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-10-23 14:28:18 +08:00
simbit18
a5f8dfdae0 Fix Kconfig style
Remove spaces from Kconfig files
Add TABs
2024-10-22 23:20:46 +08:00
Matteo Golin
bbc95d70db adc: Implement ADC driver interface for MCP3008 over SPI. Includes documentation page for the driver, and inclusion of driver registration code for RP2040-based boards. 2024-10-22 13:56:23 +08:00
Bowen Wang
71fe4acef4 MacOs: fix the sim compile warning in MacOS
CC:  clk/clk_fixed_rate.c clk/clk_divider.c:177:14: warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value]
      return abs(rate - now) < abs(rate - best);
             ^
clk/clk_divider.c:177:14: note: remove the call to 'abs' since unsigned values cannot be negative
      return abs(rate - now) < abs(rate - best);
             ^~~
clk/clk_divider.c:177:32: warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value]
      return abs(rate - now) < abs(rate - best);
                               ^
clk/clk_divider.c:177:32: note: remove the call to 'abs' since unsigned values cannot be negative
      return abs(rate - now) < abs(rate - best);
                               ^~~
CC:  mm_heap/mm_initialize.c 2 warnings generated.
clk/clk.c:1324:11: warning: variable 'irqflags' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
      if (clk->parents == NULL)
          ^~~~~~~~~~~~~~~~~~~~
clk/clk.c:1341:19: note: uninitialized use occurs here
  clk_list_unlock(irqflags);
                  ^~~~~~~~
clk/clk.c:1324:7: note: remove the 'if' if its condition is always false
      if (clk->parents == NULL)
      ^~~~~~~~~~~~~~~~~~~~~~~~~
clk/clk.c:1255:22: note: initialize the variable 'irqflags' to silence this warning
  irqstate_t irqflags;
                     ^
                      = 0
CC:  clk/clk_mux.c clk/clk_multiplier.c:110:14: warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value]
      return abs(rate - new) < abs(rate - best);
             ^
clk/clk_multiplier.c:110:14: note: remove the call to 'abs' since unsigned values cannot be negative
      return abs(rate - new) < abs(rate - best);
             ^~~
clk/clk_multiplier.c:110:32: warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value]
      return abs(rate - new) < abs(rate - best);
                               ^
clk/clk_multiplier.c:110:32: note: remove the call to 'abs' since unsigned values cannot be negative
      return abs(rate - new) < abs(rate - best);
                               ^~~
clk/clk_mux.c:47:14: warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value]
      return abs(now - rate) < abs(best - rate);
             ^
clk/clk_mux.c:47:14: note: remove the call to 'abs' since unsigned values cannot be negative
      return abs(now - rate) < abs(best - rate);
             ^~~
clk/clk_mux.c:47:32: warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value]
      return abs(now - rate) < abs(best - rate);
                               ^
clk/clk_mux.c:47:32: note: remove the call to 'abs' since unsigned values cannot be negative
      return abs(now - rate) < abs(best - rate);
                               ^~~
AS:  sim/sim_fork_x86.S 2 warnings generated.
1 warning2 warnings generated.
 generated.
iperf.c:325:14: warning: format specifies type 'uintmax_t' (aka 'unsigned long long') but the argument has type 'unsigned long' [-Wformat]
             now_len -last_len,
             ^~~~~~~~~~~~~~~~~
iperf.c:340:14: warning: format specifies type 'uintmax_t' (aka 'unsigned long long') but the argument has type 'uintmax_t' (aka 'unsigned long') [-Wformat]
             now_len,
             ^~~~~~~
CC:  misc/rpmsgblk_server.c 2 warnings generated.
:28: warning: format specifies type 'uintmax_t' (aka 'unsigned long long') but the argument has type 'uintmax_t' (aka 'unsigned long') [-Wformat]
                           (uintmax_t)skip);
                           ^~~~~~~~~~~~~~~
nsh_dbgcmds.c:473:20: warning: format specifies type 'uintmax_t' (aka 'unsigned long long') but the argument has type 'uintmax_t' (aka 'unsigned long') [-Wformat]
                   (uintmax_t)position);
                   ^~~~~~~~~~~~~~~~~~~
CC:  nsh_main.c 2 warnings generated.

              return INTMAX_MIN;
              ~~~~~~ ^~~~~~~~~~
CC:  nsh_system.c  note: expanded from macro 'INTMAX_MIN'
                            ^~~~~~~~~
/Users/vela/work/nuttx/include/stdint.h:65:41: note: expanded from macro 'INT64_MIN'
                             ~~~~~~~~~~~^~~
inttypes/lib_strtoimax.c:103:37: warning: implicit conversion from 'long long' to 'intmax_t' (aka 'long') changes value from -9223372036854775808 to 0 [-Wconstant-conversion]
          return (accum == limit) ? INTMAX_MIN : -(intmax_t)accum;
          ~~~~~~                    ^~~~~~~~~~
/Users/vela/work/nuttx/include/stdint.h:136:29: note: expanded from macro 'INTMAX_MIN'
                            ^~~~~~~~~
/Users/vela/work/nuttx/include/stdint.h:65:41: note: expanded from macro 'INT64_MIN'
                             ~~~~~~~~~~~^~~
inttypes/lib_strtoimax.c:106:17: warning: result of comparison of constant 9223372036854775807 with expression of type 'uintmax_t' (aka 'unsigned long') is always false [-Wtautological-constant-out-of-range-compare]
      if (accum > INTMAX_MAX)
          ~~~~~ ^ ~~~~~~~~~~
inttypes/lib_strtoimax.c:109:18: warning: implicit conversion from 'long long' to 'intmax_t' (aka 'long') changes value from 9223372036854775807 to -1 [-Wconstant-conversion]
          return INTMAX_MAX;
          ~~~~~~ ^~~~~~~~~~
/Users/vela/work/nuttx/include/stdint.h:137:29: note: expanded from macro 'INTMAX_MAX'
                            ^~~~~~~~~
/Users/vela/work/nuttx/include/stdint.h:66:29: note: expanded from macro 'INT64_MAX'
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/vela/work/nuttx/include/arch/inttypes.h:35:23: note: expanded from macro 'INT64_C'
                      ^~~~~~~
<scratch space>:12:1: note: expanded from here
9223372036854775807ll
^~~~~~~~~~~~~~~~~~~~~
syslog/vsyslog.c:212:32: warning: format specifies type 'uintmax_t' (aka 'unsigned long long') but the argument has type 'uintmax_t' (aka 'unsigned long') [-Wformat]
                             , (uintmax_t)ts.tv_sec
                               ^~~~~~~~~~~~~~~~~~~~
CC:  iob/iob_free.c 4 warnings generated.
1 warning generated.
CC:  mqueue/mq_msgqalloc.c inttypes/lib_strtoumax.c:91:23: warning: implicit conversion from 'unsigned long long' to 'uintmax_t' (aka 'unsigned long') changes value from 18446744073709551615 to 4294967295 [-Wconstant-conversion]
              accum = UINTMAX_MAX;
                    ~ ^~~~~~~~~~~
/Users/vela/work/nuttx/include/stdint.h:140:29: note: expanded from macro 'UINTMAX_MAX'
                            ^~~~~~~~~~
/Users/vela/work/nuttx/include/stdint.h:67:29: note: expanded from macro 'UINT64_MAX'
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/vela/work/nuttx/include/arch/inttypes.h:36:23: note: expanded from macro 'UINT64_C'
                      ^~~~~~~~
<scratch space>:8:1: note: expanded from here
18446744073709551615ull
^~~~~~~~~~~~~~~~~~~~~~~
CC:  icmp/icmp_ioctl.c 1 warning generated.
time/lib_strftime.c:584:52: warning: format specifies type 'uintmax_t' (aka 'unsigned long long') but the argument has type 'uintmax_t' (aka 'unsigned long') [-Wformat]
               len = snprintf(dest, chleft, "%ju", (uintmax_t)mktime(&tmp));
                                             ~~~   ^~~~~~~~~~~~~~~~~~~~~~~
                                             %ju

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-22 08:55:57 +08:00
Bowen Wang
320b1b8011 rpmsg_virtio: move notify_wait_cb to struct rpmsg_virtio_device
notify_wait_cb has been moved to struct rpmsg_virtio_device, so
change rpmsg_virtio.c transport too.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-22 08:55:57 +08:00
buxiasen
ed14c1d3a6 rpmsg/virtio: fix compile issue, feature uint32_t to uint64_t
Has change the virtio feature bit to 64bit, so rpmsg virtio need
change to 64bit too.

Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-10-22 08:55:57 +08:00
yangsong8
e00fbc5557 syslog: enable LF to CRLF config as default
This commit fixes the issue #14418

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-10-21 10:50:36 +02:00
Xiang Xiao
8c882cb790 ramlog: Remove RAMLOG_CRLF config and related code
since the conversion is moved to common layer after:
https://github.com/apache/nuttx/pull/14362

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-21 16:27:35 +08:00
yezhonghui
317d7a7f59 Fix make warn as error in pci drivers
Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
2024-10-21 15:35:39 +08:00
wanggang26
adc52bf968 syslog: fix ramlog not work issue with cmake
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2024-10-19 12:37:07 +02:00
chao an
68d6b18f9a drivers/misc/devmem: add dev_mem.c into cmake build
Signed-off-by: chao an <anchao@lixiang.com>
2024-10-18 21:32:48 +08:00
chao an
11af0e476f drivers/misc/devmem: remove unnecessary register parser
Signed-off-by: chao an <anchao@lixiang.com>
2024-10-18 21:32:48 +08:00
zhangshoukui
a7f7afe019 bmi160: fix Parameter passing error when use spi
nuttx/drivers/sensors/bmi160_uorb.c:596:18: warning: passing argument 1 of ‘bmi160_getreg8’ from incompatible pointer type [-Wincompatible-pointer-types]
  596 |   bmi160_getreg8(priv, 0x7f);
      |                  ^~~~
      |                  |
      |                  struct bmi160_dev_uorb_s *
In file included from nuttx/drivers/sensors/bmi160_uorb.c:25:
nuttx/drivers/sensors/bmi160_base.h:235:49: note: expected ‘struct bmi160_dev_s *’ but argument is of type ‘struct bmi160_dev_uorb_s *’
  235 | uint8_t bmi160_getreg8(FAR struct bmi160_dev_s *priv, uint8_t regaddr);
      |                            ~~~~~~~~~~~~~~~~~~~~~^~~~
nuttx/drivers/sensors/bmi160_uorb.c:597:18: warning: passing argument 1 of ‘bmi160_getreg8’ from incompatible pointer type [-Wincompatible-pointer-types]
  597 |   bmi160_getreg8(priv, 0x7f); /* workaround: fail to switch SPI, run twice */
      |                  ^~~~
      |                  |
      |                  struct bmi160_dev_uorb_s *

Signed-off-by: zhangshoukui <zhangshoukui@xiaomi.com>
2024-10-18 19:58:22 +08:00
zhangshoukui
50f16c840c bmi160: fix compile warning and %zu replace %u
VELAPLATFO-45270

nuttx/drivers/sensors/bmi160.c: In function ‘bmi160_set_normal_imu’:
nuttx/drivers/sensors/bmi160.c:79:3: warning: implicit declaration of function ‘up_mdelay’ [-Wimplicit-function-declaration]
   79 |   up_mdelay(30);
      |   ^~~~~~~~~

Signed-off-by: zhangshoukui <zhangshoukui@xiaomi.com>
2024-10-18 19:58:22 +08:00
lipengfei28
e259aba31c fix build error shift-count-overflow
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-10-18 17:23:41 +08:00
Xiang Xiao
24cb8c25ab bluetooth: Fix the incompatibility made by https://github.com/apache/nuttx/pull/14224
that pr requires chip turn on CONFIG_DRIVERS_BLUETOOTH to use bluetooth,
but not all defconig enable this option, so let's map bt_driver_register
to bt_netdev_register in header file in this case, and revert the unnessary
change in the related chip and board folders.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-18 09:05:54 +08:00
jihandong
d802912cba nuttx ai driver update
Signed-off-by: jihandong <jihandong@xiaomi.com>
2024-10-17 22:35:40 +08:00