cloudFPGA (cF) API  1.0
The documentation of the source code of cloudFPGA (cF)
AxisIcmp.hpp
Go to the documentation of this file.
1 
18 
66 #ifndef _AXIS_ICMP_H_
67 #define _AXIS_ICMP_H_
68 
69 #include "./AxisRaw.hpp"
70 
71 
78 #define ICMP_HEADER_LEN 8 // In bytes
79 
80 
83 typedef ap_uint< 8> LE_IcmpType; // ICMP Type of control Message
84 typedef ap_uint< 8> LE_IcmpCode; // ICMP subtype of control Message
85 typedef ap_uint<16> LE_IcmpCsum; // ICMP header and data Checksum
86 
87 
91 typedef ap_uint< 8> IcmpType; // ICMP Type of control Message
92 typedef ap_uint< 8> IcmpCode; // ICMP subtype of control Message
93 typedef ap_uint<16> IcmpCsum; // ICMP header and data Checksum
94 typedef ap_uint<16> IcmpIdent; // ICMP identifier
95 typedef ap_uint<16> IcmpSeqNum; // ICMP sequence number
96 
97 
98 
102 class AxisIcmp: public AxisRaw {
103 
104  public:
105  AxisIcmp() {}
106  AxisIcmp(AxisRaw axisRaw) :
107  AxisRaw(axisRaw.getLE_TData(), axisRaw.getLE_TKeep(), axisRaw.getLE_TLast()) {}
109  AxisRaw(tdata, tkeep, tlast) {}
110  AxisIcmp(const AxisIcmp &axisIcmp) :
111  AxisRaw(axisIcmp.tdata, axisIcmp.tkeep, axisIcmp.tlast) {}
112 
113 
117  // Set-Get the message Type field
118  void setIcmpType(IcmpType type) { tdata.range( 7, 0) = type; }
119  IcmpType getIcmpType() { return tdata.range( 7, 0); }
120  // Set-Get the message Code field
121  void setIcmpCode(IcmpCode code) { tdata.range(15, 8) = code; }
122  IcmpCode getIcmpCode() { return tdata.range(15, 8); }
123  // Set-Get the Checksum field
124  void setIcmpCsum(IcmpCsum csum) { tdata.range(31, 16) = swapWord(csum); }
125  IcmpCsum getIcmpCsum() { return swapWord (tdata.range(31, 16)); }
126  // Set-Get the Identifier field
127  void setIcmpIdent(IcmpIdent id) { tdata.range(47, 32) = swapWord(id); }
128  IcmpIdent getIcmpIdent() { return swapWord (tdata.range(47, 32)); }
129  // Set-Get the Sequence Number field
130  void setIcmpSeqNum(IcmpSeqNum num) { tdata.range(63, 48) = swapWord(num); }
131  IcmpSeqNum getIcmpSeqNum() { return swapWord (tdata.range(63, 48)); }
132 
133  private:
134  // Swap the two bytes of a word (.i.e, 16 bits)
135  ap_uint<16> swapWord(ap_uint<16> inpWord) {
136  return (inpWord.range(7,0), inpWord.range(15, 8));
137  }
138  // Swap the four bytes of a double-word (.i.e, 32 bits)
139  ap_uint<32> swapDWord(ap_uint<32> inpDWord) {
140  return (inpDWord.range( 7, 0), inpDWord.range(15, 8),
141  inpDWord.range(23,16), inpDWord.range(31, 24));
142  }
143 
144 }; // End of: AxisArp
145 
146 #endif
147 
: A generic class used by the Network-Transport-Stack (NTS) to to transfer a chunk of data over an AX...
IcmpCsum getIcmpCsum()
Definition: AxisIcmp.hpp:125
AxisIcmp(LE_tData tdata, LE_tKeep tkeep, LE_tLast tlast)
Definition: AxisIcmp.hpp:108
IcmpType getIcmpType()
Definition: AxisIcmp.hpp:119
void setIcmpSeqNum(IcmpSeqNum num)
Definition: AxisIcmp.hpp:130
void setIcmpCsum(IcmpCsum csum)
Definition: AxisIcmp.hpp:124
IcmpSeqNum getIcmpSeqNum()
Definition: AxisIcmp.hpp:131
AxisIcmp(const AxisIcmp &axisIcmp)
Definition: AxisIcmp.hpp:110
IcmpCode getIcmpCode()
Definition: AxisIcmp.hpp:122
void setIcmpIdent(IcmpIdent id)
Definition: AxisIcmp.hpp:127
void setIcmpType(IcmpType type)
Definition: AxisIcmp.hpp:118
void setIcmpCode(IcmpCode code)
Definition: AxisIcmp.hpp:121
AxisIcmp(AxisRaw axisRaw)
Definition: AxisIcmp.hpp:106
IcmpIdent getIcmpIdent()
Definition: AxisIcmp.hpp:128
LE_tKeep getLE_TKeep(int leHi=64/8-1, int leLo=0) const
Definition: AxisRaw.hpp:264
LE_tData tdata
Definition: AxisRaw.hpp:173
LE_tData getLE_TData(int leHi=64 -1, int leLo=0) const
Definition: AxisRaw.hpp:260
LE_tKeep tkeep
Definition: AxisRaw.hpp:174
LE_tLast getLE_TLast() const
Definition: AxisRaw.hpp:268
LE_tLast tlast
Definition: AxisRaw.hpp:175
ap_uint< 16 > LE_IcmpCsum
Definition: AxisIcmp.hpp:85
ap_uint< 16 > IcmpIdent
Definition: AxisIcmp.hpp:94
ap_uint< 64 > LE_tData
Definition: AxisRaw.hpp:122
ap_uint< 8 > LE_IcmpType
Definition: AxisIcmp.hpp:83
ap_uint< 16 > IcmpSeqNum
Definition: AxisIcmp.hpp:95
ap_uint< 64/8 > LE_tKeep
Definition: AxisRaw.hpp:124
ap_uint< 16 > IcmpCsum
Definition: AxisIcmp.hpp:93
ap_uint< 8 > LE_IcmpCode
Definition: AxisIcmp.hpp:84
ap_uint< 8 > IcmpCode
Definition: AxisIcmp.hpp:92
ap_uint< 1 > LE_tLast
Definition: AxisRaw.hpp:125
ap_uint< 8 > IcmpType
Definition: AxisIcmp.hpp:91