: Class DataPort

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.dalsemi.system
Class DataPort

    java.lang.Object
      |
      +--com.dalsemi.system.DataPort

public class DataPort
extends Object

This class allows byte wide reads and writes to memory mapped IO devices.

Two modes are available: Sequential and FIFO (First In First Out). Sequential mode is the default and automatically increments the address after each byte when block reads and writes occur. FIFO access only writes to the specified address, and does not increment the address during block reads and writes. `setFIFOMode` should be called to set the appropriate mode. After each `read` or `write` call, the memory address is returned to the start address designated by `setAddress`.

For slower memory devices, the use of stretch cycles access may be needed. Set this parameter via `setStretchCycles`.

Eight chip enables are available, CE0-CE3, PCE0-PCE3.
The memory map is divided into two segments.
CE decoded address space spans from 0 - 4MB: `0x00000000 - 0x003FFFFF`
PCE decoded address space spans from 8MB - 12MB: `0x00800000 - 0x00BFFFFF`

Expected Transfer Speeds
Function | Speed (bytes/s)
to CE Sequential | 655000
to PCE Sequential | 172000
to CE FIFO | 655000
to PCE FIFO | 172000
single byte only | 770

Field Summary
`int` | `address` Starting memory address for mapped IO access.
`int` | `latchValue` The last written value.
`static byte` | `STRETCH0` Use to set the number of memory bus cycles to 2.
`static byte` | `STRETCH1` Use to set the number of memory bus cycles to 3.
`static byte` | `STRETCH10` Use to set the number of memory bus cycles to 12.
`static byte` | `STRETCH2` Use to set the number of memory bus cycles to 4.
`static byte` | `STRETCH3` Use to set the number of memory bus cycles to 5.
`static byte` | `STRETCH7` Use to set the number of memory bus cycles to 9.
`static byte` | `STRETCH8` Use to set the number of memory bus cycles to 10.
`static byte` | `STRETCH9` Use to set the number of memory bus cycles to 11.
`byte` | `stretchCycles` Number of stretch memory cycles to use when accessing memory mapped IO.
`boolean` | `useFIFOAccess` Set to `true` to access FIFO type devices.

Constructor Summary
`DataPort()` Creates a DataPort object with address of 0x000000.
`DataPort(int address)` Creates a DataPort object using the address specified.

Method Summary
`int` | `getAddress()` Gets the starting address for read/write.
`boolean` | `getFIFOMode()` Gets the FIFO mode.
`int` | `getStretchCycles()` Gets the number of stretch memory cycles to use when accessing memory mapped IO.
`int` | `read()` Reads a single byte from the `address`.
`int` | `read(byte[] arr, int off, int len)` Reads bytes into an array starting at the `address`.
`int` | `readLatch()` Reads the current latch value.
`void` | `setAddress(int address)` Sets the starting address for read/write.
`void` | `setFIFOMode(boolean useFIFOAccess)` Sets/Clears the FIFO mode.
`void` | `setStretchCycles(byte stretch)` Sets the number of stretch memory cycles to use when accessing memory mapped IO.
`void` | `write(byte[] arr, int off, int len)` Writes an array of bytes starting at the `address`.
`void` | `write(int value)` Writes a single byte to the `address`.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### STRETCH0

    public static final byte STRETCH0

  Use to set the number of memory bus cycles to 2.

### STRETCH1

    public static final byte STRETCH1

  Use to set the number of memory bus cycles to 3.

### STRETCH2

    public static final byte STRETCH2

  Use to set the number of memory bus cycles to 4.

### STRETCH3

    public static final byte STRETCH3

  Use to set the number of memory bus cycles to 5.

### STRETCH7

    public static final byte STRETCH7

  Use to set the number of memory bus cycles to 9.

### STRETCH8

    public static final byte STRETCH8

  Use to set the number of memory bus cycles to 10.

### STRETCH9

    public static final byte STRETCH9

  Use to set the number of memory bus cycles to 11.

### STRETCH10

    public static final byte STRETCH10

  Use to set the number of memory bus cycles to 12.

### address

    public int address

  Starting memory address for mapped IO access.

### useFIFOAccess

    public boolean useFIFOAccess

  Set to `true` to access FIFO type devices.

### latchValue

    public int latchValue

  The last written value.

### stretchCycles

    public byte stretchCycles

  Number of stretch memory cycles to use when accessing memory mapped IO. Valid values are:
  `STRETCH0`
  `STRETCH1`
  `STRETCH2`
  `STRETCH3`
  `STRETCH7`
  `STRETCH8`
  `STRETCH9`
  `STRETCH10`

Constructor Detail

### DataPort

    public DataPort()

  Creates a DataPort object with address of 0x000000.

### DataPort

    public DataPort(int address)

  Creates a DataPort object using the address specified.
  Parameters:
    `address` - address location for read/write.

Method Detail

### readLatch

    public int readLatch()

  Reads the current latch value. This is always the last value written. To read the current value of the pin, call the `read` method.
  Returns:
    latch value

### read

    public int read()
             throws IllegalAddressException

  Reads a single byte from the `address`.
  Returns:
    byte read
  Throws:
    IllegalAddressException - if `address` is out of range

### read

    public int read(byte[] arr,
                    int off,
                    int len)
             throws IllegalAddressException

  Reads bytes into an array starting at the `address`.
  Parameters:
    `arr` - array of bytes
    `off` - starting offset to read into
    `len` - length to read
  Returns:
    number of bytes read
  Throws:
    IllegalAddressException - if `address` is out of range

### write

    public void write(int value)
               throws IllegalAddressException

  Writes a single byte to the `address`.
  Parameters:
    `value` - single byte to write
  Throws:
    IllegalAddressException - if `address` is out of range

### write

    public void write(byte[] arr,
                      int off,
                      int len)
               throws IllegalAddressException

  Writes an array of bytes starting at the `address`.
  Parameters:
    `arr` - array of bytes
    `off` - starting offset to send
    `len` - length to send
  Throws:
    IllegalAddressException - if `address` is out of range

### setAddress

    public void setAddress(int address)

  Sets the starting address for read/write.
  Parameters:
    `address` - address for read/write

### getAddress

    public int getAddress()

  Gets the starting address for read/write.
  Returns:
    address for read/write

### setFIFOMode

    public void setFIFOMode(boolean useFIFOAccess)

  Sets/Clears the FIFO mode.
  Parameters:
    `useFIFOAddress` - `false` for automatic incrementing of address during multiple reads, or `true` for FIFO style non-incrementing addressing

### getFIFOMode

    public boolean getFIFOMode()

  Gets the FIFO mode.
  Returns:
    `true` if using FIFO mode, `false` if using sequential mode

### setStretchCycles

    public void setStretchCycles(byte stretch)
                          throws IllegalArgumentException

  Sets the number of stretch memory cycles to use when accessing memory mapped IO. Valid values are:
  `STRETCH0`
  `STRETCH1`
  `STRETCH2`
  `STRETCH3`
  `STRETCH7`
  `STRETCH8`
  `STRETCH9`
  `STRETCH10`
  Parameters:
    `stretch` - stretch cycle value
  Throws:
    IllegalArgumentException - if stretch is out of range

### getStretchCycles

    public int getStretchCycles()

  Gets the number of stretch memory cycles to use when accessing memory mapped IO.
  Returns:
    stretch cycle value

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD