Add UART printing on qemu_riscv64#343
Conversation
|
build_prs #343 |
|
Job is started, see https://github.com/vivoblueos/kernel/actions/runs/22700766319. |
| #[cfg(target_chip = "gd32vw55x")] | ||
| pub mod gd32vw55x; | ||
| pub mod ns16650; | ||
| pub mod ns16550a; |
There was a problem hiding this comment.
What's the difference between ns16550a and ns16550?
There was a problem hiding this comment.
see wiki: (https://en.wikipedia.org/wiki/16550_UART). The "Issue with the buffer" section.
"""
The original 16550 had a bug that prevented this FIFO from being used. National Semiconductor later released the 16550A which corrected this issue.
"""
driver/src/uart/ns16550a.rs
Outdated
| @@ -0,0 +1,154 @@ | |||
| // Copyright (c) 2025 vivo Mobile Communication Co., Ltd. | |||
There was a problem hiding this comment.
| // Copyright (c) 2025 vivo Mobile Communication Co., Ltd. | |
| // Copyright (c) 2026 vivo Mobile Communication Co., Ltd. |
| @@ -17,5 +17,5 @@ | |||
| use crate::arch::irq::IrqNumber; | |||
There was a problem hiding this comment.
Does this driver work on qemu_riscv32?
There was a problem hiding this comment.
not yet, but I can make it work
There was a problem hiding this comment.
qemu_riscv32 is supported
|
❌ Job failed. Failed jobs: check_format (failure), build_and_check_boards (failure), see https://github.com/vivoblueos/kernel/actions/runs/22700766319. |
| #[cfg(target_chip = "gd32vw55x")] | ||
| pub mod gd32vw55x; | ||
| pub mod ns16650; | ||
| pub mod ns16550a; |
There was a problem hiding this comment.
Please check whether the ns16550 driver can be reused between the two platforms via modification.
There was a problem hiding this comment.
I guess what you're asking is whether the ns16650 can be reused (ns16650 differs from ns16550 by just one digit).
The current only board which uses ns16650 is rk3568.
google "rk3568 TRM", see https://opensource.rock-chips.com/wiki_File:Rockchip_RK3568_TRM_Part1_V1.3-20220930P.PDF
At 25.4.2 Registers Summary, it says that each register of the rk3568 UART occupies a 4-byte MMIO space.
If rk3568 is using ns16650 UART, then it means that each register of ns16650 occupies a 4-byte MMIO space.
The manual of ns16550a is here: https://uart16550.readthedocs.io/en/latest/uart16550doc.html#registers
It says that most registers of ns16550a occupies a 1-byte MMIO space.
Therefore, the drivers for ns16550a and ns16650 are not compatible.
There was a problem hiding this comment.
It looks like there’s no real difference in the operation logic; the only difference is that one is 4-byte and the other is 1-byte. Is it possible to reuse the same operation logic via conditional compilation?
change 2025 -> 2026 in driver/src/uart/ns16550a.rs add uart support for riscv32 rename NS16550A_UART0_IRQ as NS16550A_UART0_IRQNUM
|
build_prs #343 |
|
Job is started, see https://github.com/vivoblueos/kernel/actions/runs/22707911821. |
|
build_prs #343 |
|
❌ Job failed. Failed jobs: check_format (failure), see https://github.com/vivoblueos/kernel/actions/runs/22707911821. |
|
Job is started, see https://github.com/vivoblueos/kernel/actions/runs/22708554673. |
|
❌ Job failed. Failed jobs: build_and_check_boards (failure), see https://github.com/vivoblueos/kernel/actions/runs/22708554673. |
|
build_prs #343 |
|
Job is started, see https://github.com/vivoblueos/kernel/actions/runs/22708903012. |
|
❌ Job failed. Failed jobs: build_and_check_boards (failure), see https://github.com/vivoblueos/kernel/actions/runs/22708903012. |
|
build_prs #343 |
|
Job is started, see https://github.com/vivoblueos/kernel/actions/runs/22709330284. |
|
✅ All jobs completed successfully, see https://github.com/vivoblueos/kernel/actions/runs/22709330284. |
lawkai-vivo
left a comment
There was a problem hiding this comment.
LGTM. I don't have strong opinion of merging ns16550a and ns16550. Please wait for @xuchang-vivo 's feedback.
| } | ||
| } | ||
|
|
||
| impl HasInterruptReg for Ns16550a<'static> { |
There was a problem hiding this comment.
Add default impl in trait HasInterruptReg to reduce code duplication
add default impl for: - Has8bitDataReg - HasLineStatusReg - HasFifo - HasInterruptReg - PlatPeri
|
build_prs #343 |
|
Job is started, see https://github.com/vivoblueos/kernel/actions/runs/22746863647. |
|
✅ All jobs completed successfully, see https://github.com/vivoblueos/kernel/actions/runs/22746863647. |
Add UART printing on qemu_riscv64
Fixes #339