Commit Graph

41912 Commits

Author SHA1 Message Date
Xiang Xiao a9f917e44d arch/sim: Implement malloc_size for the custom heap
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-28 21:26:09 +08:00
Xiang Xiao 62ac1e1b6d arch/sim: Remove host_malloc and host_calloc
use host_realloc instead

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I41e5a722532830b9ec26dd7b32bfab9f30b443c2
2021-06-28 21:26:09 +08:00
Xiang Xiao 4e3c1ed8af mm: Support malloc_size function
and rename malloc_usable_size to malloc_size

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I8d83e9148d70e752142af26d7dd9a291123fdd14
2021-06-28 21:26:09 +08:00
liuhaitao 29d1bc9e87 Add exfat directory into .gitignore
Change-Id: I86b94644157af2b1204bcc0d52b118a61c683f53
Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2021-06-28 20:24:31 +08:00
Jiuzhu Dong 6d883bbb5d driver/sensor: fix crash casued by closing the handle during the reading.
N/A

Change-Id: I0632f3f81192b3924302f9b363497822b1117032
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-06-28 19:53:40 +08:00
Xiang Xiao d37d8e00a5 mtd: Add MTDIOC_FLUSH IOCTL like MTDIOC_XIPBASE
since the old design reuse BIOC_FLUSH for
MTD device which make some confusion

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-28 18:06:52 +08:00
Virus.V 4624cb25d6 riscv/bl602:replace syslog to debugging log macros 2021-06-28 18:06:52 +08:00
Xiang Xiao 8c5c09b4bb fs/tmpfs: Account the filename in the allocation block
and caclulate the available block more accurately

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ia6382239f422970771ccefbd6e461241a5f995a5
2021-06-28 16:57:33 +08:00
Xiang Xiao 4e011793dc fs/tmpfs: Remove the temporary strdup in all place
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I224cc9d4ec5fd08937f9f2ddfff022866090be29
2021-06-28 16:57:33 +08:00
Xiang Xiao 4bee08c67f fs/tmpfs: Fix the memory corruption when reallocate tmpfs_directory_s
since it's hard to adjust all childern to point back the new parent
location. Let's allocate the dynamical part(e.g. tdo_entry) separately
and remove the back pointer.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I53afb8336360b7845bd8ecb5aa908acea20e7797
2021-06-28 16:57:33 +08:00
Jiuzhu Dong b658b85bae wqueue: fix compile break becauseof work_process
N/A

Change-Id: I97acaaa4575f87051596ab0b436721690e9289ad
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-06-28 15:10:30 +08:00
Jiuzhu Dong 67dc33bbe1 sched/wqueue: merge kwork_lpthread.c and kwork_hpthread.c to kwork_thread.c
N/A

Change-Id: Ib24a80d8373c954d4532ba54f76c887f62800a36
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-06-28 14:09:59 +08:00
Xiang Xiao 5cd03beaf1 sched: Add kthread_create_with_stack
let caller customize the stack buffer

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I878818ec1ce5650165dbbe2d72a4618cb2e6a094
2021-06-28 10:57:42 +08:00
Xiang Xiao b16a6b9aac net/udp: Fix error: 'MAX_IFINDEX' undeclared
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I6bc09ede185d6ee71d93268c44a8f69a49bf68c9
2021-06-27 19:40:53 -07:00
Xiang Xiao 811bcd413d net: Add if_nameindex and if_freenameindex API
Specified here:
https://man7.org/linux/man-pages/man3/if_nameindex.3.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ia5daed775bd11fa5978d54860632554da8f7b416
2021-06-26 19:45:21 -07:00
Xiang Xiao 52b7656205 libc/time: Initialize tm_zone field correctly
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ief32aedc72ec062d428f8538a25ddfe4f81d7e29
2021-06-25 23:40:19 +08:00
Xiang Xiao 7f23b68038 libc/time: Fix nxstyle issue in lib_localtime.c
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I2e98d92e62b47ade375bda3f043175841d9fa1b7
2021-06-25 23:40:19 +08:00
Xiang Xiao b0493deda7 libc/time: Rename lclptr/gmtptr to g_lcl_ptr/g_gmt_ptr
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I380f28c15ffe3d98734016bfedb1618b20a5f400
2021-06-25 23:40:19 +08:00
Xiang Xiao b7a8ad8318 libc/time: Update g_lcl_tzname only after the success
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I0117c5b43bee3affb36d118e0b97f6dd7137080b
2021-06-25 23:40:19 +08:00
Xiang Xiao 73285ea7f4 libc/time: Avoid modify the global variables concurrently in tzset
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I7fb6439c3a669ef07c1756ccc294cd487805a510
2021-06-25 23:40:19 +08:00
Xiang Xiao 266db9067e libc/time: Change the type of ls_corr to int_fast32_t
since the leap correction is always four bytes in timezone file

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I2d72f5eaf37f0c86d95eaf7504a1b8b1469bf06a
2021-06-25 23:40:19 +08:00
Xiang Xiao 2241f12282 libc/time: Update TZDEFRULESTRING to ",M3.2.0,M11.1.0"
which is the current DST plan used by US

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I50001e69ec1cb9cbf6a0b84fc87f4ad8ff41c0f0
2021-06-25 23:40:19 +08:00
Xiang Xiao 212025c2ba libc/time: Update timezone by tzset in localtime_r
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I54d6aed8f6bc35c1a1d8156702ff71471c3f8066
2021-06-25 23:40:19 +08:00
Xiang Xiao c9c9d84ca4 libc/zoneinfo: Correct the path in comment
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I4bc0490d12f8b469a1f250cd410290a51ef9640f
2021-06-25 23:40:19 +08:00
Xiang Xiao 87709b3a7c sched/wdog: Remove flags field from wdog_s to save memory
since WDOG_ISACTIVE can check func field instead

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I21d7f9cfe6195c8ccb6cc5925ff66f3c89822f9d
2021-06-25 23:40:19 +08:00
liuhaitao 7b93d0c99f sim/miot: add simulator miot defconfig symlink
Change-Id: Iedfaf2fc4d08e307f9711978e3c123e154b6f879
Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2021-06-25 21:09:08 +08:00
yangjiukui b112e70f8b L61: Sensor: Add driver for OPT3006 light sensor.
N/A

Add light sensor.

Signed-off-by: yangjiukui <yangjiukui@xiaomi.com>
Change-Id: If0695aaec21476e68d739c420db732b184c178bb
2021-06-25 17:47:55 +08:00
Jiuzhu Dong b41923aad3 Revert "sched/wqueue: replace the notification mech from signal to semaphore"
This reverts commit a3a0f578bc.
2021-06-25 17:04:36 +08:00
Jiuzhu Dong a2a774fa81 Revert "sched/wqueue: Remove the unused kwork_lpthread.c"
This reverts commit 298f743ea4.
2021-06-25 17:04:25 +08:00
Huang Qi 5c0a079aea libc: Implement fesetround & fegetround for arm
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2021-06-25 12:24:24 +08:00
Xiang Xiao aa2aa503b8 libc/dirname: Handle the consecutive '/' correctly
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I8387aca067e91724fb4656cd7af59bbd626ceffa
2021-06-24 20:57:00 +08:00
Xiang Xiao bf9d8457bd lic/libgen: Remove g_retchar from basename/dirname
to avoid the race condtion

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: If55fba8eca7b98d6a8f0fb44393cf4858b9e9ae4
2021-06-24 20:56:48 +08:00
Xiang Xiao fea4cfe91c libc/sched: Implement nice API
Specified here:
https://pubs.opengroup.org/onlinepubs/007904875/functions/nice.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ib25be28c8dc1c9288e8c78ad756c91ec6ef325a7
2021-06-24 20:56:02 +08:00
Xiang Xiao 30ee11470c libc/sched: Map the nice value more correctly
from https://pubs.opengroup.org/onlinepubs/007904875/functions/setpriority.html:
1.The nice value shall in the range [-{NZERO},{NZERO} -1]
2.Lower nice value shall cause more favorable scheduling

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I5ad60d92abc3b69fbaa406da68cec2e40ca3fa6d
2021-06-24 20:55:53 +08:00
Xiang Xiao 5e70d212b9 sys/select.h: Should include sys/time.h instead of time.h
because struct timeval is defined in sys/time.h

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I767347fc3e0a4cdb3280307c7dfcac53fbddd24e
2021-06-24 20:55:24 +08:00
Xiang Xiao 800754a9be Replace mktime with timegm in rtc and fs driver
since kernel component should use UTC instead local time

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Icf939e1ab0af8e577105f539d2553bc67b3b3d10
2021-06-24 20:53:53 +08:00
Xiang Xiao fed064f45e libc/time: Implement timegm function
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Id988ae077cf54597b2522546c4309b66416b8b0e
2021-06-24 20:53:17 +08:00
Xiang Xiao a8cf6a6655 net: Fix: left shift of 1 by 31 places cannot be represented in type 'long int'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Id2daa60834f7b1917b15bbad89b091b59311e988
2021-06-24 11:42:55 +08:00
Jiuzhu Dong 05d9dc5682 syslog: fix crash when print localtime by syslog
N/A

Enable
CONFIG_LIBC_LOCATIME=y
CONFIG_SYSLOG_TIMESTAMP_FORMATTED=y
CONFIG_SYSLOG_TIMESTAMP_LOCALTIME=y
CONFIG_SYSLOG_TIMESTAMP_REALTIME=y

Change-Id: I322830e0818237a7eb65a158a6a0dea8f9da9b6c
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
(cherry picked from commit 95f97277caf827e145275a1a3b6d82a4535c8c4d)
2021-06-23 10:28:35 +08:00
Xiang Xiao 298f743ea4 sched/wqueue: Remove the unused kwork_lpthread.c
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I7f525f4e9ba847f32c7777b89f7bd738b2487a9f
2021-06-18 21:03:30 +08:00
Xiang Xiao b3bcc02a04 sched: Identify the stack need to free by TCB_FLAG_FREE_STACK
instead calling kmm_heapmember or umm_heapmember because:
1.The stack supplied by caller may allocate from heap too
2.It's hard to implement these two function in ASan case

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I196377822b7c4643ab4f29b7c1dc41dcd7c4dab1
2021-06-18 20:59:03 +08:00
chao.an a3a0f578bc sched/wqueue: replace the notification mech from signal to semaphore
Change-Id: I57596eb661083e914c8718b7c3c1b7190bfa2863
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-06-18 20:44:04 +08:00
chao.an 96f5a5f2c0 drivers/rptun: replace the notification mech from signal to semaphore
Change-Id: Ic06b945effa876f5aff2f8ddc1fe5775c75f77b1
Signed-off-by: chao.an <anchao@xiaomi.com>
(cherry picked from commit 8df58e5675cab032da16e371c4686929a19ee897)
2021-06-18 20:37:47 +08:00
pengyiqiang 0caf78a9c7 sim: Fix posix_memalign mapping error.
N/A

Change-Id: Ie62aac122c8daa11d4118b5b3837016d0283164d
Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>
2021-06-18 11:00:50 +08:00
Xiang Xiao c1593c0f2f Revert "sched/init: don't check remain stack for idle task"
This reverts commit 9b4b8cb0ee.
2021-06-17 22:46:46 +08:00
Jiuzhu Dong 2e6932316e syslog/ramlog_channel: fix log confusion when multi task writing together
N/A

Change-Id: I2a17a81028862ccdd3936862e2548f93c4837ae1
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
(cherry picked from commit a96a9ef5279f50f7fb7fb262cb2b1cd5285f2d8b)
2021-06-17 22:02:39 +08:00
Jiuzhu Dong 40789e2d98 sched/idle: disable sched when idle call nx_bringup
Because idle task will call mm_malloc to create some task
and will take sem of mm. But if smp enable, the sem of mm may be
taken by other cpu, so idle may be block because take this sem and crash.

Change-Id: I22f0233ef6c59a1b81607d4389e68f8646c89395
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-06-17 22:01:57 +08:00
Jiuzhu Dong 90abae1b91 syslog/default_channel: fix log confusion when multi task writing together
N/A

Change-Id: I3ef830c437bd9631272a300e309b88c84fdaa275
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
(cherry picked from commit 74d9cb80b38109392029206f66f6b8af63229bbc)
2021-06-17 22:01:41 +08:00
Xiang Xiao 8b26671c40 syslog/ramlog: Remove the duplication of \n->\r\n conversion
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I5497f3ab40a55c5c08ba893e1186b93915cef03a
2021-06-17 21:52:54 +08:00
Xiang Xiao 95338b2139 net/local: Remove all HAVE_LOCAL_POLL reference
since HAVE_LOCAL_POLL always hardcode to 1

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-17 21:52:54 +08:00