Compare commits

..

7 Commits

Author SHA1 Message Date
MorganTL 85da57980a -runtime main: rename function
- satman: change i2c0..1 to use raw pointer
- add reverted SFP LED commit
2023-08-04 13:32:02 +08:00
MorganTL bc1f445be7 - inline i2c0..1 into io_expander
- remove redundant i2c.init
2023-08-03 10:53:35 +08:00
MorganTL e1a2ab47e5 - remove debug message
- save 1 csr call
2023-08-03 10:53:35 +08:00
MorganTL 163a85f9d8 rust format 2023-08-03 10:53:35 +08:00
MorganTL 88d030aded fix SPF LED stay on after removal 2023-08-03 10:53:35 +08:00
MorganTL cdf4a56d97 use csr::virtual_leds for SFP0..3 LED indication 2023-08-03 10:51:48 +08:00
Sebastien Bourdeauducq ca17cd419e Revert "kasli_soc: add SFP0..3 LED indication"
This reverts commit 5111778363.
2023-08-03 10:42:09 +08:00
4 changed files with 9 additions and 17 deletions

View File

@ -87,8 +87,6 @@ class GenericStandalone(SoCCore):
self.acpki = acpki
self.rustc_cfg = dict()
self.rustc_cfg["hw_rev"] = description["hw_rev"]
platform = kasli_soc.Platform()
platform.toolchain.bitstream_commands.extend([
"set_property BITSTREAM.GENERAL.COMPRESS True [current_design]",
@ -181,8 +179,6 @@ class GenericMaster(SoCCore):
self.acpki = acpki
self.rustc_cfg = dict()
self.rustc_cfg["hw_rev"] = description["hw_rev"]
platform = kasli_soc.Platform()
platform.toolchain.bitstream_commands.extend([
"set_property BITSTREAM.GENERAL.COMPRESS True [current_design]",
@ -325,8 +321,6 @@ class GenericSatellite(SoCCore):
self.acpki = acpki
self.rustc_cfg = dict()
self.rustc_cfg["hw_rev"] = description["hw_rev"]
platform = kasli_soc.Platform()
platform.toolchain.bitstream_commands.extend([
"set_property BITSTREAM.GENERAL.COMPRESS True [current_design]",

View File

@ -56,7 +56,9 @@ impl<'a> IoExpander<'a> {
let mut io_expander = match index {
0 => IoExpander {
i2c,
channel: 0,
address: 0x40,
virtual_led_mapping: &VIRTUAL_LED_MAPPING0,
iodir: IO_DIR_MAPPING0,
out_current: [0; 2],
out_target: [0; 2],
@ -66,12 +68,12 @@ impl<'a> IoExpander<'a> {
gpioa: 0x12,
gpiob: 0x13,
},
virtual_led_mapping: &VIRTUAL_LED_MAPPING0,
channel: 0,
},
1 => IoExpander {
i2c,
channel: 1,
address: 0x42,
virtual_led_mapping: &VIRTUAL_LED_MAPPING1,
iodir: IO_DIR_MAPPING1,
out_current: [0; 2],
out_target: [0; 2],
@ -81,8 +83,6 @@ impl<'a> IoExpander<'a> {
gpioa: 0x12,
gpiob: 0x13,
},
virtual_led_mapping: &VIRTUAL_LED_MAPPING1,
channel: 1,
},
_ => return Err("incorrect I/O expander index"),
};

View File

@ -118,7 +118,7 @@ fn wait_for_virtual_leds_change() -> nb::Result<(), Void> {
}
}
#[cfg(all(feature = "target_kasli_soc", has_drtio))]
async fn async_rtio_led() {
async fn async_io_expanders_service() {
let mut io_expander0 = io_expander::IoExpander::new(unsafe { (&mut i2c::I2C_BUS).as_mut().unwrap() }, 0).unwrap();
let mut io_expander1 = io_expander::IoExpander::new(unsafe { (&mut i2c::I2C_BUS).as_mut().unwrap() }, 1).unwrap();
loop {
@ -175,7 +175,7 @@ pub fn main_core0() {
task::spawn(report_async_rtio_errors());
#[cfg(all(feature = "target_kasli_soc", has_drtio))]
task::spawn(async_rtio_led());
task::spawn(async_io_expanders_service());
comms::main(timer, cfg);
}

View File

@ -610,6 +610,7 @@ pub extern "C" fn main_core0() -> i32 {
ram::init_alloc_core0();
let mut i2c = I2c::i2c0();
let i2c_ptr = &mut i2c as *mut I2c;
i2c.init().expect("I2C initialization failed");
#[cfg(feature = "target_kasli_soc")]
{
@ -655,11 +656,8 @@ pub extern "C" fn main_core0() -> i32 {
let mut hardware_tick_ts = 0;
let mut i2c0 = I2c::i2c0();
let mut i2c1 = I2c::i2c0();
i2c0.init().expect("I2C0 initialization failed");
let mut io_expander0 = io_expander::IoExpander::new(&mut i2c0, 0).unwrap();
let mut io_expander1 = io_expander::IoExpander::new(&mut i2c1, 1).unwrap();
let mut io_expander0 = io_expander::IoExpander::new(unsafe { &mut *i2c_ptr }, 0).unwrap();
let mut io_expander1 = io_expander::IoExpander::new(unsafe { &mut *i2c_ptr }, 1).unwrap();
loop {
while !drtiosat_link_rx_up() {