Commit Graph

45983 Commits

Author SHA1 Message Date
Jiuzhu Dong
78381f9fc4 driver/sensor: fix deadlock about sensor_rpmsg
task1:
nuttx/arch/arm/src/common/arm_blocktask.c:151
nxsem_wait
nuttx/arch/arm/src/../../../sched/semaphore/sem_wait.c:155 (discriminator 2)
sem_wait
nuttx/arch/arm/src/../../../sched/semaphore/sem_wait.c:273
nxmutex_lock.lto_priv.2
nuttx/include/nuttx/mutex.h:161
sensor_rpmsg_push_event_one
nuttx/arch/arm/src/../../../drivers/sensors/sensor_rpmsg.c:748
up_unblock_task
nuttx/arch/arm/src/common/arm_unblocktask.c:75 (discriminator 2)
sensor_rpmsg_push_event
nuttx/arch/arm/src/../../../drivers/sensors/sensor_rpmsg.c:858
write
orb_publish_multi
nuttx/arch/arm/src/../../../../apps/system/uorb/uORB/uORB.c:188

task2:
nxrmutex_lock.isra.0
sensor_read
nuttx/arch/arm/src/../../../drivers/sensors/sensor.c:753
sem_post
nuttx/arch/arm/src/../../../sched/semaphore/sem_post.c:224
nxmutex_unlock.lto_priv.1
nuttx/include/nuttx/mutex.h:259
sensor_rpmsg_push_event_one
nuttx/arch/arm/src/../../../drivers/sensors/sensor_rpmsg.c:787
nxmutex_unlock.lto_priv.1
nuttx/include/nuttx/mutex.h:259
nuttx/arch/arm/src/../../../drivers/sensors/sensor.c:969
sensor_rpmsg_alloc_stub
nuttx/arch/arm/src/../../../drivers/sensors/sensor_rpmsg.c:549
sensor_rpmsg_advack_handler

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-08-02 01:28:56 +08:00
Jiuzhu Dong
ad20bd4bb3 driver/sensor: fix rpmsg send failed when buffer is NULL
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-08-02 01:28:56 +08:00
jihandong
9485174ff0 nuttx/dirvers/sensor: down-sampling 2.0
1. about interval:
  If interval is not set, generation is increased by 1 along with
  publish and copy, multi-copy is continuous.

  If interval is set, pick proper samples from buffer based on
  mainline/user generation, multi-copy is one-by-one.

2. about bufferpos:
  user->bufferpos always point to next position to check.

       data user last read
  ----------v--------------------------
  |        |        |        |
  -------------------^-----------------
                 bufferpos

  If buffer is full, bufferpos point to buffer.head

Examples:
  If a buffer contains 4 samples, newest generatoin is 40.

  -------------------------------------
  |10      |20      |30      |40
  ------------------------------^------
                                |
   if user's next generation is 42, notify user to copy No.40 sample,
                because 42 is closer to 40 than 50.

  -------------------------------------
  |10      |20      |30      |40
  ----------------------------------^--
                                    |
   if user's next generation is 48, do not notify user,
         because 48 is closer to 50, which is next mainline sample.

Signed-off-by: jihandong <jihandong@xiaomi.com>
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-08-02 01:28:56 +08:00
Jiuzhu Dong
5b91641a09 driver/sensor: add cmd SNIOC_UPDATED and remove readlast
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-08-02 01:28:56 +08:00
jihandong
12e5371a05 uorb: fix, should check min_interval modified by lowerhalf.
Signed-off-by: jihandong <jihandong@xiaomi.com>
2022-08-02 01:28:56 +08:00
Jiuzhu Dong
fe1d83c41b driver/sensor: solve the deadlock problem caused by sensor_close
note: replace dev lock by upper driver lock

rptun:
sem_wait
sched/semaphore/sem_wait.c:273
nxmutex_lock
/home/neo/projects/monkey/nuttx/include/nuttx/mutex.h:161
sensor_close (wait upper driver lock)
drivers/sensors/sensor.c:509
sensor_rpmsg_free_stub (get dev lock)
drivers/sensors/sensor_rpmsg.c:546
sensor_rpmsg_unsub_handler
drivers/sensors/sensor_rpmsg.c:1025
rptun_thread

apps:
sem_wait
sched/semaphore/sem_wait.c:273
sensor_rpmsg_close (wait dev lock)
drivers/sensors/sensor_rpmsg.c:613
sensor_close (get upper driver lock)
drivers/sensors/sensor.c:512

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-08-02 01:28:56 +08:00
Jiuzhu Dong
107e3e5d52 driver/sensor: export upper half lock
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-08-02 01:28:56 +08:00
Jiuzhu Dong
48b4667318 driver/sensor: slove deadlock issue because ept/devlist using same lock
CHAMPION-6418
rptun sensor:
[ap] [ 5] [<0x2c352c68>] arm_switchcontext+0xc/0x10
[ap] [ 5] [<0x2c322eae>] sem_wait+0x5a/0xbc
[ap] [ 5] [<0x2c3376cc>] sensor_rpmsg_find_dev+0x8/0x78 (wait g_lock)
[ap] [ 5] [<0x2c338d96>] sensor_rpmsg_suback_handler+0xa/0x4c
[ap] [ 5] [<0x2c7630f6>] rpmsg_virtio_rx_callback+0xba/0x1b4
[ap] [ 5] [<0x2c762788>] rproc_virtio_notified+0x44/0x5c
[ap] [ 5] [<0x2c762154>] remoteproc_get_notification+0x1c/0x2c
[ap] [ 5] [<0x2c335576>] rptun_thread+0x6e/0x164
[ap] [ 5] [<0x2c324aba>] nxtask_start+0x3a/0x60

apps:(note: ipc buffer is busy, it's not enough for dual core.)
[ap] [26] [<0x2c323a5e>] nxsig_timedwait+0x8a/0x184
[ap] [26] [<0x2c324344>] nxsig_nanosleep+0x34/0xa4
[ap] [26] [<0x2c324446>] nxsig_usleep+0x26/0x38
[ap] [26] [<0x2c76338e>] rpmsg_virtio_get_tx_payload_buffer+0x5e/0x100 (wait ipc buffer)
[ap] [26] [<0x2c33775a>] sensor_rpmsg_advsub_one+0x1e/0xdc (get g_lock)
[ap] [26] [<0x2c338312>] sensor_rpmsg_open+0xee/0x178
[ap] [26] [<0x2c3365bc>] sensor_open+0x50/0x234
[ap] [26] [<0x2c749cb8>] open+0xc8/0x194
[ap] [26] [<0x2c375324>] orb_subscribe_multi+0x1c/0x94

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-08-02 01:28:56 +08:00
Jiuzhu Dong
01254de1bf driver/sensor: update batch initial value
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-08-02 01:28:56 +08:00
Jiuzhu Dong
ddd4a0d635 driver/sensor: sync batch and interval when update interval
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-08-02 01:28:56 +08:00
Jiuzhu Dong
8e03f213e3 driver/sensor: convert interval 0 to ULONG_MAX
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-08-02 01:28:56 +08:00
Jiuzhu Dong
78eb832e23 driver/sensor: using standard recursive mutex api
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-08-02 01:28:56 +08:00
Jiuzhu Dong
38393cfc94 driver/sensor: move register_driver to end to avoid race condition
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-08-02 01:28:56 +08:00
Jiuzhu Dong
bf6063cc04 driver/sensor/rpmsg: fix deadlock case: push event in ioctl_ack handler
using recursive mutex to fix this issue.

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-08-02 01:28:56 +08:00
Jiuzhu Dong
67f156c2f7 driver/sensor: add cpuname info about failed case
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-08-02 01:28:56 +08:00
Jiuzhu Dong
fa4cebce32 driver/sensor: support sensor data persist
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-08-02 01:28:56 +08:00
Jiuzhu Dong
2a910b7ca9 driver/sensor: using re-entrant mutex for sensor access to avoid deadlock
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-08-02 01:28:56 +08:00
Jiuzhu Dong
74b2be20d0 driver/sensor: move readlast for each user
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-08-02 01:28:56 +08:00
Jiuzhu Dong
6f3873dfa2 sensor: add SNIOC_READLAST
If enable SNIOC_READLAST, sensor_read will return 0
when there is no new data until last read.

Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-08-02 01:28:56 +08:00
Jiuzhu Dong
2f5727b102 driver/sensor: add _SNIOCVALID check to command
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-08-02 01:28:56 +08:00
Jiuzhu Dong
8de6c29aa4 driver/sensor: enable usensor and rpmsg_sensor
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-08-02 01:28:56 +08:00
Jiuzhu Dong
c5f87bb5c6 driver/sensor: support access remote sensor by rpmsg
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-08-02 01:28:56 +08:00
Peter van der Perk
1cc7f6e63a Add MIT license kconfig symbol 2022-08-01 17:35:40 +03:00
Jari van Ewijk
1e6054afba NXP S32K1XX boards: add up_perf_init to support SEGGER SystemView 2022-08-01 16:32:41 +03:00
Jari van Ewijk
a554b9ce89 NXP S32K1XX: fix LPI2C reset 2022-08-01 07:34:03 -04:00
Xiang Xiao
f09f75f2c9 power/axp202: Replace battery_charger_operations_s * with battery_charger_dev_s
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-08-01 13:00:30 +03:00
Xiang Xiao
c26bb35843 Remove the private NULL, TRUE and FALSE macros
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-07-31 22:12:57 +03:00
Sergey Nikitenko
ec59125ad3 stm32wb/mbox: fixing ACL transmit buffer 2022-07-31 10:29:29 +08:00
Sergey Nikitenko
30a80a390d stm32wb/ble: disable default CPU2 host config option 2022-07-31 10:29:29 +08:00
Sergey Nikitenko
bbdcb82f18 boards/stm32wb/nimble: adding nimble config 2022-07-31 10:29:29 +08:00
Sergey Nikitenko
9db4caca1d stm32wb/nimble: workaround for unsupported HCI command 2022-07-31 10:29:29 +08:00
Sergey Nikitenko
cf594b2c81 stm32wb/mbox: renaming msg_buf->cmd_buf 2022-07-30 11:45:15 +08:00
Sergey Nikitenko
49af13c507 stm32wb/mbox: fixing txbuf queue 2022-07-30 11:45:15 +08:00
Jiuzhu Dong
f758e0f260 sensor: format custom ioctl argument by stucture sensor_ioctl_s
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-30 03:15:23 +08:00
Jiuzhu Dong
2ae5a82607 driver/sensor: add struct file for all sensor_ops_s
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-30 03:15:23 +08:00
Jiuzhu Dong
bb07354198 driver/sensors: add open/close api and struct file for sensor_ops
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-30 03:15:23 +08:00
Jiuzhu Dong
3fdd036ba6 driver/sensor: add name prefix "sensor_" for sensor register
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-30 03:15:23 +08:00
Peter van der Perk
26dbdba5d8 [TCP] Close RAM usage optimization 2022-07-29 23:51:06 +08:00
Michał Łyszczek
e887a4a5b7 stm32wl5: add lower half driver for IPCC
Signed-off-by: Michał Łyszczek <michal.lyszczek@bofc.pl>
2022-07-29 23:11:32 +08:00
Michał Łyszczek
a9f78a64db drivers/ipcc: add Inter Processor Communication driver
This patch adds upper half driver for IPCC character driver. IPCC
is a Inter Processor Communication Controller.

Driver is still immature and not thoroughly tested, thus
CONFIG_EXPERIMENTAL is required.

Signed-off-by: Michał Łyszczek <michal.lyszczek@bofc.pl>
2022-07-29 23:11:32 +08:00
simbit18
666c2d255a Update stm32_ina219.c
Fix mistakes in syslog
2022-07-29 16:09:25 +03:00
simbit18
7a9b434ae6 Update stm32_max31855.c
Fix mistakes in comments
2022-07-29 16:09:25 +03:00
simbit18
9851d4483b Update stm32_max6675.c
Fix mistakes in comments
2022-07-29 16:09:25 +03:00
simbit18
07c0b2844a Update stm32_mlx90614.c
Fix mistakes in comments and snerr
2022-07-29 16:09:25 +03:00
Michael Jung
4ab8f9383d w25qxxxjv.c: Use PRIxOFF to format off_t
Signed-off-by: Michael Jung <michael.jung@secore.ly>
2022-07-29 17:41:25 +08:00
chao.an
0d28168679 arm/allocateheap: fix multiple definition of 'up_allocate_heap'
ld: arch/libarch.a(cxd56_allocateheap.c.obj): in function `up_allocate_heap':
arch/arm/src/cxd56xx/cxd56_allocateheap.c:113: multiple definition of `up_allocate_heap'; arch/libarch.a(arm_allocateheap.c.obj):
                                               arch/arm/src/common/arm_allocateheap.c:110: first defined here

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-07-29 11:57:10 +03:00
liyi
b232508bd9 make sure conn's domain is match with addr's family 2022-07-29 13:53:19 +08:00
chao.an
93f719bccb arm/hostfs: fix build warning
arch/arm/src/common/arm_hostfs.c: In function 'host_read':
arch/arm/src/common/arm_hostfs.c:156:24:
  warning: passing argument 1 of 'up_invalidate_dcache' makes integer from pointer without a cast [-Wint-conversion]
  156 |   up_invalidate_dcache(buf, buf + count);
      |                        ^~~
      |                        |
      |                        void *
In file included from arch/arm/src/common/arm_hostfs.c:26:
include/nuttx/cache.h:261:37: note: expected 'uintptr_t' {aka 'unsigned int'} but argument is of type 'void *'
  261 | void up_invalidate_dcache(uintptr_t start, uintptr_t end);
      |                           ~~~~~~~~~~^~~~~

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-07-29 08:52:59 +03:00
hejianliang3
e88a49007d timers/watchdog: fix build warning
drivers/timers/watchdog.c:57:5: warning: "CONFIG_WATCHDOG_AUTOMONITOR_PING_INTERVAL" is not defined, evaluates to 0 [-Wundef]
   57 |     CONFIG_WATCHDOG_AUTOMONITOR_PING_INTERVAL)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: hejianliang3 <hejianliang3@xiaomi.com>
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-07-29 07:25:45 +02:00
zhuyanlin
031c89db89 power: add PM_IDLE_DOMAIN to pm.h and remove definations
Signed-off-by: zhuyanlin <zhuyanlin1@xiaomi.com>
2022-07-29 11:15:40 +08:00