net/helpers.h File Reference


Detailed Description

Helper functions for Modtronix TCP/IP Stack.

Author:
Modtronix Engineering
Dependencies:
stacktsk.h
Compiler:
MPLAB C18 v2.10 or higher
HITECH PICC-18 V8.35PL3 or higher

Description

This module contains general helper functions.

#include "net\compiler.h"

Functions

BYTE btohexa_high (BYTE b)
WORD CalcIPBufferChecksum (WORD len)
WORD CalcIPChecksum (BYTE *buffer, WORD len)
BYTE hextob (char *s, BYTE *c)
void memclr (void *dest, WORD size)
BYTE strcmpee2ram (char *strRam, WORD strEe)
BYTE strcpyram2ee (WORD strDst, char *strSrc, BYTE len)
DWORD swapl (DWORD v)
WORD swaps (WORD v)


Function Documentation

BYTE btohexa_high ( BYTE  b  ) 

Parameters:
b An ascii byte (always uppercase) between '0'-'9' or 'A'-'F' that corresponds to the upper 4 bits of the input byte. ex: b = 0xAE, btohexa_high() returns 'A'
Returns:
*Buffer: Receives the resulting string

WORD CalcIPBufferChecksum ( WORD  len  ) 

This function performs checksum calculation in MAC buffer itself.

Pre-Condition:
TCPInit() is already called AND MAC buffer pointer set to start of buffer
Parameters:
len Total number of bytes to calculate checksum for
Returns:
16-bit checksum as defined by rfc 793

WORD CalcIPChecksum ( BYTE buffer,
WORD  len 
)

BYTE hextob ( char *  s,
BYTE c 
)

Converts the given hex string to a byte value

Parameters:
s Input string. First two characters of string must contain hex string. For example "8F" or "8f"
c Will contain the byte representation of the given string on return.
Returns:
1 if a valid hex value was found, or 0 if s did NOT contain a valid hex value

void memclr ( void *  dest,
WORD  size 
)

Fills the given number of bytes in the given array with 0

Parameters:
dest Pointer to memory area in RAM that has to be set to 0
size Number of consecutive bytes to set to 0
Examples:
ex_udp.c, ex_udp_echo.c, ex_udp_echo2.c, and ex_udp_init.c.

BYTE strcmpee2ram ( char *  strRam,
WORD  strEe 
)

Compare two strings.

Parameters:
strRam Pointer to null terminated string contained in RAM
strEe Address (offset) in EEPROM of null terminated string
Returns:
Returns 0 if both strings are the same, else non 0

BYTE strcpyram2ee ( WORD  strDst,
char *  strSrc,
BYTE  len 
)

Copies the source string (in RAM) to the given destination in EEPROM. Characters in strSrc are copied up to, and including, the terminating null character strSrc.

Parameters:
strSrc Pointer to null terminated Source string contained in RAM.
strDst Destination address (offset) in the EEPROM
len The maximum string length that is allowed to be written (excluding NULL terminating char). If the source string is longer then this value, the destination will be truncated with a NULL! To disable length checking, set this value to 255. For example, if len = 8, then that string can have a maximum of 8 characters = 8 + NULL. The destination must always have len + 1 positions available!
Returns:
Returns the number of bytes written, including the NULL terminated char. For example, if 9 is returned, then 8 characters + NULL terminating char were written.

DWORD swapl ( DWORD  v  ) 

WORD swaps ( WORD  v  ) 


Generated on Thu Sep 21 20:31:02 2006 for SBC65EC Web Server by  doxygen 1.4.7