Commit Graph

5654 Commits

Author SHA1 Message Date
zhanghongyu 3610b25c91 cmake: add include path for special source
fix the cmake build error.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-11-07 17:39:03 +01:00
Zhe Weng 3e4d847f42 net/netdev: Support managing multiple IPv6 addresses by ioctl
1. Supporting `SIOCSIFADDR` and `SIOCDIFADDR` with Linux in6_ifreq struct to manage ipv6 addresses.
   Ref: https://man7.org/linux/man-pages/man7/netdevice.7.html
2. Supporting alias like 'eth0:0' for multiple IPv6 addresses, to keep previous ioctl `SIOCGLIFADDR`, `SIOCSLIFADDR`, `SIOCGLIFNETMASK` and `SIOCSLIFNETMASK` working.
   Ref: https://man7.org/linux/man-pages/man8/ifconfig.8.html

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-11-07 19:30:36 +08:00
chao an 85a375cd7d drivers/serial: check the remote device before get name
| #0 0x2119bf1 in rpmsg_get_cpuname rptun/rptun.c:1157
| #1 0x24f97bd in uart_rpmsg_device_destroy serial/uart_rpmsg.c:342
| #2 0x2117d56 in rptun_dev_stop rptun/rptun.c:883
| #3 0x21181d7 in rptun_do_ioctl rptun/rptun.c:922
| #4 0x2119721 in rptun_ioctl_foreach rptun/rptun.c:1086

Signed-off-by: chao an <anchao@xiaomi.com>
2023-11-07 18:27:05 +08:00
chao an 93ff6f9703 drivers/rptun: check the status before stop remote proc
Race condition if the remote proc is stoped during initialization phase

| #0  0x0249f959 in rpmsg_destroy_ept (ept=0xffffffc0) at open-amp/lib/rpmsg/rpmsg.c:376
| #1  0x024a938c in rpmsg_deinit_vdev (rvdev=0xf2303a48) at open-amp/lib/rpmsg/rpmsg_virtio.c:971
| #2  0x02117e33 in rptun_dev_stop (rproc=0xf2303a04, stop_ns=true) at rptun/rptun.c:891
| #3  0x021181d8 in rptun_do_ioctl (priv=0xf2303a00, cmd=11010, arg=0) at rptun/rptun.c:922
| #4  0x02119722 in rptun_ioctl_foreach (cpuname=0x0, cmd=11010, value=0) at rptun/rptun.c:1086
| #5  0x0211b9df in rptun_poweroff (cpuname=0x0) at rptun/rptun.c:1378
| #6  0x02053aa6 in board_power_off (status=0) at sim/sim_head.c:206
| #7  0x0253d65c in boardctl (cmd=65283, arg=0) at boardctl.c:400
| #8  0x021eb497 in cmd_poweroff (vtbl=0xef606280, argc=1, argv=0xef9b73e0) at nsh_syscmds.c:356
| #9  0x021cdb4d in nsh_command (vtbl=0xef606280, argc=1, argv=0xef9b73e0) at nsh_command.c:1164
| #10 0x021baa72 in nsh_execute (vtbl=0xef606280, argc=1, argv=0xef9b73e0, redirfile=0x0, oflags=0) at nsh_parse.c:845
| #11 0x021c6b0a in nsh_parse_command (vtbl=0xef606280, cmdline=0xef606708 "poweroff") at nsh_parse.c:2744
| #12 0x021c7166 in nsh_parse (vtbl=0xef606280, cmdline=0xef606708 "poweroff") at nsh_parse.c:2828
| #13 0x0221fa2f in nsh_session (pstate=0xef606280, login=1, argc=1, argv=0xef7a7860) at nsh_session.c:245
| #14 0x021f8c04 in nsh_consolemain (argc=1, argv=0xef7a7860) at nsh_consolemain.c:75
| #15 0x021b77eb in nsh_main (argc=1, argv=0xef7a7860) at nsh_main.c:74
| #16 0x02166ddf in nxtask_startup (entrypt=0x21b76ca <nsh_main>, argc=1, argv=0xef7a7860) at sched/task_startup.c:70
| #17 0x020b363c in nxtask_start () at task/task_start.c:134

Signed-off-by: chao an <anchao@xiaomi.com>
2023-11-07 18:27:05 +08:00
Zhe Weng 90a8e2e422 usrsock_rpmsg_server: Keep msg order in recursive call
In `drivers/rptun/rptun.c`, we have a `rptun_is_recursive` function,
which lets rptun thread run recursively. Then the `usrsock_rpmsg_ept_cb`
may be called inside `usrsock_rpmsg_ept_cb`, which can cause some
unexpected behavior, so we add a queue to keep the order of incoming
messages to reduce the complexity.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-11-01 10:14:18 +08:00
Zhe Weng 52fddb1f12 usrsock_rpmsg_server: Save iov and remain per endpoint
Then we may support multiple endpoints with sendto working correctly.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-11-01 10:14:18 +08:00
ligd 978e124d42 pm: use pm_staytimeout() in greedy_governor_activity()
Signed-off-by: ligd <liguiding1@xiaomi.com>
2023-10-31 09:05:40 +08:00
raiden00pl 5b87fdfb9d Documentation: remove all migrated READMEs 2023-10-29 21:03:54 -03:00
raiden00pl b565e28da3 Kconfigs: rename {Rpmsg|rpmsg} to RPMGS 2023-10-28 13:58:56 +08:00
TimJTi 896727b576 Add new ioctls 2023-10-27 13:52:28 -03:00
raiden00pl c2863f90f6 bluetooth rpmsg depends on RPTUN 2023-10-27 13:27:05 -03:00
dongjiuzhu1 ed6fb11de6 driver/mtd: get mtd_geometry_s.model for mtd partition and optimize code
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-10-26 20:02:45 +08:00
dongjiuzhu1 68fc3adeff drivers/usbdev: config USBDEV_TRACE_INITIALIDSET when disbale USBDEV_TRACE
usbtrace is valid when enable USBDEV_TRACE or DEBUG_FEATURE && DEBUG_USB,

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-10-26 16:32:18 +08:00
chao an 2b06142232 kernel: replace all sem_* to nxsem_*: in kernel space
syscall cannot be called from kernel space

Signed-off-by: chao an <anchao@xiaomi.com>
2023-10-25 15:46:03 +08:00
chao an 3cadf6642a kernel: replace all usleep to nxsig_usleep in kernel space
syscall cannot be called from kernel space

Signed-off-by: chao an <anchao@xiaomi.com>
2023-10-25 15:46:03 +08:00
zhanghongyu 5374af077b tun: Fix the error of calling tun_close when tun_txavail or tun_txavail_work is executed
When tun_txavail_work is running, switch to tun_close thread and priv->lock will be destroyed, then switch back to tun_txavail_work thread, an error will occur when nxmutex_unlock(&priv->lock)

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-10-25 01:13:21 +08:00
zhanghongyu 3b469271d7 Revert "tun: Fix the error of calling tun_close when tun_txavail or tun_txavail_work is executed"
This reverts commit 0f1a49bba5.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-10-25 01:13:21 +08:00
yinshengkai 605c4e6c1f note: fix notesnap compilation failure
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-10-23 12:50:19 +03:00
zhanghongyu 3ad28c28aa usrsock: Make the field of usrsock_request native alignment
There is a risk that interfaces such as psock_ioctl/psock_setsockopt
will cause paramete to be not four-byte aligned after calculating the
offset, so align the length of the structure with parameters by four
bytes.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-10-21 10:55:30 +08:00
zhanghongyu 0f1a49bba5 tun: Fix the error of calling tun_close when tun_txavail or tun_txavail_work is executed
When tun_txavail_work is running, switch to tun_close thread and priv->lock will be destroyed, then switch back to tun_txavail_work thread, an error will occur when nxmutex_unlock(&priv->lock)

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-10-21 06:29:21 +08:00
makejian be72a6e26f math/mpi: add mpi driver in math
add interface for MPI(Multiple Precision Integer) registration in /math/mpi
Signed-off-by: makejian <makejian@xiaomi.com>
2023-10-17 13:43:43 +08:00
yinshengkai 58c6b60df5 note: remove remaining event code
Some event-related codes were missed in the previous modification and have not been deleted.

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-10-17 09:07:06 +08:00
Philippe Leduc 98b15b1409 Cleanup interface and a4988 implementation
Change step frequency from step/ms to step/s
Add DRV8825 stepper driver
2023-10-16 08:55:53 +08:00
chenrun1 73ca090ab9 filemtd:Fix teardown return error number EINVAL
In previous versions, during the teardown phase, the "open_blockdriver" would call the "mtd proxy" causing the "file mtd" node to be registered in the ftl. " node is registered in ftl.
Therefore, we changed the behavior to find the corresponding inode by node name.

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2023-10-15 01:29:12 +08:00
Philippe Leduc 095c32b0eb Add a stepper generic upperhalf driver
Add a stepper A4988 lowerhalf driver
2023-10-14 12:28:41 -04:00
Xiang Xiao f196d108bf drivers/note: Change 0/1 to false/true
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-10-13 14:38:51 -04:00
liqinhui d27ca03b6c wifi/simdriver: Support the sim wifi.
Add the Sim WiFi function, which can provide the wifi operating on nuttx sim emulator,
  and support two modes that simulate wifi, HWSIM and RNC(real network card).

 - In the HWSIM mode, we simulates two wlan interfaces. The wlan0 is STA and
   the wlan1 is AP. The wlan0 can connect to the wlan1 in the nuttx simulator.
 - In the RNC mode, we can use the same wlan interface name on the nuttx simulator
   to control the connection behavior of the real wireless card.

Signed-off-by: liqinhui <liqinhui@xiaomi.com>
2023-10-12 17:08:25 +08:00
hujun5 061be5f18e refine: move BIT Macro to nuttx/bits.h
The BIT macro is widely used in NuttX,
and to achieve a unified strategy,
we have placed the implementation of the BIT macro
in bits.h to simplify code implementation.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2023-10-12 14:52:56 +08:00
hujun5 4967de8621 ramlog: remove sched_[un]lock and rl_nwaiters
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2023-10-12 10:14:59 +08:00
yinshengkai 9c59ee7c58 note: optimize note performance and reduce lib_sprintf calls
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-10-12 00:15:14 +08:00
hujun5 66fa229fcc Fix some typos in comments
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2023-10-11 08:14:49 +02:00
Xiang Xiao 28dee592a3 video/fb: Add fb_register_device
so the user could register fb device directly instead
go through the sequence of up_fbinitialize/up_fbgetvplane

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-10-09 13:18:36 +03:00
laoniaokkk aec0271e48 max31865:RTD-to-Digital Converter 2023-10-06 21:15:21 +08:00
Xiang Xiao 414491e340 pm: Let PM_PROCFS depend on FS_PROCFS_REGISTER
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-10-02 14:30:18 -04:00
raiden00pl c52188f0bf drivers/foc/foc_dummy.c: update dummy device state only if dev opened
This is fix for seg fault for sim/foc configuration
2023-10-02 23:33:05 +08:00
yinshengkai ddb87d3b86 clock: replace all up_perf_xx with perf_xx
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-10-02 16:11:43 +02:00
raiden00pl 6865697b70 sensors: SENSORS_BMI270_LOAD_FROM_HEAP equals ARCH_DMA_NO_FLASH_TRANSFER 2023-09-29 21:04:02 +08:00
raiden00pl 4db39d7afd drivers/rtt: make RTT console optional 2023-09-29 13:00:06 +08:00
Daniel P. Carvalho 024bdcbca0 Fixes compilation warnings. 2023-09-29 12:57:58 +08:00
Xiang Xiao a37759a6a9 drivers/ioexpander: Add const to the value array of multiwritepin
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-09-28 10:09:51 +08:00
Xiang Xiao e499c6c1c7 drivers/ioexpander: Add const to the pin array
forget in patch: https://github.com/apache/nuttx/pull/9529

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-09-28 10:09:51 +08:00
likun17 f99b1a41a3 nuttx/drivers: add regmap subsystems support.
regmap: add i2c and spi bus support.

Signed-off-by: likun17 <likun17@xiaomi.com>
2023-09-27 00:46:51 +08:00
Xiang Xiao ee3d2d1c0d video/goldfish: Remove the vsync residual code
forget from patch:
commit bbf5b0bb6d
Author: jianglianfang <jianglianfang@xiaomi.com>
Date:   Tue Aug 15 19:47:14 2023 +0800

    driver/video: adapting Goldfish FB to VSync optimized FB driver

    The circbuf part is implemented by the fb driver, and goldfish needs to
    delete the part related to circbuf and adapt to the interface of the fb
    driver.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-09-26 22:51:12 +08:00
Xiang Xiao f02ad03124 Fix error: 'mmcsd_general_cmd_read' defined but not used
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-09-26 00:45:50 +03:00
wanggang26 50cad1536d emmc: add get emmc cid register interface.
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2023-09-25 23:29:34 +08:00
shipei f99f67378d audio:add state sync for virtio snd device
qemu host virtio device don't support recvice the same cmd like start/stop twice
Signed-off-by: shipei <shipei@xiaomi.com>
2023-09-25 21:04:59 +08:00
yintao 2a1f1041fd driver/sensors: fix sensor_rpmsg_ns_unbind_cb crash
==2787216==ERROR: AddressSanitizer: heap-use-after-free on address 0xf4702448 at pc 0x0136c544 bp 0x9f54d358 sp 0x9f54d348
READ of size 4 at 0xf4702448 thread T0

0 0x136c543 in rpmsg_destroy_ept open-amp/lib/rpmsg/rpmsg.c:357
1 0x1252b29 in sensor_rpmsg_ns_unbind_cb sensors/sensor_rpmsg.c:1216
2 0x1371de5 in rpmsg_virtio_ns_callback open-amp/lib/rpmsg/rpmsg_virtio.c:663
3 0x1371026 in rpmsg_virtio_rx_callback open-amp/lib/rpmsg/rpmsg_virtio.c:583
4 0x137c105 in virtqueue_notification open-amp/lib/virtio/virtqueue.c:711
5 0x1368604 in rproc_virtio_notified open-amp/lib/remoteproc/remoteproc_virtio.c:433
6 0x1363abe in remoteproc_get_notification open-amp/lib/remoteproc/remoteproc.c:10

Signed-off-by: yintao <yintao@xiaomi.com>
2023-09-25 12:52:09 +08:00
Dong Heng ca03a92327 drivers/lcd/st7789: Add option to support set BGR mode 2023-09-25 12:51:43 +08:00
wanggang26 203b558ec9 mmcsd: fix a typo
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2023-09-24 19:34:14 -04:00
Xiang Xiao 723d721098 Fix mmcsd/mmcsd_debug.c:110:9: error: format '%d' expects argument of type 'int', but argument 3 has type 'long unsigned int'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-09-25 01:10:00 +03:00