38 #define THIS_NAME "NtsUtils" 
   47     printInfo(callerName, 
"AxisRaw = {D=0x%16.16lX, K=0x%2.2X, L=%d} \n",
 
   59     printInfo(callerName, 
"%s {D=0x%16.16lX, K=0x%2.2X, L=%d} \n", \
 
   70     printInfo(callerName, 
"DmCmd = {BTT=0x%6.6X, TYPE=0x%1.1X DSA=0x%2.2X, EOF=0x%1.1X, DRR=0x%1.1X, SADDR=0x%8.8X, TAG=0x%1.1X} \n", \
 
   71               dmCmd.
btt.to_uint(), dmCmd.
type.to_uint(), dmCmd.
dsa.to_uint(), dmCmd.
eof.to_uint(), dmCmd.
drr.to_uint(), dmCmd.
saddr.to_uint(), dmCmd.
tag.to_uint());
 
   81     printInfo(callerName, 
"ArpBind {MAC,IP4} = {0x%12.12lx,0x%8.8lx} = {%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X,%3.3d.%3.3d.%3.3d.%3.3d}\n",
 
   84         (
unsigned char)((arpBind.
macAddr.to_ulong() & 0xFF0000000000) >> 40),
 
   85         (
unsigned char)((arpBind.
macAddr.to_ulong() & 0x00FF00000000) >> 32),
 
   86         (
unsigned char)((arpBind.
macAddr.to_ulong() & 0x0000FF000000) >> 24),
 
   87         (
unsigned char)((arpBind.
macAddr.to_ulong() & 0x000000FF0000) >> 16),
 
   88         (
unsigned char)((arpBind.
macAddr.to_ulong() & 0x00000000FF00) >>  8),
 
   89         (
unsigned char)((arpBind.
macAddr.to_ulong() & 0x0000000000FF) >>  0),
 
   90         (
unsigned char)((arpBind.
ip4Addr.to_ulong()  & 0xFF000000) >> 24),
 
   91         (
unsigned char)((arpBind.
ip4Addr.to_ulong()  & 0x00FF0000) >> 16),
 
   92         (
unsigned char)((arpBind.
ip4Addr.to_ulong()  & 0x0000FF00) >>  8),
 
   93         (
unsigned char)((arpBind.
ip4Addr.to_ulong()  & 0x000000FF) >>  0));
 
  103     printInfo(callerName, 
"LE_SocketPair {Src,Dst} = {{0x%8.8X:0x%4.4X} {0x%8.8X:0x%4.4X}} \n", \
 
  115     printInfo(callerName, 
"SocketPair {Src,Dst} = {0x%8.8X:0x%4.4X, 0x%8.8X:0x%4.4X} = {%3.3d.%3.3d.%3.3d.%3.3d:%5.5d, %3.3d.%3.3d.%3.3d.%3.3d:%5.5d}\n", \
 
  120       (sockPair.
src.
addr.to_uint() & 0xFF000000) >> 24,
 
  121       (sockPair.
src.
addr.to_uint() & 0x00FF0000) >> 16,
 
  122       (sockPair.
src.
addr.to_uint() & 0x0000FF00) >>  8,
 
  123       (sockPair.
src.
addr.to_uint() & 0x000000FF) >>  0,
 
  125       (sockPair.
dst.
addr.to_uint() & 0xFF000000) >> 24,
 
  126       (sockPair.
dst.
addr.to_uint() & 0x00FF0000) >> 16,
 
  127       (sockPair.
dst.
addr.to_uint() & 0x0000FF00) >>  8,
 
  128       (sockPair.
dst.
addr.to_uint() & 0x000000FF) >>  0,
 
  139     printInfo(callerName, 
"SocketPair {Src,Dst} = {0x%8.8X:0x%4.4X, 0x%8.8X:0x%4.4X} = {%3.3d.%3.3d.%3.3d.%3.3d:%5.5d, %3.3d.%3.3d.%3.3d.%3.3d:%5.5d}\n", \
 
  164     printInfo(callerName, 
"LE_SocketAddr {IpAddr:TcpPort} = {0x%8.8X:0x%4.4X} \n", \
 
  165         leSockAddr.
addr.to_uint(), leSockAddr.
port.to_uint());
 
  175     printInfo(callerName, 
"SocketAddr {IpAddr:TcpPort} = {0x%8.8X:0x%4.4X} = {%3.3d.%3.3d.%3.3d.%3.3d:%5.5d} \n", \
 
  176          sockAddr.
addr.to_uint(),
 
  177          sockAddr.
port.to_uint(),
 
  178         (sockAddr.
addr.to_uint() & 0xFF000000) >> 24,
 
  179         (sockAddr.
addr.to_uint() & 0x00FF0000) >> 16,
 
  180         (sockAddr.
addr.to_uint() & 0x0000FF00) >>  8,
 
  181         (sockAddr.
addr.to_uint() & 0x000000FF) >>  0,
 
  182          sockAddr.
port.to_uint());
 
  206     printInfo(callerName, 
"%s IPv4 Addr = 0x%8.8X = %3.3d.%3.3d.%3.3d.%3.3d\n",
 
  209         (ip4Addr.to_uint() & 0xFF000000) >> 24,
 
  210         (ip4Addr.to_uint() & 0x00FF0000) >> 16,
 
  211         (ip4Addr.to_uint() & 0x0000FF00) >>  8,
 
  212         (ip4Addr.to_uint() & 0x000000FF) >>  0);
 
  222     printInfo(callerName, 
"IPv4 Addr = 0x%8.8X = %3.3d.%3.3d.%3.3d.%3.3d\n",
 
  224         (ip4Addr.to_uint() & 0xFF000000) >> 24,
 
  225         (ip4Addr.to_uint() & 0x00FF0000) >> 16,
 
  226         (ip4Addr.to_uint() & 0x0000FF00) >>  8,
 
  227         (ip4Addr.to_uint() & 0x000000FF) >>  0);
 
  238     printInfo(callerName, 
"%s ETH Addr = 0x%12.12lX \n", 
message, ethAddr.to_ulong());
 
  248     printInfo(callerName, 
"ETH Addr = 0x%12.12lX \n", ethAddr.to_ulong());
 
  258     printInfo(callerName, 
"TCP Port = 0x%4.4X = %5.5d\n", \
 
  259          tcpPort.to_uint(), tcpPort.to_uint());
 
  279         return "SYN_RECEIVED";
 
  281         return "ESTABLISHED";
 
  293         return "ERROR: UNKNOWN TCP STATE!";
 
  309     switch(noValidBytes) {
 
  310         case 1: leKeep = 0x01; 
break;
 
  311         case 2: leKeep = 0x03; 
break;
 
  312         case 3: leKeep = 0x07; 
break;
 
  313         case 4: leKeep = 0x0F; 
break;
 
  314         case 5: leKeep = 0x1F; 
break;
 
  315         case 6: leKeep = 0x3F; 
break;
 
  316         case 7: leKeep = 0x7F; 
break;
 
  317         case 8: leKeep = 0xFF; 
break;
 
  330     switch(noValidBytes) {
 
  331         case 1: keep = 0x80; 
break;
 
  332         case 2: keep = 0xC0; 
break;
 
  333         case 3: keep = 0xE0; 
break;
 
  334         case 4: keep = 0xF0; 
break;
 
  335         case 5: keep = 0xF8; 
break;
 
  336         case 6: keep = 0xFC; 
break;
 
  337         case 7: keep = 0xFE; 
break;
 
  338         case 8: keep = 0xFF; 
break;
 
  350     return (inputValue.range(7,0), inputValue(15, 8));
 
  360     return (inputValue.range( 7, 0), inputValue(15,  8),
 
  361         inputValue.range(23,16), inputValue(31, 24));
 
  371     return (inputValue.range( 7,  0), inputValue.range(15,  8),
 
  372             inputValue.range(23, 16), inputValue.range(31, 24),
 
  373             inputValue.range(39, 32), inputValue.range(47, 40));
 
  383     return (inputValue.range( 7, 0), inputValue(15,  8),
 
  384             inputValue.range(23,16), inputValue(31, 24),
 
  385             inputValue.range(39,32), inputValue(47, 40),
 
  386             inputValue.range(55,48), inputValue(63, 56));
 
LE_tKeep getLE_TKeep(int leHi=64/8-1, int leLo=0) const
LE_tData getLE_TData(int leHi=64 -1, int leLo=0) const
LE_tLast getLE_TLast() const
ap_uint< 48 > byteSwap48(ap_uint< 48 > inputValue)
Swap the six bytes of a triple-word (.i.e, 48 bits).
void printLE_SockPair(const char *callerName, LE_SocketPair sockPair)
Print a socket pair association in LITTLE-ENDIAN order.
ap_uint< 32 > byteSwap32(ap_uint< 32 > inputValue)
Swap the four bytes of a double-word (.i.e, 32 bits).
ap_uint< 16 > byteSwap16(ap_uint< 16 > inputValue)
Swap the two bytes of a word (.i.e, 16 bits).
LE_tKeep lenToLE_tKeep(ap_uint< 4 > noValidBytes)
A function to set a number of '1' in an 8-bit field. It is used here to set the number of valid bytes...
void printArpBindPair(const char *callerName, ArpBindPair arpBind)
Print an ARP binding pair association.
ap_uint< 64 > byteSwap64(ap_uint< 64 > inputValue)
Swap the eight bytes of a quad-word (.i.e, 64 bits).
void printAxisRaw(const char *callerName, AxisRaw chunk)
Prints an Axis raw data chunk (used for debugging).
void printDmCmd(const char *callerName, DmCmd dmCmd)
Prints the details of a Data Mover Command (used for debugging).
void printSockAddr(const char *callerName, SockAddr sockAddr)
Print a socket address.
void printLE_SockAddr(const char *callerName, LE_SockAddr leSockAddr)
Print a socket address encoded in LITTLE_ENDIAN order.
const char * getTcpStateName(TcpState tcpState)
Returns the name of an enum-based TCP-State as a user friendly string.
tKeep lenTotKeep(ap_uint< 4 > noValidBytes)
A function to set a number of '1' in an 8-bit field. It is used here to set the number of valid bytes...
#define printInfo(callerName, format,...)
A macro to print an information message.
void printIp4Addr(const char *callerName, const char *message, Ip4Addr ip4Addr)
Print an IPv4 address prepended with a message (used for debugging).
void printTcpPort(const char *callerName, TcpPort tcpPort)
Print a TCP port.
void printSockPair(const char *callerName, SocketPair sockPair)
Print a socket pair association.
void printEthAddr(const char *callerName, const char *message, EthAddr ethAddr)
Print an ETHERNET MAC address prepended with a message (for debug).
: Utilities and helpers for the Network-Transport-Stack (NTS) components.