Class M25PxxIo

java.lang.Object
cbsw.adept.xilinx.M25PxxIo

class M25PxxIo extends Object

Programmatic interface for SPI flash memories

The IO interface addresses are set in Java Preferences:

/M25Pxx/rxBase Receive buffer address

/M25Pxx/txBase Transmit buffer address

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) static final byte
     
    (package private) ByteBuffer
     
    (package private) byte[]
     
    (package private) RegisterIo
     
    (package private) final int
     
    (package private) static final byte
     
    (package private) Preferences
     
    (package private) static final byte
     
    (package private) static final byte
     
    (package private) static final byte
     
    (package private) static final byte
     
    (package private) JTextArea
     
    (package private) final int
     
    (package private) static final byte
     
    (package private) static final byte
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    append(byte code, short opLength)
    Appends dataless operation to transaction buffer
    void
    append(byte code, short opLength, byte[] buf)
    Appends operation to transaction buffer with data
    (package private) void
    bulkErase(boolean poll, JTextField statusTF)
    Does bulk erase operation
    void
    Clears the transaction buffer
    void
    getRxBuffer(int offset, byte[] buf)
    Reads data from the RX buffer
    void
    op(int offset, boolean waitflag)
    Writes instruction to buffer.
    (package private) void
    pp(int start)
    Does oage program operation
    (package private) void
    program(byte[] buf, JTextField statusTF)
    Reads the flash data from file and programs flash.
    (package private) void
    read(int start)
    Does read operation
    (package private) void
    read(int start, int len)
    Does read operation
    void
    save(FileOutputStream fo, int npages)
     
    (package private) void
    sectorErase(int start)
    Does sector erase operation
    void
    Registers a text area
    void
    showRxBuffer(int offset, byte[] buf)
    Displays data from the RX buffer
    void
    Displays text in the registered text area

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • M25PxxIo

      public M25PxxIo(RegisterIo io)

      Constructor

      Parameters:
      io - The IO interface
  • Method Details

    • setTextArea

      public void setTextArea(JTextArea textArea)

      Registers a text area

      Parameters:
      textArea - The text area
    • showText

      public void showText(String txt)

      Displays text in the registered text area

      Parameters:
      txt - The text to display
    • clear

      public void clear()

      Clears the transaction buffer

    • append

      public void append(byte code, short opLength)

      Appends dataless operation to transaction buffer

      Parameters:
      code - Opcode
      opLength - Length field of the operation in bytes
    • append

      public void append(byte code, short opLength, byte[] buf)

      Appends operation to transaction buffer with data

      Parameters:
      code - Opcode
      opLength - Length field of the operation in bytes
      buf - Data to write
    • op

      public void op(int offset, boolean waitflag)

      Writes instruction to buffer.

      End of commands is marked by x"0000" in the next length field.

      Parameters:
      offset - Offset into buffer where to start writing
      waitflag - If true, activate the IO wait feature
    • bulkErase

      void bulkErase(boolean poll, JTextField statusTF)

      Does bulk erase operation

      May take tens of seconds depending on memory type

      Parameters:
      poll - If true, poll until operation has completed
      statusTF - Text field where to write status
    • sectorErase

      void sectorErase(int start)

      Does sector erase operation

      Parameters:
      start - Start address of sector
    • read

      void read(int start)

      Does read operation

      Parameters:
      start - Start address
    • read

      void read(int start, int len)

      Does read operation

      Parameters:
      start - Start page
    • pp

      void pp(int start)

      Does oage program operation

      Currently this is just a test operation that writes a fixed pattern.

      Parameters:
      start - Start address
    • program

      void program(byte[] buf, JTextField statusTF)

      Reads the flash data from file and programs flash.

      It is most efficient to minimise the number of DEPP transactions therefore buffer several pages into the same DEPP message.

      The FPGA buffer is 16Kb so we could do up to 7 pages at a time but we must also take account of the programming time which must not exceed the 10ms DEPP timeout since we are using DEPP wait to synchronise with timeout of 10ms.

      Parameters:
      buf - Buffer containing data to write
      statusTF - Test field where to display status
    • showRxBuffer

      public void showRxBuffer(int offset, byte[] buf)

      Displays data from the RX buffer

      Parameters:
      offset - Offset in buffer from where to start reading
      buf - Buffer to receive data
    • getRxBuffer

      public void getRxBuffer(int offset, byte[] buf)

      Reads data from the RX buffer

      Parameters:
      offset - Offset in buffer from where to start reading
      buf - Buffer to receive data
    • save

      public void save(FileOutputStream fo, int npages) throws IOException
      Throws:
      IOException