Kasli-SoC: Get MAC address from EEPROM #90

Merged
sb10q merged 5 commits from mwojcik/zynq-rs:mac_from_eeprom into master 2022-03-07 18:01:44 +08:00
3 changed files with 6 additions and 3 deletions
Showing only changes of commit c52de6b2d7 - Show all commits

View File

@ -15,4 +15,5 @@ target_zc706 = []
target_coraz7 = [] target_coraz7 = []
target_redpitaya = [] target_redpitaya = []
target_kasli_soc = [] target_kasli_soc = []
no_i2c = []
ipv6 = [] ipv6 = []

View File

@ -30,7 +30,7 @@ impl fmt::Display for NetAddresses {
} }
} }
#[cfg(feature = "target_kasli_soc")] #[cfg(all(feature = "target_kasli_soc", not(feature = "no_i2c")))]
fn get_address_from_eeprom() -> EthernetAddress { fn get_address_from_eeprom() -> EthernetAddress {
use libboard_zynq::i2c::{I2c, eeprom}; use libboard_zynq::i2c::{I2c, eeprom};
@ -55,8 +55,10 @@ pub fn get_addresses(cfg: &Config) -> NetAddresses {
let mut hardware_addr = EthernetAddress([0x02, 0x00, 0x00, 0x00, 0x00, 0x55]); let mut hardware_addr = EthernetAddress([0x02, 0x00, 0x00, 0x00, 0x00, 0x55]);
#[cfg(feature = "target_redpitaya")] #[cfg(feature = "target_redpitaya")]
let mut ipv4_addr = IpAddress::v4(192, 168, 1, 55); let mut ipv4_addr = IpAddress::v4(192, 168, 1, 55);
#[cfg(feature = "target_kasli_soc")] #[cfg(all(feature = "target_kasli_soc", not(feature = "no_i2c")))]
let mut hardware_addr = get_address_from_eeprom(); let mut hardware_addr = get_address_from_eeprom();
#[cfg(all(feature = "target_kasli_soc", feature = "no_i2c"))]
let mut hardware_addr = EthernetAddress([0x02, 0x00, 0x00, 0x00, 0x00, 0x56]);
#[cfg(feature = "target_kasli_soc")] #[cfg(feature = "target_kasli_soc")]
let mut ipv4_addr = IpAddress::v4(192, 168, 1, 56); let mut ipv4_addr = IpAddress::v4(192, 168, 1, 56);

View File

@ -9,7 +9,7 @@ edition = "2018"
target_zc706 = ["libboard_zynq/target_zc706", "libsupport_zynq/target_zc706", "libconfig/target_zc706"] target_zc706 = ["libboard_zynq/target_zc706", "libsupport_zynq/target_zc706", "libconfig/target_zc706"]
target_coraz7 = ["libboard_zynq/target_coraz7", "libsupport_zynq/target_coraz7", "libconfig/target_coraz7"] target_coraz7 = ["libboard_zynq/target_coraz7", "libsupport_zynq/target_coraz7", "libconfig/target_coraz7"]
target_redpitaya = ["libboard_zynq/target_redpitaya", "libsupport_zynq/target_redpitaya", "libconfig/target_redpitaya"] target_redpitaya = ["libboard_zynq/target_redpitaya", "libsupport_zynq/target_redpitaya", "libconfig/target_redpitaya"]
target_kasli_soc = ["libboard_zynq/target_kasli_soc", "libsupport_zynq/target_kasli_soc", "libconfig/target_kasli_soc"] target_kasli_soc = ["libboard_zynq/target_kasli_soc", "libsupport_zynq/target_kasli_soc", "libconfig/target_kasli_soc", "libconfig/no_i2c"]
default = ["target_zc706"] default = ["target_zc706"]
[dependencies] [dependencies]