def __init__(self, bus): self.bus = bus self.eeprom = chips.EEPROM(bus) self.temp1 = chips.LM75(bus, 0x48) self.temp2 = chips.LM75(bus, 0x49) self.spi = chips.SPI(bus, 0x2a) self.flash = chips.SPIFlash(self.spi, 0b0001)
def dump_eeproms(self, **kwargs): ee = chips.EEPROM(self, **kwargs) for port in sorted(self.ports): if port in self.skip: continue self.enable(port) if self.poll(ee.addr): eui48 = ee.fmt_eui48() logger.info("Port %s: found %s", port, eui48) open("data/{}.bin".format(eui48), "wb").write(ee.dump())
s.n31 = 65 # 125 MHz CKIN1 s.n32 = 52 # 100 MHz CKIN2 (not free run) s.n1_hs = 10 s.nc1_ls = 4 s.nc2_ls = 4 s.n2_hs = 10 s.n2_ls = 260 # 125MHz CKOUT s.bwsel = 10 si.setup(s) logger.warning("flags %s %s %s", si.has_xtal(), si.has_clkin2(), si.locked()) elif action == "sfp": bus.enable(args.eem) sfp0 = chips.SFF8472(bus) sfp0.report() # for i in 0x50, 0x51, 0x56: # sfp0.print_dump(bus.read_many(i, 0, 256)) # sfp0.watch(n=0) elif action == "ee": bus.enable(args.eem) ee = chips.EEPROM(bus) logger.warning(ee.fmt_eui48()) logger.warning(ee.dump()) io = chips.PCF8574(bus, addr=0x3e) # io.write(0xff) # logger.warning(hex(io.read())) else: raise ValueError("unknown action", action) finally: bus.enable()