Commit Graph

5447 Commits

Author SHA1 Message Date
liaoao
a44f498842 rpmsgclk: allow client to disable clk of server
Signed-off-by: liaoao <liaoao@xiaomi.com>
2023-07-28 06:57:29 -07:00
xucheng5
872913e67b netdev_upperhalf: reply logic only for ipv4/ipv6/arp input
VELAPLATFO-12228

Signed-off-by: xucheng5 <xucheng5@xiaomi.com>
2023-07-28 06:56:35 -07:00
xucheng5
04c4207dee driver/net : net_upperhalf support NET_LL_CAN
VELAPLATFO-9099

Signed-off-by: xucheng5 <xucheng5@xiaomi.com>
2023-07-28 06:56:35 -07:00
dongjiuzhu1
1a609c53d7 misc/rwbuffer: using unify lock function for lock and unlock
if disable CONFIG_DRVR_WRITEBUFFER, the lock and unlock will misc match.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-07-28 05:10:39 -07:00
dongjiuzhu1
37fc0a0208 drivers/mmcsd_sdio: config timout to write one data block
Some hardware needs to config this delay to write one data block, because
the hardware needs more time to wear leveling and bad block manage.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-07-28 05:01:36 -07:00
Zhihong Chen
8e85e52708 drivers: usbhost: fix usbhost_hidkbd some errors
- usbhost_send_request(): data should using DRVR_ALLOC buffer
- fix usbhost_cralloc() assert variable

Signed-off-by: Zhihong Chen <zhihong.chen@hpmicro.com>
2023-07-27 00:51:59 -07:00
yuexinyi
baefa5fa6b Revert "drivers/video: Don't need update vbuf_tail in dequeue_vbuf_unsafe"
This reverts commit e15bccaa71.

Signed-off-by: yuexinyi <yuexinyi@xiaomi.com>
2023-07-26 07:45:30 -07:00
raiden00pl
e48d730273 cmake: enable more cmake builds 2023-07-25 06:18:22 -07:00
Victor Benso
0c5145b7d1 New implementation of the ESP32's RMT driver. 2023-07-23 16:17:57 -03:00
chao an
ee6e2ce149 arch/perf: add ARCH_HAVE_PERF_EVENTS to support hardware perf events
The implementation of up_perf_*() is in a different static library in nuttx:

Hardware: libarch.a
Software: libdrivers.a (weak function)

Since functions with weak attributes cannot be correctly replaced in multiple static libraries,
this PR will use macros to replace whether the arch supports hardware perf events

Signed-off-by: chao an <anchao@xiaomi.com>
2023-07-21 20:43:30 +08:00
Zhihong Chen
3d8324962a drivers: usbhost_hub: usb communication memory should use DRVR_ALLOC
- usb communication memory should use DRVR_ALLOC

Signed-off-by: Zhihong Chen <zhihong.chen@hpmicro.com>
2023-07-19 13:38:36 +08:00
mks2183
f9386282dc driver/audio: low level reset must always succeed
- considering simplicity and design assumption, the reset function must work without flaw.
  If it fails, there is no way to recover but to reset again. so checking return status does not
  bring additional benefit

- There is unnecessary switch inside switch which is making code not too readable

Signed-off-by: mks2183 <manishsharma3134@gmail.com>
2023-07-18 10:14:24 -03:00
Xiang Xiao
abfe082a6f Kconfig: Simplify the conditional default statement
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-16 14:39:20 -03:00
Xiang Xiao
e031a73aef Kconfig: Change some "default y" to "default !DEFAULT_SMALL"
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-16 14:39:20 -03:00
Xiang Xiao
bcaa52e0f1 driver/segger: Simplify serial driver configuation
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-16 14:37:21 +03: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
dbd13c2aca drivers/segger: Rename serial device from /dev/rttx to /dev/ttyRx
follow the serial driver naming convention

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-07-15 18:38:08 -03:00
chao an
f10b54a081 cmake: fix CMake build break
Signed-off-by: chao an <anchao@xiaomi.com>
2023-07-15 23:32:36 +08:00
chao an
f49ee08ab4 drivers/sensors: fix build warning on GCC-12
nuttx/drivers/sensors/wtgahrs2.c: In function ‘wtgahrs2_initialize’:
nuttx/drivers/sensors/wtgahrs2.c:545:22: warning: ‘%lx’ directive output may be truncated writing between 1 and 16 bytes into a region of size 14 [-Wformat-truncation=]
  545 |   snprintf(arg1, 16, "0x%" PRIxPTR, (uintptr_t)rtdata);
      |                      ^~~~~
nuttx/drivers/sensors/wtgahrs2.c:545:25: note: format string is defined here
  545 |   snprintf(arg1, 16, "0x%" PRIxPTR, (uintptr_t)rtdata);
nuttx/drivers/sensors/wtgahrs2.c:545:22: note: directive argument in the range [1, 18446744073709551615]
  545 |   snprintf(arg1, 16, "0x%" PRIxPTR, (uintptr_t)rtdata);
      |                      ^~~~~
nuttx/drivers/sensors/wtgahrs2.c:545:3: note: ‘snprintf’ output between 4 and 19 bytes into a destination of size 16
  545 |   snprintf(arg1, 16, "0x%" PRIxPTR, (uintptr_t)rtdata);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: chao an <anchao@xiaomi.com>
2023-07-15 23:32:36 +08:00
Michal Lenc
548f4b652c st7789: add support for 3 wire interface
3 wire interface for ST7789 LCD controller does not use  CMD/DATA pin to
specify whether data  or command is send but uses 9th bit of SPI transfer.

This commit adds support for 3 wire interface to ST7789 controller.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2023-07-15 00:08:43 +08:00
liaoao
e8c6eb0aba rpmsg: use workqueue for rpmsgdev poll notify
use workqueue for rpmsgdev poll notify to prevent
calling rpmsgdev_poll_cb in interrupt context which
will try to hold mutex in rpmsg_send

Signed-off-by: liaoao <liaoao@xiaomi.com>
2023-07-14 19:18:36 +08:00
chao an
0b69731a97 netdev/upperhalf: fix visual studio Compiler Error C2059
D:\archer\code\nuttx\drivers\net\netdev_upperhalf.c(557,5): error C2059: syntax error : '{'

Compiler error C2059:
The token caused a syntax error.

Reference:
https://learn.microsoft.com/en-us/cpp/error-messages/compiler-errors-1/compiler-error-c2059?view=msvc-170
Signed-off-by: chao an <anchao@xiaomi.com>
2023-07-14 07:52:34 +02:00
liaoao
2ebc8aff16 rpmsgblk: get return value from header
cookie->result as the return value of rpmsg operations,
it should get from remote response.

Signed-off-by: liaoao <liaoao@xiaomi.com>
2023-07-14 13:34:53 +08:00
yinshengkai
6a0ffa5c52 syslog: replace lib_sprintf to lib_sprintf_internal
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-07-14 00:22:11 +03:00
yinshengkai
0052ff2bd8 syslog: replace %pV with lib_sprintf
%pV will increase the stack size

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-07-14 00:22:11 +03:00
simbit18
b0965ab963 Fix nuttx coding style
Remove TABs
Fix indentation
Fix Multi-line comments
Fix Comments to the Right of Statements.
2023-07-14 01:16:06 +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
yinshengkai
043d5922e4 drivers: add ascii drvier, returns a printable string of 0x21-0x7f
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-07-12 11:13:37 -06: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
062e08ea3a serial:fix driver/serial/serial.c logic error
Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2023-07-12 11:28:54 -03:00
dulibo1
7ccdb2cfa8 battery:fix poll return type
Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2023-07-12 11:06:47 -03: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
yinshengkai
e1553e8407 drivers/rtt: check whether Jlink is connected
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
lile7
a3db142fbf drivers/video: use kmm_free(buff) to free memory instead of realloc(buff, 0) which is abandoned
ref: 89d61f4eb4

Signed-off-by: lile7 <lile7@xiaomi.com>
2023-07-12 02:33:17 +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
yinshengkai
81553deb53 time: add up_perf_init weak_function
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-07-11 10:09:25 -03:00
liuzhao
899471c6bd add support for YT8512 phy 2023-07-11 03:40:53 +08:00
chao an
6ee9ec7656 build: add initial cmake build system
1. Update all CMakeLists.txt to adapt to new layout
2. Fix cmake build break
3. Update all new file license
4. Fully compatible with current compilation environment(use configure.sh or cmake as you choose)

------------------

How to test

From within nuttx/. Configure:

cmake -B build -DBOARD_CONFIG=sim/nsh -GNinja
cmake -B build -DBOARD_CONFIG=sim:nsh -GNinja
cmake -B build -DBOARD_CONFIG=sabre-6quad/smp -GNinja
cmake -B build -DBOARD_CONFIG=lm3s6965-ek/qemu-flat -GNinja

(or full path in custom board) :
cmake -B build -DBOARD_CONFIG=$PWD/boards/sim/sim/sim/configs/nsh -GNinja

This uses ninja generator (install with sudo apt install ninja-build). To build:

$ cmake --build build

menuconfig:

$ cmake --build build -t menuconfig

--------------------------

2. cmake/build: reformat the cmake style by cmake-format

https://github.com/cheshirekow/cmake_format

$ pip install cmakelang

$ for i in `find -name CMakeLists.txt`;do cmake-format $i -o $i;done
$ for i in `find -name *\.cmake`;do cmake-format $i -o $i;done

Co-authored-by: Matias N <matias@protobits.dev>
Signed-off-by: chao an <anchao@xiaomi.com>
2023-07-08 13:50:48 +08:00
Petro Karashchenko
2ca40e14e9 drivers/syslog: remove redundant 'int' cast
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-07-07 17:39:39 -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
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
simonatoaca
fd4dd59c3c Made the PWM frequency of the RGB driver configurable from the menu.
Signed-off-by: simonatoaca <simona.alexandra2000@gmail.com>
2023-07-05 00:49:44 +08:00
Beat Küng
cbbeec3183 ramtron.c: add FM25V02A-DGQ 2023-07-04 08:19:56 +08:00
simbit18
79db26bda3 drivers/sensors/apds9960.c: Fix mistakes in comments snerr
Fix mistakes in comments snerr
APDS9960_GCONFIG3 -> APDS9960_GCONFIG4
2023-07-03 23:05:36 +03:00
Nicolas Caramelli
e82b762fb7 input/touchscreen: Translate raw X/Y data into pixel coordinates 2023-07-03 10:17:04 -03:00
Petro Karashchenko
b1dd5d1189 drivers/wireles/gs2200m: add NET_TCP dependency to NFS_DONT_BIND_TCP_SOCKET option
The NFS_DONT_BIND_TCP_SOCKET should be selected only TCP networking is enabled

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-07-03 13:32:31 +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
Masayuki Ishikawa
248fe7529a drivers: wireless: select NFS_DONT_BIND_TCP_SOCKET for GS2200M
Summary:
- https://github.com/apache/nuttx/pull/3707

Impact:
- None

Testing:
- Tested with spresense:wifi_smp

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2023-07-01 13:18:27 +08:00
Mingjie Shen
1d6e51220d cxd56_dmac, lcd_dev: fix null pointer dereference
Check return values of following functions for null:
   - board_lcd_getdev
   - get_device

Signed-off-by: Mingjie Shen <shen497@purdue.edu>
2023-06-28 10:16:38 +03: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
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
Mingjie Shen
3344697afc drivers/sensors/apds9960.c: Fix resource leak in error handling
Signed-off-by: Mingjie Shen <shen497@purdue.edu>
2023-06-26 09:43:01 -03:00
Mingjie Shen
65e97ffca1 drivers/can/can.c: Fix nested loops with same variable
In this nested loop, the iteration variable is the same for both loops.
This is a typo and the inner loop should use a new loop variable.

Signed-off-by: Mingjie Shen <shen497@purdue.edu>
2023-06-25 11:47:34 +03:00
Mingjie Shen
209bee3266 drivers/sensors/apds9960.c: Fix use after free
Memory pointed by priv may be used (in line 1289) after it is
freed in line 1283.
Fix by adding the missing return statement in error handling.

Signed-off-by: Mingjie Shen <shen497@purdue.edu>
2023-06-25 14:36:22 +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
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
Xiang Xiao
309f89d6c3 segger: Change the default value of SEGGER_RTT_MAX_NUM_DOWN_BUFFERS to SEGGER_RTT_MAX_NUM_UP_BUFFERS
since the number of down buffers should be equal to the number of up buffers in most cases.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-06-23 00:36:36 +03:00
simbit18
f0a74eb492 Fix Kconfig style
Remove spaces from Kconfig files
2023-06-22 11:46:09 +09:00
Masayuki Ishikawa
5e7ce13b3e drivers: virtio: Use one dscriptor for RX in virtio-mmio-net.c
Summary:
- In this implementation, only one descriptor is used for RX.
- NOTE: we still use two descriptors for TX

Impact:
- None

Testing:
- Tested with qemu-7.1

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2023-06-21 16:38:04 +08:00
wangchen
dd0f967798 usrsock_server:fix incomplete received data error
if number of bytes available for reading more than zero,set USRSOCK_EVENT_RECVFROM_AVAIL flag into the event

Signed-off-by: wangchen <wangchen41@xiaomi.com>
2023-06-21 07:40:52 +03:00
simbit18
3f4151525d Fix Kconfig style
Remove TABs from Kconfig files
Add comments
2023-06-19 20:05:57 +03:00
simbit18
a4398b50c8 drivers/lcd/Kconfig: Fix Kconfig style
Remove TABs from Kconfig file
Add comments
2023-06-19 23:06:48 +08:00
Bowen Wang
69756f277e rptun_dump: do not acquire the lock when has hold the lock
Otherwise, system will crash again when call rptun_dump_all()
after has acquired the lock.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2023-06-17 19:38:39 +08:00
wangbowen6
41e399aa43 rptun: init the semtx before the thread/workqueue created
If the rptun driver set auto start, the smetx may has been used
in rptun_notify_wait() but not inited.

Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2023-06-17 19:38:39 +08:00
wangbowen6
940bbfc720 rpmsg: support the fdsan feature for rpmsg dev/mtd/blk
Directly return -ENOTTY in rpmsgxxx_ioctl() when the command is
not supported to avoid fdsan command FIOC_SETTAG and FIOC_GETTAG
pass to the rpmsg dev/mtd/blk server with CONFIG_FDSAN enabled.

Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2023-06-17 19:34:39 +08:00
Zhe Weng
f80539b6a8 netdev/upper: Use atomic when we have atomic support from compiler
Ref: How to test atomic support https://beej.us/guide/bgc/html/split/chapter-atomics.html

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-06-15 19:31:59 -03:00
Zhe Weng
483eb10f37 netdev/upper: Make quota_load public
Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-06-15 19:31:59 -03:00
Simon Filgis
04f8bab063 Dynamic adjustment of the orientation, switch orientation on the fly:
1. orientation is a parameter of initialize
2. y and x offset need to be adjusted with the orientaiton
3. bpp must be changed no matter what
2023-06-15 10:15:11 -03:00
raiden00pl
387944b837 usbdev/cdcacm.c: register console only for device with minor number 0
With this change, we can register several CDCACM devices where one is used as a console
2023-06-14 16:24:20 -03:00
Sebastien Lorquet
43fec5dd53 pca9555: fix const correctness of pin set parameters 2023-06-13 16:10:52 -03:00
zhanghongyu
aa43f6ff1a usrsock_rpmsg_server: fix poll recursive when revent POLLHUP or POLLERR
the previous patch can not handle the revent is POLLHUP or POLLERR,
poll_setup needs to be executed only when the POLLIN or POLLOUT event
changes.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-06-13 15:33:05 +08:00
Petro Karashchenko
2a38c38b03 style: fix style issues found during code review
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-06-11 12:54:52 +08:00
Sebastien Lorquet
d36e2a8394 is25xp: Enable usage of several chips on the same spi bus 2023-06-10 02:14:23 +08:00
Huang Qi
d8a61108cf drivers/ptmx: Fix a potential buffer overflow
Fix warning:
```
serial/ptmx.c:205:34: warning: ‘%d’ directive output may be truncated writing between 1 and 10 bytes into a region of size 8 [-Wformat-truncation=]
  205 |   snprintf(devname, 16, "/dev/pty%d", minor);
      |
serial/ptmx.c:205:25: note: directive argument in the range [0, 2147483647]
  205 |   snprintf(devname, 16, "/dev/pty%d", minor);
      |                         ^~~~~~~~~~~~
serial/ptmx.c:205:3: note: ‘snprintf’ output between 10 and 19 bytes into a destination of size 16
  205 |   snprintf(devname, 16, "/dev/pty%d", minor);
```

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-06-09 19:41:11 +03:00
SPRESENSE
54112ac070 drivers/modem/alt1250: Update alt1250 driver
Updated alt1250 driver with regarding to the following changes.
- Add LTE hibernation feature
- Split source code per module
- Some refactoring
- Some bug fixes
2023-06-08 07:48:17 +02:00
xucheng5
f4e3f23945 driver/mtd : mtd_config name len max changed to NAME_MAX
Signed-off-by: xucheng5 <xucheng5@xiaomi.com>
2023-06-07 09:40:02 -03:00
chao an
7c5d2a8bdd usrsock/dns: add sanity check before send dns event
Signed-off-by: chao an <anchao@xiaomi.com>
2023-06-06 13:29:23 +08:00
Xiang Xiao
694c0f0b7f usbhost/cdcacm: Fix the compiler warning when serial dma is enabled
CP:  nuttx/nuttx/include/nuttx/config.h
CC:  mqueue/mq_sndinternal.c usbhost/usbhost_cdcacm.c:435:3: warning: initialization of ‘void (*)(struct uart_dev_s *)’ from incompatible pointer type ‘void (*)(struct uart_dev_s *, _Bool)’ [-Wincompatible-pointer-types]
  435 |   usbhost_txint,         /* txinit */
      |   ^~~~~~~~~~~~~
usbhost/usbhost_cdcacm.c:435:3: note: (near initialization for ‘g_uart_ops.dmareceive’)
usbhost/usbhost_cdcacm.c:436:3: warning: initialization of ‘void (*)(struct uart_dev_s *)’ from incompatible pointer type ‘_Bool (*)(struct uart_dev_s *)’ [-Wincompatible-pointer-types]
  436 |   usbhost_txready,       /* txready */
      |   ^~~~~~~~~~~~~~~
usbhost/usbhost_cdcacm.c:436:3: note: (near initialization for ‘g_uart_ops.dmarxfree’)
usbhost/usbhost_cdcacm.c:437:3: warning: initialization of ‘void (*)(struct uart_dev_s *)’ from incompatible pointer type ‘_Bool (*)(struct uart_dev_s *)’ [-Wincompatible-pointer-types]
  437 |   usbhost_txempty        /* txempty */
      |   ^~~~~~~~~~~~~~~
usbhost/usbhost_cdcacm.c:437:3: note: (near initialization for ‘g_uart_ops.dmatxavail’)

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-06-05 09:25:31 +02:00
Xiang Xiao
87aa067ab3 serial/16550: Include nuttx/clk/clk.h
to avoid the build break when CONFIG_CLK is enabled

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-06-04 11:37:59 +03:00
Masayuki Ishikawa
ee364e115a drivers: virtio: Remove unused code and fix comments in virtio-mmio-net.c
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2023-06-04 01:14:08 +08:00
wanggang26
01348b70a9 mtd: fix a typo 2023-06-02 19:57:15 +03:00
Masayuki Ishikawa
e149a1278b dirivers: virtio: Fix virtnet_virtnet_txpoll() in virtio-mmio-net.c
Summary:
- I noticed that nfsmount always timed out.
- This commit fixes this issue.

Impact:
- None

Testing:
- Tested wih qemu-7.1
- NOTE: defconfigs will be updated later.

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2023-06-02 16:28:34 +08:00
Tiago Medicci Serrano
71c8265e2d drivers/syslog: add mutex to syslog_default_write
This commit reverts 19f269e54b and
substitutes the semaphore to a mutex, used as a locking mechanism
to avoid syslog messages being messed.

Considering SMP, threads running on different CPUs could call
syslog_default_write simultaneously. It then calls `up_nputs` that,
in most of the implementations, calls `up_putc` multiple times to
write to the serial. So, calling it at the same would cause syslog
messages to interfere with each other.

`up_nputs` and `up_putc` are low-level functions that could be used
during initialization and by the interrupt handler. Hence, it isn't
advisable to implement any locking mechanism on them. On the other
hand, syslog can also be used from the interrupt: if the interrupt
buffer is selected (`CONFIG_SYSLOG_INTBUFFER=y`), the syslog
messages will be flushed when we aren't serving an interrupt.
On the contrary, if it isn't set, it would call the registered
`sc_force` callback, which calls `syslog_default_putc` instead of
the lock-protected `syslog_default_write`.
2023-06-02 10:17:54 +08:00
raiden00pl
4089e35805 drivers/sensors: add bh1749nuc color sensor support
Add support for the BH1749NUC I2C color sensor.
Currently, the interrupt pin is not supported.
2023-06-01 23:45:30 +08:00
raiden00pl
e1ffacfc33 drivers/sensors: add BMI270 IMU support 2023-06-01 11:23:54 -04:00
paolovolpi
0ed9842180 drivers/can/mcp2515.c Fix: add missing spi configuration in mcp2515_reset_lowlevel 2023-06-01 09:52:16 -03:00
Masayuki Ishikawa
6b35a49f6e dirivers: virtio: Fix virtnet_transmit() in virtio-mmio-net.c
Summary:
- I noticed that the driver sends incorrect packets sometimes.
- This commit fixes this issue.

Impact:
- None

Testing:
- Tested with qemu-7.1

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2023-06-01 13:44:30 +08:00
xucheng5
484d349fe3 driver/mtd : check args for nvs read
mtd_config_fs: check configdata before use

Signed-off-by: xucheng5 <xucheng5@xiaomi.com>
2023-05-31 15:24:14 +08:00
chao an
589d4a9f8e net/semantic/parser: fix compile warning found by sparse
Reference:
https://linux.die.net/man/1/sparse

Signed-off-by: chao an <anchao@xiaomi.com>
2023-05-30 23:00:00 +08:00
chao an
fb9b41221d semantic/parser: fix compile warning found by sparse
Reference:
https://linux.die.net/man/1/sparse

Signed-off-by: chao an <anchao@xiaomi.com>
2023-05-30 23:00:00 +08:00
paolovolpi
f875db41d4 drivers/can/mcp2515.c Use SPIDEV_CANBUS(config->devid) instead of SPIDEV_CANBUS(0) 2023-05-30 11:48:13 +03:00
Michal Lenc
5f5ffa9380 fix compile warnings caused by incorrect variable format in print
Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2023-05-27 18:52:01 +08:00
Michael Jung
2e27698d6c SLIP: Switch to poll based design
This is a refactored version of the SLIP network driver.  Updates
include:

1. The original design started two kernel threads per SLIP device.
   The refactored version uses file_poll to essentially be driven
   by the UART RX and TX interrupts and pushes work to the low
   priority work queue.

2. The SLIP byte un-/stuffing is more efficient now, using memcpy
   instead of handling each byte individually.

3. The switch of the old SLIP driver to IOBs caused buffer overwrites
   if packets were sent that would not fit into a single IOB.  This is
   fixed now.

Signed-off-by: Michael Jung <michael.jung@secore.ly>
2023-05-26 19:57:57 -03:00
paolovolpi
ecaa62010a drivers/can/mcp2515.c Fix Configure Spi Bus on every bus lock 2023-05-27 03:18:31 +08:00
TimJTi
c904b16cd9 Rename touchscreen ioctls for clarity 2023-05-26 22:42:57 +08:00
paolovolpi
8b27e455b1 drivers/can/mcp2515.c Fix Missing Chipselect de-assert before bus unlocking 2023-05-25 18:55:07 -03:00
fangpeina
0b8d5e993d drivers/lcd: Add JD9851 driver
Added support for the JD9851 TFT controller based on ST7789

Signed-off-by: fangpeina <fangpeina@xiaomi.com>
2023-05-26 02:21:25 +08:00
jianglianfang
73832ab0a4 vnc server: Fix that vnc_updater thread exited caused by readed a null data
When updating the full-screen data, sq_ init() will clear the updqueue and add just one new full-screen data to the updqueue. So when the vnc_updater thread is awakened, it may read a null data due to multiple reading, leading to vnc_updater thread exited , which is not expected.

Signed-off-by: jianglianfang <jianglianfang@xiaomi.com>
2023-05-25 22:41:47 +08:00
Xiang Xiao
20ea607bd0 stream: Rename syslogstream to syslograwstream
to prepare a new stream implementation of syslog

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Signed-off-by: chao an <anchao@xiaomi.com>
2023-05-25 15:22:04 +08:00
chao an
0455167457 stream/syslog: use internal buffer to decoupling syslog with iob
Signed-off-by: chao an <anchao@xiaomi.com>
2023-05-24 09:53:30 +08:00
TimJTi
3cb168b177 GD25 Flash memory - performance enhancements 2023-05-23 01:32:58 +08:00
zhanghu5
a043657323 dma support 16550 uart
Signed-off-by: zhanghu5 <zhanghu5@xiaomi.com>
2023-05-23 01:32:03 +08:00
simbit18
e4ffce3355 Fix Kconfig style
Remove spaces from Kconfig files
2023-05-23 00:03:25 +08:00
Xiang Xiao
7990f90915 Indent the define statement by two spaces
follow the code style convention

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-21 09:52:08 -03:00
Lwazi Dube
ae1fd83a46 usbhost: Can now handle multiple interface descriptors.
See #3644. Code from:
https://github.com/apache/nuttx/compare/master...btashton:libusb
2023-05-21 09:50:36 -03:00
jianglianfang
14c77dce15 fb_driver: add fb_open and fb_close
Signed-off-by: jianglianfang <jianglianfang@xiaomi.com>
2023-05-19 21:46:07 +08:00
jianglianfang
73a1066613 vnc_server: set touch.maxpoint to 1 for circbuf_init
set touch.maxpoint to 1 in vnc_server.c for circbuf_init,otherwise
touch_event will circbuf_overwrite a wrong value.
test step:vnc run lvgldemo,test input event

Signed-off-by: jianglianfang <jianglianfang@xiaomi.com>
2023-05-19 17:42:05 +08:00
Petro Karashchenko
c70b7f6b3d nuttx: improve C89 compatibility in common code
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-05-19 02:40:38 +08:00
Petro Karashchenko
8254b374dd drivers/mmcsd: fix style issues
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-05-19 02:40:38 +08:00
Petro Karashchenko
1e86682feb drivers/mtd: fix C89 compatibility of w25qxxxjv
Correct various style issues

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-05-19 02:40:38 +08:00
Xiang Xiao
8d56a9bbcb Remove #warning if the code already return the error code or value
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-18 15:44:28 +03:00
simbit18
ca026a5b0f drivers\power\supply\Kconfig: Fix indentation
Remove TABs
2023-05-18 15:43:22 +03:00
Lwazi Dube
9948b5e701 usbhost: Make unplugging hubs more reliable.
USB drivers should not try control devices in the usbhost_disconnected
function. The control endpoint is NULL at this point because the device
has already been disconnected.

Before this change, the hub driver crashed when the child called
usbhost_hubpwr after the parent had already deactivated the control
pipe and set hport->ep0 to NULL.
2023-05-18 13:47:15 +08:00
Michal Lenc
cf04f2e555 w25qxxxjv: add dual die support for 1 Gbit flash
1 Gbit W25Q01JV flash uses two 512 Mbit dies. This requires specific
operations in the driver in order to support the entire 1 Gbit region.
This commit adds dual die support for W25Q01JV flash.

Generally the driver has to switch active dies when die specific read from
status register is required (therefore before read, write, erase and when
checking if write status register was successful).

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2023-05-18 01:10:55 +08:00
chao an
6be363ff35 drivers/serial: fix race condition in multi-thread write
if multiple threads are doing serial read/write at the same time,
the driver will only wake up one of the thread, which will cause
other threads fail to be woken up in time and cause blocking

Signed-off-by: chao an <anchao@xiaomi.com>
2023-05-17 07:56:08 +02:00
Huang Qi
23ad4700a9 drivers/serial/pty.c: Fix coverity issue
Coverity report that `ntotal` may be a negative value.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-05-17 07:44:26 +02:00
Zhe Weng
eb47312518 netdev_upper: Protect quota by spin lock to allow netpkt_xxx be called in interrupt context
Before atomic is ready on every platform, we need a way to protect
quota, previously it's protected by net_lock, but this makes netpkt_xxx
interfaces unable to be called under interrupt context, so changed to
spin lock. Also, we can easily change them into atomic under this
implementation.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-05-16 21:39:05 +08:00
hujun5
6da335cd81 driver/uart_16550: serial output can cause deadlock
All interrupts must be disabled to prevent re-entrancy and to prevent
interrupts from firing in the serial driver code.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2023-05-16 15:11:38 +08:00
Michal Lenc
482cbc4363 w25qxxxjv: fix STATUS2_QE_ENABLED bitfield write
W25QXXXJV_WRITE_STATUS_2 register uses just first byte therefore all
operations has to be done in priv->cmdbuf[0]. Previous priv->cmdbuf[1]
caused QuadSPI mode not being enabled.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2023-05-15 10:43:55 +08:00
Masayuki Ishikawa
498a75a58b drivers: virtio: Add virtio-mmio-blk
Summary:
- This commit adds virtio-mmio-blk driver

Impact:
- None

Testing:
- Tested with rv-virt:netnsh which will be updated later

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2023-05-13 13:58:09 +08:00
TimJTi
b4b9a180c0 Add ATSAMA5D2/D4 Secure Fuse Controller (SFC) driver 2023-05-12 16:29:48 -03:00
zhanghongyu
06a10202af usrsock_server: fix issues with usrsock_rpmsg_sendto_handler
If the current poll setup only has POLLIN, adding POLLOUT does not cause the
protocol stack to refocus on flags such as TCP_ACK or UDP_POLL, the user is
not notified when flags for POLLOUT relationships appear and vice versa,
so we have to call poll_setup again.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-05-12 22:40:41 +08:00
Lwazi Dube
38ba0aefca usbhost_hub: Prevent crash when the last hub port is used.
An off-by-one error caused invalid memory to be accessed when the
last port was used. The first entry, at index 0, was never used.
The USB standard uses 1-based numbering for hub ports. This number
was used to index an array. This change converts the port number to
a zero-based port index when the array is accessed. The zero-based
value in the port field of the usbhost_hubport_s structure is also
converted before printing.

For testing, this bug was exposed on a 4 port hub when port 4 was
used after changing USBHUB_MAX_PORTS to 4 in hub.h. The bug should
also be triggered without changing hub.h if a 7 port hub is
available.
2023-05-12 11:41:26 +08:00
Alan Carvalho de Assis
54d92d1a0f Fix typo -EACESS -> -EACCES 2023-05-12 06:29:35 +03:00
Fotis Panagiotopoulos
4231938892 rtc: Fix compiler warning in driver initialization. 2023-05-11 22:18:10 +03:00
pengyiqiang
26e99ed042 drivers/video/fb: adapt to fbmem dynamic update.
Considering that the future fb needs to achieve dynamic resolution, the address and size of fbmem will be redistributed on the bottom driver side, so remove fbmem, fblen, and bpp cached in fb_chardev_s, and change it to call getplaneinfo every time to re-acquire panel info from the bottom driver. Avoid cache coherency problems.

Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>
Signed-off-by: jianglianfang <jianglianfang@xiaomi.com>
2023-05-12 01:06:52 +08:00
Lwazi Dube
d66282a893 usbhost: Fix function address generation for multi-port root hubs.
Devices connected to the same USB bus should have unique function addresses.
This was not true for root hubs with multiple ports. After this change,
enumeration is more reliable on the sama5d3-xplained board when both root hub
ports are used.

This change amounts to using one usbhost_devaddr_s object per root hub
instead of one per root hub port. For the majority of boards only one
root hub port is available so no change in behavior should be expected.
2023-05-11 09:44:18 +02:00
simbit18
f12b9c44cb drivers/power/relay/Kconfig: Fix Kconfig style
Remove spaces from Kconfig files
Add TABs
2023-05-10 22:51:11 +08:00
simbit18
e320299ba7 drivers/audio/Kconfig: Fix Kconfig style
Remove spaces from Kconfig files
Add TABs
2023-05-10 22:51:11 +08:00
hujun5
7f4cb3057a arch/arm64: merge serial_pl011.c and qemu_serial.c
At present, the serial drivers qemu_serial.c and serial_pl011.c on the fvp-v8r and qemu platforms in arm64 are duplicated
and need to be merged. The plan is to place them under the drivers\serial directory to create a common code module,
so that both fvp-v8r and qemu can use the same code.
In the future, if new platforms use pl011 serial ports, they can also be directly reused

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2023-05-10 09:06:59 +02:00
gaojiawei
64b51bbbf7 driver/serial/pty.c fix update local flags for the pty device attribute
Signed-off-by: gaojiawei <gaojiawei@xiaomi.com>
2023-05-10 00:47:33 +08:00
raiden00pl
b7341975ab drivers/usbhost/usbhost_cdcacm.c: fix warning 2023-05-09 20:48:51 +08:00
chao an
d3240061db syslog/Kconfig: fix kconfig warning
warning: The int symbol SYSLOG_RPMSG_WORK_DELAY (defined at drivers/syslog/Kconfig:274) is being evaluated in a logical context somewhere. It will always evaluate to n.
make: *** [tools/Unix.mk:663: olddefconfig] Error 1

Signed-off-by: chao an <anchao@xiaomi.com>
2023-05-08 21:36:45 +03:00
Xiang Xiao
325f395300 Replace all strncpy with strlcpy
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-08 09:57:01 +02:00
Xiang Xiao
6f6fce95a2 Replace all sprintf with snprintf
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-08 09:57:01 +02:00
Xiang Xiao
fa8719bb5a Replace all strcat with strlcat
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-08 09:57:01 +02:00
Lucas Saavedra Vaz
8b9dc54a0a drivers/audio: Add support for the ES8311 codec
Adds support for the ES8311 audio codec by Everest Semiconductor on NuttX. Both output and input are supported.
2023-05-04 18:41:54 -03:00
Lucas Saavedra Vaz
d82d73c660 audio: Separate common settings for the ESXXXX family of products
To avoid code duplication, the common settings for Everest Semiconductor's codecs were separated in an "esxxxx_common" header
2023-05-04 18:41:54 -03:00
Lucas Saavedra Vaz
a5a3b919a0 audio: Add i2s_getmclkfrequency function
Rename i2s_mclkfrequency to i2s_setmclkfrequency and add i2s_getmclkfrequency for getting the current MCLK frequency from the I2S interface
2023-05-04 18:41:54 -03:00
Xiang Xiao
a514c0a13e mtd/nand: Implement isbad and markbad callback
these new callbacks are added by:
https://github.com/apache/nuttx/pull/8683

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-03 17:40:18 +03:00
Xiang Xiao
3e1ddb3de9 mtd/nand: Return -EUCLEAN when the bit error happen but fixed by ecc
follow how Linux report the correction information from ecc:
http://www.infradead.org/pipermail/linux-mtd/2012-March/040305.html
since this information is very useful to file system(e.g. yaffs, ubi/buifs)
which is specially designed for nand flash.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-03 17:40:18 +03:00
Xiang Xiao
7a725019bc mtd/nand: Add nand_raw_initialize to skip the probing
Since not all nand devices follow ONFI spec, nand_raw_initialize could be used to skip ONFI special action

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-02 15:02:38 +02:00
Xiang Xiao
b4814811f5 mtd/nand: Implement MTDIOC_ERASESECTORS ioctl
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-02 12:15:56 +02:00
Xiang Xiao
3fc882df9e mtd/nand: Implement MTDIOC_ERASESTATE ioctl
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-02 12:15:56 +02:00