Commit Graph

453 Commits

Author SHA1 Message Date
Peter Bee c3506448c2 drivers/serial: fix cmsdk serial driver warning
serial/serial_cmsdk.c: In function 'uart_cmsdk_ioctl':
serial/serial_cmsdk.c:544:10: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]
  544 |   return ret;
      |          ^~~

Signed-off-by: Peter Bee <bijunda1@xiaomi.com>
2024-10-16 08:05:01 +08:00
ligd 3479622fec serial: use nxsig_tgkill instead of nxsig_kill
Caused nxsig_tgkill is for the one thread, nxsig_kill for the group

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-12 09:30:37 +08:00
zhangwenjian aec44de921 ICANON mode need echo every bytes
Signed-off-by: zhangwenjian <zhangwenjian@xiaomi.com>
2024-10-11 03:11:26 +08:00
zhangwenjian 7532a0e833 serial:need check old config before setting tty
Signed-off-by: zhangwenjian <zhangwenjian@xiaomi.com>
2024-10-11 03:11:26 +08:00
zhangwenjian df5c876932 libc:getline support backspace
Signed-off-by: zhangwenjian <zhangwenjian@xiaomi.com>
2024-10-11 03:11:26 +08:00
Bowen Wang 092bdec20b drivers/serial: support force panic only when repeat the panic char
We can increase the panic repeat count to avoid abnormal crashes
caused by serial port interference.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-10 02:38:12 +08:00
Bowen Wang bbb7f436d4 serial.c: should protect the fds when calling poll_notify
1. Use critical_section to protect the fds array;
2. Use critical_section and sched lock to protect the poll notify, because
   poll notify may cause context switch, delay the context swtich to
   sched_unlock();

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-10 02:38:12 +08:00
ligd 0a70235b0c serial/pl011: fix can't up_putc() after setup
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-10 02:38:12 +08:00
ligd 94cc99d01b serial: fix cu ctrl+c crash
__assert
/home/work/ssd1/workspace/MiRTOS-N62-Rel-4.0-Pre-Build/nuttx/libs/libc/assert/lib_assert.c:36
nxsem_recover
/home/work/ssd1/workspace/MiRTOS-N62-Rel-4.0-Pre-Build/nuttx/sched/semaphore/sem_recover.c:86 (discriminator 3)
nxtask_recover
/home/work/ssd1/workspace/MiRTOS-N62-Rel-4.0-Pre-Build/nuttx/sched/task/task_recover.c:79
nxtask_exithook
/home/work/ssd1/workspace/MiRTOS-N62-Rel-4.0-Pre-Build/nuttx/sched/task/task_exithook.c:448
nxtask_terminate
/home/work/ssd1/workspace/MiRTOS-N62-Rel-4.0-Pre-Build/nuttx/sched/task/task_terminate.c:110
pthread_cancel
/home/work/ssd1/workspace/MiRTOS-N62-Rel-4.0-Pre-Build/nuttx/sched/pthread/pthread_cancel.c:110
cu_main
/home/work/ssd1/workspace/MiRTOS-N62-Rel-4.0-Pre-Build/apps/system/cu/cu_main.c:485
nxtask_startup
/home/work/ssd1/workspace/MiRTOS-N62-Rel-4.0-Pre-Build/nuttx/libs/libc/sched/task_startup.c:70 (discriminator 2)
nxtask_start
/home/work/ssd1/workspace/MiRTOS-N62-Rel-4.0-Pre-Build/nuttx/sched/task/task_start.c:134

Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-10-10 02:38:12 +08:00
sunjikun ee306d47fd drivers/serial: Add 16550_DLF_SIZE option for DesignWare UART.
Signed-off-by: sunjikun <sunjikun@xiaomi.com>
2024-10-10 02:38:12 +08:00
yangsong8 81d704cd82 gdbstub: support the use of recvbuf and sendbuf
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-10-09 15:41:48 +08:00
anjiahao e007ace00d gdbstub:support only use gdbstub when panic
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-10-09 15:41:48 +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
Bowen Wang 064eb5fd35 rpmsg services: should release the tx buffer when rpmsg_send_nocopy failed
Otherwise, the tx buffer will be discarded and can no longer be obtained

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-08 18:26:39 +08:00
Bowen Wang 79be76a22c serial/uart_rpmsg: should init the lock before call rpmsg_register_callback
To avoid init the lock after this lock has been used.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-07 20:42:44 +08:00
Bowen Wang 262ccbb068 drivers/uart_rpmsg: add recv lock when received the data from peer
The recv buffer is used both in user thread and rpmsg ept->callback
thread, so add recv lock to protect the recv buffer.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-10-07 20:42:44 +08:00
yintao a1dc6dc7fc driver/uart_rpmsg: clear transmit buffer when remote exception occurred
Make uart rpmsg work normally when restart the remote core

Signed-off-by: yintao <yintao@xiaomi.com>
2024-10-07 20:42:44 +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
raiden00pl e3bbd0cfd8 drivers/serial/CMakeLists.txt: add missing files
add missing files: uart_bth5.c and uart_ram.c
2024-10-05 23:40:11 +08:00
xuxingliang 7044b10c88 task: use get_task_name where possible
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-10-01 20:38:06 +08:00
xuxingliang 1ec3623b6b serial: add message for FORCE_PANIC
Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
2024-09-30 18:21:05 +08:00
yangsong8 b319c27f03 serial: Added APIs for receiving and sending multiple chars
Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-09-30 16:27:21 +08:00
chenxiaoyi 065046b2a2 serial: use hostfs read/write on stdio as uart
This is used to implement serial console on instruction set simulator (ISS).

Signed-off-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
2024-09-28 13:53:06 +08:00
dulibo1 b4b07ce6bd PM:use CONFIG_SERIAL_PM_ACTIVITY_PRIORITY == 0 disable pm_activity which need by bl616
Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
2024-09-28 11:03:48 +08:00
chenrun1 4cec713dbf fs_inode:Change the type of i_crefs to atomic_int
Summary:
  1.Modified the i_crefs from int16_t to atomic_int
  2.Modified the i_crefs add, delete, read, and initialize interfaces to atomic operations
The purpose of this change is to avoid deadlock in cross-core scenarios, where A Core blocks B Core’s request for a write operation to A Core when A Core requests a read operation to B Core.

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-09-23 14:07:03 +08:00
p-szafonimateusz 545774eb88 serial/pci_16550: make sure that interrupts are disabled during init
Make sure that interrups are disabled during initialization.
This is a proper fix for an unexpected MSI interrupt for PCI serial driver.

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-09-18 23:54:12 +08:00
dongjiuzhu1 d4bbbe0d0b drivers/pty: support pty write to send signal, like serial driver
The interaction between the shell service in adb and adbd occurs through a pseudo-terminal (pty).
so, when a command is launched through adb shell from a PC, users now have the ability to pause
or kill the launched,application by inputting specific commands CONFIG_TTY_SIGTSTP_CHAR or
CONFIG_TTY_SIGTINT_CHAR, akin to the capabilities provided by nsh.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-17 20:11:10 +08:00
p-szafonimateusz 8ab0785d71 drivers: add UART 16550 compatible PCI device support
add support for UART 16550 compatible PCI device.
For now we support qemu serial PCI devices and AX99100 based cards.

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-09-15 03:37:58 +08:00
p-szafonimateusz ceb2921d79 drivers: prepare 16550 UART driver to support PCI
prepare 16550 UART driver to support PCI:

- [breaking change] change argument of uart_ioctl() from `struct file *filep` to `FAR struct u16550_s *priv`
  Also fix moxart_16550.c build related to this change

- [breaking change] change argument of uart_getreg() and uart_putreg from `uart_addrwidth_t base` to `FAR struct u16550_s *priv`
  Also fix arch/x86/src/qemu/qemu_serial.c and arch/x86_64/src/intel64/intel64_serial.c related to this change

- [breaking change] change argument of uart_dmachan() from `uart_addrwidth_t base` to `FAR struct u16550_s *priv`

- move `struct u16550_s` to public header

- generalize UART_XXX_OFFSET so we can use it with any register increment

- make u16550_bind(), u16550_interrupt(), u16550_interrupt() public

- remove arch/or1k/src/common/or1k_uart.c and use common 16550 MIMO interfacve

- change irq type in `struct u16550_s` from uint8_t to int to match MSI API

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-09-15 03:37:58 +08:00
p-szafonimateusz c7e8fd43a4 drivers/uart_16550: configure MCR_OUT2 bit from Kconfig
move MCR_OUT2 configuration from qemu-intel64/src/qemu_boot.c to common code
also leave this option disabled for qemu-intel64 as it's not required

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
2024-09-15 03:37:58 +08:00
fangpeina 11f06eb0f5 drivers/serial: fix deadlock when executing rexec in a user task
CPU0                                                  CPU1
task:nsh_main     task:user_app                       rexecd
nsh_consolemain	  system
uart_read         rexec				      ---
got recv.lock     poll			              ---
	          uart_poll       rpmsg_socket_poll   rpmsg_socket_close
wait recvsem      get recv.lock   poll_notify
                  deadlock        routine work

the error accurs in CPU0 when waiting console input

resolve: unlock recv.lock when waiting recvsem

Signed-off-by: fangpeina <fangpeina@xiaomi.com>
2024-09-14 10:27:40 +08:00
zhanghu5 10e7d8fe44 set min read length in uart_ioctl
set min read length in uart_ioctl

Signed-off-by: zhanghu5 <zhanghu5@xiaomi.com>
2024-09-14 10:27:40 +08:00
chao an 7223a1d0d4 serial/uart_16550: remove up_putc spinlock
putc atomicity should be guaranteed by common code rather than add similar hack to lower half driver

Signed-off-by: chao an <anchao@lixiang.com>
2024-09-12 18:11:30 +08:00
chao an c19bdf204c serial/uart_pl011: default syslog needs to check flow control in up_putc
default syslog needs to check flow control in up_putc(), otherwise
up_puts() will lose character if the hardware fifo is full.
2024-09-12 17:15:40 +08: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
yangsong8 6a38c37702 pty: use mutex to protect alloc minor
If failed in pty_register2, it is possible to enter unregister_driver
function, which eventually calls ptmx_minor_free, resulting in mutex
conflict.

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
2024-08-25 22:16:53 +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
guohao15 458bab9ae7 fix:uart_rpmsg_dmareceive data copy to nbuffer should start from data + length
Signed-off-by: guohao15 <guohao15@xiaomi.com>
2024-08-22 09:23:12 -03:00
Lwazi Dube f3ddb3ffac drivers/serial: Make the 16550 rx trigger level configurable
To avoid breaking other configs, the default value 2 is equal to the original
hard coded value.
2024-08-03 10:31:36 +08:00
hujun5 a4fece3450 spin_lock: inline spin_lock
test:
We can use qemu for testing.
compiling
make distclean -j20; ./tools/configure.sh -l qemu-armv8a:nsh_smp ;make -j20
running
qemu-system-aarch64 -cpu cortex-a53 -smp 4 -nographic -machine virt,virtualization=on,gic-version=3 -net none -chardev stdio,id=con,mux=on -serial chardev:con -mon chardev=con,mode=readline -kernel ./nuttx
2024-07-15 02:29:30 +08:00
Huang Qi add8b71fee serial/gdbstub: Change GDBSTUB_ to GDB_
Fix nameing convention inconsistent

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2024-06-24 23:51:43 +08:00
TakuyaMiyasita d6445484fe drivers/serial/uart_pl011.c : add the bitmask according to PL011 spec. (Although almost no problem.) 2024-06-03 21:18:44 +08:00
TakuyaMiyasita c93383407b drivers/serial/uart_pl011.c : add the interface about clock and reset control for reducing power consumption. 2024-06-03 21:18:44 +08:00
TakuyaMiyasita 99dee09146 drivers/serial/uart_pl011.c : bug fix about the function : pl011_txready(). 2024-06-03 21:18:44 +08:00
hujun5 5cee996588 up_putc: int up_putc, enter_critical_section may be called
before kernel has been iniitialized,we use spin_lock_irqsave to replace.

Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-05-09 13:45:02 +08:00
chao an e4d4c67b78 serial/pl011: configurable clock frequency
move clock frequency into Kconfig

Signed-off-by: chao an <anchao@lixiang.com>
2024-04-30 17:26:39 +08:00
anjiahao 0040e9a239 drivers/serial:support arm cmsdk drivers
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2024-04-26 18:42:35 -03:00
dongjiuzhu1 9c55f21a6f drivers/cdcacm/serial: add release interface to release uart_dev resource
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-04-21 23:21:54 +08:00
chao an d11b1ba9cb drivers/serial/16550: remove unused function
drivers/serial/uart_16550.c:690:20: warning: unused function 'u16550_restoreuartint' [-Wunused-function]
static inline void u16550_restoreuartint(FAR struct u16550_s *priv,
                   ^

Signed-off-by: chao an <anchao@lixiang.com>
2024-04-19 20:13:16 +08:00