Commit Graph

47491 Commits

Author SHA1 Message Date
chao an
a0bce18192 net/ipv4: fix shadows declaration
devif/ipv4_input.c: In function ‘ipv4_in’:
devif/ipv4_input.c:305:15: warning: declaration of ‘ret’ shadows a previous local [-Wshadow]
  305 |           int ret = ipv4_forward(dev, ipv4);
      |               ^~~
devif/ipv4_input.c:151:7: note: shadowed declaration is here
  151 |   int ret = OK;
      |       ^~~

Signed-off-by: chao an <anchao@xiaomi.com>
2022-12-01 09:38:33 +08:00
TimJTi
a634da9a30 Fix SAMA5D2 ADC and TSD problems
SAMA5Dx ADC and TSD fixes

Ensures ADC and TSD work together. TSD now works on SAMA5D2 and should be OK, still, for other SAMA5D familiy members

Fix CI error

checkpatch error

Update arch/arm/src/sama5/sam_tsd.h

Squash commits to arch/arm/src/sama5/hardware/sam_adc.h

Update arch/arm/src/sama5/hardware/sam_adc.h

Update arch/arm/src/sama5/hardware/sam_adc.h

Update arch/arm/src/sama5/hardware/sam_adc.h

Update arch/arm/src/sama5/hardware/sam_adc.h

Update arch/arm/src/sama5/hardware/sam_adc.h

Update arch/arm/src/sama5/hardware/sam_adc.h

Update arch/arm/src/sama5/hardware/sam_adc.h

Squash commits to arch/arm/src/sama5/sam_tsd.c

Update arch/arm/src/sama5/sam_tsd.c

Update arch/arm/src/sama5/sam_tsd.c

Update arch/arm/src/sama5/sam_tsd.c

Update sam_tsd.c

Fixes after feedback from PR and additional testing

Update sam_tc.c

checkpatch.sh error was missed when fixing someone else's error...

feedback corrections missed

Co-Authored-By: Xiang Xiao <xiaoxiang781216@gmail.com>
Co-Authored-By: Petro Karashchenko <petro.karashchenko@gmail.com>

squashed everything after 248072e02C
2022-12-01 01:51:12 +08:00
zouboan
498bc98b1b tools/Win.mk:Fix an pass1dep error when USERDEPDIRS is empty in Windows native build 2022-12-01 01:47:46 +08:00
zouboan
f115a97bdc tools/Config:Fix too long input line error call ARCHIVE when use too many libc in Windows native build
tools/Config:Fix too long input line error call ARCHIVE when use too many libc in Windows native build
2022-12-01 01:47:46 +08:00
zouboan
20c69294db tools/Win.mk:Fix an issue in mkdir -p in Windows native build 2022-12-01 01:47:46 +08:00
zouboan
744df68b10 tools/Win.mk:Fix some error in clean_context in Windows native build 2022-12-01 01:47:46 +08:00
zouboan
eaea38e0f2 libc and mm/Makefile:Fix an error caused by backslash in Windows native build
libc and mm/Makefile:Fix an error caused by backslash in Windows native build
2022-12-01 01:47:46 +08:00
zouboan
e2c2cc16ee tools/Config:Fix some error call DELFILE/DELDIR/CATFILE/CLEAN in Windows native build
tools/Config:Fix some error call DELFILE/DELDIR/CATFILE  in Windows native build
2022-12-01 01:47:46 +08:00
zouboan
fd9838f41f tools/mkdeps:Fix an error caused by do_shquote in Windows native build
tools/mkdeps:Fix an error caused by do_shquote in Windows native build

tools/mkdeps:Fix an error caused by do_shquote in Windows native build
2022-12-01 01:47:46 +08:00
TimJTi
57a21fbe1a Fixes for SAMA5D2 Flexcom USART
squashed everything after 8f8b8f5e05

Update Kconfig

Update Kconfig
2022-11-30 23:14:17 +08:00
flyingfish89
fa59db8cea Add Hexadecimal parsing for strtof
solve:
  almost the Hexadecimal string string->float
such as:
  code:float num;
       const char *s= "0x123p32lala";
       char *p;
       num=strtof(s,&p);
       printf("num is %f\n",num);
       printf("str is %s\n",p);
  output:num is 1249835483136.000000
         str is lala

but if the input number is much big;
like:
  code:const char *s2= "0x999999p100";
       num=strtof(s2,&p);
       printf("num is %f\n",num);
       printf("str is %s\n",p);
  corrent : num is 12760587998944832242938906880669384704.000000
  real:     num is 12760587998944800000000000000000000000.000000
it didn't have enough precision
2022-11-30 19:03:07 +08:00
chao an
4281acdb83 net/chksum: move all chksum api declarations to common header
The following APIs need to be overriden by the arch after enabling
CONFIG_NET_ARCH_CHKSUM, move these functions to the common header
file to avoid prototype conflicts

uint16_t chksum(uint16_t sum, FAR const uint8_t *data, uint16_t len);
uint16_t net_chksum(FAR uint16_t *data, uint16_t len);
uint16_t ipv4_upperlayer_chksum(FAR struct net_driver_s *dev, uint8_t proto);
uint16_t ipv6_upperlayer_chksum(FAR struct net_driver_s *dev,
                                uint8_t proto, unsigned int iplen);
uint16_t ipv4_chksum(FAR struct ipv4_hdr_s *ipv4);

Signed-off-by: chao an <anchao@xiaomi.com>
2022-11-30 15:08:14 +08:00
chao an
0de9e387a7 net/loopback: reuse devif_loopback() logic for device lo(loopback)
TX poll callback in device lo(loopback) can be replaced by devif_loopback()
from devif_poll() hook, remove duplicate code to reuse this logic

Signed-off-by: chao an <anchao@xiaomi.com>
2022-11-30 10:07:14 +08:00
chao an
823252261f net/devif: remove link layer length from loopback
Add link layer length in loopback is unnecessary after below change checkin:

 | commit 6fa60627eb
 | Author: chao an <anchao@xiaomi.com>
 | Date:   Sun Nov 27 02:13:21 2022 +0800
 |
 |     net/devif/ip: build l2 header on the IP layer
 |
 |     Signed-off-by: chao an <anchao@xiaomi.com>

Signed-off-by: chao an <anchao@xiaomi.com>
2022-11-30 10:07:14 +08:00
liyi
391b501639 net: extract l3 header build code into new functions
Signed-off-by: liyi <liyi25@xiaomi.com>
2022-11-29 18:36:15 +08:00
chao an
d54a20b393 net/tcp/udp: remove all domain assertion
fix build break if enable CONFIG_NET_IPv6 only

In file included from tcp/tcp_sendfile.c:38:
tcp/tcp_sendfile.c: In function ‘sendfile_eventhandler’:
tcp/tcp_sendfile.c:173:27: error: ‘struct tcp_conn_s’ has no member named ‘domain’
  173 |           DEBUGASSERT(conn->domain == PF_INET6);
      |                           ^~

Signed-off-by: chao an <anchao@xiaomi.com>
2022-11-29 17:28:36 +08:00
flyingfish89
bb040befee optimize the code of the printf 2022-11-29 17:27:02 +08:00
Masayuki Ishikawa
3377aa23ca boards: qemu-armv8a: Add virtio-net to netnsh/netnsh_smp
Summary:
- This commit adds virtio-net to netnsh/netnsh_smp

Impact:
- None

Testing:
- Tested iperf and telnetd with QEMU-7.1

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2022-11-29 13:16:44 +08:00
Masayuki Ishikawa
1eb3d01956 arch: arm64: Add qemu_virtio.c
Summary:
- This commit adds qemu_virtio.c

Impact:
- None

Testing:
- Tested with qemu-armv8a:netnsh (will be added later)

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2022-11-29 13:16:44 +08:00
Masayuki Ishikawa
b1ebca68f1 arch: arm64: Remove arm64_netinitialize() from qemu_boot.c
Summary:
- This commit removes arm64_netinitialize() from qemu_boot.c

Impact:
- None

Testing:
- Tested with QEMU-7.1

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2022-11-29 13:16:44 +08:00
Masayuki Ishikawa
5c8d9c928a boards: rv-virt: Add virtio-net to netnsh/netnsh_smp/netnsh64
Summary:
- This commit add virtio-net to netnsh/netnsh_smp/netnsh64

Impact:
- None

Testing:
- Tested iperf and telnetd with QEMU-7.1

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2022-11-29 13:16:44 +08:00
Masayuki Ishikawa
8053931d31 arch: qemu-rv: Add qemu_rv_virtio.c
Summary:
- This commit adds qemu_rv_virtio.c

Impact:
- None

Testing
- Tested with rv-virt:netnsh (will be added later)

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2022-11-29 13:16:44 +08:00
Masayuki Ishikawa
8b4ffb8d3e virtio: Add virtio drivers
Summary:
- This commit adds virtio-mmio and virtio-net drivers

Impact:
- None (new drivers)

Testing:
- Tested with rv-virt (will be updated later) with QEMU-7.1

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2022-11-29 13:16:44 +08:00
chao an
cdaa2ba8d4 mm/iob: new function iob_update_pktlen() to update packet length of the iob
Signed-off-by: chao an <anchao@xiaomi.com>
2022-11-29 13:16:23 +08:00
chao an
b452e2fddf mm/iob: new function iob_reserve() to adjust headroom offset
Signed-off-by: chao an <anchao@xiaomi.com>
2022-11-29 13:16:23 +08:00
Lucas Saavedra Vaz
a926445995 boards: Fix buttons GPIO IRQ on ESP boards 2022-11-28 17:24:57 -03:00
Lucas Saavedra Vaz
cd5e536c40 boards/esp32-lyrat: Add buttons example 2022-11-28 17:24:57 -03:00
Gao Feng
08f5a5a3be meminfo: buflen identify the left of buffer
It is enought to only checking the buflen's avaiable or not.
(total size means total copied size)

Co-authored-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-11-29 01:29:55 +08:00
qiaohaijiao1
127a3585cc tools/ci/docker/linux/Dockerfile: add libmad0-dev in docker environment
Signed-off-by: qiaohaijiao1 <qiaohaijiao1@xiaomi.com>
2022-11-29 00:20:25 +08:00
zhanghongyu
ec8cc6db37 net: add parameter check in psock_setsockopt
0  0x565a60bd in memmove (dest=0xf7fbaabe, src=0x0, count=3) at string/lib_memmove.c:58
1  0x565d8b90 in usrsock_iovec_do (srcdst=0xf7fbaab0, srcdstlen=2018, iov=0xf3de798c, iovcnt=0, pos=0, from_iov=true, done=0xf3de78e7) at usrsock/usrsock_devif.c:155
2  0x565d9349 in usrsock_iovec_get (dst=0xf7fbaab0, dstlen=2032, iov=0xf3de797c, iovcnt=2, pos=0, done=0xf3de78e7) at usrsock/usrsock_devif.c:612
3  0x5659f4b9 in usrsock_request (iov=0xf3de797c, iovcnt=2) at usrsock/usrsock_rpmsg.c:210
4  0x565d9436 in usrsock_do_request (conn=0x566316c0 <g_usrsock_connections>, iov=0xf3de797c, iovcnt=2) at usrsock/usrsock_devif.c:659
5  0x565dcfe9 in do_setsockopt_request (conn=0x566316c0 <g_usrsock_connections>, level=1, option=7, value=0x0, value_len=4) at usrsock/usrsock_setsockopt.c:131
6  0x565dd11e in usrsock_setsockopt (psock=0xf3dea840, level=1, option=7, value=0x0, value_len=4) at usrsock/usrsock_setsockopt.c:208
7  0x565d4d31 in psock_setsockopt (psock=0xf3dea840, level=1, option=7, value=0x0, value_len=4) at socket/setsockopt.c:310
8  0x565d4dde in setsockopt (sockfd=3, level=1, option=7, value=0x0, value_len=4) at socket/setsockopt.c:396

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2022-11-29 00:20:09 +08:00
chao an
615845d9a6 net/devif: add common interface to build L2 headers
So we can hide the implementation details of L2 NICs.

Signed-off-by: chao an <anchao@xiaomi.com>
2022-11-28 14:44:15 +01:00
xinbingnan
4800c166ec Dockerfile: fix cp clang-extdef-mapping no effect
Use a wrong command `CMD`, and the correct is `RUN`.
That's a low level fault made by me.

Signed-off-by: xinbingnan <xinbingnan@xiaomi.com>
2022-11-28 14:31:19 +01:00
田昕
1d8d6e5ed2 drivers/syslog:support stream as syslog backend.
Signed-off-by: 田昕 <tianxin7@xiaomi.com>
2022-11-28 20:19:00 +08:00
ligd
b71f124b7b armv7-r: correct the wrong usage of ARMV7A_XX marco
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-11-28 12:21:32 +01:00
ligd
f243e4f268 localtime: fix deadlock when print syslog in romfs
thread1:
romfs_seek -> take romfslock -> syslog -> tzset
thread2:
sylsog -> tzset -> tz_load -> romfs_open -> deadlock

Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-11-28 18:04:38 +08:00
ligd
11fa70d53a romfs: change lock to recursion lock
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-11-28 18:04:38 +08:00
TimJTi
578f7783c6 Corrects PIO errors and omissions for SAMA5D2
Changes and corrections after review

Correct slow clock config
2022-11-28 16:37:44 +08:00
田昕
9d48d86606 libc/stream:add putc interface for mtd/blk stream.
Signed-off-by: 田昕 <tianxin7@xiaomi.com>
2022-11-28 16:37:01 +08:00
ligd
139663ba89 local: add net_lock to local_listen
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-11-28 16:36:39 +08:00
Xiang Xiao
c38d6f1ae4 net: Remove usrsock specific process from common code as much as possible
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-28 16:32:41 +09:00
yinshengkai
699e3e8291 let segger RTT kconfig sink one level
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2022-11-28 15:22:58 +08:00
Masayuki Ishikawa
5215eb7e0f boards: cxd56xx: Fix the build error in cxd56_crashdump.c
Summary:
- This commit fixes the build error in cxd56_crashdump.c
  regressed by https://github.com/apache/nuttx/pull/7707

Impact:
- None

Tesing:
- Tested with spresense:wifi

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2022-11-28 08:18:47 +01:00
ligd
f72bab20b6 inet: fix compile failed if not define UDP
inet/ipv4_setsockopt.c: In function ‘ipv4_setsockopt’:
inet/ipv4_setsockopt.c:200:19: error: invalid use of undefined type ‘struct udp_conn_s’
  200 |               conn->ttl = ttl;
      |                   ^~
inet/ipv4_setsockopt.c:223:19: error: invalid use of undefined type ‘struct udp_conn_s’
  223 |               conn->flags |= _UDP_FLAG_PKTINFO;
      |                   ^~
inet/ipv4_setsockopt.c:223:30: error: ‘_UDP_FLAG_PKTINFO’ undeclared (first use in this function)
  223 |               conn->flags |= _UDP_FLAG_PKTINFO;
      |                              ^~~~~~~~~~~~~~~~~
inet/ipv4_setsockopt.c:223:30: note: each undeclared identifier is reported only once for each function it appears in
inet/ipv4_setsockopt.c:227:19: error: invalid use of undefined type ‘struct udp_conn_s’
  227 |               conn->flags &= ~_UDP_FLAG_PKTINFO;

Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-11-28 08:16:59 +01:00
ligd
092c78d636 signal: correct signal() return value & errno
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-11-28 14:15:21 +08:00
ligd
eef619fc46 signal: correct sigset() return value & errno
ref:
https://man7.org/linux/man-pages/man3/sigset.3.html
The dispositions for SIGKILL and SIGSTOP cannot be changed.

Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-11-28 14:15:21 +08:00
Xiang Xiao
af2b491420 driver/segger: Move SYSLOG_RTT config from drivers/syslog to drivers/segger
and remove include/nuttx/syslog/syslog_rtt.h

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-27 23:10:39 +01:00
Xiang Xiao
fd268d7123 drivers/segger: Add STREAM_RTT option
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-27 23:10:39 +01:00
Xiang Xiao
ac365ab7e9 drivers/segger: Refine Kconfig option
1.Add SEGGER_SYSVIEW_RTT_CHANNEL option
2.SEGGER_RTT_BUFFER_SIZE_UP always default to 1KB
3.SEGGER_SYSVIEW_RTT_BUFFER_SIZE default to SEGGER_RTT_BUFFER_SIZE_UP

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-27 23:10:39 +01:00
Xiang Xiao
7c7ab96b53 libc/stdio: Remove putc macro from lib_libvsprintf.c
call lib_stream_put directly instead

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-27 22:59:21 +01:00
Xiang Xiao
7568a0df22 libc/stdio: Don't count the output length repeatly in vsprintf_internal
let's reuse the counting from lib_outstream_s::nput instead

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-27 22:59:21 +01:00