kasli_soc: add SFP0..3 LED indication #242

Merged
sb10q merged 2 commits from morgan/artiq-zynq:feature into master 2023-07-24 16:30:15 +08:00
1 changed files with 10 additions and 8 deletions
Showing only changes of commit a87b0e388b - Show all commits

View File

@ -11,9 +11,9 @@ struct Registers {
}
//IO expanders pins
const IO_DIR_INPUT_ALL: u8 = 0xFF;
const IO_DIR_INPUT_ALL: u8 = 0xFF;
const IO_DIR_OUT_SFP_TX_DISABLE: u8 = !0x02;
const IO_DIR_OUT_SFP_LED:u8 = !0x40;
const IO_DIR_OUT_SFP_LED: u8 = !0x40;
//SFP0 LED has different place in v1.1
#[cfg(hw_rev = "v1.0")]
const IO_DIR_OUT_SFP0_LED: u8 = !0x40;
@ -21,13 +21,15 @@ const IO_DIR_OUT_SFP0_LED: u8 = !0x40;
const IO_DIR_OUT_SFP0_LED: u8 = !0x80;
//IO expander port direction
const IO_DIR_MAPPING0: [u8; 2] = [IO_DIR_INPUT_ALL & IO_DIR_OUT_SFP_TX_DISABLE & (IO_DIR_OUT_SFP0_LED),
IO_DIR_INPUT_ALL & IO_DIR_OUT_SFP_TX_DISABLE & IO_DIR_OUT_SFP_LED];
const IO_DIR_MAPPING1: [u8; 2] = [IO_DIR_INPUT_ALL & IO_DIR_OUT_SFP_TX_DISABLE & IO_DIR_OUT_SFP_LED,
IO_DIR_INPUT_ALL & IO_DIR_OUT_SFP_TX_DISABLE & IO_DIR_OUT_SFP_LED];
const IO_DIR_MAPPING0: [u8; 2] = [
IO_DIR_INPUT_ALL & IO_DIR_OUT_SFP_TX_DISABLE & (IO_DIR_OUT_SFP0_LED),
IO_DIR_INPUT_ALL & IO_DIR_OUT_SFP_TX_DISABLE & IO_DIR_OUT_SFP_LED,
];
const IO_DIR_MAPPING1: [u8; 2] = [
IO_DIR_INPUT_ALL & IO_DIR_OUT_SFP_TX_DISABLE & IO_DIR_OUT_SFP_LED,
IO_DIR_INPUT_ALL & IO_DIR_OUT_SFP_TX_DISABLE & IO_DIR_OUT_SFP_LED,
];
pub struct IoExpander<'a> {
i2c: &'a mut i2c::I2c,