Commit Graph

55163 Commits

Author SHA1 Message Date
dongjiuzhu1 190fdd18e2 misc/rpmsgdev: get battery info by rpmsgdev
read battery info register by other core

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-28 19:09:54 +08:00
dongjiuzhu1 22c4a82fa3 rpmsgdev:add support FIOC_FILEPATH for rpmsgdev_ioctl
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-28 19:09:54 +08:00
hujun5 64ebb149c6 syscall: Use a more compatible writing style
compile error:
Register: ostest
Register: nsh
Register: sh
Register: hello
Register: getprime
In file included from /home/hujun5/downloads1/vela_sim/nuttx/include/arch/irq.h:35,
                 from /home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/irq.h:37,
                 from /home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/sched.h:40,
                 from /home/hujun5/downloads1/vela_sim/nuttx/include/nuttx/arch.h:87,
                 from common/arm_signal_dispatch.c:26:
common/arm_signal_dispatch.c: In function 'up_signal_dispatch':
common/arm_signal_dispatch.c:72:3: error: 'asm' operand has impossible constraints
   72 |   sys_call4(SYS_signal_handler, (uintptr_t)sighand, (uintptr_t)signo,
      |   ^~~~~~~~~
make[1]: *** [Makefile:168:arm_signal_dispatch.o] error 1

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-28 19:08:15 +08:00
hujun5 4c69bb8cc7 arch: inline up_switch_context,in arm arm64
reason:
when a context switch occurs, up_switch_context is executed.
In order to reduce the time taken for context switching,
we inline the up_switch_context function.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-28 19:08:15 +08:00
raiden00pl e7c9e46eb2 Documentation: port "Device Drivers vs. Bus Drivers and GPIO Drivers" from wiki
port page from wiki:
https://cwiki.apache.org/confluence/display/NUTTX/Device+Drivers+vs.+Bus+Drivers+and+GPIO+Drivers
2024-09-28 19:06:30 +08:00
raiden00pl 45a53f0079 Documentation: migrate pages from wiki
migrate pages:
https://cwiki.apache.org/confluence/display/NUTTX/Driver+Types
https://cwiki.apache.org/confluence/display/NUTTX/Upper+Half+and+Lower+Half+Drivers

and combine them into one page because they describe a similar topic
2024-09-28 19:06:30 +08:00
yezhonghui f81c844685 arm64 support gicv2m for pci irq
Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
2024-09-28 16:09:11 +08:00
wangchen 48ecb6f922 devif:fix issue about devif_callback being released wrongly,resulting in no access to it
Signed-off-by: wangchen <wangchen41@xiaomi.com>
2024-09-28 16:06:36 +08:00
chenxiaoyi 065046b2a2 serial: use hostfs read/write on stdio as uart
This is used to implement serial console on instruction set simulator (ISS).

Signed-off-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
2024-09-28 13:53:06 +08:00
chenxiaoyi b6225676f4 xtensa: hostfs: handle nonblock open for iss
Signed-off-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
2024-09-28 13:53:06 +08:00
dongjiuzhu1 0fb1dc2b93 drivers/pipes: using rmutex to protect pipe and avoid deadlock
nxsem_wait
nuttx/sched/semaphore/sem_wait.c:176
nxmutex_lock
nuttx/libs/libc/misc/lib_mutex.c:204 (discriminator 2)
pipecommon_write
nuttx/drivers/pipes/pipe_common.c:538 (discriminator 2)
file_write
nuttx/fs/vfs/fs_write.c:91
write
nuttx/include/unistd.h:523 (discriminator 2)
nxsig_deliver
nuttx/sched/signal/sig_deliver.c:170 (discriminator 4)
arm_sigdeliver
nuttx/arch/arm/src/armv7-a/arm_sigdeliver.c:107
irq_waitlock
nuttx/sched/irq/irq_csection.c:204
nxsem_post
nuttx/sched/semaphore/sem_post.c:86 (discriminator 2)
nxmutex_unlock
nuttx/libs/libc/misc/lib_mutex.c:339 (discriminator 2)
pipecommon_poll
nuttx/drivers/pipes/pipe_common.c:769
file_poll
nuttx/fs/vfs/fs_poll.c:321
poll_fdsetup
nuttx/fs/vfs/fs_poll.c:194
poll
nuttx/include/sys/poll.h:164
uv_run
apps/system/libuv/libuv/src/unix/core.c:449
adb_hal_run
apps/system/adb/microADB/hal/hal_uv.c:76
adbd_main
apps/system/adb/adb_main.c:157
nxtask_startup
nuttx/libs/libc/sched/task_startup.c:70 (discriminator 2)
nxtask_start
nuttx/sched/task/task_start.c:134

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-28 13:50:21 +08:00
yezhonghui 786dabfb13 QemuEPC multi function verify for pci
Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
2024-09-28 13:39:50 +08:00
yezhonghui db19d00e64 QemuEPC support multi function for pci device
Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
2024-09-28 13:39:50 +08:00
Tomashevskiy b5382234cc weact stm32h743vit6 usbconsole fix
fix previous problemc

added defconfig for weact-stm32h743:nshusb

board.h
Wrong column position or missing blank line before comment: FIX

hopefully last commit
2024-09-28 13:36:34 +08:00
Yongrong Wang fa6d41471f arm_gicv2.c: fix armv7a compile error
/vela/nuttx/drivers/pci/pci_ecam.c:432:(.text.pci_ecam_get_irq+0x16): undefined reference to `up_get_legacy_irq'

Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
2024-09-28 13:34:33 +08:00
lipengfei28 30be81add6 arm64 pci legacy irq do not support yet
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-09-28 13:34:33 +08:00
lipengfei28 39ec3291ee armv7a pci irq support
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-09-28 13:34:33 +08:00
Bowen Wang 0e3a96a398 include/pci.h: sync the subvendor/subdevice type in id table and pci_device_s
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-09-28 13:34:33 +08:00
Bowen Wang 6d4cab62fd pci/pci_ecam: add read_io/write_io for pci ecam
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-09-28 13:34:33 +08:00
yezhonghui f6db814804 pci: add pci endpoint test driver
Signed-off-by: yezhonghui <yezhonghui@xiaomi.com>
2024-09-28 13:13:37 +08:00
yangguangcai 9a84484df5 capture:add multiple register.
Signed-off-by: yangguangcai <yangguangcai@xiaomi.com>
2024-09-28 13:11:52 +08:00
yangguangcai fd47add2a3 capture:add CAPIOC_ALL for ioctl.
When monitoring multiple capture channels, the `ioctl` function
is called three times, leading to significant overhead mainly due
to VFS and `nxmutex_lock/unlock`. Adding a new interface can save
the overhead of two `ioctl` calls.

Signed-off-by: yangguangcai <yangguangcai@xiaomi.com>
2024-09-28 13:11:52 +08:00
makejian 5b1d910ec6 nuttx/crypto: export asynchronous calling process
Signed-off-by: makejian <makejian@xiaomi.com>
2024-09-28 13:05:28 +08:00
hujun5 f49d5f4451 armv7a/r: fix use arch-timer in SMP
reason:
Only one timer will be effective at a time.In the current
implementation of NuttX's timer handling, only a single global timer is necessary.
Having an excessive number of timers can lead to additional performance
overhead and logical errors, especially when operating in SMP
(Symmetric Multi-Processing) tickless mode.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-09-28 11:52:09 +08:00
Bowen Wang 23a4a23397 devicetree/fdt_pci: implement the fdt_pci_ecam_register()
So the borad level do not need implement the
pci_ecam_register_from_fdt() again and again.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-09-28 11:51:33 +08:00
nuttxs c0403ed768 1.xtensa/esp32s3: configure the number of universal management
(IEEE) MAC addresses when there are multipleinterfaces.
2.Optimize Lan9250 to adapt to ESP32S3 universalMAC address.
2024-09-28 11:47:24 +08:00
dongjiuzhu1 b5713fd7f4 drivers/sensor: remove frequent logs
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-28 11:39:54 +08:00
dongjiuzhu1 d88e0eac02 drivers/sensors: Fixed the overflow problem of uint32_t subtracting large from small.
Signed-off-by: likun17 <likun17@xiaomi.com>
2024-09-28 11:39:54 +08:00
dongjiuzhu1 a5729a81e3 driver/sensors: add flags O_DIRECT to watch sensor state to avoid rpmsg work
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-28 11:39:54 +08:00
dongjiuzhu1 05f5517f4f drivers/sensors: clear pollpri events after get events
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-28 11:39:54 +08:00
dongjiuzhu1 49b650e9db drivers/sensors: avoid using sre lock between rptun thread and hpwrok
When the system cannot obtain buffers for a long time, hpwork will hold
a lot of buffers. However, due to a deadlock between the rptun thread
and hpwork, hpwork cannot send the buffers in time, causing the system
to crash.

so, avoid hold sre lock in rptun thread.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-28 11:39:54 +08:00
dongjiuzhu1 6b6666ee50 drivers/sensors: update nbuffer after initialization
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-28 11:39:54 +08:00
yintao ef9a02f51c sensors/sensor_rpmsg.c: fix list_delete node is NULL
if remote not set CONFIG_SENSOR_RPMSG, local can't receive NS_ACK
so sensor_rpmsg_device_ns_bound won't be called, not add sre->node
when local stop remote, rpmsg_deinit_vdev will call sensor_rpmsg_ns_unbind_cb
if (ept && ept->ns_unbind_cb)
	ept->ns_unbind_cb(ept);
list_delete node is NULL at sensor_rpmsg_ns_unbind_cb

Signed-off-by: yintao <yintao@xiaomi.com>
2024-09-28 11:39:54 +08:00
dongjiuzhu1 d72d9049e9 drivers/sensors: fix minor issue about sensor driver
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-28 11:39:54 +08:00
dongjiuzhu1 7a8d58bf1b drivers/sensors: release rpmsg resource when register_driver failed
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-28 11:39:54 +08:00
dongjiuzhu1 fcf2eb8fcb drivers/sesnros: fix crash because ipc buffer pointer used after free
When the ipc buffer is obtained for the first time due to insufficient space,
it waits due to insufficient ipc buffer.
At this time, if rptun recursively operates the next ipc request, the ipc buffer
will be reused, but it has been released at this time.

0  file_read (filep=filep@entry=0x20596738, buf=buf@entry=0x205d4358, nbytes=1560) at vfs/fs_read.c:86
1  sensor_rpmsg_push_event_one (dev=0x20558f70, dev@entry=0x2058fc80, stub=stub@entry=0x20596720) at sensors/sensor_rpmsg.c:799
2  sensor_rpmsg_alloc_stub (dev=dev@entry=0x2058fc80, ept=ept@entry=0x20558f08, cookie=<optimized out>) at sensors/sensor_rpmsg.c:552
3  sensor_rpmsg_sub_handler (ept=0x20558f08, data=0x204849c0, len=51, src=<optimized out>, priv=0x20558f00) at sensors/sensor_rpmsg.c:993
4  sensor_rpmsg_ept_cb (ept=<optimized out>, data=<optimized out>, len=<optimized out>, src=<optimized out>, priv=0x20558f00) at sensors/sensor_rpmsg.c:1186
5  rpmsg_virtio_rx_callback (vq=<optimized out>) at open-amp/lib/rpmsg/rpmsg_virtio.c:605
6  virtqueue_notification (vq=<optimized out>) at open-amp/lib/virtio/virtqueue.c:711
7  rproc_virtio_notified (vdev=vdev@entry=0x20558c98, notifyid=notifyid@entry=4294967295) at open-amp/lib/remoteproc/remoteproc_virtio.c:433
8  remoteproc_get_notification (rproc=rproc@entry=0x2054ff34, notifyid=notifyid@entry=4294967295) at open-amp/lib/remoteproc/remoteproc.c:1002
9  rptun_worker (arg=0x2054ff30) at rptun/rptun.c:339
10 rptun_notify_wait (rproc=<optimized out>, id=<optimized out>) at rptun/rptun.c:543
11 remoteproc_virtio_notify_wait (priv=<optimized out>, id=<optimized out>) at open-amp/lib/remoteproc/remoteproc.c:907
12 rproc_virtio_notify_wait (vdev=<optimized out>, vq=<optimized out>) at open-amp/lib/remoteproc/remoteproc_virtio.c:176
13 rpmsg_virtio_notify_wait (vq=<optimized out>, rvdev=0x2054ff78) at nuttx/include/openamp/rpmsg_virtio.h:162
14 rpmsg_virtio_get_tx_payload_buffer (rdev=0x2054ff78, len=0x20558f90, wait=<optimized out>) at open-amp/lib/rpmsg/rpmsg_virtio.c:404
15 rpmsg_get_tx_payload_buffer (ept=ept@entry=0x20558f08, len=len@entry=0x20558f90, wait=wait@entry=1) at open-amp/lib/rpmsg/rpmsg.c:207
16 sensor_rpmsg_push_event_one (dev=0x0, dev@entry=0x20590d60, stub=stub@entry=0x20596720) at sensors/sensor_rpmsg.c:783
17 sensor_rpmsg_alloc_stub (dev=dev@entry=0x20590d60, ept=ept@entry=0x20558f08, cookie=<optimized out>) at sensors/sensor_rpmsg.c:552
18 sensor_rpmsg_sub_handler (ept=0x20558f08, data=0x20483700, len=49, src=<optimized out>, priv=0x20558f00) at sensors/sensor_rpmsg.c:993
19 sensor_rpmsg_ept_cb (ept=<optimized out>, data=<optimized out>, len=<optimized out>, src=<optimized out>, priv=0x20558f00) at sensors/sensor_rpmsg.c:1186
20 rpmsg_virtio_rx_callback (vq=<optimized out>) at open-amp/lib/rpmsg/rpmsg_virtio.c:605
21 virtqueue_notification (vq=<optimized out>) at open-amp/lib/virtio/virtqueue.c:711
22 rproc_virtio_notified (vdev=vdev@entry=0x20558c98, notifyid=notifyid@entry=4294967295) at open-amp/lib/remoteproc/remoteproc_virtio.c:433
23 remoteproc_get_notification (rproc=0x2054ff34, rproc, notifyid=notifyid@entry=4294967295)
24 rptun_worker (arg=0x2054ff30) at rptun/rptun.c:339
25 rptun_thread (argc=<optimized out>, argv=<optimized out>) at rptun/rptun.c:375

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-28 11:39:54 +08:00
dulibo1 9d8991dd29 power:add BATIO_OPRTN_CHARGER_STATE for gauge sync charger state.
Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2024-09-28 11:25:17 +08:00
liangdongdong 5238f2c200 feature: charge: Add battery operate
Signed-off-by: liangdongdong<liangdongdong@xiaomi.com>
2024-09-28 11:25:17 +08:00
dulibo1 5a796dfbff power: fix BQ27426 driver compile error
power/battery/bq27426.c:331:17: error: ‘BATTERY_UNKNOWN’ undeclared (first use in this function)
  331 |       *status = BATTERY_UNKNOWN;
      |                 ^~~~~~~~~~~~~~~
power/battery/bq27426.c:331:17: note: each undeclared identifier is reported only once for each function it appears in
Makefile:108: recipe for target 'bq27426.o' failed

Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-09-28 11:25:17 +08:00
dulibo1 797df22802 power:add default protocol for the driver which not impl get_protocol
add default protocol for the driver which not impl get_protocol

Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2024-09-28 11:25:17 +08:00
dulibo1 b29d103ad3 ramlog:flush should reset the tail of the reader
Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2024-09-28 11:08:39 +08:00
dulibo1 c055fc2f85 noteram:read noteram may cause crash
noteram_get may cause _read = ni_bufsize cause assert crash

[ 1493.627200] [79] [ EMERG] [ap] _assert: Assertion failed : at file: note/noteram_driver.c:370 task: trace process: trace 0x446f238a
[ 1493.627400] [79] [ EMERG] [ap] backtrace:
[ 1493.627500] [79] [ EMERG] [ap] [79] [<0xf7933c9d>] _fini+0xae0720b9/0xb673e41b
[ 1493.628400] [79] [ EMERG] [ap] [79] [<0x498b1b0c>] host_backtrace+0x42/0x72
[ 1493.629300] [79] [ EMERG] [ap] [79] [<0x48bef3d1>] up_backtrace+0x127/0x2d2
[ 1493.630200] [79] [ EMERG] [ap] [79] [<0x48b86bed>] sched_backtrace+0x71/0x8a
[ 1493.631100] [79] [ EMERG] [ap] [79] [<0x44676273>] sched_dumpstack+0xed/0x486
[ 1493.631600] [79] [ EMERG] [ap] [79] [<0x445c61ff>] _assert+0x9f0/0xb38
[ 1493.632200] [79] [ EMERG] [ap] [79] [<0x4420dd07>] __assert+0x3f/0x4c
[ 1493.632800] [79] [ EMERG] [ap] [79] [<0x44151648>] noteram_get+0x1b0/0x5fe
[ 1493.633600] [79] [ EMERG] [ap] [79] [<0x44152370>] noteram_read+0x331/0x4f7
[ 1493.634200] [79] [ EMERG] [ap] [79] [<0x444c66f9>] file_read+0x38b/0x3c0
[ 1493.634700] [79] [ EMERG] [ap] [79] [<0x444c6840>] nx_read+0x112/0x170
[ 1493.635300] [79] [ EMERG] [ap] [79] [<0x444c68e5>] NXread+0x47/0xfa
[ 1493.635800] [79] [ EMERG] [ap] [79] [<0x446f2c70>] trace_dump+0x148/0x2f4
[ 1493.636400] [79] [ EMERG] [ap] [79] [<0x446f110b>] trace_cmd_dump+0x41b/0x4b9
[ 1493.636900] [79] [ EMERG] [ap] [79] [<0x446f2723>] trace_main+0x399/0x6e2
[ 1493.637500] [79] [ EMERG] [ap] [79] [<0x44217fc9>] nxtask_startup+0x69/0x7c
[ 1493.638000] [79] [ EMERG] [ap] [79] [<0x440f9b78>] nxtask_start+0x8a5/0x8b8

Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2024-09-28 11:08:39 +08:00
yinshengkai d888df9673 note: add ringbuffer aligned access handle
Fix ubsan warning that writes need to be aligned to memory boundaries when writing data

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-09-28 11:08:39 +08:00
dulibo1 98482d429b noteram:overflow may discard all the trace message
noteram_add may cause head = tail when remain == NOTE_ALIGN(notelen)
log:
nsh_main-14  [0]   2.132127493: tracing_mark_write: B|14|trace dump -c

nsh_main-14  [0]   2.143322780: tracing_mark_write: E|14|trace dump -c

nsh_main-14  [0]   2.513023895: tracing_mark_write: B|14|trace dump -c

nsh_main-14  [0]   2.524060048: tracing_mark_write: E|14|trace dump -c

nsh_main-14  [0]   2.897055341: tracing_mark_write: B|14|trace dump -c

ap> trace dump -c
nsh_main-14  [0]   3.270037241: tracing_mark_write: B|14|trace dump -c

ap> trace dump -c

Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2024-09-28 11:08:39 +08:00
dulibo1 e5e4e3030e power:add extern for public function prototypes
Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
Signed-off-by: buxiasen <buxiasen@xiaomi.com>
2024-09-28 11:03:48 +08:00
dulibo1 b4b07ce6bd PM:use CONFIG_SERIAL_PM_ACTIVITY_PRIORITY == 0 disable pm_activity which need by bl616
Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2024-09-28 11:03:48 +08:00
dulibo1 5a57aa0af8 pm:CMakeLists update for pm runtime
Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2024-09-28 11:03:48 +08:00
dongjiuzhu1 29e7b00c4e fs/epoll: add error log when epoll wait return failed
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-28 10:44:59 +08:00
dongjiuzhu1 580bdda624 fs/poll: ouput error log about poll failed
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-28 10:44:59 +08:00
Filipe Cavalcanti a64171f059 arch/xtensa/esp32s3: fix timer initialization 2024-09-28 10:43:49 +08:00