Commit Graph

3556 Commits

Author SHA1 Message Date
v-tangmeng a044d6b2c0 fix the compilation error
error: implicit declaration of function 'nxmutex_lock'

Signed-off-by: v-tangmeng <v-tangmeng@xiaomi.com>
2026-04-21 01:31:49 +08:00
v-tangmeng 71d25d56de fix the compilation error
usbdev/rndis.c: In function 'rndis_allocnetreq':
usbdev/rndis.c:761:10: error: implicit declaration of function 'nxmutex_lock'; did you mean 'net_mutex_lock'? [-Werror=implicit-function-declaration]
  761 |   while (nxmutex_lock(&priv->lock) < 0);
      |          ^~~~~~~~~~~~
      |          net_mutex_lock
usbdev/rndis.c:767:7: error: implicit declaration of function 'nxmutex_unlock' [-Werror=implicit-function-declaration]
  767 |       nxmutex_unlock(&priv->lock);
      |       ^~~~~~~~~~~~~~
usbdev/rndis.c: In function 'usbclass_classobject':
usbdev/rndis.c:2890:3: error: implicit declaration of function 'nxmutex_init'; did you mean 'nxsem_init'? [-Werror=implicit-function-declaration]
2890 |   nxmutex_init(&priv->lock);
     |   ^~~~~~~~~~~~
     |   nxsem_init
usbdev/rndis.c: In function 'usbclass_uninitialize':
usbdev/rndis.c:2939:3: error: implicit declaration of function 'nxmutex_destroy'; did you mean 'nxsem_destroy'? [-Werror=implicit-function-declaration]
2939 |   nxmutex_destroy(&drvr->dev->lock);
     |   ^~~~~~~~~~~~~~~
     |   nxsem_destroy
cc1: all warnings being treated as errors

Signed-off-by: v-tangmeng <v-tangmeng@xiaomi.com>
2026-04-21 01:31:48 +08:00
yangsong8 8521e0be32 driver/usbdev: fix cdcacm wr container missing issue
in cdcacm_sndpacket, If `if (priv->wrcontainer)` is true, then
`priv->wrcontainer` is set to NULL. If an interrupt occurs before
`priv->wrcontainer` is reassigned after being NULL,
`priv->wrcontainer` will be reassigned once during the interrupt,
and `nwrq--` will be called, but no data will be sent at this time.
Only when data is sent by calling `txint` will `priv->wrcontainer`
be reassigned and `nwrq--` called again. This causes the issue.

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2026-04-21 01:30:32 +08:00
yangsong8 d8d1f83a69 driver/usbdev: Fix usbtrace lock unpaired issue
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2026-04-21 01:27:05 +08:00
yangsong8 3a60458988 drivers/usb: use lock to protect reqbuf when cdcacm unbind
When CONFIG_CDCACM_DISABLE_TXBUF is enabled, if the USB is
unplugged during serial data transmission, it is possible
that cdcacm will enter the unbind process, and reqbuf will
be released, causing a crash during serial write.

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2026-04-21 01:26:42 +08:00
yangsong8 52dac29cde Revert "drivers/usbdev: release buf and ep in release function"
When using cdcacm for quick plugging and unplugging, if the software
does not close the serial port in time to release the EP after
unplugging, the EP will not be allocated after plugging in.

This reverts commit 66b3f785fd52e166d077a6715b438ace1d57c30c.

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2026-04-21 01:26:42 +08:00
v-tangmeng 53512876c9 drivers: fix compile error.
error: implicit declaration of function 'enter_critical_section'
[-Werror=implicit-function-declaration]

error: implicit declaration of function 'leave_critical_section'
[-Werror=implicit-function-declaration]

Signed-off-by: v-tangmeng <v-tangmeng@xiaomi.com>
2026-04-21 01:26:11 +08:00
yangsong8 b4ef615ab1 drivers/usbdev: Use small lock to protect usbdev msc
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2026-04-21 01:24:48 +08:00
yangsong8 02c27c2f8e drivers/usbdev: release buf and ep in release function
When CONFIG_CDCACM_DISABLE_TXBUF is enabled, if the USB is
unplugged during serial data transmission, it is possible
that cdcacm will enter the unbind process, and reqbuf will
be released, causing a crash during serial write.

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2026-04-21 01:24:48 +08:00
yangsong8 72a5ff0c2b drivers/usbdev: Use small lock to protect usbdev trace
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2026-04-21 01:24:43 +08:00
yangsong8 8129bd1691 drivers/usbdev: fix usb cdcacm build warning
usbdev/cdcacm.c:371:11: warning: implicit declaration of function 'spin_lock_irqsave' [-Wimplicit-function-declaration]
  371 |   flags = spin_lock_irqsave(&priv->lock);
      |           ^~~~~~~~~~~~~~~~~
usbdev/cdcacm.c:375:3: warning: implicit declaration of function 'spin_unlock_irqrestore' [-Wimplicit-function-declaration]
  375 |   spin_unlock_irqrestore(&priv->lock, flags);
      |   ^~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2026-04-21 01:24:43 +08:00
zhanghongyu ee1dd301d8 drivers/usbdev: replace critical_section with mutex_t
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-04-21 01:24:41 +08:00
zhanghongyu cc04614c7d drivers/usbdev/rndis.c: set netdev running when setconfig
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-04-21 01:24:41 +08:00
zhanghongyu fe348cab52 drivers/usbdev/cdcncm.c: fix build error
/usr/bin/ld: nuttx.rel: in function `cdcncm_classobject':
/home/zhhyu/source/vela/system-dev/nuttx/drivers/usbdev/cdcncm.c:2890: undefined reference to `kmm_zalloc'
/usr/bin/ld: nuttx.rel: in function `cdcmbim_classobject':
/home/zhhyu/source/vela/system-dev/nuttx/drivers/usbdev/cdcncm.c:2966: undefined reference to `kmm_zalloc'
/usr/bin/ld: nuttx.rel: in function `cdcncm_uninitialize':
/home/zhhyu/source/vela/system-dev/nuttx/drivers/usbdev/cdcncm.c:3074: undefined reference to `kmm_free'
/usr/bin/ld: nuttx.rel: in function `cdcmbim_uninitialize':
/home/zhhyu/source/vela/system-dev/nuttx/drivers/usbdev/cdcncm.c:3121: undefined reference to `kmm_free'

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-04-21 01:24:41 +08:00
wangzhi16 fed2785b8c drivers/usbdev: fix compile warning.
CC:  target.c usbdev/cdcncm.c: In function 'cdcncm_classobject':
usbdev/cdcncm.c:2890:10: warning: implicit declaration of function 'kmm_zalloc'; did you mean 'mm_zalloc'? [-Wimplicit-function-declaration]
 2890 |   self = kmm_zalloc(sizeof(struct cdcncm_driver_s));
      |          ^~~~~~~~~~
      |          mm_zalloc
usbdev/cdcncm.c:2890:8: warning: assignment to 'struct cdcncm_driver_s *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
 2890 |   self = kmm_zalloc(sizeof(struct cdcncm_driver_s));
      |        ^
usbdev/cdcncm.c: In function 'cdcmbim_classobject':
usbdev/cdcncm.c:2966:8: warning: assignment to 'struct cdcmbim_driver_s *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
 2966 |   self = kmm_zalloc(sizeof(struct cdcmbim_driver_s));
      |        ^

Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2026-04-21 01:24:33 +08:00
yangsong8 f8c20cc8f2 drivers/usbdev/cdcacm: Fix the issue of missing release one req buf
When unbinding, if a req buf is held by priv->container, it also
needs to be released.

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2026-04-21 01:24:14 +08:00
wangzhi16 5ecf31d7b1 drivers/usbdev: fix compile error.
usbdev/cdcacm.c:757:7: error: implicit declaration of function 'spin_unlock_irqrestrore'; did you mean 'spin_unlock_irqrestore'? [-Werror=implicit-function-declaration]
  757 |       spin_unlock_irqrestrore(&priv->lock, flags);
      |       ^~~~~~~~~~~~~~~~~~~~~~~
      |       spin_unlock_irqrestore

Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2026-04-21 01:24:10 +08:00
wangzhi16 6b02a74ea0 drivers/usbdev: fix compile error.
CC:  libm/lib_frexpf.c usbdev/cdcacm.c: In function 'cdcuart_sendbuf':
usbdev/cdcacm.c:371:11: warning: implicit declaration of function 'spin_lock_irqsave' [-Wimplicit-function-declaration]
  371 |   flags = spin_lock_irqsave(&priv->lock);
      |           ^~~~~~~~~~~~~~~~~
CC:  chip/stm32_allocateheap.c usbdev/cdcacm.c:375:3: warning: implicit declaration of function 'spin_unlock_irqrestore' [-Wimplicit-function-declaration]
  375 |   spin_unlock_irqrestore(&priv->lock, flags);
      |   ^~~~~~~~~~~~~~~~~~~~~~
usbdev/cdcacm.c: In function 'cdcacm_release_rxpending':
usbdev/cdcacm.c:619:11: warning: implicit declaration of function 'spin_lock_irqsave_nopreempt' [-Wimplicit-function-declaration]
  619 |   flags = spin_lock_irqsave_nopreempt(&priv->lock);
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~
CC:  fs_heap.c usbdev/cdcacm.c:680:3: warning: implicit declaration of function 'spin_unlock_irqrestore_nopreempt' [-Wimplicit-function-declaration]
  680 |   spin_unlock_irqrestore_nopreempt(&priv->lock, flags);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: wangzhi16 <wangzhi16@xiaomi.com>
2026-04-21 01:23:28 +08:00
yangsong8 dd5dff9acf drivers/usbdev/mtp: support build usb mtp with cmake
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2026-04-21 01:23:06 +08:00
yangsong8 2feb246672 drivers/usbdev/cdcacm.c: Use small lock to protect cdcacm
Use spin lock to replace enter_critical_section

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2026-04-21 01:22:32 +08:00
yangsong8 193e431241 drivers/usbdev/cdcacm.c: fix check priv->nwrq issue when enable CONFIG_CDCACM_DISABLE_TXBUF
When enable CONFIG_CDCACM_DISABLE_TXBUF, dev->xmit.buffer always
take one req, so just compare CONFIG_CDCACM_NWRREQS - 1.

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2026-04-21 01:22:32 +08:00
yangsong8 6140d22adc drivers/usbdev/cdcacm.c: fix runtime error memcpy para is null
usbdev/cdcacm.c:2974:3: runtime error: null pointer passed as argument 2, which is declared to never be null
    #0 0x44716307 in cdcuart_dmasend usbdev/cdcacm.c:2974

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2026-04-21 01:22:32 +08:00
yangsong8 eec93aed0a driver/usbdev: Use small lock to protect usbdev fs
Use spin lock to replace enter_critical_section

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2026-04-21 01:21:53 +08:00
yangsong8 dda40b5a06 driver/usbdev: Use small lock to protect composite device
Use spin lock to replace enter_critical_section

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2026-04-21 01:21:53 +08:00
yangsong8 8a8e2b6dde driver/serial/cdcacm: config to enable or disable txbuf
To be compatible with the previous method, add a buf between cdcacm
and serial. Because when using usbreqbuf directly as the buf of serial,
the amount of data sent may be insufficient due to the limit of the
number of reqs. For example, when the number of reqs is 4, the number
of data send through cdcacm is 5, and each data is a separate USB
packet, if the host does not read in time, resulting in blocking send.

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2026-04-21 01:21:29 +08:00
yangsong8 8b15ad4b60 driver/serial/cdcacm: config to enable or disable rxbuf
To be compatible with the previous method, add a buf between cdcacm
and serial. Because when using usbreqbuf directly as the buf of serial,
the amount of data received may be insufficient due to the limit of the
number of reqs. For example, when the number of reqs is 4, the number
of data received through cdcacm is 5, and each data is a separate USB
packet, which should require 5 reqs, resulting in the last number not
being received. If the application always waits for 5 numbers before
performing an operation, this will cause problems.

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2026-04-21 01:21:28 +08:00
yangsong8 483dba861f driver/serial/cdcacm: Get the status of rx or tx buf by ioctl
In cdcacm, USB req buf is directly used as serial buf, so the getting
buf status operation in ioctl is different from the original serial.

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2026-04-21 01:21:28 +08:00
yangsong8 2cd0094a26 cdcacm: add disable cdcacm syslog channel function
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2026-04-21 01:16:01 +08:00
yangsong8 9e0b177c60 cdcacm: check present bit
When close the serial tool in PC, only the persent bit is cleared
on Windows and all bits are cleared on linux.

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2026-04-21 01:16:00 +08:00
zhanghongyu 2b444489c7 drivers/usbdev/cdcecm.c: fix cdcecm netdev can not enter running state
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2026-04-21 01:15:55 +08:00
yangsong8 f90a77f764 cdcacm: Reduce one copy of data between serial and cdcacm framework
Data form serial framework will be written to usb reqbuf directly,
and data form cdcacm will be read form reqbuf directly.

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2026-04-21 01:15:29 +08:00
yangsong8 40578732aa syslog: add cdcacm channel
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2026-04-21 01:15:04 +08:00
Alin Jerpelea 75a2b5a5f7 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>
2026-04-21 01:13:35 +08:00
Tim Hardisty 2515e2e6b1 Fix cdcncm printf formatter compiler warning 2026-04-21 01:12:45 +08:00
openvela-robot 77f0bea7f5 Merge branch 'master' into vela
apache/nuttx commit id: eb27ebba8adfe29644a7b890f86e6f16941921dc

Signed-off-by: ligd <liguiding1@xiaomi.com>
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2026-04-21 01:12:27 +08:00
openvela-robot 87c6ff19cf mm: Fix some typos
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2026-04-21 01:12:20 +08:00
openvela-robot b2f5ba0753 syslog: convert \n to \r\n in syslog framework layer
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2026-04-21 01:12:15 +08:00
openvela-robot 24c239f8f5 arm/cmake: fix cmake compile error
1. The -c parameter should not be added during the link phase, otherwise the link will fail.
2. If it is the clang compiler, its toolchain library should use --print-file-name to find it, otherwise an error will occur

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2026-04-21 01:12:09 +08:00
ouyangxiangzhen f06a244c21 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>
2026-04-21 01:12:03 +08:00
openvela-robot 44ed68d400 fs/rpmsgfs: return real err value when open failed
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2026-04-21 01:12:00 +08:00
openvela-robot 85912ed402 syslog/channel: rename syslog_channel() to syslog_channel_register()
Change syslog API naming more reasonable:

1. rename syslog_channel() to syslog_channel_register()
2. rename syslog_channel_remove() to syslog_channel_unregister()

Signed-off-by: chao an <anchao@lixiang.com>
2026-04-21 01:11:54 +08:00
openvela-robot 0fdd165dfa Fix disable msi when msi capability not exist issue
Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
2026-04-21 01:11:48 +08:00
openvela-robot 61f4f9411d openamp: sync with community
Comminity has upgrade the openamp to the last commit (near 2024.05 Release),
sync back to vela.

Only modify the makefile and upgrade the patch, should be no impact in any
features.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2026-04-21 01:11:43 +08:00
openvela-robot 4ea93dbabf add a flag of lin internal sleep/wakeup state
Signed-off-by: wangxiaoxin <wangxiaoxin@xiaomi.com>
2026-04-21 01:11:35 +08:00
openvela-robot 5081b31bd0 cmake(sync):sync CMakeLists.txt conflict of libc with github
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2026-04-21 01:11:30 +08:00
openvela-robot 39fce4b20d arch/x86_64: Resolving NUC Boot Failure Issue
The segment of the Xen PVH boot protocol was not specified during linking and was placed before .loader.text, causing the boot to fail

Signed-off-by: liwenxiang1 <liwenxiang1@xiaomi.com>
2026-04-21 01:11:24 +08:00
openvela-robot d2e613094f arm64/makefile: No longer using hwasan pile insertion
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
2026-04-21 01:11:19 +08:00
openvela-robot a3dd40b0d9 mm: call sched_note within mm lock
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2026-04-21 01:11:12 +08:00
openvela-robot 8b787c52e2 sched: sync minor differences in community code
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2026-04-21 01:11:07 +08:00
openvela-robot bf0c4ea69a libc/modlib: Make modlib selectable from defconfig
since bootloader may call modlib functions directly
to load elf firmware without binfmt, dlfcn or module.

BTW, this patch also remove the duplicated selecttion

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2026-04-21 01:11:02 +08:00