public class Packet
extends Object
Modifier and Type | Field and Description |
---|---|
static Packet |
BUS_WIDTH_AUTO_DETECT1
The first bus width auto detect packet
|
static Packet |
BUS_WIDTH_AUTO_DETECT2
The second bus width auto detect packet
|
static Packet |
DUMMY
A 'Dummy' packet
|
static Packet |
NOOP
A 'No Op' packet
|
static Packet |
SYNC
A 'Sync Word' packet
|
Constructor and Description |
---|
Packet(CMDCode code)
Creates a new packet targeting the command register with the provided command code
|
Packet(int header)
Creates a new packet with the provided header word
|
Packet(int header,
int data)
Creates a new packet that has a single word of data
|
Packet(int header,
int[] data)
Creates a new packet with the provided header
and set of data
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Checks if this packet is equal (header and data match) with the provided
packet.
|
int[] |
getData()
Gets the data (payload) of this packet
|
int |
getHeader()
Gets the header word (first word) in the packet
|
OpCode |
getOpCode()
Gets the specified opcode from the header of the packet
|
PacketType |
getPacketType()
Gets the packet type of the packet based on the header information.
|
RegisterType |
getRegister()
Gets the configuration register specified in the header of the packet.
|
int |
getWordCount()
Gets the number of words in the data/payload portion of the packet as indicated in the header.
|
int |
hashCode()
Creates a hash from the packets header and data.
|
boolean |
isTypeOnePacket()
Checks if it is a Type 1 packet
|
boolean |
isTypeTwoPacket()
Checks if it is a Type 2 packet
|
static Packet |
newType1(OpCode opCode,
RegisterType regType,
int wordCount)
Creates a new type 1 packet and allocates any applicable data words.
|
static Packet |
newType1(OpCode opCode,
RegisterType regType,
int[] data)
Creates a new type 1 packet and allocates any applicable data words.
|
static Packet |
newType2(OpCode opCode,
int wordCount)
Creates a new type 2 packet and allocates any applicable data words.
|
static Packet |
newType2(OpCode opCode,
int[] data)
Creates a new type 2 packet and allocates any applicable data words.
|
void |
setData(int[] data)
Updates the data/payload of this packet with the provided array
|
String |
toString() |
public static Packet NOOP
public static Packet DUMMY
public static Packet SYNC
public static Packet BUS_WIDTH_AUTO_DETECT1
public static Packet BUS_WIDTH_AUTO_DETECT2
public Packet(int header)
header
- The 32-bit header wordpublic Packet(int header, int data)
header
- The 32-bit header worddata
- The 32-bit data wordpublic Packet(CMDCode code)
code
- The command code to use in the packetpublic Packet(int header, int[] data)
header
- The 32-bit header worddata
- An array of data words to attach to the packetpublic int[] getData()
public void setData(int[] data)
data
- The desired set of integer words to be carried as payload of the packetpublic int getHeader()
public int getWordCount()
public RegisterType getRegister()
public OpCode getOpCode()
public boolean isTypeOnePacket()
public boolean isTypeTwoPacket()
public PacketType getPacketType()
PacketType
public String toString()
toString
in class Object
public static Packet newType1(OpCode opCode, RegisterType regType, int wordCount)
opCode
- The opcode for the packetregType
- The intended register for the packetwordCount
- The number of 32-bit words that are payload in the packet.public static Packet newType1(OpCode opCode, RegisterType regType, int[] data)
opCode
- The opcode for the packetregType
- The intended register for the packetdata
- The data to be carried as payload for the packetpublic static Packet newType2(OpCode opCode, int wordCount)
opCode
- The op code to use in packet creationwordCount
- The number of 32-bit payload words to add to the packetpublic static Packet newType2(OpCode opCode, int[] data)
opCode
- The op code to use in packet creationdata
- The data to be carried as payloadpublic int hashCode()
hashCode
in class Object
public boolean equals(Object obj)
equals
in class Object