mirror of https://github.com/m-labs/artiq.git
firmware: move mod ethmac to libboard.
This commit is contained in:
parent
55cfdec644
commit
33e0393e4a
|
@ -15,5 +15,11 @@ build_misoc = { path = "../libbuild_misoc" }
|
||||||
[dependencies]
|
[dependencies]
|
||||||
byteorder = { version = "1.0", default-features = false }
|
byteorder = { version = "1.0", default-features = false }
|
||||||
|
|
||||||
|
[dependencies.smoltcp]
|
||||||
|
git = "https://github.com/m-labs/smoltcp"
|
||||||
|
rev = "507d2fe"
|
||||||
|
default-features = false
|
||||||
|
optional = true
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
uart_console = []
|
uart_console = []
|
||||||
|
|
|
@ -2,7 +2,8 @@ use core::{slice, fmt};
|
||||||
use smoltcp::Result;
|
use smoltcp::Result;
|
||||||
use smoltcp::phy::{self, DeviceCapabilities, Device};
|
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 RX_SLOTS: usize = csr::ETHMAC_RX_SLOTS as usize;
|
||||||
const TX_SLOTS: usize = csr::ETHMAC_TX_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 {
|
fn rx_buffer(slot: usize) -> *const u8 {
|
||||||
debug_assert!(slot < RX_SLOTS);
|
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 {
|
fn tx_buffer(slot: usize) -> *mut u8 {
|
||||||
debug_assert!(slot < TX_SLOTS);
|
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(());
|
pub struct EthernetDevice(());
|
|
@ -2,6 +2,8 @@
|
||||||
#![feature(asm)]
|
#![feature(asm)]
|
||||||
|
|
||||||
extern crate byteorder;
|
extern crate byteorder;
|
||||||
|
#[cfg(feature = "smoltcp")]
|
||||||
|
extern crate smoltcp;
|
||||||
|
|
||||||
#[cfg(target_arch = "or1k")]
|
#[cfg(target_arch = "or1k")]
|
||||||
#[path = "or1k/mod.rs"]
|
#[path = "or1k/mod.rs"]
|
||||||
|
@ -21,3 +23,5 @@ pub mod spiflash;
|
||||||
pub mod config;
|
pub mod config;
|
||||||
#[cfg(feature = "uart_console")]
|
#[cfg(feature = "uart_console")]
|
||||||
pub mod uart_console;
|
pub mod uart_console;
|
||||||
|
#[cfg(all(has_ethmac, feature = "smoltcp"))]
|
||||||
|
pub mod ethmac;
|
||||||
|
|
|
@ -17,7 +17,7 @@ build_artiq = { path = "../libbuild_artiq" }
|
||||||
byteorder = { version = "1.0", default-features = false }
|
byteorder = { version = "1.0", default-features = false }
|
||||||
cslice = { version = "0.3" }
|
cslice = { version = "0.3" }
|
||||||
log = { version = "0.3", default-features = false }
|
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" }
|
alloc_list = { path = "../liballoc_list" }
|
||||||
std_artiq = { path = "../libstd_artiq", features = ["alloc", "io_error_alloc"] }
|
std_artiq = { path = "../libstd_artiq", features = ["alloc", "io_error_alloc"] }
|
||||||
logger_artiq = { path = "../liblogger_artiq" }
|
logger_artiq = { path = "../liblogger_artiq" }
|
||||||
|
|
|
@ -26,11 +26,11 @@ extern crate drtioaux;
|
||||||
use smoltcp::wire::{EthernetAddress, IpAddress, IpCidr};
|
use smoltcp::wire::{EthernetAddress, IpAddress, IpCidr};
|
||||||
|
|
||||||
use board::config;
|
use board::config;
|
||||||
|
#[cfg(has_ethmac)]
|
||||||
|
use board::ethmac;
|
||||||
use proto::{mgmt_proto, analyzer_proto, moninj_proto, rpc_proto, session_proto, kernel_proto};
|
use proto::{mgmt_proto, analyzer_proto, moninj_proto, rpc_proto, session_proto, kernel_proto};
|
||||||
use amp::{mailbox, rpc_queue};
|
use amp::{mailbox, rpc_queue};
|
||||||
|
|
||||||
#[cfg(has_ethmac)]
|
|
||||||
mod ethmac;
|
|
||||||
#[cfg(has_rtio_core)]
|
#[cfg(has_rtio_core)]
|
||||||
mod rtio_mgt;
|
mod rtio_mgt;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue