Commit Graph

463 Commits

Author SHA1 Message Date
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
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
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
dongjiuzhu1
0b832fd127 driver/usbdev: return -ENOTCONN when usbdev had been unbind
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-11-11 21:09:59 +08:00
dongjiuzhu1
20401c202e driver/usbdev: add unlink flags to better release endpoint resource
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-11-11 21:09:59 +08:00
dongjiuzhu1
f6098244f6 driver/usbdev_fs: fix minor issue about unbind
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-11-11 21:09:59 +08:00
dongjiuzhu1
68fc3adeff drivers/usbdev: config USBDEV_TRACE_INITIALIDSET when disbale USBDEV_TRACE
usbtrace is valid when enable USBDEV_TRACE or DEBUG_FEATURE && DEBUG_USB,

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-10-26 16:32:18 +08:00
sunkun3
219677cdae rndis: Fixed rndis assert issue when calling composite_uninitlize
Signed-off-by: sunkun3 <sunkun3@xiaomi.com>
2023-09-19 07:51:49 +02:00
dongjiuzhu1
8ababfc310 usbdev/mtp: support mtp class driver
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-09-16 14:40:08 +08:00
SPRESENSE
1b1b1a025d usbdev: Fix build error with BOARD_USBDEV_SERIALSTR 2023-09-15 13:34:06 +08:00
simbit18
b3973496cd Fix Kconfig style
Remove spaces from Kconfig
Add comments
2023-09-13 21:39:49 +08:00
zhangyuan21
fb7c36978f usbdev: support usb adb fastboot
Enable CONFIG_USBFASTBOOT to support fastboot driver.

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-09-12 16:27:49 +08:00
zhangyuan21
59f7fe11a3 usbdev: adb use fs device for ep process
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-09-09 15:52:08 +08:00
zhangyuan21
1f6d9bbd17 usbdev: add usbdev fs device for usb char device
Add usb_fs driver so that userspace can directly transfer USB packets
through the EP node. ADB, Fastboot, MTP will use usb_fs, these class
driver only need to provide the descriptors and register the usb_fs device.

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-09-09 15:52:08 +08:00
zhangyuan21
0efd4d0e12 usbdev: Split usbdev descriptor information
The class device only handles descriptor information specific to the class,
and shared descriptor information is passed through parameters and
handled by the composite driver.

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-09-06 02:29:32 +08:00
zhangyuan21
06d9356d12 usbdev: Use BOARD_USBDEV_SERIALSTR config directly
A usbdev has only one serial string, so use a unique macro to control it.

For boards that enable board serial string using COMPOSITE_BOARD_SERIALSTR,
PL2303_BOARD_SERIALSTR, CDCACM_BOARD_SERIALSTR, USBADB_BOARD_SERIALSTR,
USBMSC_BOARD_SERIALSTR, and RNDIS_BOARD_SERIALSTR, they need to be replaced
with BOARD_USBDEV_SERIALSTR.

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-09-01 19:29:12 +08:00
chao an
664927c86e mm/alloc: remove all unnecessary cast for alloc
Fix the minor style issue and remove unnecessary cast

Signed-off-by: chao an <anchao@xiaomi.com>
2023-08-30 14:34:20 +08:00
zhangyuan21
9bccd94fee rndis: Fixing erroneous macros
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-08-22 01:31:19 +08:00
Xiang Xiao
90f8315432 arch: Remove up_netinitialize
since this api change to xxx_netinitialize

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-08-20 14:33:17 +03:00
Petro Karashchenko
075738cf14 net/ip: print ip addresses using ip4_addrN macro
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-08-19 13:28:21 -03:00
zhangyuan21
1e7678c58a usbdev: clear configid after class disconnect
In class disconnect, resetconfig will be performed based on
configid, so configid should be cleared after disconnect.

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-08-17 01:11:53 +08:00
xuxin19
f2f0d7fbad cmake:fix drivers build block during cmake reforming
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2023-08-16 22:38:52 +08:00
sunkun3
7ba9236c54 usbdev/composite: winusb devices are not automatically recognized by windows
Description bMS_VendorCode is incorrectly configured. Change it to
USB_REQ_GETMSFTOSDESCRIPTOR(0xee), which is the same as the request
processing logic for GET_MS_DESCRIPTOR in the code

Signed-off-by: sunkun3 <sunkun3@xiaomi.com>
2023-08-11 13:19:13 +08:00
sunkun3
052d46c690 usbdev: a memory leak occurred when the usb uninitialize process was executed
In usbclass_unbind, DEV_FREEEP is called first, and later
usbclass_freereq does not free memory due to ep NULL

Signed-off-by: sunkun3 <sunkun3@xiaomi.com>
2023-08-11 13:19:13 +08:00
zhangyuan21
5af40a6fa4 composite: add COMPOSITE_DEVICES config for composite device
Add COMPOSITE_DEVICES configuration so that external composite
devices can also know the maximum number of supported classes.
The default COMPOSITE_DEVICES number is 8.

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-08-08 19:25:57 +08:00
zhangyuan21
dc0b0d6b4c composite: Use the correct USB dual-speed descriptor when enabling IAD
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-08-08 17:01:41 +08:00
zhangyuan21
98fba71998 usbadb: add usbadb boardctl
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-08-07 11:23:36 +08:00
zhangyuan21
419207d23d adb: Use composite devices as universal devices
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-08-07 11:23:36 +08:00
zhangyuan21
f52f04e131 composite: return ok when host send a duplicate setconfig message
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-08-07 11:23:36 +08:00
zhangyuan21
fe6b0619f9 usbdev: Use composite devices as universal devices
The enumeration process for composite and non-composite devices
has a lot of duplicate code. Treating the code for composite
devices as universal enumeration code can reduce redundant code.

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-08-07 11:23:36 +08:00
sunkun3
e872610071 usbdev-composite: In the device descriptor, 0xEF means use of IAD
Signed-off-by: sunkun3 <sunkun3@xiaomi.com>
2023-08-04 10:58:50 +02:00
sunkun3
1b0ab4c0f7 usbdev-composite: The maximum number of composite devices supported is changed to 8
Signed-off-by: sunkun3 <sunkun3@xiaomi.com>
2023-08-04 10:58:50 +02:00
sunkun3
324402ed30 usbdev-composite: fix enumeration error for 192 bytes desc
when the size of the usb configuration descriptor
is a multiple of 64 integers, only for this size less than wlength,
host do need send ZLP

Signed-off-by: sunkun3 <sunkun3@xiaomi.com>
2023-08-04 10:58:50 +02:00
sunkun3
9f19a333d2 usbdev/cdcacm: Logic error handled in USB_REQ_SETINTERFACE.
config value changed after resetconfig was executed
endpoint will stay disable state after setinterface cmd

Signed-off-by: sunkun3 <sunkun3@xiaomi.com>
2023-08-04 10:58:50 +02:00
dinglongfei
8520a40866 usb:When the adbd task is running, the usb uninstall process will panic in the adbd task, because the memory of the adb driver has been freed.
unbind will call the adb_char_on_connect interface to wake up the adbd task,
adbd will then access the adb device and fail to return, at this time it will
close the adb device, we can do the final memory release operation in the
second unbind

Signed-off-by: dinglongfei <dinglongfei@xiaomi.com>
2023-08-04 10:58:50 +02:00
zhangyuan21
602d5974c8 usbdev: move usbdev_req function to common code
Move usbdev_req function to common code, Reduce duplicated code.

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-08-03 22:46:25 -07:00
zhangyuan21
0cb8fdfe83 usbdev: set ep0 priv only not define CONFIG_USBDEV_COMPOSITE
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-08-02 17:42:28 -03:00
zhangyuan21
9893bfd45a rndis: fixed wrong incorrect macro definition
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-08-02 17:42:28 -03: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
simbit18
f0a74eb492 Fix Kconfig style
Remove spaces from Kconfig files
2023-06-22 11:46:09 +09: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
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
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
Xiang Xiao
6f6fce95a2 Replace all sprintf with snprintf
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-08 09:57:01 +02:00
raiden00pl
478f2f3d5f rndis: move private definitions from a public header to the source file 2023-03-31 08:17:01 +09:00
raiden00pl
58e817db76 rndis: do not configure endpoints from Kconfig when composite enabled
This should be done from a board specific logic, as for other composite devices
2023-03-31 08:17:01 +09:00
raiden00pl
bed53538e8 rndis: EP0 belongs to composite class if composite enabled 2023-03-28 19:43:56 -03:00
raiden00pl
8de2197773 rndis: exclude the logic that belongs to composite 2023-03-28 19:43:56 -03:00
raiden00pl
cb05700acf rndis: interface association descriptor should depend on CONFIG_COMPOSITE_IAD 2023-03-28 19:43:56 -03:00
raiden00pl
10f1d3e76e rndis: fix dev info init for composite 2023-03-28 19:43:56 -03:00