com.dalsemi.system
Class BitPort

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

public class BitPort
extends Object

This class allows bit manipulation of available processor port pins, SMC Ethernet controller port pins and provides abstracted methods of manipulating bits in memory mapped IO addresses through the DataPort class.

See Also:
DataPort

Field Summary
static byte ETH_EEDO
          SMC EEDO, output ONLY, pin 4.
static byte ETH_EESK
          SMC EESK, output ONLY, pin 7.
static byte ETH_IOS0
          SMC IOS0, input ONLY, pin 98.
static byte ETH_IOS1
          SMC IOS1, input ONLY, pin 99.
static byte ETH_IOS2
          SMC IOS2, input ONLY, pin 1.
 int latchValue
          The last written value.
static byte Port3Bit0
          P3.0, RXD0, "serial 0", pin 4.
static byte Port3Bit1
          P3.1, TXD0, "serial 0", pin 5.
static byte Port3Bit2
          P3.2, /INT0, /SMCINT (Ethernet interrupt), pin 6.
static byte Port3Bit3
          P3.3, /INT1, /EXTINT (External interrupt), pin 7.
static byte Port3Bit4
          P3.4, T0, /SMCRST (Ethernet Reset), pin 10.
static byte Port3Bit5
          P3.5, T1, INTOW (Internal 1-Wire), pin 11.
static byte Port5Bit0
          P5.0, C0TX, I2C SCL, pin 21.
static byte Port5Bit1
          P5.1, C0RX, I2C SDA, pin 20.
static byte Port5Bit2
          P5.2, C1RX, RXD1, DS2480 RX, "serial 1", pin 19.
static byte Port5Bit3
          P5.3, C1TX, TXD1, DS2480 TX, "serial 1", pin 18.
static byte Port5Bit4
          P5.4, /PCE0, pin 17.
static byte Port5Bit5
          P5.5, /PCE1, pin 16.
static byte Port5Bit6
          P5.6, /PCE2, pin 15.
static byte Port5Bit7
          P5.7, /PCE3, pin 14.
 
Constructor Summary
BitPort(byte bitname)
          Creates a new instance of BitPort using the bit specified.
BitPort(DataPort port)
          Creates a new instance of BitPort using the DataPort object specified.
 
Method Summary
 void clear()
          Clears the port pin low.
 void clear(int bitpos)
          Clears the specified bit low.
 int read()
          Reads the port pin.
 int readBit(int bitpos)
          Reads the specified pin.
 int readLatch()
          Reads the current latch value.
 int readLatch(int bitpos)
          Reads the latch value of the specified pin.
 void set()
          Sets the pin high.
 void set(int bitpos)
          Sets the specified bit high.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Port5Bit0

public static final byte Port5Bit0
P5.0, C0TX, I2C SCL, pin 21.

Port5Bit1

public static final byte Port5Bit1
P5.1, C0RX, I2C SDA, pin 20.

Port5Bit2

public static final byte Port5Bit2
P5.2, C1RX, RXD1, DS2480 RX, "serial 1", pin 19.

Port5Bit3

public static final byte Port5Bit3
P5.3, C1TX, TXD1, DS2480 TX, "serial 1", pin 18.

Port5Bit4

public static final byte Port5Bit4
P5.4, /PCE0, pin 17.

Port5Bit5

public static final byte Port5Bit5
P5.5, /PCE1, pin 16.

Port5Bit6

public static final byte Port5Bit6
P5.6, /PCE2, pin 15.

Port5Bit7

public static final byte Port5Bit7
P5.7, /PCE3, pin 14.

Port3Bit0

public static final byte Port3Bit0
P3.0, RXD0, "serial 0", pin 4.

Port3Bit1

public static final byte Port3Bit1
P3.1, TXD0, "serial 0", pin 5.

Port3Bit2

public static final byte Port3Bit2
P3.2, /INT0, /SMCINT (Ethernet interrupt), pin 6.

Port3Bit3

public static final byte Port3Bit3
P3.3, /INT1, /EXTINT (External interrupt), pin 7.

Port3Bit4

public static final byte Port3Bit4
P3.4, T0, /SMCRST (Ethernet Reset), pin 10.

Port3Bit5

public static final byte Port3Bit5
P3.5, T1, INTOW (Internal 1-Wire), pin 11.

ETH_EESK

public static final byte ETH_EESK
SMC EESK, output ONLY, pin 7. WARNING: This pin may also be used as serial flow control by the serial driver. Be aware of resource usage. You have been warned!

ETH_EEDO

public static final byte ETH_EEDO
SMC EEDO, output ONLY, pin 4. WARNING: This pin may also be used as serial flow control by the serial driver. Be aware of resource usage. You have been warned!

ETH_IOS0

public static final byte ETH_IOS0
SMC IOS0, input ONLY, pin 98. WARNING: This pin may also be used as serial flow control by the serial driver. Be aware of resource usage. You have been warned!

ETH_IOS1

public static final byte ETH_IOS1
SMC IOS1, input ONLY, pin 99. WARNING: This pin may also be used as serial flow control by the serial driver. Be aware of resource usage. You have been warned!

ETH_IOS2

public static final byte ETH_IOS2
SMC IOS2, input ONLY, pin 1. WARNING: This pin may also be used as serial flow control by the serial driver. Be aware of resource usage. You have been warned!

latchValue

public int latchValue
The last written value.
Constructor Detail

BitPort

public BitPort(byte bitname)
Creates a new instance of BitPort using the bit specified.
Parameters:
bitname - descriptor of bit to twiddle (e.g. Port5Bit0)

BitPort

public BitPort(DataPort port)
Creates a new instance of BitPort using the DataPort object specified.
Parameters:
port - An eight bit wide field of bits to twiddle
Method Detail

set

public void set()
Sets the pin high.

clear

public void clear()
Clears the port pin low.

read

public int read()
Reads the port pin.
Returns:
pin value

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

set

public void set(int bitpos)
         throws IllegalAddressException
Sets the specified bit high.
Parameters:
bitpos - value 0-7 of bit to set
Throws:
IllegalAddressException - if DataPort reports an exception during the operation

clear

public void clear(int bitpos)
           throws IllegalAddressException
Clears the specified bit low.
Parameters:
bitpos - value 0-7 of bit to clear
Throws:
IllegalAddressException - if DataPort reports an exception during the operation

readBit

public int readBit(int bitpos)
            throws IllegalAddressException
Reads the specified pin.
Side effect: Will update all bits in the byte.
Parameters:
bitpos - value 0-7 of bit to read.
Returns:
port pin value
Throws:
IllegalAddressException - if DataPort reports an exception during the operation

readLatch

public int readLatch(int bitpos)
Reads the latch value of the specified pin. This is always the last value written. To read the current value of the pin, call the read method.
Parameters:
bitpos - value 0-7 of bit to read.
Returns:
latch value