forked from M-Labs/artiq
1
0
Fork 0

efc: add DRTIO virtual LEDs

- EFC Gateware: Add virtual_leds to rtio
- EFC Firmware: io_expander is kept being serviced to update
  virtual_leds after init
This commit is contained in:
linuswck 2023-08-23 06:21:14 +00:00 committed by GitHub
parent b7bac8c9d8
commit cd22e42cb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 2 deletions

View File

@ -83,7 +83,6 @@ impl IoExpander {
#[cfg(soc_platform = "efc")] #[cfg(soc_platform = "efc")]
pub fn new() -> Result<Self, &'static str> { pub fn new() -> Result<Self, &'static str> {
// TODO: Put Virtual User LEDs L0 L1 in gateware
const VIRTUAL_LED_MAPPING: [(u8, u8, u8); 2] = [(0, 0, 5), (1, 0, 6)]; const VIRTUAL_LED_MAPPING: [(u8, u8, u8); 2] = [(0, 0, 5), (1, 0, 6)];
let mut io_expander = IoExpander { let mut io_expander = IoExpander {

View File

@ -531,9 +531,15 @@ pub extern fn main() -> i32 {
sysclk_setup(); sysclk_setup();
#[cfg(soc_platform = "efc")]
let mut io_expander;
#[cfg(soc_platform = "efc")] #[cfg(soc_platform = "efc")]
{ {
let mut io_expander = board_misoc::io_expander::IoExpander::new().unwrap(); io_expander = board_misoc::io_expander::IoExpander::new().unwrap();
// Enable LEDs
io_expander.set_oe(0, 1 << 5 | 1 << 6 | 1 << 7).unwrap();
// Enable VADJ and P3V3_FMC // Enable VADJ and P3V3_FMC
io_expander.set_oe(1, 1 << 0 | 1 << 1).unwrap(); io_expander.set_oe(1, 1 << 0 | 1 << 1).unwrap();
@ -576,6 +582,8 @@ pub extern fn main() -> i32 {
io_expander0.service().expect("I2C I/O expander #0 service failed"); io_expander0.service().expect("I2C I/O expander #0 service failed");
io_expander1.service().expect("I2C I/O expander #1 service failed"); io_expander1.service().expect("I2C I/O expander #1 service failed");
} }
#[cfg(soc_platform = "efc")]
io_expander.service().expect("I2C I/O expander service failed");
hardware_tick(&mut hardware_tick_ts); hardware_tick(&mut hardware_tick_ts);
} }
@ -609,6 +617,8 @@ pub extern fn main() -> i32 {
io_expander0.service().expect("I2C I/O expander #0 service failed"); io_expander0.service().expect("I2C I/O expander #0 service failed");
io_expander1.service().expect("I2C I/O expander #1 service failed"); io_expander1.service().expect("I2C I/O expander #1 service failed");
} }
#[cfg(soc_platform = "efc")]
io_expander.service().expect("I2C I/O expander service failed");
hardware_tick(&mut hardware_tick_ts); hardware_tick(&mut hardware_tick_ts);
if drtiosat_tsc_loaded() { if drtiosat_tsc_loaded() {
info!("TSC loaded from uplink"); info!("TSC loaded from uplink");

View File

@ -12,6 +12,7 @@ from misoc.integration.builder import builder_args, builder_argdict
from artiq.gateware.amp import AMPSoC from artiq.gateware.amp import AMPSoC
from artiq.gateware import rtio from artiq.gateware import rtio
from artiq.gateware.rtio.xilinx_clocking import fix_serdes_timing_path from artiq.gateware.rtio.xilinx_clocking import fix_serdes_timing_path
from artiq.gateware.rtio.phy import ttl_simple
from artiq.gateware.drtio.transceiver import eem_serdes from artiq.gateware.drtio.transceiver import eem_serdes
from artiq.gateware.drtio.rx_synchronizer import XilinxRXSynchronizer from artiq.gateware.drtio.rx_synchronizer import XilinxRXSynchronizer
from artiq.gateware.drtio import * from artiq.gateware.drtio import *
@ -122,6 +123,11 @@ class Satellite(BaseSoC, AMPSoC):
self.rtio_channels = [] self.rtio_channels = []
for i in range(2):
phy = ttl_simple.Output(self.virtual_leds.get(i))
self.submodules += phy
self.rtio_channels.append(rtio.Channel.from_phy(phy))
self.config["HAS_RTIO_LOG"] = None self.config["HAS_RTIO_LOG"] = None
self.config["RTIO_LOG_CHANNEL"] = len(self.rtio_channels) self.config["RTIO_LOG_CHANNEL"] = len(self.rtio_channels)
self.rtio_channels.append(rtio.LogChannel()) self.rtio_channels.append(rtio.LogChannel())