forked from M-Labs/artiq
1
0
Fork 0

firmware: move mod ethmac to libboard.

This commit is contained in:
whitequark 2017-12-28 14:40:15 +00:00
parent 55cfdec644
commit 33e0393e4a
5 changed files with 17 additions and 6 deletions

View File

@ -15,5 +15,11 @@ build_misoc = { path = "../libbuild_misoc" }
[dependencies]
byteorder = { version = "1.0", default-features = false }
[dependencies.smoltcp]
git = "https://github.com/m-labs/smoltcp"
rev = "507d2fe"
default-features = false
optional = true
[features]
uart_console = []

View File

@ -2,7 +2,8 @@ use core::{slice, fmt};
use smoltcp::Result;
use smoltcp::phy::{self, DeviceCapabilities, Device};
use board::{csr, mem};
use csr;
use mem::ETHMAC_BASE;
const RX_SLOTS: usize = csr::ETHMAC_RX_SLOTS as usize;
const TX_SLOTS: usize = csr::ETHMAC_TX_SLOTS as usize;
@ -30,12 +31,12 @@ fn next_tx_slot() -> Option<usize> {
fn rx_buffer(slot: usize) -> *const u8 {
debug_assert!(slot < RX_SLOTS);
(mem::ETHMAC_BASE + SLOT_SIZE * slot) as _
(ETHMAC_BASE + SLOT_SIZE * slot) as _
}
fn tx_buffer(slot: usize) -> *mut u8 {
debug_assert!(slot < TX_SLOTS);
(mem::ETHMAC_BASE + SLOT_SIZE * (RX_SLOTS + slot)) as _
(ETHMAC_BASE + SLOT_SIZE * (RX_SLOTS + slot)) as _
}
pub struct EthernetDevice(());

View File

@ -2,6 +2,8 @@
#![feature(asm)]
extern crate byteorder;
#[cfg(feature = "smoltcp")]
extern crate smoltcp;
#[cfg(target_arch = "or1k")]
#[path = "or1k/mod.rs"]
@ -21,3 +23,5 @@ pub mod spiflash;
pub mod config;
#[cfg(feature = "uart_console")]
pub mod uart_console;
#[cfg(all(has_ethmac, feature = "smoltcp"))]
pub mod ethmac;

View File

@ -17,7 +17,7 @@ build_artiq = { path = "../libbuild_artiq" }
byteorder = { version = "1.0", default-features = false }
cslice = { version = "0.3" }
log = { version = "0.3", default-features = false }
board = { path = "../libboard", features = ["uart_console"] }
board = { path = "../libboard", features = ["uart_console", "smoltcp"] }
alloc_list = { path = "../liballoc_list" }
std_artiq = { path = "../libstd_artiq", features = ["alloc", "io_error_alloc"] }
logger_artiq = { path = "../liblogger_artiq" }

View File

@ -26,11 +26,11 @@ extern crate drtioaux;
use smoltcp::wire::{EthernetAddress, IpAddress, IpCidr};
use board::config;
#[cfg(has_ethmac)]
use board::ethmac;
use proto::{mgmt_proto, analyzer_proto, moninj_proto, rpc_proto, session_proto, kernel_proto};
use amp::{mailbox, rpc_queue};
#[cfg(has_ethmac)]
mod ethmac;
#[cfg(has_rtio_core)]
mod rtio_mgt;