Commit graph

41969 commits

Author SHA1 Message Date
yangjiukui
eafc254e14 Fix: Sensor: Fix the use of ioexpander and delete redundant member of opt3006.
N/A

Add pull up when using SETDIRECTION; Using transformation replace pinset;
Delete i2c point in opt3006 device struct.

Signed-off-by: yangjiukui <yangjiukui@xiaomi.com>
Change-Id: I7e46d0cde878fbca325f89be47c57ff9b9456ff0
2021-07-12 15:30:37 +08:00
mage1
fc3920904e mm: Add dmalloc wrapper layer and enable dmalloc module.
Change-Id: I83fe5e275215946d5962379fc7aad882724741f2
2021-07-10 05:04:56 -07:00
Xiang Xiao
0961be771a mm: Simplify the semaphore handling
1.Move all special process to mm_takesemaphore
2.Remove the support of recurive lock
3.Remove mm_trysemaphore function

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ie216a6294ab67c5d427f31b089beb15c532f08fe
2021-07-10 05:02:33 -07:00
Xiang Xiao
49a4cfd8aa fs: Remove the inernal st_count field from struct stat
it's more simple to reuse the resolve argument as the recursive count

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I826b2fef3af8b12aae230e4766ab09f8de988f8a
2021-07-10 04:37:16 -07:00
Xiang Xiao
8692c316ff libc: Implement futimes on top of futimens
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ie54de66ca1bc26a68f2922861e1edd1fdabb8f33
2021-07-10 19:33:18 +08:00
Xiang Xiao
b47cdeb910 libc: Implement utime on top of utimes
https://man7.org/linux/man-pages/man2/utime.2.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ia10574fdd0d07eabbc93aceeea5a0b953e30339a
2021-07-10 19:32:48 +08:00
Xiang Xiao
a7c2343c32 libc: Move the declaration of futimens from sys/time.h to sys/stat.h
to follow the spec here:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/futimens.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Id8e418794bd43827c01af772ce704a8d3e7681c5
2021-07-10 19:22:58 +08:00
Xiang Xiao
5398821b6c fs: pseudorename should call inode_release in the error path
to avoid the memory leak

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I8f7e4c8fb89188614d03dcf383a1707f25c65174
2021-07-10 19:21:25 +08:00
Xiang Xiao
78b5e4c657 libc: Implement ttyname and ttyname_r
Note: this patch can get file path from root pseudo file handle,
but a general infrastructure is setup for other file system too.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I86cd79ebb741f2f43fdd398bb7498c40687d949b
2021-07-09 15:46:00 +08:00
zhouliang3
2317117176 fs: Add parent node of inode
N/A

Signed-off-by: zhouliang3 <zhouliang3@xiaomi.com>
Change-Id: I006c6172ced8edd47b9d4661880e04d3a4274854
2021-07-09 14:52:25 +08:00
Xiang Xiao
38dd53c6ba arch/armv7-a: Remove the special SMP SGI process
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Iaf7fe77a3ab7cbf145d907dafb0b7ca54cc4a012
2021-07-09 11:34:39 +08:00
Xiang Xiao
9166ffe83c mm/tlfs: Report the number of used block correctly
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I0457b3843e9e62b47b1600d627909533aab8986d
2021-07-08 22:56:10 +08:00
Xiang Xiao
6ab3dd1e7c fs: Move the default ioctl handle from nx_vioctl to file_vioctl
ensure the behaviour is same in all ioctl function variant

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ie67cfbc579004c8488ef5004c9be7fb179e77041
2021-07-08 17:29:12 +08:00
Jiuzhu Dong
2d9b18a8ea smp: fix pid assign issue
example:lack pid:4 when CONFIG_SMP_NCPUS=4
nsh> ps
  PID  PPID CPU PRI POLICY   TYPE    NPX STATE    EVENT     SIGMASK   STACK COMMAND
    0     0   0   0 FIFO     Kthread N-- Assigned           00000000 000944 CPU0 IDLE
    1     0   1   0 FIFO     Kthread N-- Running            00000000 000000 CPU1 IDLE
    2     0   2   0 FIFO     Kthread N-- Running            00000000 000000 CPU2 IDLE
    3     0   3   0 FIFO     Kthread N-- Running            00000000 000000 CPU3 IDLE
    5     0   0 100 FIFO     Task    --- Running            00000000 065504 init

Change-Id: I30a7e50c418332ec89edfd42473d9bebb2b02bbc
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-07-08 15:16:35 +08:00
Jiuzhu Dong
1ecbc99b21 sim/smp: fix smp can't start, caused by signal too busy
N/A

Change-Id: Ia9cad04759a869f9bed871fa0acd002115eefb0a
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-08 15:16:35 +08:00
Jiuzhu Dong
4c867f3b6d syslog: optimize init logic for early buffer initialize
N/A

Change-Id: I3295803977fa51e8ed8dedf7f0966b9604f8204d
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-07-08 14:16:21 +08:00
Jiuzhu Dong
e63fe68980 ramlog: init head and tail when buffer is empty on boot
N/A

Change-Id: I6963ef6256c3a93ac7a63115c303033ceafa321f
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-07-08 14:05:13 +08:00
Jiuzhu Dong
c5e6c0a99f Revert "fix(ramlog): fix initial ramlog buffer pointer overflow"
This reverts commit 76242c5ee1.
2021-07-08 11:43:23 +08:00
Xiang Xiao
0fe1c85ba4 mm: Remove mm_heap_impl_s struct
it's more simple to make mm_heap_s opaque outside of mm

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I5c8e435f6baba6d22b10c5f7e8d9191104fb5af2
2021-07-07 02:14:53 -07:00
chenwei23
76242c5ee1 fix(ramlog): fix initial ramlog buffer pointer overflow
description: modify function ramlog_initbuf in
drvers/syslog/ramlog.c to fix initial ramlog buffer
pointer overflow

Signed-off-by: chenwei23 <chenwei23@xiaomi.com>
Change-Id: I38e2d5c726e3af11c4b47245197fec5cbe4af1f6
2021-07-07 14:33:19 +08:00
Xiang Xiao
bf83a3253f fs/procfs: layout the output of meminfo correctly
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ic30e70772e19a43e2ad3b298e3ba1ac77f2f2219
2021-07-06 23:25:39 +08:00
ligd
560a86ff57 sim: fix loop add delaylist when mm_free in IDLE thread
Change-Id: I1827c663275f47c9dc30d63e17e3d016b0000166
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-06 11:16:05 +08:00
zhouliang3
07b2bd769e Increase the function of crc8 to use custom polynomials
N/A

Signed-off-by: zhouliang3 <zhouliang3@xiaomi.com>
Change-Id: I3c53bf25541c1811a05d025b39dfe24cb0613b72
2021-07-06 09:20:56 +08:00
chao.an
55c032d061 net/socketpair: move socketpair implement into socket internal
Change-Id: Ibf84671a1d59122ee5a3c5161048ea4f00356b1c
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-07-05 12:13:40 +08:00
xiatian6
cf9baa0178 feature(nuttx sensor driver): add ak09919c mag sensor dirver.
Add ak09919c mag sensor dirver.

Change-Id: Ie90149689a50dc4f68aa1802d00bb818092ed795
Signed-off-by: xiatian6 <xiatian6@xiaomi.com>
2021-07-05 09:22:04 +08:00
Xiang Xiao
8cea82708a mm/tlsf: don't do mm_checkcorruption in IRQ
because this not safe in SMP mode, port from:
commit 34f63bdc13

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I288f373e10aa4a68034fc9d9a0f87a0dc3f36cd5
2021-07-04 10:36:58 -07:00
Xiang Xiao
9ad74b2c3a arch/sim: Fixup_heap.c:154:3: error: 'heap_impl' undeclared
and up_heap.c:58:33: error: field 'mm_procfs' has incomplete type

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I4e871e397758c5b0a54803b6cfd1e0c697bef5d8
2021-07-04 10:36:20 -07:00
Xiang Xiao
4adf7ad09d mm/tlsf: Register mem procfs in mm_initialize
follow up this change:
commit 268d66173d
Author: Xiang Xiao <xiaoxiang@xiaomi.com>
Date:   Sat Jul 3 21:25:14 2021 +0800

    mm: Move procfs_register_meminfo into common place

    to avoid the code duplication and ensure the consistent behaviour

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ifd9f6ff67f0cb6de54d733f929474154830dc46b
2021-07-04 00:56:24 -07:00
Xiang Xiao
69cb1d7086 mm: Move the real implementation of mm_sbrk to sbrk
and remove mm_sbrk and kmm_sbrk since it's wrong to expose
sbrk to other heaps except the default userspace heap.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I78fdf34c271585ec8fdb81eacedda9fc9f2431fb
2021-07-04 00:53:07 -07:00
Xiang Xiao
9cd1252109 mm: Call memalign in malloc if ARCH_ADDRENV and BUILD_KERNEL are defined
to reuse the sbrk logic inside memalign

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-07-04 15:35:13 +08:00
Xiang Xiao
268d66173d mm: Move procfs_register_meminfo into common place
to avoid the code duplication and ensure the consistent behaviour

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I3fa9ba13d3f8abf882907782708f52c788d0c813
2021-07-04 15:33:19 +08:00
Virus.V
bb6273d4d1 netlink: fix compile error when enable netlink
Signed-off-by: Virus.V <virusv@live.com>
2021-07-02 14:57:22 +08:00
mage1
f6a4c17838 sim: fix sim runtime err under sanitize check mode.
since gcc sanitize can not stub proper code in nuttx kernel code.

Change-Id: I0910bddee71538c202c6a0a8faab76bcc65f5cd2
2021-07-02 10:49:13 +08:00
Jiuzhu Dong
1dac6f93fd fs/procfs: add StackAlloc field for task stack info
N/A

Change-Id: I4b74191896a4223bb889bbe759694e0b229db71c
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-07-01 22:04:46 +08:00
liuhaitao
b072d4709a mm: correct typo error to fix build break
Change-Id: Ieb053b4e58e127121fa5e9a93cb7da6ec7b0474a
Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2021-07-01 21:16:30 +08:00
Jiuzhu Dong
5d51a3c3ec wqueue: fix assert about work was cancelled when work doesn't occur.
N/A

Change-Id: I04916e041b1b3329287214c052d3ba5fc259235c
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-07-01 19:10:50 +08:00
ligd
1438eca2a7 sched/waitpid: handle waitpid waitting tcb->group is NULL
Fail case:
exit -> nxtask_terminate -> nxtask_exithook -> nxsched_release_tcb
                            group_leave     || nxsched_releasepid & group_leave
                                            /\
                                           /  \
                                       switch out & waitpid()

Thread A group_leave in nxtask_exithook, switch out,
Thread B do waitpid(thread A) then meet traget thread A group is NULL, error.

Change-Id: Ia181d7a13aa645ec1c3141a45839fbf79db35b17
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-01 18:26:20 +08:00
ligd
17e65242d3 sched: add depends on ARCH_INTERRUPTSTACK to SMP
Change-Id: I7edbbcf314045c5567e30b39b0693672e5d10e9a
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-01 18:26:20 +08:00
ligd
03b7bd9cf1 fs: move out nx_close from filelock
Change-Id: Ia6c4ec88d90db0330134d0aaa30e94cb71c8a066
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-01 18:26:20 +08:00
ligd
dcea2afd7e mm: fix memory corruption when loop create/exit thread in SMP mode
Root casue:
when do thread exit, need add free stack operation to mm_delaylist,
but in SMP mode, CPU0 thread1 exit, at this time, CPU1 call malloc
and free mm_delaylist.

Fix:
Divide mm_delaylist for per CPU in SMP mode.

Change-Id: Ibf7d04614ea2f99fb5b506356b7346a0d94f0590
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-01 18:26:20 +08:00
ligd
772044bbdf serial: add ioctl TIOCNOTTY
Change-Id: I14ab1304d6330578423e0775f42faa8e19886fef
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-01 18:26:20 +08:00
ligd
5c7166f9dd sched: add STACK_USAGE_SAFE_PERCENT for stack overflow check
Change-Id: Ia70e243b36401e28c31fcd7e1b480b79374c27ef
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-01 18:26:20 +08:00
ligd
2d71063825 sched: fix stack check crash in idle thread
Change-Id: Iea7c096ffcab181f318edcc1bfe1717785831b7a
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-01 18:26:20 +08:00
ligd
34f63bdc13 mm: don't do mm_checkcorruption in IRQ
because this not safe in SMP mode

Change-Id: Ifaf49818c51ee4283f0e280ae3e4e23cbd0dba08
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-01 18:26:20 +08:00
ligd
23f948aa7f syslog: add CPU id to system when open CONFIG_SMP
Change-Id: Ie8aaf44583ff4146b79b1392d1410b31806a81e8
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-01 18:26:20 +08:00
Xiang Xiao
82047fe3c4 mm: Add kmm_malloc_size and mm_malloc_size
make malloc_size implementation align with malloc

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I8d7781925f06e58a880437a16569dccbfd2ea035
2021-07-01 18:08:54 +08:00
Xiang Xiao
1c5b37a1f5 libc: Remove the duplication lib_xxx macro
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I73c876ed40811c013dad83b8b2aeb7bdc3041913
2021-07-01 18:08:54 +08:00
Xiang Xiao
3dd31cba2c Move aligned_alloc, posix_memalign and valloc from mm/umm to libs/libc/stdlib
since the similar functions(e.g. strdup/strndup) put into libs/libc/string

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ifb2c0c51298b09014748e5ee8275db51213d6911
2021-07-01 18:08:54 +08:00
Xiang Xiao
da028e391b fs: Initialize fs_allmaps_s::exclsem in declaration directly
and then remove rammap_initialize and caller

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ife9f04d409b3a14a3be4bbb61c23da6e7a9f8a3d
2021-07-01 12:52:01 +08:00
Xiang Xiao
2cfb3f673a mmap: Implement the minial but reasonable mlock/munlock/mprotect
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I538e0d78ecd0680374a2e0f56adbc61d7a4e6d1f
2021-07-01 12:31:17 +08:00