Commit Graph

6782 Commits

Author SHA1 Message Date
raiden00pl c1e81c348d ieee802154_mac: add TRACEDUMP request
Used to dump trace log from radio.
Not used in upstream yet, will be supported by nrf52 IEEE 802.15.4 implementation
2024-02-17 05:00:44 -08:00
Yanfeng Liu 9620d7a12d rpmsg/debug: add debug configs and macros
This patch adds debug macros for RPTUN/RPMSG related logging purposes.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-02-15 19:53:55 -08:00
SPRESENSE eaba1bef1e drivers/modem/alt1250: Add LTE_CMDID_RESTARTAPI command
ALT1250 driver sends an event named LTE_CMDID_RESTARTAPI
to ALT1250 daemon when state is PM_NOARMAL in the function
of prepare registered by pm_register.
2024-02-07 22:19:03 -08:00
Xiang Xiao 6a6bd30500 rptun: Remove the empty implementation of get_firmware and get_addrenv
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-02-04 09:54:05 +01:00
Ville Juven f0846e1d2d fs/shmfs: Fix stat() system call for shmfs object
Set i_size for shmfs objects
2024-02-02 09:12:18 -08:00
Ville Juven 15f19c32ac arch/addrenv: Add utility function to wipe one page
up_addrenv_page_wipe can be used to wipe a single page of memory.
2024-02-02 09:09:55 -08:00
Antoine Juckler b343fd2adb Fix typo in mtx_timedlock 2024-02-02 09:03:18 -08:00
Yongrong Wang c5d8e5a0db rptun: remove temporarily retained RPTUNIOC_xxx definitions.
Signed-off-by: Yongrong Wang <wangyongrong@xiaomi.com>
2024-01-31 05:03:36 -08:00
wangyongrong ce832c6377 rptun_ping: Strip rptun_ping out of rptun and rename to rpmsg_ping
It should be possible to use ping without rptun being enabled, so striped rptun_ping out of rptun and rename to rpmsg_ping.

Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-01-30 04:08:59 -08:00
wangyongrong 5651612f45 rptun: extract rptun char to rpmsg/rpmsg.c
Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-01-26 00:42:28 -08:00
raiden00pl a12fdd8876 cosmetic changes after pci code rebase 2024-01-25 09:09:30 -08:00
Brennan Ashton 69ed5bb67d Various fixes for PCI work
Squashed commits:

1. Porting prior PCI work in place of jailhouse code

At this point the PCI enumeration works for x86_64 including over
pci-pci bridges.

Running QEMU with this configuration we see the bridge and the
device on the bridge.  It also detected the qemu test device

qemu-system-x86_64 \
  -cpu host,+pcid,+x2apic,+tsc-deadline,+xsave,+rdrand \
  --enable-kvm -smp 1 -m 2G -cdrom boot.iso --nographic -no-reboot \
  -device pci-testdev \
  -device pci-bridge,id=bridge0,chassis_nr=2 \
  -device e1000,bus=bridge0,addr=0x3

qemu_pci_init: Initializing PCI Bus
pci_probe_device: [00:00.0] Found 8086:1237, class/revision 06000002
pci_probe_device: [00:01.1] Found 8086:7010, class/revision 01018000
pci_probe_device: [00:01.2] Found ffff:ffff, class/revision ffffffff
pci_probe_device: [00:01.3] Found 8086:7113, class/revision 06800003
pci_probe_device: [00:01.4] Found ffff:ffff, class/revision ffffffff
pci_probe_device: [00:01.5] Found ffff:ffff, class/revision ffffffff
pci_probe_device: [00:01.6] Found ffff:ffff, class/revision ffffffff
pci_probe_device: [00:01.7] Found ffff:ffff, class/revision ffffffff
pci_probe_device: [00:02.0] Found 1234:1111, class/revision 03000002
pci_probe_device: [00:03.0] Found 8086:100e, class/revision 02000003
pci_probe_device: [00:04.0] Found 1b36:0005, class/revision 00ff0000
pci_probe_device: [00:04.0] Probing
pci_check_pci_bridge: [00:05.0] Found Bridge
pci_probe_device: [01:03.0] Found 8086:100e, class/revision 02000003
pci_probe_device: [00:05.0] Found 1b36:0001, class/revision 06040000

2. Remove unused CONFIG_PCI_MAX_BDF option

3. Add a workaround for Jailhouse pci scanning

4. Extend BAR parsing and handle PIO and MMIO for pci-testdev

Signed-off-by: Brennan Ashton <bashton@brennanashton.com>

5. PCI: Add initial support for QEMU 'edu' test device

Signed-off-by: Brennan Ashton <bashton@brennanashton.com>

6. Bring up PCI later in boot process

Signed-off-by: Brennan Ashton <bashton@brennanashton.com>

7. Add ISR and DMA support to QEMU edu test pci device

Signed-off-by: Brennan Ashton <bashton@brennanashton.com>

8. Fix bad function prototype definition in qemu_edu

9. intel64:  Add a pci test configuration and instructions

Signed-off-by: Brennan Ashton <bashton@brennanashton.com>

10. PCI: Fix issue in identification of 64bit bar

Signed-off-by: Brennan Ashton <bashton@brennanashton.com>
2024-01-25 09:09:30 -08:00
Yang Chung-Fan 18f97bf2f8 pcie: add framework
Squashed commits:

1. x86_64: qemu: implement pci-e functions and enumerate pci-e devices on boot

2. virt: add qemu pci-testdev driver

3. pcie: types array should be null terminated

4. pcie: enable don't take flags, hardcoded enabling flags

5. pcie: checking bar > 4 for 64bit bars are sufficient

6. pcie: qemu: remove not used header

7. pcie: qemu: return -EINVAL if buffer argument is NULL

8. pcie: make pcie enumerate routine as common instead of architecture dependent

9. pcie: cosmetic changes to fit check tools

10. pcie: create MSI/MSIX related marcos and simplify the msi/msix routines
2024-01-25 09:09:30 -08:00
wangchen 204f4a18a0 Support to ARP Address Conflict Detection
Support to ARP Address Conflict Detection

Signed-off-by: wangchen <wangchen41@xiaomi.com>
2024-01-25 11:25:03 -03:00
Yanfeng Liu ebef20ee17 docs: revising comments and documents
- spi/slave.h: revise comments in pulic types section
- doc/sim.rst: minor formatting, add ways to escape cu

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-01-24 23:38:52 -08:00
wangyongrong 5018964155 rpmsgfs: decoupling rpmsgfs server and rpmsg virtio.
create a new general api to make rpmsgfs work with virtio/spi/uart transport.

Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-01-24 06:52:13 -08:00
Michal Lenc 22110b3b83 ioexpander: add support for iC-JX expander
This commit adds basic support for iC-JX expander in SPI mode. The
expander is functional and supports both input and output pins. Further
expander functionalities (filtering, adc, interrupt support) are not
yet implemented.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
2024-01-23 17:15:25 -03:00
Lwazi Dube 1349dcfc1f drivers/usbhost: Add a USB bluetooth driver.
This change adds support for the USB Transport Layer as described
in the bluetooth spec. Isochronous endpoints are not yet supported.
Because of limitations in the NuttX bluetooth stack, only one USB
device can be used. This driver will only allow one USB dongle to
use bluetooth.

A Laird USB BT4.2 dongle (from Mouser) was used for testing:
M/N BT851 1.0 1829, FCC ID:SQGBT850
lsusb: 04b4:f901 Cypress Semiconductor Corp. CYW20704A2

The following commands were used to test from the nsh prompt:
bt bnep0 scan start
bt bnep0 scan stop
bt bnep0 scan get
bt bnep0 info

The Linux gatttool was used to connect over wireless.

With the BDAddr found by "bt bnep0 info", start gatttool using:
gatttool -b BDAddr -I

Connect to the device using:
connect

Read the device name using the GAP device name UUID:
char-read-uuid 2a00

Part of the response is:
value: 41 70 61 63 68 65 20 4e 75 74 74 58
which is the string "Apache NuttX"
2024-01-16 16:02:15 +01:00
wangyongrong 7508a10e20 rptun: Strip rpmsg and rptun
nuttx/driver/rpmsg: new folder, extract common rpmsg api in rptun.c to rpmsg.c.
rpmsg provide rpmsg_ops to each backend for specific implementation.

Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-01-16 15:58:32 +01:00
wangyongrong df147406db rptun_ping: decoupling rptun ping and rptun.
ping is not only rptun support, so move it to public part.

Signed-off-by: wangyongrong <wangyongrong@xiaomi.com>
2024-01-14 23:06:51 -08:00
fangxinyong c479ccb8aa sched: move etc romfs mount from nsh to sched/init
Usually the startup script is placed under /etc. The contents of the etc directory
are compiled and linked with Nuttx binary in the form of romfs. After startup,
it will be  mounted by Nsh.

etc is generated by the different boards, that use genromfs and xxd tools to generate
and compile it into the Nuttx, for example: boards/arm/at32/at32f437-mini/tool/mkromfs.sh
The more common method is etc image generated from the content in the corresponding
board/arch/board/board/src/etc directory, and added by Makefile for example:
boards/sim/sim/sim/src/etc.

But in kernel/protected mode, Nuttx kernel and apps are run in different privileged/
non-privileged mode or the isolated binarys, so as that nsh should use syscall to
access Nuttx kernel by exported API. In this scenario, nsh can not mount the etc image
content, because that is generated in board and as a part of Nuttx kernel.

changes:

- move etc romfs mount from nsh to Nuttx, but keep the script to parse and execute.
- move and rename the related CONFIG, move customized nsh_romfsimg.h to etc_romfs.c
  in boards, and no need declaration for romfs_img/romfs_img_len.

This commit changes and updates all configurations in Nuttx arch/board as much as possible,
but if any missing, please refer to the following simple guide:

- rename CONFIG_NSH_ROMFSETC to CONFIG_ETC_ROMFS, and delete CONFIG_NSH_ARCHROMFS in defconfig
- rename the etc romfs mount configs, for example CONFIG_NSH_FATDEVNO to CONFIG_ETC_FATDEVNO
- move customized nsh_romfsimg.h to etc_romfs.c in board/arch/board/board/src and no need
  declaration for romfs_img/romfs_img_len.
- delete default nsh_romfsimg.h, if ROMFSETC is enabled, should generate and compile etc_romfs.c
  in board/arch/board/board/src.

Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
2024-01-09 21:29:46 -03: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
Zhe Weng 3b74cfecc2 net/route: Support longest prefix match for routing
Support longest prefix match routing described as "Longest Match" in
RFC 1812, Section 5.2.4.3, Page 75.

Introduced `prefixlen` to indicate the prefix length of currently
founded route, and only looks up for longer prefix in all later steps.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-01-09 05:58:10 -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
TimJTi 222ca5b040 Add MTD for AT25 eeprom 2024-01-04 09:25:52 -08:00
YAMAMOTO Takashi 1ec63e1701 make 64-bit time_t back to unsigned
it has been changed by https://github.com/apache/nuttx/pull/10303
without any explicit mentions. i suppose it was a mistake.

see https://github.com/apache/nuttx/pull/8201 and referenced PRs
for previous discussions.
2023-12-30 08:48:43 -08:00
yinshengkai 9852428953 fs: procfs add poll support
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-12-26 19:23:13 -08:00
yinshengkai ca99e69c28 fs: update hostfs structure definition
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-12-26 17:41:12 -08:00
yinshengkai 9b10255088 fs: fix structure layout inconsistency in hostfs
Use the following command to view the structure layout:
pahole nuttx > struct_size.h

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-12-26 17:41:12 -08:00
YAMAMOTO Takashi 992719730f Fix hostfs after uid/gid changes
This fixes a regression in https://github.com/apache/nuttx/pull/10869
2023-12-25 19:40:47 -08:00
yinshengkai 81fccf96db libc/stream: add file out stream
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-12-25 16:54:16 -03:00
yinshengkai 0c95bf73dc libc/stream: provide lowerout_stream default initialization function
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-12-25 16:54:16 -03: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
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
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
guoshichao b3867d5230 libs/libc/wchar: add ungetwc implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-12-17 01:39:06 -08:00
guoshichao 0b2f7f7f3c libs/libc/wchar: add getwc implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-12-17 01:39:06 -08:00
guoshichao 8c37c3841b libs/libc/wchar: add fgetwc implementation
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
2023-12-17 01:39:06 -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
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
Ville Juven e03599d9ae libs/log2ceil: Move implementation of log2ceil to a common place
Move log2ceil from riscv_pmp to libc. Also, implement log2floor for
completeness.

These are the run-time alternative to the compile-time macros.
2023-12-14 08:46:12 -08:00
simbit18 9d50d180b1 Fix nuttx coding style
Remove spaces
Remove extra */
2023-12-13 17:29:08 +01:00
Petteri Aimonen c3a234fe99 ipv6: Fix source address with many addresses in same network
Previously ipv6 multi-address support decided packet source
address based on its destination. This doesn't work if NuttX
device has multiple addresses within same subnet.

Instead when a packet is a response to existing connection,
the source address should be based on the destination address
used in the received packet.
2023-12-13 06:13:25 -08:00
Ville Juven 996625ec58 riscv/arch_elf.c: Handle PCREL_HI20/LO12_I/S relocations correctly
There is a problem with the current elf loader for risc-v: when a pair of
PCREL_HI20 / LO12 relocations are encountered, it is assumed that these
will follow each other immediately, as follows:

label:
	auipc      a0, %pcrel_hi(symbol)    // R_RISCV_PCREL_HI20
	load/store a0, %pcrel_lo(label)(a0) // R_RISCV_PCREL_LO12_I/S

With this assumption, the hi/lo relocations are both done when a hi20
relocation entry is encountered, first to the current instruction (addr)
and to the next instruction (addr + 4).

However, this assumption is wrong. There is nothing in the elf relocation
specification[1] that mandates this. Thus, the hi/lo relocation always
needs to first fixup the hi-part, and when the lo-part is encountered, it
needs to find the corresponding hi relocation entry, via the given "label".
This necessitates (re-)visiting the relocation entries for the current
section as well as looking for "label" in the symbol table.

The NuttX elf loader does not allow such operations to be done in the
machine specific part, so this patch fixes the relocation issue by
introducing an architecture specific cache for the hi20 relocation and
symbol table entries. When a lo12 relocation is encountered, the cache
can be consulted to find the hi20 part.

[1] https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-elf.adoc
2023-12-12 17:32:36 -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
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 bb0a706bdc arch/arm:add up_debugpoint api
on armv8-m/armv7-m,implement breakpoint & watchpoint using FBP & DWT

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-12-11 08:43:26 -08:00
anjiahao 94d449e722 arch:Mark key functions to prohibit instrumentation to prevent recursive calls
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-12-11 02:06:51 -08:00