-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Move keyboard key decoding to keyboard interrupt handler * Read keys from serial * Disable cursor in shell for serial * Trim cpu brand string * Use array for writer position * Add Serial struct * Add console::clear_row() * Update autocomplete commands * Parse ANSI color code * Add colors to banner * Remove newline before diskless mode * Use lighter colors in banner * Fix ansi color code parsing * Use ansi colors in logger * Rewrite colors command * Add color to halt command * Rewrite help command * Use yellow color for titles * User kernel::console::color() in shell * Update screenshot * Fix execute state in vte parser * Fix typo * Add colors to serial logger * Fix banner colors * Add some randomnly darker colors to banner * Autocomplete devices path * Create /ini/version.txt during install
- Loading branch information
Showing
18 changed files
with
427 additions
and
191 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,3 +33,4 @@ spin = "0.5.2" | |
uart_16550 = "0.2.7" | ||
volatile = "0.2.6" | ||
x86_64 = "0.11.1" | ||
vte = "0.8.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
MOROS v{x.x.x} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,58 @@ | ||
use crate::kernel; | ||
use lazy_static::lazy_static; | ||
use spin::Mutex; | ||
use uart_16550::SerialPort; | ||
use core::fmt; | ||
use core::fmt::Write; | ||
|
||
lazy_static! { | ||
pub static ref SERIAL1: Mutex<SerialPort> = { | ||
let mut serial_port = unsafe { SerialPort::new(0x3F8) }; | ||
serial_port.init(); | ||
Mutex::new(serial_port) | ||
}; | ||
pub static ref SERIAL: Mutex<Serial> = Mutex::new(Serial::new(0x3F8)); | ||
} | ||
|
||
pub struct Serial { | ||
pub port: SerialPort | ||
} | ||
|
||
impl Serial { | ||
fn new(addr: u16) -> Self { | ||
let mut port = unsafe { SerialPort::new(addr) }; | ||
port.init(); | ||
Self { port } | ||
} | ||
|
||
fn write_string(&mut self, s: &str) { | ||
for byte in s.bytes() { | ||
self.write_byte(byte) | ||
} | ||
} | ||
|
||
pub fn write_byte(&mut self, byte: u8) { | ||
self.port.send(byte); | ||
} | ||
} | ||
|
||
impl fmt::Write for Serial { | ||
fn write_str(&mut self, s: &str) -> fmt::Result { | ||
self.write_string(s); | ||
Ok(()) | ||
} | ||
} | ||
|
||
#[doc(hidden)] | ||
pub fn print_fmt(args: ::core::fmt::Arguments) { | ||
use core::fmt::Write; | ||
SERIAL1.lock().write_fmt(args).expect("Could not print to serial"); | ||
pub fn print_fmt(args: fmt::Arguments) { | ||
SERIAL.lock().write_fmt(args).expect("Could not print to serial"); | ||
} | ||
|
||
pub fn init() { | ||
kernel::idt::set_irq_handler(4, interrupt_handler); | ||
} | ||
|
||
fn interrupt_handler() { | ||
let b = SERIAL.lock().port.receive(); | ||
let c = match b as char { | ||
'\r' => '\n', | ||
'\x7F' => '\x08', // Delete => Backspace | ||
c => c, | ||
}; | ||
kernel::console::key_handle(c); | ||
} |
Oops, something went wrong.