Commit graph

5169 commits

Author SHA1 Message Date
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
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
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
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
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
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
anchao
d24b879e63 Revert "net/socketpair: move socketpair implement into socket internal"
This reverts commit a66e18bc53.

Reason for revert: <N/A>

Change-Id: I3b707a2f6f52fb4a9eb2ab649b686b955b879d65
2021-06-17 20:23:59 +08:00
chao.an
a66e18bc53 net/socketpair: move socketpair implement into socket internal
Change-Id: I1c6d7178e2631e43d9fcc99918456eec36f730ce
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-06-16 15:19:44 +08:00
chao.an
70135e1e45 sys/poll: add POLLRDHUP definition
Change-Id: I1117279d9a620138789256d699ae32d47eab3a90
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-06-16 14:15:14 +08:00
Xiang Xiao
1c02246a78 Revert "sched/posix_spawn: Don't insert name at the begin of argv"
This reverts commit 032086870d.
2021-06-15 21:55:30 -07:00
chao.an
693bd87cab net/sock: move the psock calloc out of sockfd_allocate
Change-Id: I3b5373ffe9a4034c2ac2cd83389fd46c47dc9047
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-06-15 11:23:13 +08:00
Xiang Xiao
a8ca032acc sched/posix_spawn: Don't insert name at the begin of argv
since the standard require the caller pass the name explicitly
https://pubs.opengroup.org/onlinepubs/009695399/functions/posix_spawn.html:
The argument argv is an array of character pointers to null-terminated strings.
The last member of this array shall be a null pointer and is not counted in argc.
These strings constitute the argument list available to the new process image.
The value in argv[0] should point to a filename that is associated with the
process image being started by the posix_spawn() or posix_spawnp() function.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Id79ffcc501ae9552dc4e908418ff555f498be7f1
2021-06-13 01:16:06 -07:00
Xiang Xiao
0655a39c91 binfmt: Remove filename/exports/nexports from binary_s
to simplify the life cycle management

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-13 00:31:22 -07:00
Xiang Xiao
5c55a1d7fd binfmt: Move argv copy into exec_module
and remove the related fields from struct binary_s

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-13 00:31:12 -07:00
Xiang Xiao
c997bf0f52 sched/task: Simplify the syscall handling of task_spawn
It's better to save one argument by returning pid directly.
This change also follow the convention of task_create.
BTW, it is reasonable to adjust the function prototype a
little bit from both implementation and consistency since
task_spawn is NuttX specific API.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Id74f4dd1ef26dfd8f7c473684cf1a45fbeee13cf
2021-06-13 00:30:57 -07:00
Xiang Xiao
4d66266a8e sched: Don't include nuttx/sched.h inside sched.h
But let nuttx/sched.h include sched.h instead to
avoid expose nuttx kernel API to userspace.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I6fe673364be9eb1259381e6575d4c1a9fea58097
2021-06-13 00:25:26 -07:00
Xiang Xiao
2331ba972a Don't include errno.h from spawn.h
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-13 00:22:14 -07:00
Xiang Xiao
5db8fc1f3a sched/spawn: Support the stack address argument
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-13 00:04:59 -07:00
Xiang Xiao
35035f5c89 arch: Rename xxx_getsp to up_getsp
All modern desgin support stack pointer and it's also an
important information, so let's standardize this interface.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-11 11:37:19 +08:00
chao.an
2152a35662 net: fix build break
Change-Id: I662580ded8d1c98ddcfbcfae961978eb3512e3b9
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-06-09 22:07:45 +08:00
chao.an
af44043ec0 net: add support of FIONREAD
Change-Id: Iebfdd960f4e9b184558e390f78ec7f8369753b5b
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-06-09 09:47:59 +08:00
chao.an
600671fe86 netinet: move the byte ordering convert functions to "netinet/in.h"
Change-Id: Ida4916fe062f20258dbbcd794e59e686d4d5c35e
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-06-08 22:21:58 +08:00
chao.an
2fd5872449 mm/iob: add iob_get_queue_size() helper
Change-Id: I117530f364cbef1e011638ff6d14087b7447bde7
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-06-08 11:57:52 +08:00
Xiang Xiao
3c33d253b4 drivers/syslog: Remove emergstream implementation and caller
since emergstream always call syslog_force, but syslog_force is designed
for the interrupt context, and then doesn't mean any emergency thing.
On the other hand, emergstream has other bad side effect:
1.Can't output to file or dev channel
2.Can't work well with the interrupt buffer

Change-Id: I1c7af74f82da93ffa4ebe0e6ac25634aeb73a890
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-06-04 13:46:41 +08:00
chao.an
e223790148 serial/uart/h4: add bt h4 uart serial driver
Change-Id: I456622ce097006447cc8b050e4a44ee96865ddfe
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-06-03 18:33:20 +08:00
chao.an
8f0cc709d4 wireless/bluetooth: decoupling bt_driver_s and bt_buf_s
Change-Id: I12879c364cf8ca63898da94621e94d8fc23a4f6f
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-06-03 18:33:14 +08:00
chao.an
df71da9450 bluetooth/filter: add more OGF into ble blacklist
Change-Id: I4f1b98dc63ab2d9eeb523b8040aae88ea285bb9a
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-05-31 21:00:01 +08:00
chao.an
caecd75b41 wirelss/bluetooth/bt_buf: add ISO buffer type
Change-Id: I9de3506e9c8f70bbcefafda3319be194dcb7cb0b
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-05-25 21:56:12 +08:00
Xiang Xiao
191e010c5f include/spawn.h: Add POSIX_SPAWN_SETSID definition
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I7ad654a1cb9b74a9f27f52c88fffa8b487a48f33
2021-05-17 20:03:49 +08:00
Xiang Xiao
88326eac8d libc/pwd: Add NSS_BUFLEN_PASSWD macro
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I739679038b2004cc45d78f540831ba81b088a586
2021-05-17 19:58:28 +08:00
Xiang Xiao
6bb3366fe2 libc: Implement openpty function
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I36e02af0145cd6e740766e7484cc9d5ce410e5e4
2021-05-17 19:58:06 +08:00
Xiang Xiao
874e564c89 drivers/serial: Change the default value of SERIAL_NPOLLWAITERS to 4
since the console is normally opened three time as stdin, stdout and
stderr and remove the dependence on STANDARD_SERIAL because other type
of serial drivers also support the poll through the same codebase.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ie68322c4647cc838b295491329969869d6ba310b
2021-05-17 19:55:40 +08:00
Byron Ellacott
70ab250c5d Add experimental support for an eZ80 toolchain using llvm and GNU binutils.
An additional fix for the RTC driver to lock the RTC after setting values instead of unlocking it is included.
2021-05-10 19:23:33 +08:00
ligd
74d29cf864 sched_critmon: add thread run time to critmonitor
Change-Id: Ib44e45f0f9a1b249b4067db324c9dbdf0cf3f288
Signed-off-by: ligd <liguiding1@xiaomi.com>
(cherry picked from commit 08aeeb5981aeb8787a9d259506185650638b9970)
2021-05-08 20:49:40 +08:00
Xiang Xiao
71c942ea51 libc/pty: Make ptsname[_r] support PSEUDOTERM_BSD config too
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I82a60ded48ea3437bd5f2b4fe328294d7077b040
2021-05-08 20:49:11 +08:00
Jiuzhu Dong
c5cd15a72e include/termios: left shift of 1 by 31 places cannot be represented in type 'int'
N/A

cu_main.c:172:22: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
by asan

Change-Id: I224345bddb11523db0c4a91c16617a3200fad034
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-05-08 20:45:42 +08:00
Jiuzhu Dong
9a956df67b sim_addrenv: support add addrenv dynamically multiple times.
N/A

Change-Id: Ie34f6c59bc16fb147c7103978253dbe9403990d3
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-05-08 20:26:39 +08:00
Jiuzhu Dong
788e409cb7 driver/syslog: add config SYSLOG_RPMSG_SERVER_NAME to
N/A

specified the name of remote proc(rpmsg server)

Change-Id: Ie270d651071e87a40a80ab489597ae18db9814f0
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-05-08 20:22:28 +08:00
Jiuzhu Dong
a099f22123 driver/rtc: add config CONFIG_RTC_RPMSG_SERVER to
N/A
select rtc rpmsg role.

Change-Id: I7f9053b070593573caa5d988c6a2e13593da6bc5
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-05-08 20:19:07 +08:00
Jiuzhu Dong
436180b6ad driver/rtc: add config RTC_RPMSG_SERVER_NAME to
N/A

specified the name of remote proc(rpmsg server)

Change-Id: I0086bb43727a2bbb5e68f88907b5e4608182ef9c
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-05-08 20:16:09 +08:00
liuhaitao
dc639b2b59 Merge remote-tracking branch 'mirtos/master' into dev-upmerge-nuttx-10.1-0507
Change-Id: I4bb3a61356be2b4a77ccfe45390b15e68a376dd6
Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2021-05-07 20:46:07 +08:00
Jiuzhu Dong
241dcfacd1 cmd/free: add nused field in command free
N/A

Change-Id: I74aa4b1e7394a17c3b117322a4cc24aa52aac3b8
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-04-28 11:34:26 +08:00
David Sidrane
e23c3ffc03 arch: remove up_irq{save|restore} these come from irq.h 2021-04-21 15:59:41 -03:00
Masayuki Ishikawa
1b00e5d518 spinlock: Remove SP_SECTION
Summary:
- SP_SECTION was introduced to allocate spinlock in non-cachable
  region mainly for Cortex-A to stabilize the NuttX SMP kernel
- However, all spinlocks are now allocated in cachable area and
  works without any problems
- So SP_SECTION should be removed to simplify the kernel code

Impact:
- None

Testing:
- Build test only

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2021-04-20 22:41:44 -05:00
YAMAMOTO Takashi
418e11b8b3 modlib: Always use separate allocation for text and data
Pros:

* Reduce code differences
* Smaller allocations for !CONFIG_ARCH_USE_MODULE_TEXT

Cons:

* Likely to use more memory for !CONFIG_ARCH_USE_MODULE_TEXT in total

Tested with:

* sim:module on macOS
* esp32-devkit:nsh + CONFIG_MODULE on qemu
* lm3s6965-ek:qemu-protected + CONFIG_EXAMPLES_SOTEST on qemu
2021-04-19 22:20:20 -05:00
Masayuki Ishikawa
1a9e7efde5 smp: Remove CONFIG_SMP_IDLETHREAD_STACKSIZE
Summary:
- The CONFIG_SMP_IDLETHREAD_STACKSIZE was introduced to optimize
  the idle stack size for other than CPU0
- However, there are no big differences between the idle stacks.
- This commit removes the config to simplify the kernel code

Impact:
- All SMP configurations

Testing:
- Tested with ostest with the following configs
- spresense:smp, spresense:rndis_smp
- esp32-devkitc:smp (QEMU), maix-bit:smp (QEMU)
- sabre-6quad:smp (QEMU), sabre-6quad:netnsh_smp (QEMU)
- raspberrypi-pico:smp, sim:smp (x86_64)

Signed-off-by: Masayuki Ishikawa <asayuki.Ishikawa@jp.sony.com>
2021-04-19 21:46:39 -05:00