Commit Graph

418 Commits

Author SHA1 Message Date
chao an
7aa45305b7 fs/inode: remove all unnecessary check for filep/inode
Since VFS layer already contains sanity checks, so remove unnecessary lower half checks

Signed-off-by: chao an <anchao@xiaomi.com>
2023-08-29 09:47:11 +08: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
Zhihong Chen
8e85e52708 drivers: usbhost: fix usbhost_hidkbd some errors
- usbhost_send_request(): data should using DRVR_ALLOC buffer
- fix usbhost_cralloc() assert variable

Signed-off-by: Zhihong Chen <zhihong.chen@hpmicro.com>
2023-07-27 00:51:59 -07:00
Zhihong Chen
3d8324962a drivers: usbhost_hub: usb communication memory should use DRVR_ALLOC
- usb communication memory should use DRVR_ALLOC

Signed-off-by: Zhihong Chen <zhihong.chen@hpmicro.com>
2023-07-19 13:38:36 +08: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
Xiang Xiao
694c0f0b7f usbhost/cdcacm: Fix the compiler warning when serial dma is enabled
CP:  nuttx/nuttx/include/nuttx/config.h
CC:  mqueue/mq_sndinternal.c usbhost/usbhost_cdcacm.c:435:3: warning: initialization of ‘void (*)(struct uart_dev_s *)’ from incompatible pointer type ‘void (*)(struct uart_dev_s *, _Bool)’ [-Wincompatible-pointer-types]
  435 |   usbhost_txint,         /* txinit */
      |   ^~~~~~~~~~~~~
usbhost/usbhost_cdcacm.c:435:3: note: (near initialization for ‘g_uart_ops.dmareceive’)
usbhost/usbhost_cdcacm.c:436:3: warning: initialization of ‘void (*)(struct uart_dev_s *)’ from incompatible pointer type ‘_Bool (*)(struct uart_dev_s *)’ [-Wincompatible-pointer-types]
  436 |   usbhost_txready,       /* txready */
      |   ^~~~~~~~~~~~~~~
usbhost/usbhost_cdcacm.c:436:3: note: (near initialization for ‘g_uart_ops.dmarxfree’)
usbhost/usbhost_cdcacm.c:437:3: warning: initialization of ‘void (*)(struct uart_dev_s *)’ from incompatible pointer type ‘_Bool (*)(struct uart_dev_s *)’ [-Wincompatible-pointer-types]
  437 |   usbhost_txempty        /* txempty */
      |   ^~~~~~~~~~~~~~~
usbhost/usbhost_cdcacm.c:437:3: note: (near initialization for ‘g_uart_ops.dmatxavail’)

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-06-05 09:25:31 +02:00
simbit18
e4ffce3355 Fix Kconfig style
Remove spaces from Kconfig files
2023-05-23 00:03:25 +08:00
Lwazi Dube
ae1fd83a46 usbhost: Can now handle multiple interface descriptors.
See #3644. Code from:
https://github.com/apache/nuttx/compare/master...btashton:libusb
2023-05-21 09:50:36 -03:00
Lwazi Dube
9948b5e701 usbhost: Make unplugging hubs more reliable.
USB drivers should not try control devices in the usbhost_disconnected
function. The control endpoint is NULL at this point because the device
has already been disconnected.

Before this change, the hub driver crashed when the child called
usbhost_hubpwr after the parent had already deactivated the control
pipe and set hport->ep0 to NULL.
2023-05-18 13:47:15 +08:00
Lwazi Dube
38ba0aefca usbhost_hub: Prevent crash when the last hub port is used.
An off-by-one error caused invalid memory to be accessed when the
last port was used. The first entry, at index 0, was never used.
The USB standard uses 1-based numbering for hub ports. This number
was used to index an array. This change converts the port number to
a zero-based port index when the array is accessed. The zero-based
value in the port field of the usbhost_hubport_s structure is also
converted before printing.

For testing, this bug was exposed on a 4 port hub when port 4 was
used after changing USBHUB_MAX_PORTS to 4 in hub.h. The bug should
also be triggered without changing hub.h if a 7 port hub is
available.
2023-05-12 11:41:26 +08:00
Lwazi Dube
d66282a893 usbhost: Fix function address generation for multi-port root hubs.
Devices connected to the same USB bus should have unique function addresses.
This was not true for root hubs with multiple ports. After this change,
enumeration is more reliable on the sama5d3-xplained board when both root hub
ports are used.

This change amounts to using one usbhost_devaddr_s object per root hub
instead of one per root hub port. For the majority of boards only one
root hub port is available so no change in behavior should be expected.
2023-05-11 09:44:18 +02:00
raiden00pl
b7341975ab drivers/usbhost/usbhost_cdcacm.c: fix warning 2023-05-09 20:48:51 +08:00
Xiang Xiao
51dc67ad5f fs: Add g_ prefix for all global file_operations instances
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-04-24 16:13:29 +02:00
Lwazi Dube
18d196e968 usbhost_hidkbd: Add the option to use interrupt transfers.
Using the interrupt pipe is recommended in the Get_Report
request section of the HID standard. This option has been
added to support some keyboards that refuse to return valid
keys when polled using the Get_Report request. Support for
the Caps Lock key, including LED, has also been added.
2023-03-29 09:22:41 -03:00
Lwazi Dube
21ffb4de72 boards/sama5d3-xplained: Make hot plugging more reliable. 2023-03-26 13:03:21 -03:00
Lwazi Dube
84a3ddd79b boards/sama5d3-xplained: Fix OHCI clock.
Choose a divider value that matches the description provided within
the same header file.
Include stddef.h to fix compiler errors because NULL is not defined.
Make logs print protocol, vid and pid consistently, (decimal hex hex).
2023-03-21 14:08:03 -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
zhangyuan21
4ddcb88c65 usbhost: fixed cdcacm issue
1. fixed cdcacm build issue
2. unregister uart driver when usbhost destroy

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-02-12 14:17:51 +08:00
Gustavo Henrique Nihei
e6b204f438 nuttx: Use MIN/MAX definitions from "sys/param.h"
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2023-02-01 23:47:44 +08:00
Xiang Xiao
9f027208d4 fs: Add model field to geometry and mtd_geometry_s
the model is very useful to track the device info

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-31 11:50:28 -03:00
Xiang Xiao
b0a0ba3ad7 fs: Move mmap callback before truncate in [file|mountpt]_operations
since mmap may exist in block_operations, but truncate may not,
moving mmap beforee truncate could make three struct more compatible

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-04 17:43:59 +02:00
Xiang Xiao
779a610ca3 Remove the unnecessary NULL fields in global instance definition of file_operations
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-04 00:32:13 +02:00
Jukka Laitinen
f33dc4df3f Change FIOC_MMAP into file operation call
- Add mmap into file_operations and remove it from ioctl definitions.
- Add mm_map structure definitions to support future unmapping
- Modify all drivers to initialize the operations struct accordingly

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2023-01-02 11:23:20 -03:00
Jukka Laitinen
41e9df2f3e Add ftruncate into file operation calls
- Add truncate into file_operations
- Move truncate to be common for mountpt_operations and file_operations
- Modify all drivers to initialize the operations struct accordingly

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2023-01-02 11:23:20 -03:00
zhangyuan21
d2c52db68e usb/ft232r: fixed build issue
1. fixed build issue;
2. make sure the read data length must greater than or equal to 2;

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2022-12-08 22:49:26 +08:00
Xiang Xiao
055f1f33eb libc/stream: Rename [lib_stream_](put|get) to [lib_stream_](putc|getc)
to make the naming style consistent with each other

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-12-05 14:27:55 +01: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
d8e53d7b4f Fix error: format specifies type 'unsigned long' but the argument has type 'unsigned int'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-20 14:34:44 +01:00
anjiahao
a4563b8744 Fix the coding style and typo issue
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-14 09:34:04 +09:00
anjiahao
d07792a343 Initialize global mutext/sem by NXMUTEX_INITIALIZER and SEM_INITIALIZER
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-14 09:34:04 +09:00
chao an
25e78c5330 drivers/usbhost/usbhost_skeleton: fix typo
Signed-off-by: chao an <anchao@xiaomi.com>
2022-11-03 14:43:12 +01:00
yinshengkai
85f727f232 tools: replace INCDIR to Makefile variable
In the past, header file paths were generated by the incdir command
Now they are generated by concatenating environment variables

In this way, when executing makefile, no shell command will be executed,
it will improve the speed of executing makfile
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2022-11-03 19:59:55 +08:00
Xiang Xiao
463be02921 Fix usbhost/usbhost_hidmouse.c:1693:13: error: unused function 'usbhost_putle16'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-01 17:12:42 +01:00
Xiang Xiao
a42bcaf680 Fix Error: usbhost/usbhost_storage.c:1471:24: error: unused function 'usbhost_getle32' [-Werror,-Wunused-function]
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-31 06:30:26 +01:00
Xiang Xiao
2d6503646d Fix Error: usbhost/usbhost_storage.c:1471:24: error: unused function 'usbhost_getle32'
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-30 16:03:35 +01:00
Xiang Xiao
00d78a51e4 Fix usbhost/usbhost_hub.c:1339:3: error: 'free' called on pointer 'alloc' with nonzero offset 12 [-Werror=free-nonheap-object]
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-23 22:44:35 +02:00
anjiahao
5724c6b2e4 sem:remove sem default protocl
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-10-22 14:50:48 +08:00
Xiang Xiao
6b31918b42 Remove the unnecessary cast for main_t, NULL and argv
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-18 08:51:45 +02:00
anjiahao
d1d46335df Replace nxsem API when used as a lock with nxmutex API
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-17 15:59:46 +09:00
Xiang Xiao
bdeaea3742 Remove the unnessary empty line after label
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-30 17:54:56 +02:00
wangbowen6
344c8be049 poll: add poll_notify() api and call it in all drivers
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2022-09-26 12:06:32 +08:00
Petro Karashchenko
b3cd9090d1 drivers/net: make sure that net driver d_buf is 16-bit aligned
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-08-05 22:21:37 +08:00
Satoshi Togawa
a9ad1a336b usbhost_cdcacm: fix error with interrupt IN endpoint. 2022-06-16 19:01:17 +03:00
zhanghongyu
035d925864 devif: remove all devif_timer
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2022-06-02 20:11:50 -03:00
anjiahao
b88a8cf39f use rmutex inside of all repeated implementation
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-05-30 19:43:48 +08:00
Xiang Xiao
7ec6b4c7dd Change dpends on SCHED_[L|H]PWORK to SCHED_WORKQUEUE
since the code could map the unsupported work to the
supported one and remove select SCHED_WORKQUEUE from
Kconfig since SCHED_[L|H]PWORK already do the selection

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-05-28 18:41:51 +03:00
Xiang Xiao
9072eecc30 sched/wqueue: Change the return type of work_notifier_teardown to void
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-05-14 00:35:29 +03:00
Xiang Xiao
ef1a98dd00 Remove the unneeded void cast
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-04-17 23:32:05 +03:00
Xiang Xiao
32ee2ae407 Remove the unneeded worker_t cast
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-04-17 23:32:05 +03:00
Jiuzhu Dong
d87cf8d4ca fs/poll: change format for type pollevent_t
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-04-07 12:14:06 +08:00