|
|
|
@ -72,11 +72,14 @@ impl Driver for E1000Interface {
|
|
|
|
|
fn try_handle_interrupt(&self) -> bool {
|
|
|
|
|
let irq = {
|
|
|
|
|
let driver = self.driver.0.lock();
|
|
|
|
|
|
|
|
|
|
if let None = active_table().get_entry(driver.header) {
|
|
|
|
|
let mut current_addr = driver.header;
|
|
|
|
|
while current_addr < driver.header + driver.size {
|
|
|
|
|
active_table().map_if_not_exists(current_addr, current_addr);
|
|
|
|
|
current_addr = current_addr + PAGE_SIZE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let e1000 = unsafe {
|
|
|
|
|
slice::from_raw_parts_mut(driver.header as *mut Volatile<u32>, driver.size / 4)
|
|
|
|
@ -115,12 +118,13 @@ impl Driver for E1000Interface {
|
|
|
|
|
|
|
|
|
|
impl E1000 {
|
|
|
|
|
fn transmit_available(&self) -> bool {
|
|
|
|
|
// TODO map it in all cpu
|
|
|
|
|
if let None = active_table().get_entry(self.header) {
|
|
|
|
|
let mut current_addr = self.header;
|
|
|
|
|
while current_addr < self.header + self.size {
|
|
|
|
|
active_table().map_if_not_exists(current_addr, current_addr);
|
|
|
|
|
current_addr = current_addr + PAGE_SIZE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let e1000 =
|
|
|
|
|
unsafe { slice::from_raw_parts_mut(self.header as *mut Volatile<u32>, self.size / 4) };
|
|
|
|
@ -136,12 +140,13 @@ impl E1000 {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn receive_available(&self) -> bool {
|
|
|
|
|
// TODO map it in all cpu
|
|
|
|
|
if let None = active_table().get_entry(self.header) {
|
|
|
|
|
let mut current_addr = self.header;
|
|
|
|
|
while current_addr < self.header + self.size {
|
|
|
|
|
active_table().map_if_not_exists(current_addr, current_addr);
|
|
|
|
|
current_addr = current_addr + PAGE_SIZE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let e1000 =
|
|
|
|
|
unsafe { slice::from_raw_parts_mut(self.header as *mut Volatile<u32>, self.size / 4) };
|
|
|
|
|