Commit Graph

5727 Commits

Author SHA1 Message Date
Tiago Medicci Serrano
69929d4084 xtensa/esp/rmt: Add the lower-half implementation of the RMT driver
The lower-half implementation of the RMT character driver based on
Espressif HAL enables using the RMT peripheral of ESP32, ESP32-S2
and ESP32-S3 as a common xtensa-based Espressif driver.

The RMT packages on Espressif SoCs are 4-byte long and are known as
"items". Please check the Techinal Reference Manual of the chip to
obtain more details.
2023-12-24 16:38:06 -08:00
Tiago Medicci Serrano
d1326e81bc drivers/leds/ws2812: Fix WS2812 pixel size
Although the LED might be RGB-only, the LED data is packed in a
32-bit long variable and, then, this is the default size of a LED
pixel to define the 'WS2812_RW_PIXEL_SIZE' macro. Please note that
the lower-half driver will deal with the case of the addressable
LED being 3 or 4-pixel sized.
2023-12-24 16:38:06 -08:00
Tiago Medicci Serrano
fcff5d43b7 drivers/rmt: Implement an upper-half RMT character driver
The RMT (Remote Control) character driver allows to use the RMT
peripheral (usually, a one-wire peripheral dedicated to driving
IR remote control) as a character driver.

Please note that this perpiheral depends on the lower-half specific
driver implementation.
2023-12-24 16:38:06 -08:00
liqinhui
41a3c8a5e3 virtio-net:Fix the compile error.
CC:  virtio/virtio-net.c virtio/virtio-net.c: In function 'virtio_net_set_macaddr':
virtio/virtio-net.c:595:17: error: invalid operands to binary % (have 'struct net_driver_s *' and 'int')
  595 |             dev % 256
      |                 ^
make[1]: *** [Makefile:107: virtio-net.o] Error 1
make: *** [tools/LibTargets.mk:101: drivers/libdrivers.a] Error 2
make: *** Waiting for unfinished jobs....

Signed-off-by: liqinhui <liqinhui@xiaomi.com>
2023-12-21 01:21:01 -08:00
Takumi Ando
6b3aa3b6b9 sensors: mx56xx: Correct type of temperature
The "temp" variable shouldn't be used as both raw
value and compensated.

Signed-off-by: Takumi Ando <t-ando@advaly.co.jp>
2023-12-20 07:00:34 -08:00
Takumi Ando
19ac909eea sensors: mx56xx: Fix calculation of second order compensation
The temperature won't be compensated correctly without this patch.

Signed-off-by: Takumi Ando <t-ando@advaly.co.jp>
2023-12-20 07:00:34 -08:00
Takumi Ando
d9455ab420 sensors: mx56xx: Fix threshold of second order compensation
The threshold of second order compensation at
very low temperature is -15°C.

Signed-off-by: Takumi Ando <t-ando@advaly.co.jp>
2023-12-20 07:00:34 -08:00
Jukka Laitinen
ebe961df9e drivers/net/ksz9477: Add simple port-based static VLAN configuration
Add a static port-based VLAN configuration for KSZ9477 switch. This doesn't
use the VLAN tagging, but is a switch's internal mechanism to simply configure
if the packet forwarding is allowed from one port to another.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2023-12-20 01:30:54 -08:00
Takumi Ando
ab693b9bec sensors: mx56xx: Add support for second order compensation
In order to obtain best accuracy over temperature range,
particularly in low temperature, it is recommended to
compensate the non-linearity over the temperature.

ref: ENG_DS_MS5611-01BA03_B3.pdf
     ENG_DS_MS5607-02BA03_B4.pdf

Signed-off-by: Takumi Ando <t-ando@advaly.co.jp>
2023-12-19 03:36:19 -08:00
chao an
b67c9e6ca7 syslog/ramlog: improve ramlog performance
replace char copy to memcpy to improve the performance

Signed-off-by: chao an <anchao@lixiang.com>
2023-12-18 20:38:00 -08:00
Xiang Xiao
0d0867484a modem/alt1250: Fix 'inst' may be used uninitialized
In function 'unlock_evtbufinst',
    inlined from 'parse_altcompkt' at modem/alt1250/alt1250.c:919:7,
    inlined from 'altcom_recvthread' at modem/alt1250/alt1250.c:968:21:
Error: modem/alt1250/alt1250.c:385:3: error: 'inst' may be used uninitialized [-Werror=maybe-uninitialized]
  385 |   nxmutex_unlock(&inst->stat_lock);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
modem/alt1250/alt1250.c: In function 'altcom_recvthread':
modem/alt1250/alt1250.c:822:26: note: 'inst' was declared here
  822 |   FAR alt_evtbuf_inst_t *inst;
      |                          ^~~~

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-12-19 08:36:49 +08:00
jianglianfang
2a92748c42 drivers/goldfish_fb: optimize goldfish fb register
The Goldfish FB register should be optimized by considering the need to pass in parameters for base and irq.

Signed-off-by: jianglianfang <jianglianfang@xiaomi.com>
2023-12-18 09:08:32 -08:00
jianglianfang
f4c8a17837 sim_lcd: add open & close
The opening and closing of the window has been associated with the opening and closing of fb, but the LCD has not yet been optimized. The window will only open when sim_x11openwindow is called, and similarly, the window will only close when sim_x11closewindow is called.

Signed-off-by: jianglianfang <jianglianfang@xiaomi.com>
2023-12-18 09:06:29 -08:00
Zhe Weng
5aeb15469a netdev/ipv6: Move xxx_ipv6multicast from arch to common code
The `xxx_ipv6multicast` function in each driver is not adapted to
multiple IPv6 addresses yet, and they're redundant, so try to take them
into common code.

Change:
1. Add MAC `g_ipv6_ethallnodes` and `g_ipv6_ethallrouters` in
   `icmpv6_devinit` and call them in `netdev_register`
2. Add multicast MAC for Neighbor Solicitation when adding any IPv6
   address, and remove them when IPv6 address is removed
3. Select `NET_MCASTGROUP` when `NET_ICMPv6` because now we need
   `d_addmac` when we have ICMPv6

Note:
We want modules outside net stack to call functions like
`netdev_ipv6_add` and never touch the related MAC address, so these MAC
functions are added as internal functions to `net/netdev/netdev.h`

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-12-16 05:26:16 -08:00
liqinhui
98e3615b60 net/netdev: Modify the logic for setting the IFF_RUNNING status of interfaces.
Refer to the logic of the `netif_carrier_on` on linux.
https://github.com/torvalds/linux/blob/master/net/sched/sch_generic.c#L575

Signed-off-by: liqinhui <liqinhui@xiaomi.com>
2023-12-15 18:24:23 -08:00
yuanyongjian
9483729328 syslog/ramlog.c:Syslog add BIOC_FLUSH supports clearing log cache
Signed-off-by: yuanyongjian <yuanyongjian@xiaomi.com>
2023-12-14 20:50:44 -08:00
Xiang Xiao
a0813b808f syslog/ramlog: Replace mutex with spinlock
and optimize the critical section usage
1.Remove the unnecessary critical section in ramlog_readnotify
2.Move the enter/leave critical section out of ramlog_pollnotify loop
3.Move the critical section of ramlog_addchar to caller

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-12-14 20:50:44 -08:00
yuanyongjian
046dd38c55 syslog/ramlog: Syslog supports multi-readers.
Signed-off-by: yuanyongjian <yuanyongjian@xiaomi.com>
2023-12-14 20:50:44 -08:00
yuanyongjian
0da8755fbc syslog/ramlog:Add tags to distinguish between hot start and cold start
Signed-off-by: yuanyongjian <yuanyongjian@xiaomi.com>
2023-12-14 20:50:44 -08:00
Xiang Xiao
e920883458 syslog/ramlog: Prepare to support the multiple reader
1.Remove RAMLOG_OVERWRITE option and related code
2.Broadcast the readability to all reader and poller

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-12-14 20:50:44 -08:00
liqinhui
6a8c638d57 qemu/wifi: Add the virtual wifi function on the emulator.
-The qemu wifi fucntion only supports the STA mode and the following
 operations:
 wapi mode wlan0 2
 wapi scan wlan0
 wapi psk wlan0 password 3
 wapi essid wlan0 wifi_name 1
 wapi show wlan0
 wapi disconnect wlan0
-Eanble the virtual wifi function with the MACRO `CONFIG_DRIVERS_WIFI_SIM`.

Signed-off-by: liqinhui <liqinhui@xiaomi.com>
2023-12-14 20:22:12 -08:00
simbit18
c494ce4a96 Update kconfig2html.c
Fix nuttx coding style
2023-12-14 20:02:52 -08:00
jianglianfang
5f631e2b2b virtio-gpu: convert virito-gpu fb_register to virtio_gpu_fb_register
Signed-off-by: jianglianfang <jianglianfang@xiaomi.com>
2023-12-13 09:05:17 -08:00
liqinhui
73ceb049af virtio-net: Support for setting MAC addresses of the virtio-net interfaces.
Refers to https://docs.oasis-open.org/virtio/virtio/v1.2/cs01/virtio-v1.2-cs01.html#x1-2230004
A driver SHOULD negotiate VIRTIO_NET_F_MAC if the device offers it.
If the driver negotiates the VIRTIO_NET_F_MAC feature, the driver MUST
set the physical address of the NIC to mac. Otherwise, it SHOULD use a
locally-administered MAC address.

Signed-off-by: liqinhui <liqinhui@xiaomi.com>
2023-12-13 05:00:59 -08:00
Zhe Weng
22b6076f26 net/udp: Add check when sending too big packet without IP frag
Commit 8a63d29c removed `devif_iob_send` from `udp_sendto_buffered`
workflow, `devif_iob_send` drops too big packet. Now we still need a
place to check the packet length, otherwise a packet larger than MTU
may be sent to the net driver.

In case of similar problem happens somewhere else, this commit also
adds a check in `netdev_upperhalf`, and count these cases into
`NETDEV_TXERRORS`.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-12-12 06:42:33 -08:00
Xiang Xiao
ca5a9c711a Remove @ and % tag from all comments
and format the multiple line comments

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-12-11 17:00:10 -03:00
Michal Lenc
02aeb66644 mtd/w25q: add nxsig_usleep to busy waiting in w25qxxxjv_erase_sector()
Busy waiting in w25qxxxjv_erase_sector() was without nxsig_usleep and
was causing the entire system to freeze for significant amount of time
as sector erase takes some time.

This commit adds nxsig_usleep into busy waiting to prevent system lock.
Sleep is set to sector erase time based on W25Q series datasheet.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2023-12-11 16:00:07 -03:00
anjiahao
bf03bb557f support gdbstub use serial.
we can use uart to debug nuttx,like debugger:

1. read/write memory
2. Use watchpoint,breakpoint,single step.
    use up_debugpoint api

3. Ctrl+c to stop, continue, or single step.
    hold uart send and receive

4. register a panic event, when crash or assert/panic, we use uart to
   debug.

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-12-11 08:43:26 -08:00
anjiahao
7dfbd14eba libc: add instrument api support
Add registration function instrumentation API,
which can achieve instrumentation of entering and
exiting functions through the compiler's functionality.

We can use CONFIG_ARCH_INSTRUMENT_ALL to add instrumentation for all
source, or add '-finstrument-functions' to CFLAGS for Part of the
source.

Notice:
1. use CONFIG_ARCH_INSTRUMENT_ALL must mark _start or entry noinstrument_function,
   becuase bss not set.
2. Make sure your callbacks are not instrumented recursively.

use instrument_register to register entry function and exit function.
They will be called by the instrumented function

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-12-11 02:06:51 -08:00
simbit18
3442af4a19 Fix Kconfig style
Remove extra TABs
Add comments
2023-12-09 13:44:46 -08:00
Petteri Aimonen
99a8c00807 usbdev: Add callback for CONFIG_USBDEV_SOFINTERRUPT
Previously CONFIG_USBDEV_SOFINTERRUPT existed in many platform
drivers but did nothing. This commit adds a callback function
usbdev_sof_irq() that can be used to take action on this interrupt.
2023-12-08 21:27:36 -03:00
Dong Heng
bf54a5ae50 driver/net/lan9250: Add LAN9250 driver(SPI and QSPI mode) 2023-12-07 19:53:05 -08:00
simbit18
ccc0c54401 Fix Kconfig style
Remove extra TABs
Remove spaces from Kconfig
Add comments
2023-12-04 22:20:50 +08:00
shizhenghui
49398d32aa move userspace interface from video.h to sys/videoio.h
Signed-off-by: shizhenghui <shizhenghui@xiaomi.com>
2023-12-02 19:44:39 -08:00
chao an
09c17fcfa8 segger/rtt: correct macro name to avoid unable to change default mode
SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL should be CONFIG_SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL

Signed-off-by: chao an <anchao@xiaomi.com>
2023-11-30 06:16:09 -08:00
Zhe Weng
bd19065933 net/loopback: Fix flags of lo device
netdev_register will set IFF_LOOPBACK in d_flags, we should not just
change it into IFF_UP only.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2023-11-29 07:57:01 -08:00
yaojingwei
a57e3f365a video.c: modify set_buf call seqence in start_capture function.
To avoid losing the first frame, the set_buf needs to excute first. At the same time, imgdata->start_capture should excuted before the imgsensor->start_capture.

Signed-off-by: yaojingwei <yaojingwei@xiaomi.com>
2023-11-29 02:01:34 -08:00
Takumi Ando
3353bd3ced sensors: mx5611: Add support for MS5607
MS5607 has few differences between MS5611.

Signed-off-by: Takumi Ando <t-ando@advaly.co.jp>
2023-11-28 16:48:50 -03:00
hujun5
5a04354832 driver/tee: add some comments and document files in LICENSE
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2023-11-23 06:25:48 -08:00
hujun5
0c2cfc767d driver/tee: add optee client driver module
The driver's main purpose is to support the porting of the open source
component optee_client (https://github.com/OP-TEE/optee_client) to nttux.

The basic function of the driver module is to convert the REE application layer data and send it to the TEE through rpmsg.

The main functions include
1 driver registration.
we need to register a device driver(/dev/tee0) through optee_register function.
2 open the driver
3 ioctl the driver
The ioctl command passes different parameters and commands, and interacts with the TEE through rpmsg.
4 close the driver

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2023-11-23 06:25:48 -08:00
Daniel P. Carvalho
ed877fd494 drivers:mtd: Adds support for W25 2Mbit memories.
Tested with W25Q20CL.
2023-11-22 19:39:40 -03:00
liaoao
ea0be3b490 rpmsgblk: split mmc_ioc_multi_cmd to mmc_ioc_cmd for less share memory allocation
Signed-off-by: liaoao <liaoao@xiaomi.com>
2023-11-22 08:08:12 -08:00
liaoao
cf27a8484f rpmsgblk: use a fixed length struct to transfer between two cpus
It may cause out_of_bounds when two side have different configuartion
on NAME_MAX and FS_LARGEFILE(affects size of blkcnt_t)

Signed-off-by: liaoao <liaoao@xiaomi.com>
2023-11-22 08:08:12 -08:00
liaoao
4b25a0dfa5 rpmsgblk: check if the block device has been removed before calling its ops
it may cause use after free if server has removed block device before calling
its operations,such as:
server: rm /dev/testrpmsgblk
client: ls /dev/testrpmsgblk

Signed-off-by: liaoao <liaoao@xiaomi.com>
2023-11-22 08:08:12 -08:00
liaoao
12d66da892 rpmsgblk: do not actually unlink blockdevice in rpmsgblk client
rpmsgblk client should not affect the server's use of blockdevice.

Signed-off-by: liaoao <liaoao@xiaomi.com>
2023-11-22 08:08:12 -08:00
liaoao
27f672d55a rpmsgblk: bind block inode to ept when create ept
A segmentfault might happen when read/write/unlink ops called without an open
ops called because it bind ept's ops in rpmsgblk_open_handler.

proxy> rm /dev/ram1
segmentfault

proxy> ls /dev/ram1
segmentfault

Signed-off-by: liaoao <liaoao@xiaomi.com>
2023-11-22 08:08:12 -08:00
jianglianfang
817e02c0c8 video/fb: move wdog from fb_chardev_s to fb_paninfo_s
every pan_info should have it own wdog

Signed-off-by: jianglianfang <jianglianfang@xiaomi.com>
2023-11-22 02:01:20 -08:00
jianglianfang
10991cf5f4 video/fb: wait when the vsync queue is full in FBIO_WAITFORVSYNC
In FBIO_WAITFORVSYNC mode, if vsync queue is full it should wait
until fb_sem_post.

Signed-off-by: jianglianfang <jianglianfang@xiaomi.com>
2023-11-22 02:01:20 -08:00
hujun5
1a65f5ed88 sched_lock refine: remove sched_[un]lock in xxx_waitsample
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2023-11-21 20:03:43 -08:00
Xiang Xiao
eddd90de78 poll: pollsetup should notify only one fd passd by caller
since it's redundant to iterate the whole fds array in setup

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-11-21 09:07:17 +01:00