Commit Graph

361 Commits

Author SHA1 Message Date
Huang Qi
7ce78dd66a Revert "driver/uart_rpmsg: Passthrough data by default"
This reverts commit 64e611d71e.
2023-03-24 14:59:41 -03:00
Huang Qi
fab77cd322 drivers/pty: Echo input by default
Align the pty behavior to linux/bsd,

Also fix the ECHO issue with microadb after https://github.com/apache/nuttx/pull/8691.

adb shell will echo normally with this patch.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-03-21 07:23:17 +09:00
Xiang Xiao
e7090022a0 drivers/serial: Fix some typo error report in https://github.com/apache/nuttx/pull/8843
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-03-20 08:08:04 +01:00
Xiang Xiao
b63994b7f7 drivers/serial: Always support c_oflag, c_iflag and c_lflag in termios
CONFIG_SERIAL_TERMIOS only decide whether to support c_cflag field since
many terminal application need the first three fields to work correctly.
For more information please reference:
https://www.mail-archive.com/dev@nuttx.apache.org/msg09321.html

before this change(olimexino-stm32:tiny):
   text    data     bss     dec     hex filename
  34884     328    1768   36980    9074 nuttx
after this change:
   text    data     bss     dec     hex filename
  35052     340    1768   37160    9128 nuttx
delta
   text    data     bss     dec     hex filename
    168      12       0     180      b4 nuttx

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-03-19 14:54:59 -06:00
Huang Qi
061e98aa98 drivers/serial: Fix wrong ECHO flag
There is a rookie mistake introduced by https://github.com/apache/nuttx/pull/8691,
ECHO flag is a part of Local Mode (c_lflags) instead of c_iflags.

nuttx-apps should do the same change in nsh_login and termcurse_vt100.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-03-13 16:29:36 -03:00
raiden00pl
b9fd059914 drivers/bluetooth: bth4 depends on bluetooth definitions 2023-03-11 20:30:25 -03:00
Huang Qi
cfe6c4be8e driver/serial: Only enable tx interrupt if tx buffer is not empty
Fix https://github.com/apache/nuttx/issues/8731

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-03-08 16:02:56 +02:00
Huang Qi
64e611d71e driver/uart_rpmsg: Passthrough data by default
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-03-08 16:39:17 +08:00
Tiago Medicci Serrano
a3badd26a0 drivers/serial: Echo CR if NL is detected if console
Echoing console's input is now performed by the serial driver
(https://github.com/apache/nuttx/pull/8691). In order to keep old
behavior of CR being echoed by the device, it's needed to detected
whenever NL is being echoed and send CR before sending it.
2023-03-05 09:44:26 +08:00
Huang Qi
44857ab30e driver/serial: Echo only determined by ECHO flag with termios enabled
Fix a bug that can not disable echo even if termios is enabled.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-03-03 09:44:30 +02:00
Huang Qi
68384e9db4 drivers/serial: Echo input in driver layer
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-03-03 11:37:41 +08:00
Huang Qi
5ced61ce08 drivers/serial: Include spawn.h required by CONFIG_TTY_LAUNCH
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-03-02 11:43:28 +08:00
Huang Qi
b178ce4da9 driver/pty: Map CR->LF from terminal input
NuttX only treat \n as new line after https://github.com/apache/nuttx/pull/8628,
so need this conversion to interact with terminal emulator.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-02-27 21:12:35 +08:00
Nathan Hartman
409e2f3701 drivers/serial, libc/termios: Implement tcsendbreak
The TERMIOS(3) function tcsendbreak() and the IOCTLs TCSBRK and TCSBRKP
transmit a serial line Break.

Previously NuttX included an extern declaration for tcsendbreak() and
defines for TCSBRK and TCSBRKP but none of these were implemented.
Attempting to build programs that called tcsendbreak() would fail with
a linker error; attempting to use TCSBRK and TCSBRKP would result in an
error at runtime.

This changeset adds the tcsendbreak() function and handling for TCSBRK
and TCSBRKP; tcsendbreak() is implemented in terms of TCSBRK. Both
TCSBRK and TCSBRKP are implemented in terms of the BSD-compatible Break
IOCTLs TIOCSBRK and TIOCCBRK, which must be provided by the lower half
serial driver. Currently, not all lower half serial drivers in NuttX
support these IOCTLs. Those that do implement them may need one or more
Kconfig options to be set, such as `CONFIG_*_U[S]ART_BREAKS` and, on
some architectures, a separate `CONFIG_*_SERIALBRK_BSDCOMPAT`.

* drivers/serial/serial.c
  (uart_tcsendbreak): New function.
  (uart_ioctl): Implement TCSBRK and TCSBRKP.

* libs/libc/termios/lib_tcsendbreak.c
  (): New file.

* libs/libc/termios/Make.defs
  (CSRCS): Add lib_tcsendbreak.c to the build.

Thanks to Xiang Xiao for PR feedback.

Co-authored-by: Xiang Xiao <xiaoxiang781216@gmail.com>
2023-02-15 07:50:02 +08:00
chao an
e942a7c55e build/Kconfig: fix warnings detected by kconfiglib
Signed-off-by: chao an <anchao@xiaomi.com>
2023-02-09 20:07:46 +08:00
Huang Qi
b250db5dba serial: Fix a warning if termios enabled
Fix:
```
 serial/serial.c: In function 'uart_ioctl':
Error: serial/serial.c:1397:46: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
 1397 |               FAR struct termios *termiosp = (FAR struct termios *)arg;
      |                                              ^
Error: serial/serial.c:1419:46: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
 1419 |               FAR struct termios *termiosp = (FAR struct termios *)arg;
      |
```

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-02-08 13:31:35 +08:00
Huang Qi
3e41bd8b35 driver/serial: Convert CR to LF in driver
Enable the behavior by default for console,
but configurable by termios.

Binary size:

Before:
   text    data     bss     dec     hex filename
 326460     409    8164  335033   51cb9 nuttx/nuttx

 After:
    text    data     bss     dec     hex filename
 326478     409    8164  335051   51ccb nuttx/nuttx

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2023-02-08 13:31:35 +08:00
Nathan Hartman
5f9cb6faf4 drivers/serial: Fix docstrings on UART interrupt handlers 2023-02-07 04:41:36 +08:00
fangzhenwei
8a1489c291 driver/h4:increase h4 uart tx/rx buffer default size
tx buffer size 1024 to 2048
rx buffer size 1024 to 8096

Signed-off-by: fangzhenwei <fangzhenwei@xiaomi.com>
2023-01-27 00:27:02 +02:00
Xiang Xiao
1280a2a8f9 Launch the initial task through task_spawn instead of nxtask_create
to share the code with the code path of posix_spawn

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-25 23:34:52 +02: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
Xiang Xiao
9cc608e4c4 drivers/serial: Don't call uart_shutdown if the serial work as a console
since uart_setup is skip at line 556 for the console device

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-12-17 01:04:15 +02: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
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
chao an
a53cc533c0 drivers/serial: transmit lock should in pairs
Signed-off-by: chao an <anchao@xiaomi.com>
2022-11-03 14:43:12 +01:00
Xiang Xiao
64e7833cbc sched/spawn: Support task_spawnattr_[set|get]stackaddr
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-31 12:46:58 +09:00
anjiahao
d7b4e91dda Call nxsem_destroy or nxmutex_destry in the error path
1.Don't check the return value of nxsem_init or nxmutex_init
2.Fix some style issue

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-30 13:56:52 +01: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
e2a18ad339 sched: Support envp argument of task_spawn and nxtask_create
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-19 08:22:56 +09: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
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
ligd
d1b118d731 uart_rpmsg: add mutex to dmatx
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-09-09 20:27:25 -03:00
Xiang Xiao
9726be616a fs: Run the default action of FIONBIO/FIOCLEX/FIONCLEX in success path
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-06 23:16:15 +08:00
chengkai
d78ffeca71 serial/uart/h4: add ioctl interface
Signed-off-by: chengkai <chengkai@xiaomi.com>
2022-08-24 21:42:58 +08:00
ligd
8a3683fb9f rptun: add ns_match callback to resolve rptun deadlock
thread A: accept -> net_lock -> socket_rpmsg_accept
          -> rpmsg_register_callabck -> rptun_lock
thread B: ns_bind -> rpmsg_socket_ns_bind -> get_tx_payload_buffer
          -> rptun_wait_tx -> usrsock_rpmsg_ept_cb -> usrsockdev_write
          -> net_lock -> deadlock

fix:
add ns_match callback

Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-27 20:36:51 +08:00
Jari van Ewijk
dd1096695d Add initial support for NXP S32K3 MCU family
Co-authored-by: Peter van der Perk <peter.vanderperk@nxp.com>
2022-07-25 23:47:05 +08:00
Lingao Meng
77557d8d9f drivers: serial: Add error for insuff buffer
Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2022-06-23 16:50:45 +08: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
Petro Karashchenko
09b3fb25ab drivers: remove unimplemented open/close/ioctl interfaces
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-04-15 16:56:25 +08: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
Xiang Xiao
9785d6606c openamp: Change the dependence from OPENAMP to RPTUN
since all rpmsg driver need the extension api exposed by rptun driver

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-04-05 10:05:41 +03:00
Petro Karashchenko
68902d8732 pid_t: unify usage of special task IDs
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-03-22 21:22:32 +08:00
Petro Karashchenko
20ac85860c config: finalize transition from USER_ENTRYPOINT to INIT_ENTRYPOINT
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-03-19 11:32:47 +08:00
Xiang Xiao
a5a25f72ab pty: Move the post process after reading the buffer
to simplify the code logic

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-22 16:17:07 +01:00
Xiang Xiao
630b55feec serial/pty: Remove the TODO comment for O_NONBLOCK
since it is fully suppported now

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-22 09:34:57 -03:00
fangzhenwei
84b88205ab serial/pty:Don't assert EBUSY when pty unregister driver
Signed-off-by: fangzhenwei <fangzhenwei@xiaomi.com>
2022-02-22 13:42:44 +08:00