yangsong8
0beceeb745
usb: Fix issue with the calculation descriptor length error
...
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-10-15 21:00:29 +08:00
yangsong8
954e84c82a
usb: If usb3.0, set the ep0 sssize to cfgdescsize
...
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-10-09 14:19:16 +08:00
Jouni Ukkonen
b4de080b1f
usbdev/cdcacm: Fix read queue counter in shutdown
...
nrdq is already set 0 in resetconfig.
Signed-off-by: Jouni Ukkonen <jouni.ukkonen@unikie.com>
2024-10-08 22:28:51 +08:00
Jukka Laitinen
a88693f519
drivers/usbdev/cdcacm.c: Fix compilation issues
...
Add #ifdef CONFIG_SERIAL_TXDMA/RXDMA in g_uartops init
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-10-03 08:55:13 +08:00
Jukka Laitinen
5d4d2cbbc8
drivers/usbdev/pl2303.c: Don't let maximum number of bytes in request exceed CONFIG_PL2303_BULKIN_REQLEN
...
The request length may not exceed CONFIG_PL2303_BULKIN_REQLEN, otherwise buffer overflow will occur
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-10-03 08:55:13 +08:00
Jukka Laitinen
18526d78eb
drivers/usbdev/cdcacm.c: Set reqlen properly according to ep->maxpacket and CONFIG_CDCACM_BULKIN/OUT_REQLEN
...
The request length may not exceed CONFIG_CDCACM_BULKIN_ lenghts, otherwise buffer overflow will occur
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2024-10-03 08:55:13 +08:00
yangsong8
09030b5d67
cdcacm: config to enable or disable interrupt endpoint
...
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-09-30 20:32:47 +08:00
yangsong8
6290e70212
cdcacm: remove the duplicate code with serial
...
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-09-30 16:27:21 +08:00
yangsong8
6c71276359
cdcacm: support polling mode in order to work normally in interrupt
...
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-09-30 16:27:21 +08:00
yangsong8
6161b1ea84
cdcacm: use DMA to rx and tx
...
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-09-30 16:27:21 +08:00
yangsong8
e3fcabaec2
cdcacm: use serial public APIs
...
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-09-30 16:27:21 +08:00
dongjiuzhu1
aa03182bab
drivers/usbdev/: don't send setconfig response for xxxx_setup with composite
...
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-30 14:06:35 +08:00
dongjiuzhu1
a9bc198bc3
composite.c warning
...
usbdev/composite.c:649:36: warning: implicit declaration of function 'board_usbdev_pid' [-Wimplicit-function-declaration]
649 | uint16_t pid = board_usbdev_pid(); usbdev/composite.c:650:36: warning: implicit declaration of function 'board_usbdev_vid'
[-Wimplicit-function-declaration] 650 | uint16_t vid = board_usbdev_vid();
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-16 10:33:01 +08:00
dongjiuzhu1
e0d82fdf3a
drivers/usedev: remove unnecessary mdelay because remain req info had beed push to serial buffer
...
this mdelay causes cpu busy wait, affects other process running.
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-16 10:33:01 +08:00
dongjiuzhu1
1a69d3c6ee
cdcacm: Add cdcacm bulkout request buffer config
...
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-16 10:33:01 +08:00
dongjiuzhu1
881cd3f7db
driver/usbdev: support userspace to access ep0
...
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-11 22:00:26 +08:00
yangsong8
918ae4cc84
drivers: usbdev: Fix USB descriptor
...
This commit fixes the regression from https://github.com/apache/nuttx/pull/13190
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-09-03 11:45:45 -03:00
yangsong8
5a39e83c05
usbdev: extend the usb req len to size_t
...
Some USB controllers can receive or send multiple data packets then
generate one interrupt. This mechanism can reduce the number of data
copies. Extend req buf to accommodate this.
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-08-30 01:32:02 +08:00
yangsong8
a2e7265adb
cdcacm: align cdcacm_epconfigure function parameters
...
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-08-28 13:48:55 +08:00
yangsong8
fa1c094e65
usbdev: add usb3.0 ep companion struct and descriptor
...
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-08-27 12:53:15 -03:00
yangsong8
1dd38fe974
usbdev: unify the parameter of mkconfdesc function
...
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-08-27 12:53:15 -03:00
yangsong8
07aa8a5c57
usbdev: modify usb device support USB3.0 MaxPacketSize
...
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-08-27 12:53:15 -03:00
yangsong8
0788e68285
usbdev: usb device descriptor support USB3.0
...
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-08-27 12:53:15 -03:00
yangsong8
af017a5c30
usbdev: fix usb cdcecm build error
...
usbdev/cdcecm.c:295:3: error: invalid type argument of '->' (have 'struct net_driver_s')
295 | NETDEV_TXPACKETS(self->dev);
| ^~~~~~~~~~~~~~~~
usbdev/cdcecm.c: In function 'cdcecm_txdone':
usbdev/cdcecm.c:495:3: error: invalid type argument of '->' (have 'struct net_driver_s')
495 | NETDEV_TXDONE(priv->dev);
| ^~~~~~~~~~~~~
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-08-27 12:53:15 -03:00
Petro Karashchenko
1528b8dcca
nuttx: resolve various 'FAR' and 'CODE' issues
...
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-08-26 10:21:03 +08:00
Petro Karashchenko
d499ac9d58
nuttx: fix multiple 'FAR', 'CODE' and style issues
...
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-08-25 19:22:15 +08:00
Petro Karashchenko
d252b6229f
nuttx: use sizeof instead of define or number in snprintf
...
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-08-25 19:22:15 +08:00
zhanghongyu
3a25286862
usbdev/cdcncm: fix notify overwrite issue
...
we need to wait until the previous notify message is done to
send a new notify message
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-08-22 01:56:26 +08:00
zhanghongyu
9f9075c48c
usbdev/cdcncm: fix ndpsign mismatch after NCM_SET_NTB_FORMAT
...
Otherwise, the NCM_SET_NTB_FORMAT message from the host may cause
subsequent parsing exceptions.
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-08-22 01:56:26 +08:00
zhanghongyu
418b692e21
usbdev/cdcmbim: add response notify
...
when the host is needed to read the data, RESPONSE_AVAILABLE must first
be sent.
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-08-22 01:56:26 +08:00
zhanghongyu
5b24917bb9
usb_cdcmbim: add mbim device driver
...
./build.sh sim:usbdev -j12
sudo gdb nuttx/nuttx -ex "source nuttx/tools/gdb/__init__.py"
below command to create mbim NIC on host
nsh> conn 3
NuttX's MBIM device implementation adds an additional MBIM network
card to the NuttX system, which can debug the data communication with
the host, but this network card is unnecessary and needs to be removed
when the business actually uses this driver, And the cdcncm_receive
method needs to be re-implemented.
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-08-22 01:56:26 +08:00
zhanghongyu
640b766d2b
usbdev/cdcncm: fix some issues
...
1. increase CDCECM_MXDESCLEN to avoid memory overrun when sending
configuration description(mkcfmdesc) information
2. correct the request structure used in the notify phase
3. disable unused configuration options
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-08-21 02:01:01 +08:00
zhanghongyu
7aa3e2ebd6
cdcncm: switch net driver to netdev_lowerhalf
...
optimize the interaction flow associated with network drivers to reduce
the amount of code and improve compatibility
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-08-21 02:01:01 +08:00
zhanghongyu
4e79741e7d
usbdev: add ncm driver
...
The compilation and verification commands are shown below:
./tools/configure.sh sim:usbdev
make -j
sudo ./nuttx
nsh> conn 2
nsh> dhcpd_start eth1
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-08-21 02:01:01 +08:00
zhaoxingyu1
fa31c1c21b
usbdev: delete unsigned comparison with 0
...
The unsigned type is always greater than or equal to 0
Signed-off-by: zhaoxingyu1 <zhaoxingyu1@xiaomi.com>
2024-07-22 23:44:18 +08:00
yinshengkai
20ebe0e64c
Replace all asserts in kernel code with ASSERT
...
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-05-17 10:18:16 -03:00
dongjiuzhu1
c093514cea
drivers/usbdev: Register the device after successful set configuration
...
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-04-23 22:02:02 +08:00
dongjiuzhu1
443306793c
drivers/usbdev: support read ZLP packet
...
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-04-23 22:02:02 +08:00
dongjiuzhu1
4bcad6115b
driver/usbdev: lock fs_ep resouce when call unbind
...
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-04-23 22:02:02 +08:00
dongjiuzhu1
d6bfa87c8d
drivers/usbdev: support send ZLP(zero length packet) data packet in bulkin
...
status = write(g_usb_ep_in, (void*)0xFEE1DEAD, 0);
sched_backtrace
nuttx/arch/arm/src/../../../sched/sched/sched_backtrace.c:57
_assert
nuttx/arch/arm/src/../../../sched/misc/assert.c:659
__assert
nuttx/arch/arm/src/../../../libs/libc/assert/lib_assert.c:36
usbdev_fs_write
nuttx/arch/arm/src/../../../drivers/usbdev/usbdev_fs.c:770 (discriminator 1)
file_write
nuttx/arch/arm/src/../../../fs/vfs/fs_write.c:91
nx_write
nuttx/arch/arm/src/../../../fs/vfs/fs_write.c:148
ffs_transport_thread_usb_write
nuttx/arch/arm/src/../../../../external/mtp-responder/mtp-responder/src/mtp_usb_driver_nuttx.c:224
_transport_thread_usb_write
nuttx/arch/arm/src/../../../../external/mtp-responder/mtp-responder/src/mtp_usb_driver.c:80
pthread_startup
nuttx/arch/arm/src/../../../libs/libc/pthread/pthread_create.c:59 (discriminator 2)
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-04-23 22:02:02 +08:00
dongjiuzhu1
2b571e1d11
drivers/usbdev: support config usb req buffer alignment bytes
...
we need to alloc req buffer in cacheline size units, othersize the
data may by incorrect.
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-04-23 22:02:02 +08:00
dongjiuzhu1
9ebed49d29
drivers/usbdev: update sem ptr before loop run
...
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-04-23 22:02:02 +08:00
dongjiuzhu1
7feb547c6f
drivers/usbdev: stop read when container length is less than the maximum length.
...
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-04-23 22:02:02 +08:00
dongjiuzhu1
0f269b1c2a
driver/usbdev: report POLLPRI event when usb connect
...
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-04-23 22:02:02 +08:00
dongjiuzhu1
1355302036
drivers/usbdev_fs: update ctrlreq buffer len base on longest string descriptor
...
nuttx/mm/kasan/kasan.c:117
kasan_report
nuttx/mm/kasan/kasan.c:111
composite_mkstrdesc
nuttx/drivers/usbdev/composite.c:404
sunxi_ep0_disptach
nuttx/arch/arm/src/chip/drivers/rtos-hal/hal/source/usb/udc/udc.c:1287
up_common_handler
nuttx/arch/arm/src/chip/drivers/osal/src/hal_interrupt.c:10
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-04-23 22:02:02 +08:00
dongjiuzhu1
070ecb480a
drivers/usbdev_fs: report POLLHUP when disconnect
...
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-04-23 22:02:02 +08:00
sunkun3
e3a6368c9a
drivers/usbdev_fs: when the device is not opened, the received data is retained.
...
It is up to the app to determine whether the data is valid when opened
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-04-23 22:02:02 +08:00
dongjiuzhu1
7c4e3aff14
drivers/usbdev/mtp: fix compile break
...
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-04-21 23:24:40 +08:00
dongjiuzhu1
e7fd416f9f
drivers/usbdev: support config pid/vid by soft interface
...
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-04-21 23:24:40 +08:00
anjiahao
ff4c6c33e8
usbdev:fix usbdev usbdev_fs_classuninitialize double free
...
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-04-21 23:21:54 +08:00