diff options
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/src/main.rs b/src/main.rs index ef3e772..cdaa6eb 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,6 +9,7 @@ use std::{ fs::File, io::{self, Read}, sync::Arc, + time::Duration, }; use trve::{ @@ -17,6 +18,8 @@ use trve::{ mem::{DeviceEntry, MemAccessFault, MemConfig, MemDeviceInterface, PageNum, Ram}, }; +use crate::basic_uart::BasicUart; + fn read_file_to_buffer(path: &str, buffer: &mut [u8]) -> io::Result<usize> { let mut file = File::open(path)?; let mut total_read = 0; @@ -42,14 +45,24 @@ fn main() -> Result<(), Box<dyn Error>> { let buf = ram.buf_mut(); read_file_to_buffer("./img", buf)?; + let uart = BasicUart::new(); + let uart = uart.spawn_poller(Duration::from_millis(10)); + let mem_cfg = MemConfig { ram: Arc::new(ram), ram_start: 0x8000_0000 / 4096, - devices: Box::new([DeviceEntry { - base: 0, - size: 1, - interface: Arc::new(DbgOut), - }]), + devices: Box::new([ + DeviceEntry { + base: 0, + size: 1, + interface: Arc::new(DbgOut), + }, + DeviceEntry { + base: 1, + size: 1, + interface: uart, + }, + ]), }; let mut core = Core::new(mem_cfg); @@ -59,6 +72,8 @@ fn main() -> Result<(), Box<dyn Error>> { Ok(()) } +mod basic_uart; + struct DbgOut; impl MemDeviceInterface for DbgOut { |
