|
jmce - 1_02 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjmce.sim.AbstractHardware
jmce.sim.AbstractPeripheral
jmce.sim.I2cBus
public class I2cBus
I2C Bus manager.
This peripheral manage all the operation between one master (the CPU) and one or more slave connected using the I2C protocol. To implement the interface the CPU must have two OpenCollectorMemoryBit/tt> mapped to phisical register.
The following bus condition are supported:
This version is not multi master can support only one master connected to one or more slave devices.
I2cSlave
Field Summary | |
---|---|
protected MemoryBit |
SCL
Memory bit connected to SCL wire |
protected MemoryBit |
SDA
Memory bit connected to SDA Wire |
Fields inherited from class jmce.sim.AbstractPeripheral |
---|
cpu |
Constructor Summary | |
---|---|
I2cBus()
Default constructor |
Method Summary | |
---|---|
protected void |
bus(boolean scl,
boolean sda)
Bus manager. |
protected void |
i2cFail(boolean bit)
Called on the failing edge od the clock. |
protected void |
i2cRecv(boolean sda)
Called when a new bit is received |
protected void |
i2cRecv(int value)
Process one received byte |
protected void |
i2cRise(boolean bit)
Called on the rising edge of the clock |
protected void |
i2cSend(boolean sda)
Called when is necessary to send one byte. |
protected void |
i2cStart()
Called when a start or repeted start condition is detected |
protected void |
i2cStop()
Called when the stop condition is detected |
void |
reset()
Reset the the device to the initial state. |
void |
setScl(OpenCollectorMemoryBit scl)
Set the memory bit used for SCL |
void |
setSda(OpenCollectorMemoryBit sda)
Set the memory bit used for SDA |
void |
writeMemory(Memory m,
int address,
int value,
int oldValue)
Implementation of listener to receive write on the bit mapped to the wire of the I2cBUS. |
Methods inherited from class jmce.sim.AbstractPeripheral |
---|
idle, registerCPU, setIdle, setLive |
Methods inherited from class jmce.sim.AbstractHardware |
---|
addHardware, createFrame, destroy, getHardware, getHardware, getHardware, getHardware, getHardware, getHardwareCount, getHardwareForName, getHardwareInstances, getHardwareTree, getName, getParent, init, initSwing, removeHardware, removeHardware, setHardware, setHardware, setName, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface jmce.sim.Hardware |
---|
addHardware, destroy, getHardware, getHardware, getHardware, getHardware, getHardwareCount, getHardwareInstances, getHardwareTree, getName, getParent, init, initSwing, removeHardware, removeHardware, setHardware, setHardware, setName |
Field Detail |
---|
protected MemoryBit SCL
protected MemoryBit SDA
Constructor Detail |
---|
public I2cBus()
Method Detail |
---|
public void setScl(OpenCollectorMemoryBit scl)
scl
- - Memory bit.public void setSda(OpenCollectorMemoryBit sda)
sda
- - Memory bitpublic void reset() throws SIMException
Hardware
reset
in interface Hardware
reset
in class AbstractHardware
SIMException
protected void i2cStart()
protected void i2cStop()
protected void i2cRecv(int value) throws SIMException
SIMException
protected void i2cSend(boolean sda) throws SIMException
SIMException
protected void i2cRecv(boolean sda) throws SIMException
SIMException
protected void i2cRise(boolean bit) throws SIMException
SIMException
protected void i2cFail(boolean bit) throws SIMException
SIMException
protected void bus(boolean scl, boolean sda) throws SIMException
scl
- - Current value of clock.sda
- - Current value of data.
SIMException
public void writeMemory(Memory m, int address, int value, int oldValue) throws SIMException
writeMemory
in interface MemoryWriteListener
m
- - Memory involved in the write operation.address
- - Address written.value
- - Value written.oldValue
- - Old value of this memory location.
SIMException
|
jmce - 1_02 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |