Commit Graph

5742 Commits

Author SHA1 Message Date
chao an
5f51aba1be serial/pl011: rename serial_pl011 to uart_pl011
The lower half driver should be prefixed with "uart_"

Signed-off-by: chao an <anchao@lixiang.com>
2024-01-11 13:39:06 +01:00
wangyongrong
976aa5552f rptun: remove rptun work queue related unused code
Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-01-11 00:51:57 -08:00
wangyongrong
5a39935d4f rpmsgmtd: use fixed length struct to transfer between two cpus
Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-01-11 08:33:15 +01:00
wangyongrong
62698051c7 rptun ping: fix data format warning
Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-01-09 06:06:40 -08:00
wangyongrong
661171661f rptun ping: fix code format in rptun ping
Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-01-09 06:06:40 -08:00
wyr8899
df09e40e3a rptun ping: support data checksum and data transfer rate calculation
Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-01-09 06:06:40 -08:00
David Sidrane
93f37ab1da net:Add support for multi PHY
Support runtime phy selection based on a list
   supplied by board.h
   For Example:

   #define BOARD_ETH0_PHY_LIST                   \
	{                                        \
		"LAN8742A",                      \
		MII_PHYID1_LAN8742A,             \
		MII_PHYID2_LAN8742A,             \
		MII_LAN8740_SCSR,                \
		0,                               \
		0xffff,                          \
		MII_LAN8720_SPSCR_10MBPS,        \
		MII_LAN8720_SPSCR_100MBPS,       \
		MII_LAN8720_SPSCR_DUPLEX,        \
		22,                              \
	},                                       \
	{                                        \
		"TJA1103",                       \
		MII_PHYID1_TJA1103,              \
		MII_PHYID2_TJA1103,              \
		0xffff,                          \
		18,                              \
		0xffff,                          \
		0,                               \
		MII_LAN8720_SPSCR_100MBPS,       \
		MII_LAN8720_SPSCR_DUPLEX,        \
		45,                              \
	},                                       \
2024-01-06 04:26:12 -08:00
Bowen Wang
e9a146bbfc virtio-mmio: use byte to byte in read/write config when length != 1,2,4,8
The length of some config elements are not equal to 1,2,4,8, so we can't
assert in virtio_mmio_config_read/write() direclty when length != 1,2,4,8

For example, in virtio_net_config from virtio spec v1.2
struct virtio_net_config {
	u8 mac[6];
	le16 status;
	le16 max_virtqueue_pairs;
	le16 mtu;
	le32 speed;
	u8 duplex;
	u8 rss_max_key_size;
	le16 rss_max_indirection_table_length;
	le32 supported_hash_types;
};

The mac length is 6 and not equal to 1,2,4,8

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-01-06 04:23:05 -08:00
Bowen Wang
fe0cd18cc5 rpmsgdev_server: do not notify the client when the fds has teardown
Donothing instead assert when poll notify is called after teardown.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-01-04 20:30:49 -08:00
Bowen Wang
a8d21c3876 virtio-mmio: avoid output error log when not found mmio device
Not found the mmio device is a normal case, so should not print the
error log.
This commit change the log level to info when not found the mmio
device.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-01-04 20:28:21 -08:00
Bowen Wang
409431b2ad virtio-mmio: ack the interrupt as soon as possible
Follow the linux does, avoid miss mmio interrupt

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-01-04 20:05:29 -08:00
TimJTi
222ca5b040 Add MTD for AT25 eeprom 2024-01-04 09:25:52 -08:00
Xiang Xiao
b9bd88d9d3 rptun: Select OPENMAP under RPTUN
to simplify the IPC related configuration

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-12-28 11:08:57 +08:00
zhanghongyu
009a1eba7c bcmf_driver: add ioctl_mutex to restrict ioctl from reentrant
avoiding resource race conditions

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-12-27 10:20:37 -08:00
yinshengkai
9852428953 fs: procfs add poll support
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-12-26 19:23:13 -08:00
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