def __init__(self, name="AxiMicronMt28ew", description="AXI-Lite Micron MT28EW PROM", tryCount=5, **kwargs): super().__init__(name=name, description=description, size=(0x1 << 12), **kwargs) self._mcs = misc.McsReader() self._progDone = False self._tryCount = tryCount @self.command( value='', description="Load the .MCS into PROM", ) def LoadMcsFile(arg): click.secho(('%s.LoadMcsFile: %s' % (self.path, arg)), fg='green') self._progDone = False # Start time measurement for profiling start = time.time() # Open the MCS file self._mcs.open(arg) # Erase the PROM self.eraseProm() # Write to the PROM self.writeProm() # Verify the PROM self.verifyProm() # End time measurement for profiling end = time.time() elapsed = end - start click.secho('LoadMcsFile() took %s to program the PROM' % datetime.timedelta(seconds=int(elapsed)), fg='green') # Add a power cycle reminder self._progDone = True click.secho( "\n\n\ ***************************************************\n\ ***************************************************\n\ The MCS data has been written into the PROM. \n\ To reprogram the FPGA with the new PROM data, \n\ a IPROG CMD or power cycle is be required.\n\ ***************************************************\n\ ***************************************************\n\n"\ , bg='green', )
def __init__( self, name="AxiMicronN25Q", description="AXI-Lite Micron N25Q and Micron MT25Q PROM", addrMode=False, # False = 24-bit Address mode, True = 32-bit Address Mode tryCount=5, **kwargs): super().__init__(name=name, description=description, size=(0x1 << 10), **kwargs) self._mcs = misc.McsReader() self._addrMode = addrMode self._progDone = False self._tryCount = tryCount ############################## # Constants ############################## self.READ_3BYTE_CMD = (0x03 << 16) self.READ_4BYTE_CMD = (0x13 << 16) self.FLAG_STATUS_REG = (0x70 << 16) self.FLAG_STATUS_RDY = (0x80) self.WRITE_ENABLE_CMD = (0x06 << 16) self.WRITE_DISABLE_CMD = (0x04 << 16) self.ADDR_ENTER_CMD = (0xB7 << 16) self.ADDR_EXIT_CMD = (0xE9 << 16) self.ERASE_CMD = (0xD8 << 16) self.WRITE_CMD = (0x02 << 16) self.STATUS_REG_WR_CMD = (0x01 << 16) self.STATUS_REG_RD_CMD = (0x05 << 16) self.DEV_ID_RD_CMD = (0x9F << 16) self.WRITE_NONVOLATILE_CONFIG = (0xB1 << 16) self.WRITE_VOLATILE_CONFIG = (0x81 << 16) self.READ_NONVOLATILE_CONFIG = (0xB5 << 16) self.READ_VOLATILE_CONFIG = (0x85 << 16) ########################## ## Configuration Register: ########################## ## BIT[15:12] Number of dummy clock cycles = 0xF (default) ## BIT[11:09] XIP mode at power-on reset = 0x7 (default) ## BIT[08:06] Output driver strength = x7 (default) ## BIT[05:05] Double transfer rate protocol = 0x1 (default) ## BIT[04:04] Reset/hold = 0x1 (default) ## BIT[03:03] Quad I/O protocol = 0x1 (default) ## BIT[02:02] Dual I/O protocol = 0x1 (default) ## BIT[01:01] 128Mb segment select = 0x1 (default) ## BIT[00:00] 1 = Enable 3-byte address mode (default) ## BIT[00:00] 0 = Enable 4-byte address mode self.DEFAULT_3BYTE_CONFIG = 0xFFFF self.DEFAULT_4BYTE_CONFIG = 0xFFFE self.READ_MASK = 0x00000000 self.WRITE_MASK = 0x80000000 self.VERIFY_MASK = 0x40000000 self.add( pr.LocalCommand( name='LoadMcsFile', function=self._LoadMcsFile, description='Load the .MCS into PROM', value='', ))