8000 Use traits for register and uart by ChocolateLoverRaj · Pull Request #39 · rust-osdev/uart_16550 · GitHub
[go: up one dir, main page]

Skip to content

Use traits for register and uart #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Make port fns const
  • Loading branch information
ChocolateLoverRaj committed Feb 26, 2025
commit cb281d32bbb7f929a79670c6b3dab09c449299c2
4 changes: 2 additions & 2 deletions src/port.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pub struct PortAccessedRegister {
}

impl PortAccessedRegister {
unsafe fn new(port: u16) -> Self {
const unsafe fn new(port: u16) -> Self {
Self { port }
}
}
Expand All @@ -29,7 +29,7 @@ impl Uart16550Register for PortAccessedRegister {
/// This function is unsafe because the caller must ensure that the given base address
/// really points to a serial port device and that the caller has the necessary rights
/// to perform the I/O operation.
pub unsafe fn new(base: u16) -> Uart16550Registers<PortAccessedRegister> {
pub const unsafe fn new(base: u16) -> Uart16550Registers<PortAccessedRegister> {
Uart16550Registers {
data: PortAccessedRegister::new(base),
int_en: PortAccessedRegister::new(base + 1),
Expand Down
0