Commit Graph

42783 Commits

Author SHA1 Message Date
anjianjun 07d7eb3ac0 drivers/mmcsd:fix build error of debug
N/A

Signed-off-by: anjianjun <anjianjun@xiaomi.com>
Change-Id: I7b5f5590bb953add6919b64fa37f73cdcfc32b49
2021-07-28 17:30:59 +08:00
liuhaitao 3ad890d10f Make top Make.defs symlink to board Make.defs instead
Symlink to board Make.defs for top Make.defs, so top Make.defs
syncs in realtime.

Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
Change-Id: I379997dbc969d97f5b469286e1c99b91f75e059a
2021-07-28 16:52:15 +08:00
liucheng5 d82a248863 feature: driver: Add a Linux SPI into simulator.
N/A

When SIM_SPI is valid, a specified Linux SPI device ‘spidevN.P’(N is bus number and P is CS number) is attached to nuttx simulator, shown as 'spi0' under /dev. One may type spi command (need SPITOOL valid) in NSH to control the Linux SPI and exchange data, other devices such sensors can use it to debug in simulator on a Ubuntu PC. Note that a USB<>SPI module (e.g. CH341A/B) should be plugged in to achieve Linux SPI ports.

Change-Id: I275b2c2bbf6d14bcdf514c89efb9a2264d69e9a3
Signed-off-by: liucheng5 <liucheng5@xiaomi.com>
2021-07-28 10:05:26 +08:00
zhuyanlin b0dbde28a5 arch:xtensa:vector: fix typo error in level4_ventor
Change-Id: I66cd3ff30e50e18ed718499aef609dd7aeb82dd3
2021-07-27 16:26:55 +08:00
zhuyanlin 39e702ab5d arch: xtensa: save current SP before overwrting in dispatch_c_isr.
In levelx(2,3,4,5)_handler, first need to save sp in a12,
then after dispatch_c_isr we can restore sp from a12.

Change-Id: Idb6b64a782da866670a4db80b33435a9b63f02c3
2021-07-27 16:26:50 +08:00
Jiuzhu Dong e09737b061 wqueue: optimize work_s structure
Change-Id: I908ac2fcead3a6fed3078b2339392ed93d2e4809
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-07-27 15:53:52 +08:00
Xiang Xiao ba9396d827 arch/sim: Copy include/nuttx/config.h to the local folder
so the source code compiled by host environment can include config.h
directly and then avoid pass Kconfig option through Makefile manually

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ic9fe6f846082cef2d0808dc717df8ae6ed929edf
2021-07-27 11:08:58 +08:00
Xiang Xiao ccb8538b6d sim: Correct the typedef in nuttx/hostfs.h
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I5fbfd519417c5686325822549c068b1d42f83946
2021-07-27 11:08:47 +08:00
liuhaitao 14cc2d09d2 board/ctrl: add BOARDCTL_SWITCH_BOOT switch boot system support
BOARDIOC_SWITCH_BOOT is required to communicate the boot partition from
userspace (OTA subsystem) to board. It can be used to change the system
boot behavior. So it's useful for A/B boot or even single boot case.

For the board support A/B boot case:
1. Download the new image from the sever
2. Write the new image to the alternative partition
3. Call BOARDCTL_SWITCH_BOOT to the alternative system

For single boot partition case:
1. Download the new image from the sever
2. Call BOARDCTL_SWITCH_BOOT and reboot to a small system
3. Write the new image to the main partition in the small system
4. Call BOARDCTL_SWITCH_BOOT again to the main system

Change-Id: Ifebb495784ecf06842946a249bec64f75dce894f
Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2021-07-26 22:46:18 +08:00
Jiuzhu Dong c4e5410fa5 usrwqueue: implement order work queue
N/A

Change-Id: I9b6a76dec96f669c0b55bef39a9e5a2a71dde50b
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-07-25 00:12:40 +08:00
Jiuzhu Dong 3d8a09e4cb fs/inode: add sanity check for inode
Change-Id: Ib2c74ba308b8f15756fac4e69632c296243eb4ab
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-07-24 15:20:27 +08:00
Jiuzhu Dong 03c1496e8e sim: change ownership to user ID of the calling process for shm file
Change-Id: Ia0b5721421c2eb7fb408d55a26f821d6e95202df
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-07-23 21:55:15 +08:00
xiatian6 941aa03401 Feature: Seneor: Add sx9373 capacitive sensor driver.
N/A

Add sx9373 capacitive sensor driver for nuttx.

Change-Id: I7179633ac0ea5c9f073ddc13b50b442997e4a2c2
Signed-off-by: xiatian6 <xiatian6@xiaomi.com>
2021-07-23 18:36:13 +08:00
xiatian6 f8ef15915a Fix: Sensor: Fix the problem of uneven sampling.
N/A

Simply using workqueue will result in uneven sampling, so
the timer is used here to ensure the uniformity of the sampling
rate.

Change-Id: If49f4782bfe7d6c4d8335141bda6d3209d6241ae
Signed-off-by: xiatian6 <xiatian6@xiaomi.com>
2021-07-23 18:36:01 +08:00
Xiang Xiao cd8be916d4 pthread: Shouldn't check the uninitialized field in pthread_barrier_init
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I4d22e3945bba92020376a9c8485897533562d0b4
2021-07-23 13:58:17 +08:00
ligd 5988732436 arm: add up_secure_irq support
Change-Id: Ibc9402dcef4045ca122da400940d57de6b508308
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-22 12:02:06 +08:00
ligd c4b1720b98 arch: add depends to trigger_irq
Change-Id: I334f625f8f1a6ebaa4fa5ea292de142a93120f51
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-22 12:02:06 +08:00
丁欣童 6805257488 fakesensor: transform ddmm.mmmm to dd.mmmmmm.
N/A

Signed-off-by: 丁欣童 <dingxintong@xiaomi.com>
Change-Id: I8c4b0e73ee20507721fe9bac13de1519fedf4807
2021-07-22 10:22:58 +08:00
Xiang Xiao cfee19f9a6 libc: Implement times function
https://pubs.opengroup.org/onlinepubs/009604599/functions/times.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: If2cccfedd532a77f86035d16d36d94ae38d8f09c
2021-07-21 19:50:54 +08:00
Xiang Xiao 84b11713be libc/sysconf: Implement the query of _SC_CLK_TCK
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I36a62d97b14ea06bbc2054ee96fd2319b2f6897c
2021-07-21 19:49:02 +08:00
Jiuzhu Dong 1c3fe27235 sensor: directly return -ENOTSUP without the set_interval or batch
implementation for lowerhalf driver.

Change-Id: I7b02e0331e5f8b89b39896049a9e24ce30116f8a
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-07-21 19:41:06 +08:00
chao.an f246c7e6ad net/socket: add SO_SNDBUF support
Change-Id: Ie7f82afd3a4c053112d15424499797eb046ed413
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-07-21 11:43:00 +08:00
chao.an d58c9f1f47 net/wrb: add tcp/udp_inqueue_wrb_size() interface
Change-Id: Iccf2829e445d4842181cd6b8c0422cdfb35c498a
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-07-21 11:42:11 +08:00
liuhaitao 332f2835a2 board/ctrl: correct BOARDIOC_USER command value
Change-Id: I3a8eb8c6c39516bbf24b1aee73312767c37158cd
Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2021-07-20 22:26:17 +08:00
Jiuzhu Dong 8b4749f89f sim/rptun: optimize multi-core startup
Don't need to wait each other.

Change-Id: I6172823c84a96e4082fa5f33bdb05d7bd1d3b056
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-07-20 18:27:11 +08:00
Xiang Xiao a27f0defa8 sim/rptun: Trigger the callback only the sequnece number change
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I4fc8b876541ccb6ee12fa92145628eece0b90e3c
2021-07-20 17:59:53 +08:00
Xiang Xiao 6e5e9cf8a1 drivers/rptun: Start/stop remote processor in the background thread
to avoid blocking the main thread initialization process

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ib8ab2a661ee9540bb03d9d4d851a8d8ee212404e
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-07-20 17:55:28 +08:00
ligd 45f9a11b29 netdb: fix access within misaligned address error
netdb/lib_dnsquery.c:444:14: runtime error: member access within misaligned address 0xef2f5a1b for type 'struct dns_question_s', which requires 2 byte alignment
0xef2f5a1b: note: pointer points here
 63  6f 6d 00 00 01 00 01 c0  0c 00 05 00 01 00 00 00  1c 00 1a 05 6d 75 73 69  63 06 6e 74 65 73 35
              ^
netdb/lib_dnsquery.c:445:14: runtime error: member access within misaligned address 0xef2f5a1b for type 'struct dns_question_s', which requires 2 byte alignment
0xef2f5a1b: note: pointer points here
 63  6f 6d 00 00 01 00 01 c0  0c 00 05 00 01 00 00 00  1c 00 1a 05 6d 75 73 69  63 06 6e 74 65 73 35
              ^

Change-Id: Id20d1f2eed5aa5e78a42233de0f5f2b51876dd44
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-20 15:32:58 +08:00
YAMAMOTO Takashi 3bc0c152c5 iob_trimhead: fix an integer truncation
I guess this fixes https://github.com/apache/incubator-nuttx/issues/4181
2021-07-20 15:29:27 +08:00
ligd af8530f3fa socket_rpmsg: fix typepo
Change-Id: I7d75efd4f4b3c3ff1b0ecc020e81ac5a972eadb5
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-19 23:17:05 +08:00
Xiang Xiao 40661849d6 fs: mkdir return EEXIST if the path already exist
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ie1808697b860974367c17e0ba614ca5cae79f324
2021-07-19 21:13:49 +08:00
Xiang Xiao 681069bdcf fs/tmpfs: Handle the tail '/' correctly
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ia2beeaced2de9c38afefd92a2ddc13dfb4919c45
2021-07-19 21:13:49 +08:00
ligd 36ecaa87d1 ARM: fix CPSR corruption after exception handling
It seems to be caused by the corrupted or wrong CPSR restored on return
from exception. NuttX restores the context using code like this:

    msr spsr, r1

GCC translates this to:

    msr spsr_fc, r1

As a result, not all SPSR fields are updated on exception return. This
should be:

    msr spsr_fsxc, r1

This bug has been fixed by Heesub Shin in:
343243c7c0

Change-Id: Ibc64db7bceecd0fb6ef39284fb5bc467f5603e2e
2021-07-19 20:48:00 +08:00
Jiuzhu Dong dc1c7a644a wqueue: delete sem_wait to avoid race condition
when work_cancel was called, we need to check work.timer whether is active
by WDOG_ISACTIVE for work_queue with delay.

The wdog cb has not been executed when the flag:active is cleared
and if we check flag:active at this moment, WDOG_ISACTIVE will return false.
so the work_cancel will sem_wait until post a semaphore, but all free hpwork_thread
also wait this semphore and their priority are high than caller, this will be a race
condition causing thread/task of calling work_cancel block.

Change-Id: Id86289da60bf967d1062c1cdaaf6959b4f6dd054
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-07-19 20:20:47 +08:00
丁欣童 932926d0d7 Delete miwear soft link.
N/A

Move miwear boards file to vendor/xiaomi/miwear/boards,so this link is
not needed.

Signed-off-by: 丁欣童 <dingxintong@xiaomi.com>
Change-Id: I39754ca6399dec8e87137fd4304347545988b0af
2021-07-19 17:50:34 +08:00
Huang Qi 6cd0fad4ae sched: Move tls_ndxset_t & tls_dtor_t to tls.h
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2021-07-19 13:55:30 +08:00
Jiuzhu Dong eb6dd4fdc7 userspace/wqueue: move exclusive access lock to mqueue inside
Change-Id: I885d5641bc81fedf698c241d4719cb3561700f17
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-07-19 11:40:44 +08:00
Huang Qi 09630961b3 sched: Remove unused TLS member from task_group_s
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2021-07-19 09:53:09 +08:00
Xiang Xiao e5c60da2f5 fs: Simplify sendfile implementation
and avoid call nx_ file API in the kernel space

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Id951ca161df2c2ee267dc4b5a0d7dfa67df4c1e6
2021-07-17 04:58:40 -07:00
Xiang Xiao be0b910f86 net: Add file_socket function
and move the socket special process from fstat/nx_vfcntl/ to file_fstat/file_vfcntl

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ia10341538488ba3a8444df8e73fb5257b2a1f512
2021-07-17 04:58:40 -07:00
Jiuzhu Dong bd1a7259fa sim/cmdline: save boot cmdline
Change-Id: I989850a09528e3868957284c9f419d0992ae8d1f
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-07-17 14:02:07 +08:00
Xiang Xiao e6d9be25b4 arch/sim: The second CPU shouldn't call up_irqinitialize
since the signal handler the process concept

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-07-17 13:34:06 +08:00
Xiang Xiao 5589ad406a arch: Fix rtcb can't found error
use the same condition check in declaration and reference

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I7b05316e914708fceeddac394d784ee3720a3c1b
2021-07-17 13:33:20 +08:00
Xiang Xiao 91518c7bf9 fs: should only apply umask to the userspace caller
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I608e3107aaf3d85045958163a742a1ef1107de91
2021-07-17 13:32:53 +08:00
Xiang Xiao e194867de4 arch/sim: Remove the unused sim_host_timer_handler
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Icacbe74308580b7fc2449cdf9e41f85fce43d5a4
2021-07-16 23:17:10 +08:00
ligd 055079e948 sched: fix build break on spin_lock_irqsave()
Change-Id: Ibfa95021964f44a714cf504fbd0f491b9d8a18c3
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-16 16:19:11 +08:00
ligd 9b6665b9e9 sched/signal: add spinlock to g_sigfreeaction
To avoid nxsig_alloc_action() & nxsig_release_action() competition

MIRTOS-800

Change-Id: I6091ed9d6425a382e8c41351817b6d5ea06638f1
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-16 11:54:06 +08:00
ligd 37c86a6510 socket_rpmsg: fix recv block when remote close early
MIRTOS-849

Change-Id: Id9ff88099bdc0efb27d64ffa8e407f5a9dd40e33
Signed-off-by: ligd <liguiding1@xiaomi.com>
(cherry picked from commit 85b917e20869f415c847c37731c5745c7942a9fd)
2021-07-16 11:40:37 +08:00
Xiang Xiao 5d9a22a0bb arch/sim: Initialize the idle thread stack info correctly
and change the default value of IDLETHREAD_STACKSIZE to 65536

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ia54efbbca4b69706150bc4178844b316688a104e
2021-07-16 11:19:56 +08:00
Xiang Xiao 31e4067eed sched/init: initialize all idle thread's tl_task
since this patch forget to initialize the idle tls info:
commit 50c08bf45b
Author: Huang Qi <huangqi3@xiaomi.com>
Date:   Tue Jun 29 16:01:02 2021 +0800

    libc: Move pthread_key_destructor to task_info_s

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: If7d0c0118323fa3dcf44081d675cd57b14eba75a
2021-07-16 11:19:25 +08:00