Commit Graph

46239 Commits

Author SHA1 Message Date
Xiang Xiao
9ffd09b1fb sensor/rpmsg: Swap "struct file *" and "struct sensor_lowerhalf_s *"
follow the change of sensor_ops_s

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-08-01 20:23:11 -03:00
Jari van Ewijk
b9ea02bad8 RDDRONE-BMS772: clarify description of some board-specific Kconfig options 2022-08-01 14:59:10 -03:00
Jari van Ewijk
249f041235 NXP S32K1XX: add initial support for NXP RDDRONE-BMS772 board 2022-08-01 14:59:10 -03:00
chao.an
27c888854d mm_heap/kasan: poison free node after return back the heap list
The free node is still in use after kasan_poison(), the node member
access will cause the assert report by kasan.

|  (gdb) bt
|  #0  kasan_report (addr=1743265406637584896, size=140737337053680, is_write=46) at kasan/kasan.c:97
|  #1  0x0000555555607bdd in __asan_loadN_noabort (addr=140737272831420, size=4) at kasan/kasan.c:289
|  #2  0x0000555555607cd7 in __asan_load4_noabort (addr=140737272831420) at kasan/kasan.c:323
|  #3  0x00005555556061ef in gmtime_r (timep=0x7ffff3275dbc, result=0x7ffff3275e10) at time/lib_gmtimer.c:301
|  #4  0x000055555560e507 in sim_rtc_rdtime (lower=0x55555576b780 <g_sim_rtc>, rtctime=0x7ffff3275e10) at sim/up_rtc.c:77
|  #5  0x00005555555fcbdb in up_rtc_gettime (tp=0x7ffff3275ef0) at timers/arch_rtc.c:128
|  #6  0x00005555555f08b4 in clock_systime_timespec (ts=0x7ffff3275ef0) at clock/clock_systime_timespec.c:72
|  #7  0x00005555555ecc77 in note_common (tcb=0x7ffff31d2180, note=0x7ffff3275f80, length=21 '\025', type=18 '\022') at sched/sched_note.c:144
|  #8  0x00005555555ed706 in sched_note_syscall_enter (nr=1, argc=0) at sched/sched_note.c:765
|  #9  0x000055555560eb37 in __wrap_getpid () at wraps/WRAP_getpid.c:26
|  #10 0x0000555555608d1c in mm_takesemaphore (heap=0x7ffff30ae000) at mm_heap/mm_sem.c:127
|  #11 0x0000555555609477 in mm_free (heap=0x7ffff30ae000, mem=0x7ffff3265b80) at mm_heap/mm_free.c:89
|  #12 0x00005555556070c5 in free (mem=0x7ffff3265b80) at umm_heap/umm_free.c:49
|  #13 0x000055555560c3b0 in up_release_stack (dtcb=0x7ffff31e4b00, ttype=0 '\000') at sim/up_releasestack.c:67
|  #14 0x00005555555f2515 in nxsched_release_tcb (tcb=0x7ffff31e4b00, ttype=0 '\000') at sched/sched_releasetcb.c:134
|  #15 0x00005555556bdf0c in nxtask_terminate (pid=4, nonblocking=true) at task/task_terminate.c:184
|  #16 0x00005555556bdb0f in nxtask_exit () at task/task_exit.c:168
|  #17 0x000055555566e05f in up_exit (status=0) at sim/up_exit.c:64
|  #18 0x000055555564f454 in _exit (status=0) at task/exit.c:78
|  #19 0x000055555560ea89 in __wrap__exit (parm1=0) at wraps/WRAP__exit.c:27
|  #20 0x00005555555eb288 in exit (status=0) at stdlib/lib_exit.c:54
|  #21 0x00005555555fe2cc in nxtask_startup (entrypt=0x555555670c34 <critmon_start_main>, argc=1, argv=0x7ffff3265bb0) at sched/task_startup.c:70
|  #22 0x00005555555f02a0 in nxtask_start () at task/task_start.c:134
|  #23 0x0000000000000000 in ?? ()

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-08-02 01:45:08 +08:00
chao.an
5db0ab1e6a mm_heap/backtrace: move MM_ADD_BACKTRACE out of heap lock
move MM_ADD_BACKTRACE out of heap lock to improve the performance

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-08-02 01:44:48 +08:00
chao.an
87cb224b1c mm/kasan: node header should updated from unpoisoning memory
| (gdb) bt
| #0  up_assert (filename=0x7fffffffdc6c "\001", lineno=0) at sim/up_assert.c:75
| #1  0x00005555555e636b in _assert (filename=0x555555627225 "kasan/kasan.c", linenum=104) at assert/lib_assert.c:36
| #2  0x00005555555a388e in kasan_report (addr=140737284458088, size=1, is_write=true) at kasan/kasan.c:104
| #3  0x00005555555a40a1 in __asan_storeN_noabort (addr=140737284458088, size=1) at kasan/kasan.c:297
| #4  0x00005555555a4519 in __asan_store1_noabort (addr=140737284458088) at kasan/kasan.c:348
| #5  0x00005555555a26d7 in memset (s=0x7ffff3d8c668, c=0, n=63) at string/lib_memset.c:169
| #6  0x00005555555a46a4 in mm_addregion (heap=0x7ffff3d8c000, heapstart=0x7ffff3d8c648, heapsize=66058656) at mm_heap/mm_initialize.c:131
| #7  0x00005555555a4a00 in mm_initialize (name=0x555555627068 "Umem", heapstart=0x7ffff3d8c648, heapsize=67107256) at mm_heap/mm_initialize.c:231
| #8  0x00005555555a33b1 in umm_initialize (heap_start=0x7ffff3d8c000, heap_size=67108864) at umm_heap/umm_initialize.c:84
| #9  0x000055555558f17c in nx_start () at init/nx_start.c:469
| #10 0x0000555555589559 in main (argc=1, argv=0x7fffffffdf58, envp=0x7fffffffdf68) at sim/up_head.c:131
| (gdb)

Signed-off-by: chao.an <anchao@xiaomi.com>
2022-08-02 01:44:48 +08:00
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