Commit Graph

345 Commits

Author SHA1 Message Date
ouyangxiangzhen 17c51c0667 userspace: Exclude nuttx/arch.h
This patch fixed userspace headers conflict. Architecture-related definition and API should not be exposed to users.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
2024-11-01 16:59:37 +08:00
YAMAMOTO Takashi 761ee81956 move readv/writev to the kernel
currently, nuttx implements readv/writev on the top of read/write.
while it might work for the simplest cases, it's broken by design.
for example, it's impossible to make it work correctly for files
which need to preserve data boundaries without allocating a single
contiguous buffer. (udp socket, some character devices, etc)

this change is a start of the migration to a better design.
that is, implement read/write on the top of readv/writev.

to avoid a single huge change, following things will NOT be done in
this commit:

* fix actual bugs caused by the original readv-based-on-read design.
  (cf. https://github.com/apache/nuttx/pull/12674)

* adapt filesystems/drivers to actually benefit from the new interface.
  (except a few trivial examples)

* eventually retire the old interface.

* retire read/write syscalls. implement them in libc instead.

* pread/pwrite/preadv/pwritev (except the introduction of struct uio,
  which is a preparation to back these variations with the new
  interface.)
2024-10-30 17:07:54 +08:00
xuxingliang d655569a7c cmake: add newly added sources to cmake
These newly added files are missing from cmake.

Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-10-14 17:19:45 +08:00
fangpeina 3f1fd42f73 drivers/input: fix complie err about undefined
There will be compilation errors about undefined reference to `enter_critical_section'.
Fixed by include irq.h

Signed-off-by: fangpeina <fangpeina@xiaomi.com>
2024-10-13 02:03:40 +08:00
Xiang Xiao b068e2357a circbuf: Move from mm/circbuf to libs/libc/misc
so that it can be used by userspace program.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2024-10-09 08:41:49 +08:00
Xiang Xiao 7c839d7a09 rptun: Remove include/nuttx/rptun/openamp.h
and use include/nuttx/rpmsg/rpmsg.h instead

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-10-07 00:44:28 +08:00
lipengfei28 b18262d78f bits:rename __set_bit to set_bit __clear_bit to clear_bit
This used for add pci ep drver framework

Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
2024-09-23 10:03:54 +02:00
fangpeina cd15d37396 drivers/input: add dummy force feedback driver
Signed-off-by: fangpeina <fangpeina@xiaomi.com>
2024-09-10 15:21:42 +08:00
fangpeina 947a32184b drivers/include: clean up compilation warning about aw86225.c
Signed-off-by: fangpeina <fangpeina@xiaomi.com>
2024-09-10 15:21:42 +08:00
dongjiuzhu1 84b3b1daa0 ff/aw86225: implement aw86225 vibrator driver base on ff
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-10 15:21:42 +08:00
dongjiuzhu1 f65491ba44 input/ff: support force feedback driver framework
Add new driver frameworks: force feedback for vibrator, like linux,
unify vendor vibrator driver using.

Incorporating a force feedback-based driving framework to replace the
conventional driver/motor setup for controlling vibrators not only
enhances the precision and responsiveness of the haptic feedback but
also aligns better with the advancements in Linux-based driver systems.

refs docs link: https://www.kernel.org/doc/html/v4.19/input/ff.html

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-10 15:21:42 +08:00
liuhongchao d2d8d49359 drivers: Fix goldfish events x64 unresponsive interrupt issue
Signed-off-by: liuhongchao <liuhongchao@xiaomi.com>
2024-08-27 01:41:43 +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
yinshengkai 9694760eb8 input: fix touchevent race condition
In touch_event, circbuf is operated, and there is a lack of protection here.

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-08-23 08:52:23 +08:00
jianglianfang db78cc9c0f input: fix goldfish input and lvgl input device name mismatch problem
Signed-off-by: jianglianfang <jianglianfang@xiaomi.com>
2024-08-19 14:03:32 +08:00
rongyichang 1676206651 drivers/input: enable touch/kbd/mouse for goldfish event
Signed-off-by: rongyichang <rongyichang@xiaomi.com>
2024-08-18 10:54:22 -03:00
liuhongchao 0b541be56a drivers/input: Fix build goldfish events warning
Signed-off-by: liuhongchao <liuhongchao@xiaomi.com>
2024-08-18 10:54:22 -03:00
liuhongchao 7495014b17 drivers/input: Add goldfish events driver
Signed-off-by: liuhongchao <liuhongchao@xiaomi.com>
2024-08-18 10:54:22 -03:00
rongyichang bb29c39d50 drivers/touchscreen: add grab for touchscreen
Providing the capability for applications to exclusively
handle touch events

Signed-off-by: rongyichang <rongyichang@xiaomi.com>
2024-08-08 18:30:32 +08:00
chao an 6d50274ebe nuttx/list: rename container_of to list_container_of from public header
Use private naming to avoid conflicts with user applications

In file included from libuv/src/unix/internal.h:25,
                 from libuv/src/unix/udp.c:23:
libuv/src/uv-common.h:57: warning: "container_of" redefined
   57 | #define container_of(ptr, type, member) \
      |
In file included from nuttx/include/nuttx/list.h:47,
                 from nuttx/include/nuttx/tls.h:40,
                 from nuttx/include/nuttx/sched.h:48,
                 from nuttx/include/nuttx/arch.h:87,
                 from nuttx/include/nuttx/userspace.h:35,
                 from nuttx/include/nuttx/mm/mm.h:30,
                 from nuttx/include/nuttx/kmalloc.h:34,
                 from nuttx/include/nuttx/lib/lib.h:31,
                 from nuttx/include/stdio.h:35,
                 from apps/system/libuv/libuv/include/uv.h:59,
                 from libuv/src/unix/udp.c:22:
nuttx/include/nuttx/nuttx.h:48: note: this is the location of the previous definition
   48 | #define container_of(ptr, type, member) \
      |

Signed-off-by: chao an <anchao@lixiang.com>
2024-02-29 19:44:54 +08:00
Bowen Wang 169f47beec rpmsg: make all the rpmsg services deponds on RPMSG
After decoupled the rpmsg and rptun, all the rpmsg service should
depends on the RPMSG.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-02-18 04:09:34 -08: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
raiden00pl b565e28da3 Kconfigs: rename {Rpmsg|rpmsg} to RPMGS 2023-10-28 13:58:56 +08:00
hujun5 66fa229fcc Fix some typos in comments
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2023-10-11 08:14:49 +02:00
liushuai25 10fce11e19 After turning on the system by power button, the first press of the power button is ineffective.
Signed-off-by: liushuai25 <liushuai25@xiaomi.com>
Co-authored-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-09-16 08:31:44 +03:00
chenrun1 dd4055be78 button_upper.c:Modify the unknown command message level in ioctl to iinfo
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2023-09-08 15:55:28 +03: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
chao an b60f01a55b inode/i_private: remove all unnecessary cast for i_private
Signed-off-by: chao an <anchao@xiaomi.com>
2023-08-29 08:58:07 +02:00
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
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
liuhongchao f9dbeaef86 drivers/input:fix circbuf leak
Signed-off-by: liuhongchao <liuhongchao@xiaomi.com>
2023-08-14 20:40:11 +08:00
hujun5 c712a00620 drivers/input: rm sched_[un]lock
We use enter_critical_section to protect the read and write of priv structures,
sched_lock is mainly used to prevent active context switching caused by nxsem_post.
We do not actively switch contexts when reading and writing priv structures,
so sched_lock can be removed.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2023-08-12 23:32:38 +08:00
liuhongchao 69b655f4b2 drivers/input:support mouse driver
Implement mouse driver lower upper

Signed-off-by: liuhongchao <liuhongchao@xiaomi.com>
2023-08-11 20:37:11 +08:00
liuhongchao 7dde402982 drivers/input:Fix setting the number of keyboard driver buffers fails
Buffer nums is not multiplied by the structure size

Signed-off-by: liuhongchao <liuhongchao@xiaomi.com>
2023-08-11 13:17:54 +08:00
zhanghu5 5890fde1ed drivers/input: Implement the debounce in button_upper.c
use delay configurable watchdog to implement debounce

Signed-off-by: zhanghu5 <zhanghu5@xiaomi.com>
2023-08-10 23:14:26 +08:00
yintao 26f996b927 nuttx/input: fix uinput_rpmsg_device_destroy crash
Signed-off-by: yintao <yintao@xiaomi.com>
2023-08-10 23:13:40 +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
Nicolas Caramelli e82b762fb7 input/touchscreen: Translate raw X/Y data into pixel coordinates 2023-07-03 10:17:04 -03:00
TimJTi c904b16cd9 Rename touchscreen ioctls for clarity 2023-05-26 22:42:57 +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
chao an 4c8d244fae sched/getpid: replace syscall getpid/tid/ppid() to kernel version
NuttX kernel should not use the syscall functions, especially after
enabling CONFIG_SCHED_INSTRUMENTATION_SYSCALL, all system functions
will be traced to backend, which will impact system performance.

Signed-off-by: chao an <anchao@xiaomi.com>
2023-02-02 10:33:01 +08:00
ligd 354abd4e8e uinput: fix uinput compile failed, if no define CONFIG_UINPUT_TOUCH
input/uinput.c:81:28: error: field 'lower' has incomplete type
   81 |   struct touch_lowerhalf_s lower;
      |                            ^~~~~
CC:  pipes/pipe.c

Signed-off-by: ligd <liguiding1@xiaomi.com>
2023-01-17 10:55:52 +08:00
Lee Lup Yuen 6de5a862cd drivers/input: Add driver for Goodix GT9XX Touch Panel
This PR adds the driver for Goodix GT9XX I2C Touch Panel, which will be called by PINE64 PinePhone.

Our driver follows the design of the NuttX Driver for [Cypress MBR3108](https://github.com/apache/nuttx/blob/master/drivers/input/cypress_mbr3108.c).

We have documented our driver here: ["NuttX Touch Panel Driver for PinePhone"](https://lupyuen.github.io/articles/touch2#appendix-nuttx-touch-panel-driver-for-pinephone)

`drivers/input/Kconfig`: Added option `INPUT_GT9XX` to select GT9XX Driver

`drivers/input/Make.defs`: Added GT9XX Driver to Makefile

`drivers/input/gt9xx.c`, `gt9xx.h`: I2C Driver for GT9XX Touch Panel
2023-01-13 12:19:53 +08: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
pengyiqiang c4535ee66a drivers/input/touchscreen_upper: add missing function code comments
Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>
2022-12-01 10:26:11 +08:00
Xiang Xiao a446b5816f mm/circbuf: Remove MM_CIRCBUF option from Kconfig
since the linker can remove the unused object file from the final image

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-08 10:18:27 -03: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