aboutsummaryrefslogtreecommitdiff
path: root/src/console.rs
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2022-08-18 20:37:09 -0700
committerChristian Cunningham <cc@localhost>2022-08-18 20:37:09 -0700
commit66ee8a34f3bcde31f9d5919f2e0e363ac11f4aca (patch)
tree7a63b38c6ea59d3058d0325d4d326a9b55390c32 /src/console.rs
parent6f1e6acb1a9775eef4b0d8879c102df86e207687 (diff)
Formatted printing to UART
Diffstat (limited to 'src/console.rs')
-rw-r--r--src/console.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/console.rs b/src/console.rs
new file mode 100644
index 0000000..bcde05a
--- /dev/null
+++ b/src/console.rs
@@ -0,0 +1,18 @@
+pub mod interface {
+ use core::fmt;
+ pub trait Write {
+ fn write_char(&self, c: char);
+ fn write_fmt(&self, args: fmt::Arguments) -> fmt::Result;
+ fn flush(&self);
+ }
+
+ pub trait Statistics {
+ fn chars_written(&self) -> usize { 0 }
+ }
+
+ pub trait All: Write + Statistics {}
+}
+
+pub fn console() -> &'static crate::uart::Uart {
+ &crate::uart::UART_WRITER
+}