Commit Graph

6686 Commits

Author SHA1 Message Date
guohao15
d4cebd5d77 mtd:add dhara compatiblity layer
to support dhara ftl for fatfs

Signed-off-by: guohao15 <guohao15@xiaomi.com>
2023-08-22 23:16:14 +08:00
zhangwenjian
aa6727b20d Add the module of SDIO Slave
Signed-off-by: zhangwenjian <zhangwenjian@xiaomi.com>
2023-08-22 20:28:24 +08:00
shizhenghui
2b34977fac nuttx/audio: support 32-bits pcm
Signed-off-by: shizhenghui <shizhenghui@xiaomi.com>
2023-08-22 20:27:40 +08:00
xiajizhong
1c860f38e7 cordic API add scale parameter
Signed-off-by: xiajizhong <xiajizhong@xiaomi.com>
2023-08-22 12:51:36 +02:00
Zhe Weng
318d136320 netdev/upper: Add netpkt_to_iov() interface
Some driver like virtio-net can offload fragmented IOBs, so an interface
to support this feature is needed.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-08-22 16:34:21 +09:00
Zhe Weng
d44e19d115 mm/iob: Add support for increasing length in iob_update_pktlen
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-08-22 16:34:21 +09:00
Zhe Weng
efc75de61e net/udp: Fix hybrid dual-stack IPv6/IPv4 socket
- Fix `ip6_map_ipv4addr` and `ip6_get_ipv4addr` macro to work under
  different endianness.
- Use `iob_reserve` instead of `iob_trimhead` in `udp_datahandler`.
  - Because we may set `sockaddr_in6` into IPv4 header, which causes
    `offset` become negative. `iob_reserve` can hold this case while
    `iob_trimhead` cannot.
- Select IPv4 domain in send case.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-08-22 09:09:21 +08:00
dongjiuzhu1
edbeb5cdd9 libs/ctype/toupper_l: Implement function toupper_l instead of macro
toupper_l will be replaced by toupper, resulting in infinite recursion, so implement toupper_l

stack:
0  std::__1::ctype_byname<char>::do_toupper (this=0xf3888120, c=49 '1') at libcxx/src/locale.cpp:1231
1  0x005b8188 in std::__1::ctype<char>::toupper (__c=49 '1', this=0xf3888120) at nuttx/include/libcxx/__locale:667
2  std::__1::ctype_byname<char>::do_toupper (this=0xf3888120, c=49 '1') at libcxx/src/locale.cpp:1231
3  0x005b8188 in std::__1::ctype<char>::toupper (__c=49 '1', this=0xf3888120) at nuttx/include/libcxx/__locale:667
4  std::__1::ctype_byname<char>::do_toupper (this=0xf3888120, c=49 '1') at libcxx/src/locale.cpp:1231
5  0x0064cfc9 in std::__1::ctype<char>::toupper (__c=49 '1', this=0xf3888120) at nuttx/include/libcxx/__locale:667
6  std::__1::__scan_keyword<char*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, std::__1::ctype<char> > (__b=@0xf38871a0: 0xf3887220 "11:55:59 PM",
   __e=0xf388722b "", __kb=0xf2c03990, __ke=0xf2c03a38, __ct=..., __err=@0xf38871b0: 0, __case_sensitive=false) at nuttx/include/libcxx/locale:299
7  0x005cb0ed in std::__1::__time_get_storage<char>::__analyze (this=0xf2c0398c, fmt=114 'r', ct=...) at libcxx/src/locale.cpp:4998
8  0x005cf888 in std::__1::__time_get_storage<char>::init (this=0xf2c0398c, ct=...) at libcxx/src/locale.cpp:5295
9  0x005d4d0f in std::__1::__time_get_storage<char>::__time_get_storage (this=0xf2c0398c, __nm=...) at libcxx/src/locale.cpp:5399
10 0x005b15c8 in std::__1::time_get_byname<char, std::__1::istreambuf_iterator<char, std::__1::char_traits<char> > >::time_get_byname (__refs=0, __nm=..., this=0xf2c03980)
   at nuttx/include/libcxx/locale:2446
11 std::__1::locale::__imp::__imp (this=0xf2803970, name=..., refs=0) at libcxx/src/locale.cpp:268
12 0x005b333e in std::__1::locale::locale (this=0xf3888f00, name=0x6ca340 "C") at libcxx/src/locale.cpp:562
13 0x0058313b in helloxx_main (argc=1, argv=0xf3878810) at helloxx_main.cxx:112
14 0x0048471a in nxtask_startup (entrypt=0x5830a0 <helloxx_main(int, char**)>, argc=1, argv=0xf3878810) at sched/task_startup.c:70
15 0x00431bcd in nxtask_start () at task/task_start.c:134
16 0x0048f643 in pre_start () at sim/sim_initialstate.c:52
17 0x00000000 in ?? ()

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-08-22 00:07:16 +08:00
xucheng5
9d3abe8b71 socket can : support ioctl cmd SIOCCANRECOVERY
send CMD to restart controller in state bus-off

Signed-off-by: xucheng5 <xucheng5@xiaomi.com>
2023-08-21 13:18:51 +08:00
makejian
afbe6239ae crypto: update aes algorithm process
(1)update iv in each encryption process
(2)support aes-ofb/aes-cfb128/aes-cfb8
Signed-off-by: makejian <makejian@xiaomi.com>
2023-08-21 13:05:19 +08:00
Xiang Xiao
6b1e8b9bfe include/nuttx/tls.h: Remove the dup typedef tls_dtor_t
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-08-20 14:32:25 +03:00
Petro Karashchenko
075738cf14 net/ip: print ip addresses using ip4_addrN macro
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-08-19 13:28:21 -03:00
zhanghongyu
3bd495c09d icmp: add SOCK_RAW type support
Since ICMPv6 has added SOCK_RAW, a SOCK_RAW related implementation has also
been added for ICMP.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-08-19 22:04:22 +08:00
fangxinyong
891e05d99a include: move clockid_t and time[r]_t define to sys/types.h
POSIX Standard: Primitive System Data Types
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_types.h.html

Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2023-08-19 09:08:40 +03:00
rongyichang
917634446e drivers/lcd : add ioctl passthrough for LCD driver
Some LCD vendors support unit test commands, we should passthrough the ioctl
commands to drivers.

Signed-off-by: rongyichang <rongyichang@xiaomi.com>
2023-08-19 01:50:41 +08:00
chenrun1
709301cbfd hostfs:support SEEK_CUR
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2023-08-19 01:48:48 +08:00
wanggang26
d8f316b998 fs/ioctl: add BIOC_BLKGETSIZE cmd to get block sector numbers
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
2023-08-19 01:43:59 +08:00
dongjiuzhu1
29ddfd44a0 driver/note: dump irq handler address to trace
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-08-19 01:42:17 +08:00
renjianguang
86ae87b1ec nuttx/audio: Add AUDIO_CHANNELS_RANGE macro
Signed-off-by: renjianguang <renjianguang@xiaomi.com>
2023-08-19 01:32:13 +08:00
anjiahao
4c39cdce09 mempool:Use default alignment inside of blockalign
can reduce memery usage

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-08-19 01:29:14 +08:00
cenzhanquan1
0fb103bc66 driver/audio: add format for AAC/MSBC/CVSD
Signed-off-by: cenzhanquan1 <cenzhanquan1@xiaomi.com>
2023-08-18 23:03:13 +08:00
xucheng5
417207678e driver/capture : add capture debug, fixed compile warning
Signed-off-by: xucheng5 <xucheng5@xiaomi.com>
2023-08-18 09:21:46 +02:00
makejian
120aaf27b3 crypto: remove software algorithm coupling in cryptodev
Signed-off-by: makejian <makejian@xiaomi.com>
2023-08-17 13:12:36 +08:00
wangyingdong
8f6f601ec1 net/local:Add peek support for pipe and MSG_PEEK support for local socket
fifo peek example:
struct pipe_peek_s peek_buf;
peek_buf.len = len;
peek_buf.data = buf;
ret = file_ioctl(filep, PIPEIOC_PEEK,(unsigned long)((uintptr_t)&peek_buf));

Signed-off-by: wangyingdong <wangyingdong@xiaomi.com>
2023-08-15 23:58:45 +08:00
fangxinyong
903e87a7bd builtin: support uid/gid config for binfs app
Implement I_SUID/I_SGID feature for binfs in the POSIX compliant way.
If set-user-ID bit is set in the file permissions, then the effective
user ID of process shall be set to UID of the new process image file.

test case:
hello example emulates to set uid and file set-user-ID bit, and call
geteuid and getegid API.
UID  = 2000
GID  = 3000
MODE = 06555

nsh> ls -l /bin/hello
 -r-sr-sr-x    2000    3000       0 hello
nsh> hello
geteuid:2000
getegid:3000

Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2023-08-14 01:37:00 +08:00
fangxinyong
2d73e86b47 binfmt: support euid of process set from the file system
From posix spec, if set-user-ID bit is set in the file permissions,
then the effective user ID of the new process shall be set to the
user ID of the new process image file.
Let's ignore whether ST_NOSUID is set on the mounted file system.

https://pubs.opengroup.org/onlinepubs/007904875/functions/exec.html

test step:
hello example build as a module and call geteuid and getegid API.
then set file binary set-user-ID bit on the host.

$ chmod +s apps/bin/hello

nsh> mount -t hostfs -o fs=. /data
nsh> ls -l /data/apps/bin/hello
 -rwsrwsr-x    1000    1000    9264 /data/apps/bin/hello
nsh> /data/apps/bin/hello
geteuid:1000
getegid:1000

Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2023-08-12 02:18:25 +08:00
yangyalei
50428979d0 fix wait after vfork return error
Signed-off-by: yangyalei <yangyalei@xiaomi.com>
2023-08-11 09:30:45 -06:00
yinshengkai
836263b132 drivers: fix devascii_register warning
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-08-11 21:20:13 +08:00
yangshuyong
9c4e608529 Fixed the reset format error
Signed-off-by: yangshuyong <yangshuyong@xiaomi.com>
2023-08-11 20:39:16 +08:00
yangshuyong
6f6977d002 support nuttx reset driver model
Signed-off-by: yangshuyong <yangshuyong@xiaomi.com>
2023-08-11 20:39:16 +08:00
xiajizhong
b84fbe87ee math acceleration api support FFT
Signed-off-by: xiajizhong <xiajizhong@xiaomi.com>
2023-08-11 20:38:00 +08:00
xiajizhong
f922f4cc61 expand cordic_register to math_register
Signed-off-by: xiajizhong <xiajizhong@xiaomi.com>
2023-08-11 20:38:00 +08:00
红桃六
d8b045fa6a Update mouse.h 2023-08-11 20:37:11 +08:00
liuhongchao
69b655f4b2 drivers/input:support mouse driver
Implement mouse driver lower upper

Signed-off-by: liuhongchao <liuhongchao@xiaomi.com>
2023-08-11 20:37:11 +08:00
chao an
60c4d61c02 libs/libc/hex2bin: enhance 64-bit compatibility
Signed-off-by: chao an <anchao@xiaomi.com>
2023-08-11 19:43:37 +08:00
dulibo1
3f9a76e131 battery:add goldfish battery driver
support the goldfish emulator battery driver

Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2023-08-11 15:30:35 +08:00
zhanghongyu
0ead147841 rpmsgdev: support single read/write mode device
The default mode for Rpmsgdev is to read/write data as long as possible for
caller, this mode does not apply to tun devices, tun devices can read and
write only one complete ip packet at a time.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-08-11 15:29:32 +08:00
zhanghongyu
2b4cf41e14 tun: move tun related macro definitions out of CONFIG_NET_TUN
to support cross-core tun device operations via rpmsgdev

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-08-11 15:26:39 +08:00
yinshengkai
4cb2d7dc25 note: directly returns the taskname pointer
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-08-11 13:27:17 +08:00
yinshengkai
84799d15ac note: remove NOTERAM_GETTASKNAME
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-08-11 13:27:17 +08:00
dulibo1
1456919e58 regulator:support lp mode and auto pm register
1.add new intf regulator_set_mode to manual set rehulator lower power mode;
2.when add auto lp desc,the regulator lp mode is controlled by  pm framework;

Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2023-08-10 23:17:51 +08:00
dulibo1
935359fa3f regulator: support link to supply
when add supply desc,the regulator is linked to the parent regulator
1.if enable the regualtor, the parent regulator is enabled
2.if disable all child regulator, the parent regualtor is disabled

Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2023-08-10 23:17:51 +08:00
dulibo1
67aa12e762 regulator:support always on
when add always on desc,the regulator is always enabled

Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2023-08-10 23:17:51 +08:00
yinshengkai
541f600ab6 drivers/note: fix unknown type name bool
/home/baerg/code/NXOS/nuttx/include/nuttx/note/noteram_driver.h💯61: error: unknown type name ‘bool’
100 | noteram_initialize(FAR const char *devpath, size_t bufsize, bool overwrite);
| ^~~~
/home/baerg/code/NXOS/nuttx/include/nuttx/note/noteram_driver.h:31:1: note: ‘bool’ is defined in header ‘<stdbool.h>’; did you forget to ‘#include <stdbool.h>’?

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-08-10 15:58:35 +08:00
Zhe Weng
264283c5a2 net/icmpv6: Fix value of SIZEOF_ICMPV6_ECHO_xxx_S
The `SIZEOF_ICMPV6_ECHO_REQUEST_S` and `SIZEOF_ICMPV6_ECHO_REPLY_S`
macro are intended to be `8+n`, but actually becomes `10-1+n` and causes
the packet sent by `ping6` one byte more than expected.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-08-10 15:51:16 +08:00
makejian
ac76a8fe0f crypto: export SHA224/SHA384 via /dev/crypto
(1)add sha224 algorithm in sha2.c
(2)export sha224/sha384
Signed-off-by: makejian <makejian@xiaomi.com>
2023-08-10 13:36:19 +08:00
wangbowen6
9aa57b6c53 virtio: add virtio framework in NuttX
1. virtio devics/drivers match and probe/remote mechanism;
2. virtio mmio transport layer based on OpenAmp (Compatible with both
   virtio mmio version 1 and 2);
3. virtio-serial driver based on new virtio framework;
4. virtio-rng driver based on new virtio framework;
5. virtio-net driver based on new virtio framework
   (IOB Offload implementation);
6. virtio-blk driver based on new virtio framework;
7. Remove the old virtio mmio framework, the old framework only
   support mmio transport layer, and the new framwork support
   more transport layer and this commit has implemented all the
   old virtio drivers;
8. Refresh the the qemu-arm64 and qemu-riscv virtio related
   configs, and update its README.txt;

New virtio-net driver has better performance
Compared with previous virtio-mmio-net:
|                        | master/-c | master/-s | this/-c | this/-s |
| :--------------------: | :-------: | :-------: | :-----: | :-----: |
| qemu-armv8a:netnsh     |  539Mbps  |  524Mbps  | 906Mbps | 715Mbps |
| qemu-armv8a:netnsh_smp |  401Mbps  |  437Mbps  | 583Mbps | 505Mbps |
| rv-virt:netnsh         |  487Mbps  |  512Mbps  | 760Mbps | 634Mbps |
| rv-virt:netnsh_smp     |  387Mbps  |  455Mbps  | 447Mbps | 502Mbps |
| rv-virt:netnsh64       |  602Mbps  |  595Mbps  | 881Mbps | 769Mbps |
| rv-virt:netnsh64_smp   |  414Mbps  |  515Mbps  | 491Mbps | 525Mbps |
| rv-virt:knetnsh64      |  515Mbps  |  457Mbps  | 606Mbps | 540Mbps |
| rv-virt:knetnsh64_smp  |  308Mbps  |  389Mbps  | 415Mbps | 474Mbps |
Note: Both CONFIG_IOB_NBUFFERS=64, using iperf command, all in Mbits/sec
      Tested in QEMU 7.2.2

Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-08-10 03:39:39 +08:00
jinxudong
571f52c9d3 feature: sensor: add force sensor
A sensor of this type measures the force on it, and additionally
compares the force with one or more specified thresholds. The sensor
can output the force value directly. Moreover, it's usually applied
as a press key. In that case, when it detects a force greater than
some given threshold, a corresponding event is reported.

Signed-off-by: jinxudong <jinxudong@xiaomi.com>
2023-08-09 21:57:58 +08:00
yangsen5
ce9f40aeb6 drivers/video: add nuttx goldfish camera driver
Signed-off-by: yangsen5 <yangsen5@xiaomi.com>
2023-08-09 18:30:11 +08:00
yinshengkai
97c26f2376 syscall: remove duplicate getegid/geteuid
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-08-09 17:07:58 +08:00
fangxinyong
896f34fde9 sched: implement effective uid and gid interfaces
Implement 'effective' setuid, getuid, setgid, and getgid interfaces.
These will be inheritance by all child task groups. These definitons
are explicitly specified here:
https://pubs.opengroup.org/onlinepubs/000095399/functions/geteuid.html
https://pubs.opengroup.org/onlinepubs/000095399/functions/getegid.html
https://pubs.opengroup.org/onlinepubs/000095399/functions/seteuid.html
https://pubs.opengroup.org/onlinepubs/000095399/functions/setegid.html

Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2023-08-09 17:07:58 +08:00
yinshengkai
13f071baa8 note: fix sched_note_begin address errr
SCHED_NOTE_IP address calculation error in some cases, refer to _THIS_IP_ implementation in linux
https://elixir.bootlin.com/linux/latest/source/include/linux/instruction_pointer.h#L6

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-08-09 15:11:33 +08:00
Petro Karashchenko
2c346c4c89 arch/esp32: use kernel internal API for libc stubs
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-08-08 11:58:29 -03:00
Petro Karashchenko
1b0baa8337 nuttx: use lib_free for memory de-allocation after strdup or asprintf
The memory allocated with strdup and asprintf is done via lib_malloc
so we need to use lib_free to deallocate memory otherwise the assertion
"Free memory from the wrong heap" is hit with flat mode and user separated
heap enabled mode.

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-08-08 11:58:29 -03:00
Zhe Weng
194d0cdec9 net/procfs: Simplify logic for tcp/udp stats
By:
1. Take out net_ip_binding_laddr/raddr macro
2. INET6_ADDRSTRLEN is long enough for all address buffer and no need to
   add 0 to the end of buffer since inet_ntop will do so

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-08-07 08:08:37 -07:00
shipei
858e43df91 audio:add format sbc support
Signed-off-by: shipei <shipei@xiaomi.com>
2023-08-07 06:44:33 -07:00
xucheng5
d0a2fa626a driver/mtd_config : add mtdconfig_register_by_path()
Signed-off-by: xucheng5 <xucheng5@xiaomi.com>
2023-08-07 01:08:24 -07:00
zhangyuan21
98fba71998 usbadb: add usbadb boardctl
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-08-07 11:23:36 +08:00
zhangyuan21
fe6b0619f9 usbdev: Use composite devices as universal devices
The enumeration process for composite and non-composite devices
has a lot of duplicate code. Treating the code for composite
devices as universal enumeration code can reduce redundant code.

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-08-07 11:23:36 +08:00
cuiziwei
6289205104 sched: Define sched_getcpu return 0 when CONFIG_SMP equals n
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2023-08-06 11:28:49 +02:00
Brennan Ashton
46b0f6d6ee fdt: Add initial FDT support and procfs for userspace export
VELAPLATFO-12536

This provides the initial hooks for Flattened Device Tree support
with QEMU RV. It also provides a new procfs file that exposes the
fdt to userspace much like the /sys/firmware/fdt endpoint in Linux.
See https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-firmware-ofw

Nodes in the fdt are not yet usable by the OS.

Signed-off-by: Brennan Ashton <bashton@brennanashton.com>
Signed-off-by: liaoao <liaoao@xiaomi.com>
2023-08-05 12:41:06 -07:00
ligd
7a0ef1d0ca secure: fix compile failed when no CONFIG_ARCH_HAVE_TRUSTZONE
Signed-off-by: ligd <liguiding1@xiaomi.com>
2023-08-05 12:40:34 -07:00
anjiahao
3a808bab19 support stm32f429i-disco run open flash loader
We can use the driver in nuttx to download
files with debugger

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Signed-off-by: chao an <anchao@xiaomi.com>
2023-08-05 12:40:02 -07:00
cuiziwei
7c8bb8c293 nuttx/tls: Remove the max key limiatation in task_tls_alloc and pthread_key_create
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2023-08-05 06:33:49 -07:00
yinshengkai
a6fcb0a5a9 fs: add pipe type support to inode
Both the device and the pipe used the FSNODEFLAG_TYPE_DRIVER type before,
and now add an independent pipe type

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-08-05 06:32:50 -07:00
Xiang Xiao
1dfcdaad84 noteram: Remove the unnessary inclusion and declaration from header file
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-08-04 19:24:08 -03:00
yinshengkai
08c4ac133b sched/cpuload: add SCHED_CPULOAD_OSCLK option
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-08-04 10:58:54 -07:00
yinshengkai
72de29422a drivers/noteram: noteram support multiple instances
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-08-04 06:48:48 -07:00
yinshengkai
3ab4d4a113 drivers/noteram: reduce global variable references
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-08-04 06:48:48 -07:00
Michal Lenc
a5fb83a5d3 ioexpander: define IOEXPANDER_OPTION_NONGENERIC option
This introduces non-generic option interface for IO expanders.
Some IO expanders have more advance options for pins and communication.
This is used to pass driver dependend structure to expander driver.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2023-08-04 05:54:24 -07:00
likun17
50fe301e8f fix SIM sensor rpmsg runtime error by asan report.
Signed-off-by: likun17 <likun17@xiaomi.com>
2023-08-04 04:20:45 -07:00
zhangyuan21
602d5974c8 usbdev: move usbdev_req function to common code
Move usbdev_req function to common code, Reduce duplicated code.

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-08-03 22:46:25 -07:00
yangsen5
d8ca744052 drivers/video: video driver supports NV12
Signed-off-by: yangsen5 <yangsen5@xiaomi.com>
2023-08-03 22:37:53 -07:00
makejian
775d9de30a crypto: export MD5/SHA1/SHA256/SHA512 via /dev/crypto
refer to commit 649dc2d985
(1) import hash method
(2) separate the update and finish processes

Signed-off-by: makejian <makejian@xiaomi.com>
2023-08-03 22:37:30 -07:00
rongyichang
9e4a9fe32b drivers/fb: add fboverlay pandisplay & display area ioctl
1. support doublebuffer swtich for overlay layer
2. Add display area ioctl to scale the active area of the overlay layer
   to a specific region on the LCD through hardware.

Signed-off-by: rongyichang <rongyichang@xiaomi.com>
2023-08-03 10:57:14 -07:00
ligd
d313248a5b queue: add dq_inqueue & sq_inqueue support
Signed-off-by: ligd <liguiding1@xiaomi.com>
2023-08-03 10:16:41 -07:00
Michal Lenc
0f6a5e50c4 ioexpander: add option to register GPIO by name for IOexpander
Function gpio_lower_half_byname() was added to support registration of
GPIO pin by name as supported for IOexpander. Some of the code is wrapped
in new static function gpio_lower_half_internal() to avoid code
duplication.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2023-08-03 07:02:12 -07:00
Michal Lenc
bf90361895 ioexpander: add support for pcf8575 expander
This adds support for 16 bit io expander pcf8575. The driver is basically
the same as for pcf8574 however it is for 16 bits instead of 8 bits. Since
pcf8575 and pcf8574 can be both used on the same i2c bus the driver for
pcf8575 is implemented in a different file to reduce the code size
and complexity and to have less if statements in the driver.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2023-08-03 06:52:27 -07:00
makejian
d5041420a3 crypto: porting Curve25519 algorithm into nuttx crypto
Signed-off-by: makejian <makejian@xiaomi.com>
2023-08-03 03:20:13 -07:00
zhangyuan21
3aa2aa4703 assert: add more information to panic notifier
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-08-03 03:17:22 -07:00
zhangyuan21
bfab486611 assert: add panic notifier data for notify more information
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-08-03 03:17:22 -07:00
yangjiao
bef756c004 fs/mqueue: Fix the wrong field type in mq_attr as the spec and add the logical judgment to deal with the condition when mq_maxmsg or mq_msgsize is less than zero or equal to zero.
In POSIX standard spec https://pubs.opengroup.org/onlinepubs/7908799/xsh/mqueue.h.html, the field type in mq_attr should be long not size_t. And no logical judgment when mq_maxmsg <= 0 or mq_msgsize <= 0. In this change, i update the field type in mq_attr, and add the missing logical judgment.

Signed-off-by: yangjiao <yangjiao@xiaomi.com>
2023-08-03 03:10:56 -07:00
Lee Lup Yuen
b2c1930825 serial/uart_16550: Wait before setting Line Control Register (Synopsys DesignWare 8250)
Some UART Controllers (Synopsys DesignWare 8250) will trigger spurious interrupts when the Line Control Register (LCR) is set while the UART is busy. This patch provides the option (16550_WAIT_LCR) to wait for UART until it's not busy, before setting the LCR. (16550_WAIT_LCR is disabled by default)

This patch fixes the spurious UART interrupts for the upcoming port of NuttX to StarFive JH7110 SoC (with Synopsys DesignWare 8250 UART). [The patch is explained here](https://lupyuen.github.io/articles/plic#appendix-fix-the-spurious-uart-interrupts)

drivers/serial/uart_16550.c: If 16550_WAIT_LCR is enabled, wait until UART is not busy before setting LCR

include/nuttx/serial/uart_16550.h: Define the UART Status Register (USR) for checking if UART is busy

drivers/serial/Kconfig-16550: Added option 16550_WAIT_LCR to 16550 UART Config, disabled by default
2023-08-03 08:38:07 +02:00
fangxinyong
43b0421b2a mm/map: limit the count of memory mapping for the task
No memory map count limit that will exhaust memory and cause
the system hang. Also that fix pass LTP posix case mmap/24-1.c

Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2023-08-02 22:57:28 -07:00
fangxinyong
2bf434214e libc/sysconf: add _SC_REALTIME_SIGNALS
pass ltp case: open_posix_testsuite/conformance/interfaces/sigwait/7-1.c

Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2023-08-02 22:57:28 -07:00
fangxinyong
da3a75da2c libc/net: compatible with Android for htonq/ntohq
Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2023-08-02 22:47:29 -07:00
Bowen Wang
477602e657 mm_heap: mm dump and panic only valid for the heap own by OS
When other code use nuttx memory manager by call mm_xx api directly,
it better to let other code to control weather dump or panic when
malloc failed.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2023-08-02 06:11:59 -07:00
yangguangcai
05af311e68 qemu:add qemu rtc driver.
Signed-off-by: yangguangcai <yangguangcai@xiaomi.com>
2023-08-02 03:27:55 -07:00
dongjiuzhu1
2945252b71 sensor/gps: support gps driver model
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-08-01 23:09:46 -07:00
dongjiuzhu1
1920ff31d3 libs/libc/gpsutils/minmea: move minmea library from apps/gpsutils
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-08-01 23:09:46 -07:00
dongjiuzhu1
f8ce0cd4ca fs/pseudofile: config pseudofile feature
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-07-31 22:22:58 -07:00
dongjiuzhu1
0f6d0eac52 fs/pesudofile: support pseudo-file operation
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-07-31 22:22:58 -07:00
Petro Karashchenko
effb0a1cad drivers: restore C89 compatibility by avoiding binary constants
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-07-31 18:56:40 -07:00
Petro Karashchenko
f3b5465969 drivers: remove redundant parentheses
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-07-31 18:56:40 -07:00
yangyalei
f40eee50d6 pwd: Add initial implementation of getpwent
fix ltp sigqueue testcase crash in getpwent:
nsh> ltp_sigqueue_3_1
core dumped

Signed-off-by: yangyalei <yangyalei@xiaomi.com>
2023-07-31 07:50:10 -07:00
yangyalei
4ecff53e2c sigaltstack: Add initial implementation of sigaltstack
fix ltp testcase compile error:
ltp/testcases/open_posix_testsuite/conformance/definitions/signal_h/31-1-buildonly.c:16:13: \
error: ‘sigaltstack’ undeclared (first use in this function)
   16 |  dummyvar = sigaltstack;
      |             ^~~~~~~~~~~

Signed-off-by: yangyalei <yangyalei@xiaomi.com>
2023-07-31 07:50:10 -07:00
yangyalei
3721af647a Add _POSIX_THREAD_PRIORITY_SCHEDULING define
fix ltp_pthread_rwlock_rdlock_2_2 testcase error:
nsh> ltp_pthread_rwlock_rdlock_2_2
Posix Thread Execution Scheduling not supported

Signed-off-by: yangyalei <yangyalei@xiaomi.com>
2023-07-31 07:50:10 -07:00
yangyalei
700cc5ab90 single: add SS_ONSTACK and SS_DISABLE define
fix ltp_sigaltstack_6_1 testcase comile error:
iltp/testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/6-1.c:41:28: \
error: ‘SS_ONSTACK’ undeclared (first use in this function); did you mean ‘SA_ONSTACK’?
ltp/testcases/open_posix_testsuite/conformance/interfaces/sigaltstack/8-1.c:41:28: \
error: ‘SS_DISABLE’ undeclared (first use in this function

Signed-off-by: yangyalei <yangyalei@xiaomi.com>
2023-07-31 07:50:10 -07:00
yangyalei
c33e6528b1 getrlimit: add RLIMIT_MEMLOCK define
add RLIMIT_MEMLOCK define, enable compile mmap/18-1.c.
ltp/testcases/open_posix_testsuite/conformance/interfaces/mmap/18-1.c:95:16: \
error: ‘RLIMIT_MEMLOCK’ undeclared (first use in this function); did you mean ‘RLIMIT_STACK’?

Signed-off-by: yangyalei <yangyalei@xiaomi.com>
2023-07-31 07:50:10 -07:00
yangyalei
fde8affe71 singal: add stack_t define
stack_t used by sigaltstack, make it compile sucess in sim.

Signed-off-by: yangyalei <yangyalei@xiaomi.com>

ltp: fix compile errors

Signed-off-by: yangyalei <yangyalei@xiaomi.com>
2023-07-31 07:50:10 -07:00
yangyalei
9a60d7bb49 signal: add SIGWINCH define
SIGWINCH used in ltp sigaction/16-1.c testcase.
ltp/testcases/open_posix_testsuite/conformance/interfaces/sigaction/16-1.c:79:3:
error: ‘SIGWINCH’ undeclared here (not in a function); did you mean ‘SIGINT’?
   79 |  {SIGWINCH, "SIGWINCH", 0},
      |   ^~~~~~~~
      |   SIGINT

Signed-off-by: yangyalei <yangyalei@xiaomi.com>
2023-07-31 07:50:10 -07:00
simbit18
8f744592d5 Fix nuttx coding style
Fix Comments
2023-07-31 10:54:53 -03:00
Bowen Wang
c9e3a0669f sched_backtrace: define sched_dumpstack when not enable SCHED_BACKTRACE
Before directly use sched_backtrace() with SCHED_BACKTRACE disable will
lead compile error, this commit avoid this problem by define
sched_backtrace to 0 when CONFIG_SCHED_BACKTRACE not enable.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2023-07-31 05:46:37 -07:00
Xiang Xiao
427e574bd1 fs/unionfs: Remove unionfs_mount function
since the same function can be achieved by mount:
mount(NULL, "/mnt/unionfs", "unionfs", 0,
      "fspath1=/mnt/path1,prefix1=prefix1,"
      "fspath2=/mnt/path2,prefix2=prefix2");

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-30 18:51:26 -03:00
simonatoaca
9794dc118f drivers: Added support for BME680
drivers/sensors/bme680.c: The bme680 driver
sensor.h: Added new type of sensor (Gas) to be used for retrieving the bme680 data
esp32/common/src/esp32_bme680.c: bme680 support on esp32
esp32/esp32-sparrow_kit/esp32_bringup.c: added support for the bme680
esp32/esp32-sparrow-kit/configs/nsh/defconfig: fixed defconfig ci problem

Signed-off-by: simonatoaca <simona.alexandra2000@gmail.com>

esp32-sparrow-kit: Fixed defconfig

Signed-off-by: simonatoaca <simona.alexandra2000@gmail.com>

Code is now C89 compatible

Signed-off-by: simonatoaca <simona.alexandra2000@gmail.com>

Reused already defined sensor data structs by registering every sub-sensor separately

Signed-off-by: simonatoaca <simona.alexandra2000@gmail.com>

Implemented suggestions

Signed-off-by: simonatoaca <simona.alexandra2000@gmail.com>
2023-07-29 17:47:23 -03:00
dongjiuzhu1
6ff4826492 nuttx/bits.h: support GENMASK and GENMASK_ULL
Ref to https://github.com/torvalds/linux/blob/master/include/linux/bits.h

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-07-29 16:41:31 -03:00
yuexinyi
326cf2bf88 drivers/video: add new video driver register api to support multi instance
Signed-off-by: yuexinyi <yuexinyi@xiaomi.com>
2023-07-29 07:42:29 -07:00
yuexinyi
56be0ab050 drivers/video: add capture arg to support multi instance
Signed-off-by: yuexinyi <yuexinyi@xiaomi.com>
2023-07-29 07:42:29 -07:00
yuexinyi
96ea877490 drivers/video: video ioctrl api support multi instance
Signed-off-by: yuexinyi <yuexinyi@xiaomi.com>
2023-07-29 07:42:29 -07:00
dongjiuzhu1
5d09b4cbd0 libc/rand_r: support rand_r api
refs to https://pubs.opengroup.org/onlinepubs/7908799/xsh/rand.html

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-07-29 07:28:23 -07:00
dongjiuzhu1
d415b7df54 include/fcntl.h: add O_NOATIME flags
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-07-28 20:56:22 -07:00
dongjiuzhu1
afb473707f libc/pthread: add pthread_attr_set/getscope
refs to https://pubs.opengroup.org/onlinepubs/7908799/xsh/pthread_attr_setscope.html

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-07-28 20:55:22 -07:00
dongjiuzhu1
9bf66ba3d5 driver/spi_slave: support spi_slave asynchronous
1. support spi slave device poll
2. support read non-block/block mode

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-07-28 19:11:16 +03:00
dongjiuzhu1
21d19f89af driver/adc: fill in missing parameters about adc driver
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-07-28 05:00:19 -07:00
guoshichao
9d7f349664 libs/pthread/pthread_atfork: fulfill implement pthread_atfork function
1. add the pthread_atfork implementation
2. the pthread_atfork implementation are referred to https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_atfork.html

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-07-26 10:41:52 +02:00
guoshichao
3524f4b9ce libs/libc/fork: add lib_fork implementation
1. add lib_fork api in libs/libc, we need a fork() api to implement the
fork relative method, such as pthread_atfork
2. rename the assembly fork entry function name to up_fork(), and rename
the up_fork() to arch specific name, such as
sim_fork()/arm_fork()/mips_fork() etc.

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-07-26 10:41:52 +02:00
Xiang Xiao
f3269a6caa sched: Rename DEBUG_TCBINFO to ARCH_HAVE_TCBINFO
and select if the arch support to define g_tcbinfo variable

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-26 09:33:38 +02:00
Xiang Xiao
e28f6d6e6e hwspinlock: Fix typo error(spin_lock_restore to spin_unlock_irqrestore)
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-25 13:03:31 +02:00
Xiang Xiao
13dfe41f6c Fix include/nuttx/hwspinlock/hwspinlock.h:117:3: error: too few arguments to function 'hwspin_unlock'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-25 09:11:24 +03:00
zhangyuan21
9792211b96 sched/tcbinfo: add stack info to tcbinfo
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-07-24 09:47:12 -07:00
anjiahao
9f644579b3 fix sim register & tcb info typo
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-07-23 21:59:35 -07:00
Victor Benso
0c5145b7d1 New implementation of the ESP32's RMT driver. 2023-07-23 16:17:57 -03:00
raiden00pl
e5b6d1cb29 include/nuttx/wireless/lte/lte.h: add fw_version field to lte_version_t 2023-07-23 19:56:38 +08:00
raiden00pl
4f8b979855 include/nuttx/wireless/lte/lte.h: increase bb_product length 2023-07-23 19:56:38 +08:00
Xiang Xiao
a51be33a41 libc/tls: Change the default value of TLS_NELEM to zero
to ensure the default config as small as possible.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-20 08:11:30 +02:00
xiajizhong
7160849f63 new feature on trace dump support segger-rtt
Signed-off-by: xiajizhong <xiajizhong@xiaomi.com>
2023-07-16 14:37:21 +03:00
Manish Kumar Sharma
6a1abbcf56 driver/audio: remove unnecessary switch in switch
- There is unnecessary switch inside switch which is making code not too readable

Signed-off-by: Manish Kumar Sharma <manishsharma3134@gmail.com>
2023-07-16 16:40:34 +08:00
Xiang Xiao
16d375e90f include/nuttx/sched.h: Remove the unnecessary forward declaration
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-16 00:35:35 +03:00
chenrun1
22d1059c97 armv7/8 cache: add up_get_xcache_size() support
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2023-07-15 15:11:07 +08:00
anjiahao
b956495c5e libs/libc:Support gdb rsp protocol
you can debug nuttx through any transport layer (serial port, network etc.),
currently supports the following functions:
1. Read and write registers
2. Read and write memory
3. Switch thread and read stack information

Future support plans:
1. Support breakpoint, watch point (requires architecture support).

related information:
https://sourceware.org/gdb/onlinedocs/gdb/Remote-Protocol.html

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-07-15 01:57:11 +08:00
yinshengkai
fe9251b546 libc: export lib_sprintf_internal function
This function does not take numbered arguments in printf

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-07-14 00:22:11 +03:00
chao an
8ef5f02b66 libs: fix visual studio Compiler Error C2036
D:\code\nuttx\include\nuttx\net\netfilter\ip_tables.h(288,42): error C2036: "void *" : unknown size

Reference:
https://learn.microsoft.com/en-us/cpp/error-messages/compiler-errors-1/compiler-error-c2036?view=msvc-170

Signed-off-by: chao an <anchao@xiaomi.com>
2023-07-14 01:23:16 +08:00
chao an
54740b3ad2 win/MSVC: add packed_struct macro implement
Signed-off-by: chao an <anchao@xiaomi.com>
2023-07-14 01:18:09 +08:00
guoshichao
79af1cdfe6 libs/libc/getpgid: add getpgid implementation
1. the getpgid function can help to pass the
ltp/open_posix_testsuite/killpg related testcases
2. NuttX do not support process group, so we use the process id as
process group id
3. the implementation are referred to: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getpgid.html

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-07-13 19:37:35 +08:00
simbit18
1b1ac6f3b7 Fix nuttx coding style
Remove TABs
Fix indentation
Fix Multi-line comments
Fix Comments to the Right of Statements.

Fix nuttx coding style

Fix Comments to the Right of Statements.
2023-07-13 19:30:56 +08:00
Neale Ferguson
878384fef0 Fix and improve dynamic loader
This patch fixes some issues found by Mark Stevens and
improve the dynamic loader.
2023-07-13 10:11:58 +08:00
yinshengkai
ce98f186c0 syslog: add syslog channel filtering function
support to control the opening or closing of the specified channel through the syslogmask command at runtime

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-07-13 01:04:07 +08:00
rongyichang
6902ed9516 drivers/lcd: add area alignment ioctl for lcd driver
Signed-off-by: rongyichang <rongyichang@xiaomi.com>
2023-07-13 01:03:18 +08:00
dulibo1
7ccdb2cfa8 battery:fix poll return type
Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2023-07-12 11:06:47 -03:00
fangxinyong
ffa084f3d2 signal: SIGKILL or SIGSTOP cannot be caught
pass ltp signal test cases, for posix spec, SIGKILL and SIGSTOP cannot be caught.

https://pubs.opengroup.org/onlinepubs/9699919799/functions/signal.html
https://pubs.opengroup.org/onlinepubs/007904875/functions/sigset.html

Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2023-07-12 21:27:06 +08:00
yinshengkai
9c6f48e57b drivers/segger: add RTT serial support
usage:
  1. Connect Jlink, start JLinkGDBServer
     JLinkGDBServer -if SWD -device stm32h743zi -speed 16000
  2. Listen to the RTT port data and forward it to the virtual serial port
     sudo socat -d -d PTY,link=/dev/ttyRTT0,raw,ignoreeof TCP:127.0.0.1:19021,reuseaddr
  3. Read serial data
     minicom -D /dev/ttyRTT0

Performance:(STM32H743, 400MHZ)
time "dd if=/dev/zero of=/dev/console bs=512 count=2048"
6.67 sec  157KB/s

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-07-12 09:54:50 +08:00
Zhe Weng
c253bb91a2 drivers/net: Add wireless ops in upper-half driver
Take the idea from Linux's iw_handler array and esp32c3_wlan's wlan_ops_s, and make it a common logic of upper-half driver.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-07-12 03:32:02 +08:00
guoshichao
c33d1c9c97 sched/task/fork: add fork implementation
1. as we can use fork to implement vfork, so we rename the vfork to
fork, and use the fork method as the base to implement vfork method
2. create the vfork function as a libc function based on fork
function

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-07-12 02:27:37 +08:00
rongyichang
5d7864fbcb drivers/spi: add support for qspi hwfeatures
add QSPI_BITORDER and QSPI_WORD_REVERSE hwfeatures

Signed-off-by: rongyichang <rongyichang@xiaomi.com>
2023-07-12 01:42:25 +08:00
simbit18
9681c52517 Fix nuttx coding style
Remove TABs
Fix indentation
2023-07-11 23:32:17 +08:00
yanghuatao
2529f371ee change clockid_t type from uint8_t to int
make the clock_getres pass the ltp/open_posix_testsuite/clock_getres testcases, posix has no explain about clockid_t type, referrence linux: 858fd168a9/include/linux/types.h (L27) and 858fd168a9/include/uapi/asm-generic/posix_types.h (L96)

Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
2023-07-11 22:36:23 +08:00
Xiang Xiao
9dc59e9109 Fix error: Mixed case identifier found
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-10 23:03:17 +03:00
Xiang Xiao
ebcb03dce9 libc/symtab: Don't include symtab.h in the header files
to unify the inclusion of symtab.h only from the source files

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-10 23:03:17 +03:00
Xiang Xiao
229293f9f8 binfmt: Move [elf|nxflat]_[un]initialize to private header file
like what builtin binary format do

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-10 23:03:17 +03:00
liuzhao
899471c6bd add support for YT8512 phy 2023-07-11 03:40:53 +08:00
Xiang Xiao
813b652ba5 elf: Move 32/64bit generic mapping from risc-v/arch_elf.c to elfxx.h
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-10 13:09:47 -03:00
Xiang Xiao
5849cf71d8 libc/symtab: Move SYMTAB_XXX from unistd/Kconfig to symtab/Kconfig
Make code and config in the same location

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-10 13:09:47 -03:00
guoshichao
dc08798764 libs/libc/pthread: add the implementation of pthread_getcpuclockid
1. the implementation can pass the
ltp/open_posix_testsuite/pthread_getcpuclockid testcases
2. the modification are referred to https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_getcpuclockid.html

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-07-10 13:40:49 +08:00
zhanghongyu
859b96e727 net/ioctl: add some bridge calls command
In order to support the compilation of third-party library, we encounter
some situations where the macro is not defined, refer to the common
implementation of other systems and add relevant definitions.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-07-09 12:02:28 +08:00
zhanghongyu
6efeec77e1 net: add netfilter compatible definitions for iptables
In order to support the compilation of third-party library, we encounter
some situations where the macro is not defined, refer to the common
implementation of other systems and add relevant definitions.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-07-08 15:29:21 -03:00
zhanghongyu
3538d1b313 netlink: add some definition
In order to support the compilation of third-party library, we encounter
some situations where the macro is not defined, refer to the common
implementation of other systems and add relevant definitions.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-07-08 11:12:41 -03:00
zhanghongyu
f917416340 netlink: add statistics-related struct definitions
In order to support the compilation of third-party library, we encounter
some situations where the macro is not defined, refer to the common
implementation of other systems and add relevant definitions.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-07-08 11:12:41 -03:00
zhanghongyu
3b186dabe0 net/if.h: add definitions associated with IF_OPER_
In order to support the compilation of third-party library, we encounter
some situations where the macro is not defined, refer to the common
implementation of other systems and add relevant definitions.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-07-08 10:59:37 -03:00
zhanghongyu
08b92ef7cf ifaddrs: add union ifa_ifu include ifu_broadaddr and ifu_dstaddr
In order to support the compilation of third-party library, we encounter
some situations where the macro is not defined, refer to the common
implementation of other systems and add relevant definitions.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-07-08 15:42:11 +08:00
Petro Karashchenko
b8d3e32bdf sched/clock: move clock_getcpuclockid() and clock_getres() to libc
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-07-07 17:39:39 -03:00
Petro Karashchenko
15991ef919 include/nuttx: remove semicolon in _SIG_KILL definition
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-07-07 17:39:39 -03:00
Petro Karashchenko
9369b75ee5 includes/nuttx: fix _SCHED_GET(T/P/PP)ID definition issue
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-07-07 17:39:39 -03:00
qiaohaijiao1
a5d1d2d4e5 audio: add AUDIOIOC_FLUSH ioctl
Signed-off-by: qiaohaijiao1 <qiaohaijiao1@xiaomi.com>
2023-07-07 23:06:11 +08:00
Gregory Nutt
8868c58720 Fix Deadloop in VFS if CONFIG_CANCELLATION_POINTS is enabled
If cancellation points are enabled, then the following logic is activated in sem_wait().  This causes ECANCELED to be returned every time that sem_wait is called.

    int sem_wait(FAR sem_t *sem)
    {
      ...

      /* sem_wait() is a cancellation point */

      if (enter_cancellation_point())
        {
    #ifdef CONFIG_CANCELLATION_POINTS
          /* If there is a pending cancellation, then do not perform
           * the wait.  Exit now with ECANCELED.
           */

          errcode = ECANCELED;
          goto errout_with_cancelpt;
    #endif
        }
      ...

Normally this works fine.  sem_wait() is the OS API called by the application and will cancel the thread just before it returns to the application.  Since it is cancellation point, it should never be called from within the OS.

There there is is one perverse cases where sem_wait() may be nested within another cancellation point.  If open() is called, it will attempt to lock a VFS data structure and will eventually call nxmutex_lock().  nxmutex_lock() waits on a semaphore:

   int nxmutex_lock(FAR mutex_t *mutex)
   {
     ...

     for (; ; )
       {
         /* Take the semaphore (perhaps waiting) */

         ret = _SEM_WAIT(&mutex->sem);
         if (ret >= 0)
           {
             mutex->holder = _SCHED_GETTID();
             break;
           }

         ret = _SEM_ERRVAL(ret);
         if (ret != -EINTR && ret != -ECANCELED)
           {
             break;
           }
       }
   ...
}

In the FLAT build, _SEM_WAIT expands to sem_wait().  That causes the error in the logic:  It should always expand to nxsem_wait().  That is because sem_wait() is cancellation point and should never be called from with the OS or the C library internally.

The failure occurs because the cancellation point logic in sem_wait() returns -ECANCELED (via _SEM_ERRVAL) because sem_wait() is nested; it needs to return the -ECANCELED error to the outermost cancellation point which is open() in this case.  Returning -ECANCELED then causes an infinite loop to occur in nxmutex_lock().

The correct behavior in this case is to call nxsem_wait() instead of sem_wait().  nxsem_wait() is identical to sem_wait() except that it is not a cancelation point.  It will return -ECANCELED if the thread is canceled, but only once.  So no infinite loop results.

In addition, an nxsem_wait() system call was added to support the call from nxmutex_lock().

This resolves Issue #9695
2023-07-06 14:20:29 -03:00
Xiang Xiao
62480d1a8b boardctl: Add const to struct boardioc_symtab_s::symtab
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-06 09:24:02 -03:00
Xiang Xiao
935f43185f libc/modlib: Replace nx_stat with file_stat
to avoid searching the path twice

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-06 09:20:24 -03:00
Neale Ferguson
fec789047a Add support for the loading of ET_DYN objects
* libs/libc/machine/arm/armv7-m/arch_elf.c
      - Fix cast of error message parameters

    * build-globals.sh
      - Build the modlib_globals.S file used to resolve symbols when dynamically loading

    * libs/libc/modlib/Make.defs
      - Build modlib_globals.S for all targets

    * libs/libc/modlib/modlib_load.c
      - Calculate sizes and text/data addresses based on program headers rather than section headers
      - Handle objects with no program headers

    * libs/libc/modlib/modlib_bind.c
      - Call modlib_readsym with pointer to symbol table
      - Add modlib_relocatedyn to manage relocation of symbols with shared object (ET_DYN)
      - Differentiate between ET_REL and ET_DYN objects
      - Use arch independent symbol ELF_R_SYM
      - Cast sizes to avoid warnings

    * libs/libc/modlib/modlib_load.c
      - Cast sizes to avoid warnings

    * include/elf.h
      - Add definitions that may be found in shared objects

    * include/nuttx/lib/modlib.h
      - Add parameter to modlib_readsym prototype
      - Add prototypes for:
        - modlib_insertsymtab
        - modlib_findglobal
      - Define Elf_Dyn and Elf_Off according to the elf architecture
      - Add fields to mod_loadifno_s:
        - Program headers
        - Exported symbols
        - Data section address
        - Padding requirement
        - Section index for dynamic symbol table
        - Number of symbols exported
      - Add prottotype for modlib_freesymtab

    * libs/libc/dlfcn/lib_dlclose.c
      - Free the symbol table when the dll is closed

    * libs/libc/dlfcn/lib_dlopen.c
      - Add dump of program headers to debug routine
      - Differentiate between ET_REL and ET_DYN objects

    * libs/libc/machine/arm/armv7-m/arch_elf.c
      - Add handling of R_ARM_RELATIVE and R_ARM_JUMP slot relocation types

    * libs/libc/modlib/modlib_loadshdrs.c
      - Rename modlib_loadshdrs.c to modlib_loadhdrs.c
      - Rename modlib_loadshdrs to modlib_loadhdrs
      - Add code to load program headers

    * libs/libc/modlib/modlib_symbols.c
      - Define entry point structure
      - Add offset parameter to modlib_symname() and use to find symbol names
      - Add symtab section header parameter to modlib_readsym()
      - Add offset parameter to modlib_symvalue() to locate symbol names
      - Add modlib_insertsyntab() to create a symbol table for exporting and resolution
      - Add findEP() to resolve a symbol in the modlib_global table
      - Add modlib_findglobal() to find symbol in the modlib_global table
      - Add modlib_freesymtab() to free the symbol table

    * libs/libc/modlib/modlib_uninit.c
      - Free header and sections from a module_loadinfo_s control block

    * libs/libc/modlib/modlib_verify.c
      - Handle ET_DYN shared objects

    * libs/libc/modlib/modlib_globals.S
      - Multi-target global table
      - Define library APIs that may be resolved when loading a shared object
2023-07-06 09:13:38 -03:00
SPRESENSE
4eb6da33c2 cxd56/alt1250: Change power on sequence
Change the power on sequence according to ALT1250 modem spec.
2023-07-06 13:18:57 +08:00
raiden00pl
206d339b37 arch/arm: add support for ARMv8-M Security Extensions 2023-07-05 11:20:46 -03:00
Xiang Xiao
015e30a866 drivers/net: Remove HAVE_ATOMICS and use CONFIG_HAVE_ATOMICS directly
since OpenAMP never support to compile in c89 only mode

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-05 13:43:17 +03:00
fangxinyong
dc7f8f136c signal: correct to const pointer for sigorset and sigandset
the two GNU functions, should use const input pointer parameter.

https://refspecs.linuxfoundation.org/LSB_1.3.0/gLSB/gLSB/baselib-sigorset.html
https://refspecs.linuxfoundation.org/LSB_1.3.0/gLSB/gLSB/baselib-sigandset.html

Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2023-07-05 16:26:18 +08:00
guoshichao
bc084a8505 sched/clock/clock_getcpuclockid: add clock_getcpuclockid implementation
1. the implementation can pass the full
ltp/open_posix_testsuite/clock_getcpuclockid testcases
2. the modification are referred to https://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_getcpuclockid.html

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-07-05 00:32:11 +08:00
libei1
63774125d9 arch/sim : Audio driver add AUDIOIOC_GETLATENCY ioctl
add AUDIOIOC_GETLATENCY definition, and add reference code in sim alsa.

Signed-off-by: libei1 <libei1@xiaomi.com>
2023-07-04 13:48:58 +08:00
guoshichao
42f8308423 sched/clock/clock_getres: add two CPUTIME_ID res support
1. make the clock_getres can pass the
ltp/open_posix_testsuite/clock_getres 7-1, 8-1 two cases
2. the modification are referred to https://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_getres.html

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-07-03 23:11:00 +03:00
Nicolas Caramelli
e82b762fb7 input/touchscreen: Translate raw X/Y data into pixel coordinates 2023-07-03 10:17:04 -03:00
Zhe Weng
210c72a651 errno: Adjust help string for EALREADY and ESTALE
EALREADY:
Both Linux(asm-generic/errno.h) and FreeBSD(sys/sys/errno.h) regard it as "Operation already in progress"

ESTALE:
Linux specifically removed the "NFS" description, and we may not only use it for NFS
0ca4343518

The ECANCELED and EOWNERDEAD also use different strings from Linux's header, but their meanings are same, and NuttX's description are more likely to obey POSIX 1003.1-2008, so not changing them.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-07-03 13:38:02 +08:00
Petro Karashchenko
46facd44b3 drivers/net/netdev: improve granularity of 'quota' locking
There is no need to use global spinlock to protect netdev
specific data counters. Allocate per-netdev specific spinlock
to get better locking granularity.

Move C/C++ atomic support checking to compiler.h

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-07-01 15:27:09 -03:00
Xiang Xiao
5af99c65de fs: Define __USE_FILE_OFFSET64 when CONFIG_FS_LARGEFILE is enabled
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-06-30 20:22:10 -03:00
guoshichao
d5f45dc33b libs/libc/aio: fix aio_cancel compatible issue
1. make the aio_cancel implementation can pass the
ltp/open_posix_testsuite/aio_cancel testcases
2. the modification are referred to https://pubs.opengroup.org/onlinepubs/9699919799/functions/aio_cancel.html

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-06-29 23:25:33 +08:00
chao an
4de2284614 compiler/fortify: remove unused label prefix and fix build warning
string/lib_memmove.c:39:1: warning: optimization attribute on 'memmove' follows definition but the attribute doesn't match [-Wattributes]
   39 | {
      | ^
In file included from string/lib_memmove.c:27:
nuttx/include/string.h:177:37: note: previous definition of 'memmove' with type 'void *(void *, const void *, size_t)' {aka 'void *(void *, const void *, unsigned int)'}
  177 | fortify_function(memmove) FAR void *memmove(FAR void *dest,
      |                                     ^~~~~~~
string/lib_memset.c:55:1: warning: optimization attribute on 'memset' follows definition but the attribute doesn't match [-Wattributes]
   55 | {
      | ^
In file included from string/lib_memset.c:30:
nuttx/include/string.h:194:36: note: previous definition of 'memset' with type 'void *(void *, int,  size_t)' {aka 'void *(void *, int,  unsigned int)'}
  194 | fortify_function(memset) FAR void *memset(FAR void *s, int c, size_t n)
      |                                    ^~~~~~
CC:  unistd/lib_sysconf.c string/lib_memcpy.c:43:1: warning: optimization attribute on 'memcpy' follows definition but the attribute doesn't match [-Wattributes]
   43 | {
      | ^
In file included from string/lib_memcpy.c:27:
nuttx/include/string.h:186:36: note: previous definition of 'memcpy' with type 'void *(void *, const void *, size_t)' {aka 'void *(void *, const void *, unsigned int)'}
  186 | fortify_function(memcpy) FAR void *memcpy(FAR void *dest,
      |

Signed-off-by: chao an <anchao@xiaomi.com>
2023-06-28 08:47:33 +08:00
raiden00pl
dc608de144 drivers/ioexpander: add support for SX1509
SX1509 from Semtech is GPIO expander with LED driver and keypad engine.
For now, the keypad engine is not supported.
2023-06-27 14:44:00 -03:00
raiden00pl
c63b2d5c91 drivers/userled: add an interface to support LED effects.
LED effects must be implemented in the lower-half of the LED driver.
The interface is designed to supports the following LED effects:
  - intenisty (PWM)
  - Bling (Timer)
  - Fade in, Fade out (Ramp)
2023-06-27 14:44:00 -03:00
Stuart Ianna
8a668fe733 include/sys: Include string.h to silence implicit memset declration.
This change stops the warning "implicit declaration of function 'memset'" when using the `FD_ZERO` macro.
2023-06-27 10:36:13 +03:00
guoshichao
037a6f5836 libs/libc/signal: add killpg function
1. the killpg function can make all the
ltp/open_posix_testsuite/killpg testcaes passed
2. Nuttx do not support process group, so we use kill process instead
3. the implementation are referred to:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/killpg.html

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-06-27 13:26:20 +08:00
Xiang Xiao
7f80b4aeba clock: Move the content of include/nuttx/time.h to include/nuttx/clock.h
and remove include/nuttx/time.h to reduce the nuttx specific header files

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-06-26 19:14:08 +03:00
Xiang Xiao
b5c48f3ed8 binfmt: Always include arch/elf.h in include/nuttx/elf.h
since symbols defined in arch/elf.h is also used in other case, for example:
CC:  pthread/pthread_testcancel.c machine/arm/gnu_unwind_find_exidx.c:32:8: error: unknown type name '__EIT_entry'
   32 | static __EIT_entry *__exidx_start_elf;
      |        ^~~~~~~~~~~

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-06-25 19:02:53 -03:00
guoshichao
3821ad514d libs/libc/unistd: add getpgrp function
1. the getpgrp function can help to pass the ltp/open_posix_teststuite/killpg related testcases
2. Nuttx do not support process group, so we use getpid to implement this
3. the implementation are referred to: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getpgrp.html

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-06-26 01:03:36 +08:00
Filipe Cavalcanti
9603288c80 drivers/sensors/mpu60x0.c: add IOCTL for AFS_SEL, sample rate and FIFO support 2023-06-24 10:57:12 -03:00
Roy Feng
10251f6b6c Fix assertion of free a wrong heap 2023-06-24 16:34:53 +08:00
Xiang Xiao
efd1b838e6 syslog: Add sc_write_force callback
It is used to write the log message to the channel immediately
when the log message is generated in the interrupt context, which
is faster than the normal force callback.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-06-23 09:55:19 -03:00
Xiang Xiao
e62c915972 syslog: Remove syslog_force and related stuff
syslog_force is used to force the syslog output to the
console in interrupt context, but we can use syslog_write
to do the same(and more) thing.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-06-23 09:55:19 -03:00
anjiahao
d5981375a6 Support gcc FORTIFY_SOURCE features for nuttx libc
This function will use gcc's function
__builtin_dynamic_object_size and __builtin_object_size

Its function is to obtain the size of the object through compilation,
so as to judge whether there are out-of-bounds operations in commonly used functions.
It should be noted that the option -O2 and above is required to enable this function

Signed-off-by: anjiahao <1090959677@qq.com>
2023-06-22 20:38:45 +08:00
anjiahao
4ae17a6f7b sched:Automatically find deadlocks when assert
When asserting, automatically analyze whether
there is a deadlock in the thread, and if there
is a deadlock, print out the deadlocked thread.

The principle is to analyze whether there is
a lock ring through the tcb holder.

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-06-22 16:08:03 +08:00
Xiang Xiao
0572bc4d03 mm/mempool: Count the backtrace overhead in mempool_[dump|info[_task]]
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-06-19 11:37:34 +03:00
Xiang Xiao
9b6cd96671 mm: Rename PID_MM_INVALID to PID_MM_LEAK
to express the intent more clear

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-06-18 14:26:07 +03:00
Xiang Xiao
b00237ac01 mm: Move PID_MM_MEMPOOL after PID_MM_ALLOC
so the allocation from mempool could be dumped correctly

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-06-18 09:12:14 +03:00
Xiang Xiao
f01deff80f mm: Rename MM_BACKTRACE_XXX_PID to PID_MM_XXX
and move the definition to malloc.h

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-06-18 09:12:14 +03:00
Xiang Xiao
ddbe9eb6ab mm: Rename mm_memdump_s to malltask
align with the naming of mallinfo_task

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-06-18 09:12:14 +03:00
Bowen Wang
8515294caa lib_syslograwstream: fix bug when iob alloc failed
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2023-06-17 19:33:41 +08:00
zhangyuan21
514e77b75e semaphore: Optimize priority inheritance with only one holder
This PR is a modification that optimizes priority inheritance
for only one holder. After the above modifications are completed,
the mutex lock->unlock process that supports priority inheritance
can be optimized by 200 cycles.

Before modify: 2000 cycle
After modify: 1742 cycle

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-06-17 08:26:46 +03:00