Commit Graph

4628 Commits

Author SHA1 Message Date
Xiang Xiao
e1ecb3e27c libc: Don't define localtime[_r] to macro when CONFIG_LIBC_LOCALTIME not define
since libc++ declare these function in ctime by:
using ::localtime[_r];

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ic0bb68b44c0cab838ab7cc34baee2aaa3ca8a9b5
2020-07-19 19:35:21 -07:00
Xiang Xiao
aa57174eb9 rwbuffer: Optimize the buffer algorithm
avoid the buffer flush as much as possible

Change-Id: I902f374e9540b36bd0b0c77a34cab5014a2c24fc
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-07-19 13:13:50 -07:00
Xiang Xiao
4f22f746f8 syscall: Remove g_funclookup and g_funcnparms
since nobody use them

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-07-19 13:07:31 -07:00
Xiang Xiao
d6827cab60 arch: up_assert shouldn't call exit directly
since exit will be only callable from userspace and change
the 1st argument from "const uint8_t *" to "const char *"

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I86487d57210ab63109148232da71dbc4d60a563b
2020-07-19 01:21:36 +01:00
Xiang Xiao
6f6d61eec4 fs/vfs: Implement statvfs and fstatvfs
specified here:
https://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/statvfs.h.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-07-13 20:25:03 +01:00
Nakamura, Yuuichi
1f7e91d217 Move note_register() declaration into the separate header 2020-07-13 00:46:55 -05:00
Oleg Evseev
b6ed3392a4 drivers/can: base readers checks on cd_readers list itself
Get rid of several useless dev vars
2020-07-11 15:06:56 -03:00
Xiang Xiao
9dff16e0e4 fix nxstyle warning
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ieaf325c899d1c349d64dfa15bddcc32afd1fce42
2020-07-10 21:30:02 +01:00
Xiang Xiao
c3e256e018 libxx: Make __dso_handle weak
since sim arch has to use other instance provided by host glibc
also initialize __dso_handle to self as glibc:
https://github.com/bminor/glibc/blob/master/csu/dso_handle.c#L21

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I7531ae58fc4dbe4600bcb2c2c3a6cac021378bc1
2020-07-10 13:51:26 +09:00
Ouss4
81d814b86e include/nuttx/arch.h: Trivial typo fixes. 2020-07-09 11:17:41 -03:00
Xiang Xiao
1bca457b28 libc: Always declare getenv, link/symlink and atexit/on_exit
since many c++ library implementation reference these symbols by using ::xxx but never
really use them, the declaration avoid the unused code is pulled into the final binary

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Idd7bf9a1e09b77a6b21f900cd3ede08a1cc82d86
2020-07-08 12:07:22 +01:00
Beat Küng
a349595316 gpio: extend gpio_pintype_e for pulldown/up and opendrain
- fix code style
- fix bool conversion when calling go_read()
2020-07-07 08:34:25 -05:00
Xiang Xiao
67ef70d460 vfs/dirread: Should return the same file type as lstat
by extend the possible value of d_type for the special file

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-07-07 13:41:10 +01:00
Xiang Xiao
91ed14c631 vfs/stat: Make the flag defintion more confirm POSIX standard
specified here:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_stat.h.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-07-07 13:41:10 +01:00
Xiang Xiao
3472de3500 Revert "sched/sched/sched_releasetcb.c: Handle custom stack allocations."
Since up_release_stack auto detect whether the memory come from builtin heap
if (ttype == TCB_FLAG_TTYPE_KERNEL)
  {
    if (kmm_heapmember(dtcb->stack_alloc_ptr))
      {
        kmm_free(dtcb->stack_alloc_ptr);
      }
  }
else
  {
    /* Use the user-space allocator if this is a task or pthread */
    if (umm_heapmember(dtcb->stack_alloc_ptr))
      {
        kumm_free(dtcb->stack_alloc_ptr);
      }
  }

This reverts commit 124e6ee53d.
2020-07-07 00:21:46 +01:00
Xiang Xiao
60fe0a0f96 libc: Refine the inline handling
1.Remove CONFIG_HAVE_INLINE macro
2.Change the ANSI C function to normal function
3.Other simple non ANSI function to macro

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-07-04 11:10:29 +09:00
Xiang Xiao
b984534255 lib/math: Remove float32 and float64 definition
since they aren't defined by standard and never supported by other POSIX OS

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-07-02 10:53:34 -03:00
chao.an
d938e2cd46 CI check: fix nxstyle warning
nxstyle fixes to reduce the CI warnings

Signed-off-by: chao.an <anchao@xiaomi.com>
2020-07-02 01:53:23 -05:00
chao.an
3fbdc213b7 syscall/prctl: fix PR_SET_NAME failure if without <pid> arg
add PR_SET_NAME_EXT/PR_GET_NAME_EXT extension to avoid semantic
conflicts, use extened version for pthread_setname_np/pthread_getname_np

Change-Id: I40404c737977a623130dcd37feb4061b5526e466
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-07-01 21:52:18 -05:00
Xiang Xiao
8153e31753 sched: Call c++ global variables constructor inside nxtask_startup
to avoid the similar code spread around each application

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I8967d647eaf2ecae47f29f83e7fa322ef1b42a02
2020-07-01 07:55:33 -06:00
Xiang Xiao
e9c7df4769 sched: Rename task_startup to nxtask_startup
to follow the naming convention

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I3594d12a65e8cacea99bc295d622628304c3f9f8
2020-07-01 07:55:33 -06:00
Xiang Xiao
651eefc8f7 fs: Rename link to symlink
since the current implementation is really a symoblic link not hard link

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I59d30d0a620b0b5714fe91bbe90d4405cf53d187
2020-07-01 11:58:12 +02:00
Xiang Xiao
a102922e12 libc: Implement realpath
specified here:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/realpath.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ie52dcd1c5c5faa4b033901eedd7182bbb9473f7a
2020-06-30 13:09:58 -06:00
Xiang Xiao
0b891d60f9 vfs: Define symlink as link
specified here:
https://pubs.opengroup.org/onlinepubs/009695399/functions/symlink.html
yes, symlink is different from link:
1.symlink create the soft(symbolic) link
2.link create the hard link
but it is suitable to make them same now since vfs doesn't support the
hard link and the soft link in file system level yet.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I3b6e311cc1c826542165c9d93cbe5e078f113684
2020-06-30 13:09:58 -06:00
Xiang Xiao
b598ab43d7 fs: Implement lstat function
specified here:
https://pubs.opengroup.org/onlinepubs/009695399/functions/lstat.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Iefc23a02d425ff84fa4027aea7da1181b01eced7
2020-06-30 13:09:58 -06:00
Xiang Xiao
14ecb8723a sched: Change tcb_s to task_tcb_s for nxtask_[un]init
since these functions can just work with task not thread

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-06-30 10:54:42 -06:00
Xiang Xiao
a81a260490 vfs: Add chmod/fchmod/utimes function prototype
but skip the implemenation because VFS layer doesn't support the time/mode change yet:
https://pubs.opengroup.org/onlinepubs/009695399/functions/chmod.html
https://pubs.opengroup.org/onlinepubs/009696699/functions/fchmod.html
https://pubs.opengroup.org/onlinepubs/009695399/functions/utimes.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ie4a2d3bb4eb5f5aaa0aeb794a4012b096aa94e4f
2020-06-30 09:20:33 +01:00
chao.an
2fc02ec4a4 sched/task_init: change the stack pointer type to (void *)
change the stack pointer type from (uint32_t *) to (void *)

Change-Id: I90bb7d6a9cb0184c133578a1a2ae9a19c233ad30
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-06-30 08:26:38 +02:00
chao.an
b296adc3bb socket/SOL: sync the SOL index with linux
Change-Id: I32b9eb7cc3bc1428f0ff7bf5e60d7fff52621db2
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-06-29 11:34:43 -05:00
Xiang Xiao
d17b963bca libc: Move double_t typedef from sys/types.h to math.h
specified here:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/math.h.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I3497a73908301d999cf1cfc4a66552a7ca4868c6
2020-06-29 13:37:41 +01:00
Xiang Xiao
771f532dcb cxx: Remove CONFIG_NET guard from [get|set]hostname
since these two functions is always implemented now

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Iae46fa4d38b680a5d1ce5c314ffcb71af4a3dc95
2020-06-29 09:06:36 -03:00
Beat Küng
f6039bbfa7 stm32f7: add CANIOC_SET_NART and CANIOC_SET_ABOM ioctl's to can driver 2020-06-29 09:05:44 -03:00
Xiang Xiao
676a2b77f8 stdio.h: Implement fseeko and ftello function
specified here:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fseek.html
https://pubs.opengroup.org/onlinepubs/9699919799/functions/ftell.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-06-29 14:26:19 +09:00
Xiang Xiao
977f04a2b1 libc: sysconf support _SC_NPROCESSORS_CONF/_SC_NPROCESSORS_ONLN
specified here:
https://www.man7.org/linux/man-pages/man3/sysconf.3.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I87fba8476221797e59c69c1953974bebc8d0d7b3
2020-06-27 22:43:13 +01:00
chao.an
b83b83bf51 pthread/mutex: add PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP support
Note: the _NP suffix indicates a non-portable extension to the POSIX specification.

Library Functions Manual

PTHREAD_MUTEX(3)
...
SYNOPSIS
...
       pthread_mutex_t recmutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
...
DESCRIPTION
       PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP (for recursive mutexes).

Change-Id: I58320421ee8dc9a90dca4f593b5d3908be3932db
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-06-26 09:52:56 -03:00
Ouss4
701100f6f9 drivers/sensors/mpu60x0: Add I2C support. 2020-06-24 23:30:34 -03:00
YAMAMOTO Takashi
ef5d204fd2 rewind: clear the error indicator
Make rewind() clear the error indicator of the stream
as it's specified by the standards.
2020-06-24 16:56:44 +08:00
Xiang Xiao
d24bd782a9 libc: Implement pathconf and fpathconf
specified here:
https://pubs.opengroup.org/onlinepubs/009695399/functions/fpathconf.html
note: only _PC_PATH_MAX is handled now

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Idd323dc10e8f31f10dd1fc64f467227808c11dbd
2020-06-23 17:34:54 +01:00
Xiang Xiao
1e166f7ecb sysconf: Implement _SC_ATEXIT_MAX query
and remove the incorrect macro ATEXIT_MAX

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ia5d7dafc50e942f62f95137313c34741c6dd60ba
2020-06-23 17:34:54 +01:00
Gregory Nutt
f24c71be32 include/ftw.h: Add header file
Add the ftw.h header file as specified at OpenGroup.org:
https://pubs.opengroup.org/onlinepubs/009695399/basedefs/ftw.h.html
2020-06-23 17:34:28 +01:00
Ouss4
530cad304f drivers/spi/spi_bitbang.c: Fix typos and nxstyle complaints. 2020-06-21 14:13:32 -06:00
Ouss4
bd82486f1c drivers/lcd: Add support for the ST7735 TFT controller. 2020-06-21 14:13:32 -06:00
Ouss4
a09f88c4a6 include/nuttx/video/fb.h: Several parentheses were missing in macros. 2020-06-21 14:13:32 -06:00
David Sidrane
c91a81149d cstdlib:Add missing atox to std namespace 2020-06-18 10:23:47 +08:00
Gregory Nutt
69e97c19ea sched/sched/sched_note.c: Implement interrupt/syscall support
A previous PR added interrupt and system call scheduler notes.  This addess buffering support for those notes.
2020-06-16 20:42:22 +01:00
Gregory Nutt
4fd506efaa include/nuttx/sched_note.h: nxstyle fixes. 2020-06-16 14:04:53 -03:00
Yuuichi Nakamura
df2bc1e4c3 Add syscall and irqhandler hooks in sched_note.h 2020-06-16 14:04:53 -03:00
Matias Nitsche
53387b53c6 style fixes 2020-06-16 01:01:14 +01:00
Matias Nitsche
6c333d7cbf bmp280: support getting temperature via ioctl() 2020-06-16 01:01:14 +01:00
Gregory Nutt
ff0161000f cstdlib: mallinfo is no longer in stdlib.h 2020-06-15 08:35:44 -06:00