Commit Graph

67 Commits

Author SHA1 Message Date
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
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
zhangyuan21
9bccd94fee rndis: Fixing erroneous macros
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-08-22 01:31:19 +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
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
9893bfd45a rndis: fixed wrong incorrect macro definition
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-08-02 17:42:28 -03: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
raiden00pl
9b70e010dc rndis: refactor usbdev_rndis_get_composite_devdesc to make it more like in other composite drivers 2023-03-28 19:43:56 -03:00
raiden00pl
50cf84c99a usbdev-composite: ep0 submit should be send only once for the composite class 2023-03-24 14:54:31 -03:00
raiden00pl
d014b9d384 rndis: use composite_ep0submit to send the ep0 when composite 2023-03-24 14:54:31 -03:00
zhangyuan21
699c930987 drivers/usb: fixed sim usb dev and host build issue
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-03-03 14:31:30 -03:00
zhanghongyu
16ea80e53b rndis: support iob offload
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2023-03-02 02:50:59 +08:00
zhangyuan21
b4aa5b0d0b usbdev: fixed DUALSPEED issue for adb/cdcecm/rndis
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-02-13 18:47:42 +08:00
zhangyuan21
8f4cb0fec3 rndis: add endpoint configure
ep3 is not avaliable in dummy hcd, so need to
make the endpoint number configurable.

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-02-12 16:38:11 +08:00
chao an
7625126c91 Remove the remain MIN/MAX like macro
Signed-off-by: chao an <anchao@xiaomi.com>
2023-02-03 23:22:41 +08:00
Xiang Xiao
d5689e070b net/arp: Remove nuttx/net/arp.h
1.move ARPHRD_ETHER to netinet/arp.h
1.move arp_entry_s to net/arp/arp.h
2.move arp_input to nuttx/net/netdev.h

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-12-16 22:10:59 +02:00
Xiang Xiao
c6e9edcbb6 net: Rename arp_arpin to arp_input
align with other similar function(e.g. ipv4_input and ipv6_input)

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-12-04 20:39:21 +08:00
chao an
6fa60627eb net/devif/ip: build l2 header on the IP layer
Signed-off-by: chao an <anchao@xiaomi.com>
2022-11-27 12:13:45 +08:00
chao an
8850dee746 net/devif: move preprocess of txpoll into common code
Signed-off-by: chao an <anchao@xiaomi.com>
2022-11-27 12:11:12 +08:00
Xiang Xiao
40ef5bc6db libc: Move queue.h from include to include/nuttx
to avoid the conflict with libuv's queue.h

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-26 08:04:58 +02:00
zhanghongyu
035d925864 devif: remove all devif_timer
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2022-06-02 20:11:50 -03:00
Xiang Xiao
366e2d5f64 Fix error: array subscript 2 is above array bounds of 'uint8_t[2]'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-03-10 19:46:01 +02:00
SPRESENSE
021a58d71a usbdev: Add board unique serial string support
iSerialNumber field in the device descriptor can be used to determining the
board when multiple boards connected to the same host. So add feature to change
serial string by board unique ID dynamically.
To use this feature, user must be implement the board_usbdev_serialstr() logic.

refs #13909
2022-01-19 09:25:48 +01:00
Petro Karashchenko
9551de7115 net: use HTONS, NTOHS, HTONL, NTOHL macro in kernel code
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-01-18 10:59:47 +01:00
Petro Karashchenko
3ccb657dc2 nuttx: remove space befone newline in logs
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2021-12-27 21:01:19 -06:00
Xiang Xiao
2e54df0f35 Don't include assert.h from public header file
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-03 08:36:03 -07:00
Xiang Xiao
d7f96003cf Don't include debug.h from public header file
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-01 06:42:02 +09:00
Alin Jerpelea
13e4f9b6b2 drivers: update licenses to Apache
Gregory Nutt is the copyright holder for those files and he has submitted the
SGA as a result we can migrate the licenses to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-05-31 02:58:08 -05:00
Petteri Aimonen
dccd436a58 USBDEV RNDIS: Fix unaligned access caused by 4f66624
Previous fix to RNDIS response queueing caused unaligned access
to response buffer in some configurations. On ARM Cortex-M, this
would cause hardfault if optimizer used strd instruction.

Fix by allocating the buffer as uint32_t. RNDIS messages are always
a multiple of 4 bytes in size, so this ensures alignment.
2021-03-26 21:31:43 +09:00
Petteri Aimonen
d0c6104efb USBDEV RNDIS: Fix style and printf issues 2021-03-24 14:44:23 -03:00
Petteri Aimonen
94480305a7 USBDEV RNDIS: Improve error recovery
Gracefully handle output queue full conditions. This shouldn't happen
in practice as the host is supposed to limit the number of commands
simultaneously in execution.

Reset the response queue on RNDIS_RESET_MSG. This way communication
can recover even if host and device get out of sync.
2021-03-24 14:44:23 -03:00
Petteri Aimonen
4f66624ea3 USBDEV RNDIS: Fix occasional disconnections due to race condition
Sometimes Windows would send RNDIS_KEEPALIVE_MSG and RNDIS_QUERY_MSG close
to each other. This would cause the latter command to overwrite the reply for
the prior command. This in turn will cause Windows to drop the connection after
a 20 second timeout.

Easy way to reproduce the issue is to open the Windows "Adapter Status" dialog that
shows the realtime TX/RX byte counts. This causes multiple RNDIS_QUERY_MSGs per
second, and the connection will drop in less than an hour.

This commit fixes this issue, and other potential race conditions (such as USB
descriptor read in middle on RNDIS query) by using a separate queue for the reply
packets.
2021-03-24 14:44:23 -03:00
chao.an
84daee1f76 drivers/netdev: try tcp timer in every txavail call
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-12-18 14:16:11 +09:00
YAMAMOTO Takashi
afe3c2cdb5 drivers/usbdev/rndis.c: Fix syslog formats 2020-11-27 05:18:57 -06:00
Xiang Xiao
acca9fcc3b sched/wdog: Remove MAX_WDOGPARMS and related stuff
since the variable arguments are error prone and seldom used.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-14 08:19:50 -06:00
Xiang Xiao
a0ce81d659 sched/wdog: Don't dynamically allocate wdog_s
to save the preserved space(1KB) and also avoid the heap overhead

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I694073f68e1bd63960cedeea1ddec441437be025
2020-08-11 12:28:55 -06:00
Xiang Xiao
f618de9c97 Fix nxstyle warning
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-08 17:30:26 -03:00
Xiang Xiao
4c706771c3 sched/wdog: Replace all callback argument from uint32_t to wdparm_t
and alwasy cast the argument of wd_start to wdparm_t

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-08 17:30:26 -03:00
Xiang Xiao
68951e8d72 Remove exra whitespace from files (#189)
* Remove multiple newlines at the end of files
* Remove the whitespace from the end of lines
2020-01-31 09:24:49 -06:00
Xiang Xiao
6a3c2aded6 Fix wait loop and void cast (#24)
* Simplify EINTR/ECANCEL error handling

1. Add semaphore uninterruptible wait function
2 .Replace semaphore wait loop with a single uninterruptible wait
3. Replace all sem_xxx to nxsem_xxx

* Unify the void cast usage

1. Remove void cast for function because many place ignore the returned value witout cast
2. Replace void cast for variable with UNUSED macro
2020-01-02 10:54:43 -06:00
Xiang Xiao
87cf5c58ae Correct some problems with network timed events when there are multiple network devices in the configuration.
Squashed commit of the following:

Author: Gregory Nutt <gnutt@nuttx.org>

    Ran nxstyle against many of the affected files.  But this job was too big for today.  Many of the network drivers under arch are highly non-compiant and generate many, many faults from nxstyle.  Those will have to be visited again another day.

Author: Xiang Xiao <xiaoxiang@xiaomi.com>

    This effects all network drivers as well as timing related portions of net/: devif_poll_tcp_timer shouldn't be skipped in the multiple card case.  devif_timer will be called multiple time in one period if the multiple card exist, the elapsed time calculated for the first callback is right, but the flowing callback in the same period is wrong(very short) because the global variable g_polltimer is used in the calculation.  So let's pass the delay time to devif_timer and remove g_polltimer.
2019-12-24 10:37:30 -06:00
Juha Niskanen
b4f6a3a878 drivers/usbdev/cdcacm.c: Fix memory leak of RX failsafe timer. 2019-10-08 08:01:30 -06:00
Anthony Merlino
1e3a60155e Merged in antmerlino/nuttx/rndis (pull request #980)
drivers/usbdev/rndis: Expose option to change number of write requests that can be in flight.

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2019-08-10 17:52:19 +00:00
Anthony Merlino
9fa5bd8df4 drivers/usbdev/rndis.c: Fixes copy/paste error introduced in last rndis change. 2019-07-23 17:59:53 -06:00