forked from M-Labs/artiq
1
0
Fork 0

sayma: support reading EUI48 from MMCSPI

This commit is contained in:
Harry Ho 2021-09-13 12:34:55 +08:00 committed by Sébastien Bourdeauducq
parent 105af644bd
commit 40e7b6058e
1 changed files with 8 additions and 1 deletions

View File

@ -5,6 +5,8 @@ use smoltcp::wire::{EthernetAddress, IpAddress};
use config; use config;
#[cfg(soc_platform = "kasli")] #[cfg(soc_platform = "kasli")]
use i2c_eeprom; use i2c_eeprom;
#[cfg(soc_platform = "sayma_amc")]
use mmcspi;
pub struct NetAddresses { pub struct NetAddresses {
@ -40,7 +42,12 @@ pub fn get_adresses() -> NetAddresses {
.unwrap_or_else(|_e| EthernetAddress([0x02, 0x00, 0x00, 0x00, 0x00, 0x21])); .unwrap_or_else(|_e| EthernetAddress([0x02, 0x00, 0x00, 0x00, 0x00, 0x21]));
} }
#[cfg(soc_platform = "sayma_amc")] #[cfg(soc_platform = "sayma_amc")]
{ hardware_addr = EthernetAddress([0x02, 0x00, 0x00, 0x00, 0x00, 0x11]); } {
let mut eui48 = [0_u8; 6];
mmcspi::read_eui48(&mut eui48)
.expect("Failed to detect EUI48 from MMC");
hardware_addr = EthernetAddress(eui48);
}
#[cfg(soc_platform = "metlino")] #[cfg(soc_platform = "metlino")]
{ hardware_addr = EthernetAddress([0x02, 0x00, 0x00, 0x00, 0x00, 0x19]); } { hardware_addr = EthernetAddress([0x02, 0x00, 0x00, 0x00, 0x00, 0x19]); }
#[cfg(soc_platform = "kc705")] #[cfg(soc_platform = "kc705")]