Commit Graph

316 Commits

Author SHA1 Message Date
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
fangzhenwei
88e871b13e nuttx/pty: pty FIONBIO return -ENOTTY when pipe_ioctl return OK
Signed-off-by: fangzhenwei <fangzhenwei@xiaomi.com>
2022-02-22 13:42:44 +08:00
fangzhenwei
c7c91488d1 nuttx/pty: pass read nonblock flag to pipe
Signed-off-by: fangzhenwei <fangzhenwei@xiaomi.com>
2022-02-22 13:42:44 +08:00
fangzhenwei
1afdb06981 nuttx/pty:pty FIONBIO pass to pipe control
1. pass FIONBIO ioctl to pipe
2. resolve the return value error

Signed-off-by: fangzhenwei <fangzhenwei@xiaomi.com>
2022-02-22 13:42:44 +08:00
Xiang Xiao
2dcaab8af8 serial/pty: Remove the unused code related to CONFIG_PSEUDOTERM_FULLBLOCKS
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-20 21:22:24 +01:00
Xiang Xiao
845640bc33 serial/pty: Decouple SUSv1 style from pseudo fs operation
and always enable BSD style PTYs since this feature doesn't
consume the additional code size

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-09 20:35:59 +08:00
Xiang Xiao
8e64db45c7 serial/pty: Close the internal pipe when reference count drop to zero
so the other side can get the hang up notification

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-09 01:42:51 +08:00
Xiang Xiao
358dab3723 serial/pty: Reorder the register driver to simplify the error handling
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-08 16:11:26 +01:00
Xiang Xiao
61066ecbc8 serial/pty: Sync the default termios setting regardless CONFIG_SERIAL_TERMIOS
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-08 09:33:46 -03:00
Xiang Xiao
3ec208fdbc serial/pty: Don't initialize pd_iflag to ISIG
since ISIG belong local mode flags not input mode flags,
but local mode isn't implemented by pty driver yet.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-08 09:33:46 -03:00
Xiang Xiao
e3fed03e43 serial/pty: Don't use shced_[lock|unlock] to protect pp_locked
since the sched lock can't work in SMP context

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-08 09:31:56 -03:00
Xiang Xiao
f03fc4a179 serial/pty: Destroy pp_slavesem in pty_destroy to avoid the leak
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-08 09:31:56 -03:00
ligd
0155e910dc serial: fix cu crash caused by ioctl is NULL
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-02-07 13:31:46 +08:00
Xiang Xiao
15c487085a serial/ptmx: Fix the typo error in ptmx_minor_free
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-06 16:19:27 +01:00
Xiang Xiao
6cc0388f4f serial/ptmx: Add lock to avoid the race condition in ptmx_minor_free
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-06 16:19:27 +01:00
chao.an
5457a9a450 serial/pty: fix the lock handling
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-02-03 13:14:34 +08:00
Xiang Xiao
4c167b0729 Correct the code alignment
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-01 21:22:21 -03:00
Xiang Xiao
f987668068 serial: Consolidate the general termios in the common place
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-01 21:22:21 -03:00
Huang Qi
2e35b6d611 serial/uart_16550: Allow uintptr_t as addr width
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-01-14 19:40:30 +08:00
Petro Karashchenko
a743fed63d file_operations: get back C89 compatible initializer
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-01-11 02:14:00 +08:00
ligd
5a0ab205ca serial: merge serial check signo to one place
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-01-10 17:07:32 +01:00
Jiuzhu Dong
dce8c96281 uart_rpmsg: fix data loss
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-01-04 20:57:40 +08:00
ligd
75aec04330 serial: add CONFIG_TTY_LAUNCH support
this allow user start new program from tty

Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-01-01 20:38:26 +08:00
Xiang Xiao
4262b09cbf libc: Implement terminal api regardless of CONFIG_SERIAL_TERMIOS setting
since many functions aren't related to termios directly

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-12-29 08:11:08 -03:00
Xiang Xiao
86684105f9 serial: Move tcdrain implementation from drivers/serial to libc
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-12-29 08:11:08 -03:00
Xiang Xiao
a010cb1af1 serial: Make SIGINT and SIGTSTP work even without CONFIG_SERIAL_TERMIOS
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-12-29 08:11:08 -03:00
ligd
5b369c5cec libs/lbc: remove CHAR_BIT = 16 support
For CEVA platform CHAR_BIT is 16, and will do lots of extra work
when use IPC.
We will not support this platform anymore, so remove all the b2c operations.

Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-12-13 11:08:28 -06:00
Huang Qi
3d4be7089c drivers/serial/uart_16550: Fix warning for format
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2021-12-07 23:28:33 -06:00
Huang Qi
a24005b70b drivers/serial: Fix offset calculation in 16550
Signed-off-by: Huang Qi <no1wudi@qq.com>
2021-12-05 07:02:40 -06:00
jordi
f3af6edf93 Kconfig: add quotes in source to clean warnings from setconfig
To avoid the setconfig warning "style: quotes recommended around xxx in
source xxx"
2021-07-23 02:32:19 -07:00
Jiuzhu Dong
3834e7e2c9 serial: use Ctrl+? composite key to force panic"
N/A

Change-Id: I249312538107266d343e326b9c966012678e6a00
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-07-19 04:24:37 -07:00
ligd
136662f5f9 serial: add ctrl+@ to force crash system for debugging
Change-Id: Iee65ac6c94ff298cfadf4429936b3744c16b8698
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-13 14:45:09 -03:00
ligd
b86bcff2eb serial: add ioctl TIOCNOTTY
Change-Id: I14ab1304d6330578423e0775f42faa8e19886fef
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-02 07:20:42 -05:00
Xiang Xiao
7ff6aac43a serial/pty: Initialize the terminal setting as a console
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ie80a22b7a074d048435524d86f0ca7fc7a20e756
2021-06-12 09:52:05 +09:00
Xiang Xiao
4e038c1724 serial/pty: Don't return -NOSYS if pollfd::events equals 0
since the caller is free not to monitor any event

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ib957be1b1b5a686faea0196bc9069e0908a492eb
2021-06-11 08:22:41 -07:00
Xiang Xiao
f7c0d46ed8 serial: Remove the unnecessary err_out label 2021-06-07 07:55:14 +09:00
Masayuki Ishikawa
3ccef09b4e drivers: serial: Remove an unnecessary critical section (cs) for SMP
Summary:
- I thought this cs is needed to avoid data corruption
- For example, while executing uart_xmitchar() in the interrupt
  handler on CPU0, an application running on CPU1 can call
  uart_putxmitchar() via write()->uart_write().
- In this case, taking xmit.sem in uart_write() will wait for CPU0
  to finish uart_xmitchar() because CPU0 has already taken a cs
  in uart_xmitchar() then nxsem_wait() on CPU0 takes a new cs
  inside (and release the cs when returning but it's OK)
- Then uart_write() on CPU1 disables UART TX, so uart_xmitchar()
  on CPU0 will not be called while executing uart_write() on CPU1.
- So this critical section in uart_putxmitchar() can be removed.

Impact:
- None

Testing:
- Tested with spresense:wifi_smp, esp32-devkitc:smp

Reported-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2021-06-05 22:33:09 -05: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
81e63e3a63 serial: Remove the unnecessary critical section in uart_pollnotify
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-02 15:46:53 -07:00
chao.an
99bfd355c7 serial/uart/h4: add bt h4 uart serial driver
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-05-31 09:50:54 -03: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
Masayuki Ishikawa
59ab8151cc drivers: serial: Remove unnecessary DEBUGASSERT in serial.c
Summary:
- This commit removes unnecessary DEBUGASSERT in serial.c

Impact:
- None

Testing:
- Tested with sabre-6quad (QEMU) and sim

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2021-05-26 23:20:29 -03:00
Xiang Xiao
276fa2ff1c drivers/serial: Change the default value of SERIAL_NPOLLWAITERS to 4
since the console is normally opened three time as stdin, stdout and
stderr and remove the dependence on STANDARD_SERIAL because other type
of serial drivers also support the poll through the same codebase.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ie68322c4647cc838b295491329969869d6ba310b
2021-05-11 16:45:22 +01:00
Julian Oes
644a0cd525 drivers/serial: fix Rx interrupt enable for cdcacm
This is addressing an issue where Rx interrupts were not restored for
cdcacm after the buffer had been filled (in a burst).
The Rx interrupts were only restored after the watchdog timeout of 200ms
fired.

This happened because CONFIG_SERIAL_RXDMA was set, however, for the
cdcacm driver this does not actually matter as it is relying on
uart_enablerxint to be called via the ops table.

This patch makes sure that uart_enablerxint and uart_disablerxint are
always called, independent of CONFIG_SERIAL_RXDMA, relying on the ops
table to be correct for the case where it should be only a no-op.
2021-05-06 06:49:07 -07:00
Alin Jerpelea
c798076084 drivers: Author Sebastien Lorquet: update licenses to Apache
Sebastien Lorquet has submitted the ICL and we can migrate the licenses
 to Apache.

Gregory Nutt has submitted the SGA and we can migrate the licenses
 to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-03-20 19:22:58 -07:00
ligd
24cc83e46f serial/serial_dma.c: fix warnnings
serial/serial_dma.c: In function ‘uart_recvchars_done’:
serial/serial_dma.c:407:7: warning: implicit declaration of function ‘nxsig_kill’ [-Wimplicit-function-declaration]
  407 |       nxsig_kill(dev->pid, signo);
      |       ^~~~~~~~~~

Change-Id: I9e1c0341ecce3033889d11fff9ec2b9e3dfe303b
2021-03-07 01:45:51 -08:00