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>
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>
- 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>
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>
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>
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>
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.
support to control the opening or closing of the specified channel through the syslogmask command at runtime
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
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>
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>
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>
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>
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)
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Updated alt1250 driver with regarding to the following changes.
- Add LTE hibernation feature
- Split source code per module
- Some refactoring
- Some bug fixes
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`.
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>
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>
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>
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>
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.
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>
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>
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>
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>
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>
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>
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>
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.
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>
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.
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>
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>
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>
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>