45 #ifndef __MEM_PACKET_ACCESS_HH__ 46 #define __MEM_PACKET_ACCESS_HH__ 56 assert(
sizeof(T) <=
size);
65 assert(
sizeof(T) <=
size);
74 return betoh(getRaw<T>());
81 return letoh(getRaw<T>());
96 panic(
"Illegal byte order in Packet::get()\n");
100 template <
typename T>
107 template <
typename T>
114 template <
typename T>
126 panic(
"Illegal byte order in Packet::set()\n");
130 #endif //__MEM_PACKET_ACCESS_HH__ #define panic(...)
This implements a cprintf based panic() function.
void set(T v, ByteOrder endian)
Set the value in the data pointer to v using the specified endianness.
void setRaw(T v)
Set the value in the data pointer to v without byte swapping.
The data pointer points to a value that should be freed when the packet is destroyed.
void setBE(T v)
Set the value in the data pointer to v as big endian.
void setLE(T v)
Set the value in the data pointer to v as little endian.
PacketDataPtr data
A pointer to the data being transferred.
unsigned size
The size of the request or transfer.
Declaration of the Packet class.
T getRaw() const
Get the data in the packet without byte swapping.
T get(ByteOrder endian) const
Get the data in the packet byte swapped from the specified endianness.
T getLE() const
Get the data in the packet byte swapped from little endian to host endian.
Is the data pointer set to a value that shouldn't be freed when the packet is destroyed?
T getBE() const
Get the data in the packet byte swapped from big endian to host endian.