Logo SoCRocket

Transaction-Level Modeling Framework for Space Applications

Classes | Macros | Functions | Variables
v42.c File Reference
#include <math.h>
#include <stdio.h>
Include dependency graph for v42.c:

Classes

struct  dict
 

Macros

#define N1   11 /* maximum codeword size in bits (V.42bis App II.1) */
 
#define N2   (1<<N1) /* maximum number of codewords */
 
#define N3   8 /* character size in bits */
 
#define N4   (1<<N3) /* number of characters in alphabet */
 
#define N5
 
#define N6   3 /* number of control codewords */
 
#define N7   250 /* maximum string length */
 
#define ETM   0 /* Enter transparent mode */
 
#define FLUSH   1 /* Flush data */
 
#define STEPUP   2 /* Step up codeword size */
 
#define ECM   0 /* Enter compress mode */
 
#define EID   1 /* Escape character in data */
 
#define RESET   2 /* Force reinitialization */
 
#define C_INIT   (-1)
 
#define C_ERROR   (-2)
 
#define C_DATA   (-3)
 
#define C_TRANSFER   (-4)
 
#define C_FLUSH   (-5)
 
#define C_STOP   (-6) /* not part of V42 spec */
 

Functions

int getdata ()
 
int getcode (int size)
 
void putcode (unsigned long code, int size)
 
void putdata (int data)
 
void init_dict ()
 
unsigned long search_dict (unsigned long string, unsigned char data)
 
void add_dict (unsigned long string, unsigned char data)
 
void checksize_dict ()
 
void encode ()
 
void decode ()
 
int main (int argc, argv)
 

Variables

int p0
 
int p1
 
int p2
 
int c1
 
int c2
 
int c3
 
int escape
 
int compress
 
struct dict dict [N2+1]
 
unsigned long last
 
unsigned char inbuf []
 
unsigned long baddr
 
unsigned long eaddr
 
int codedone
 
unsigned char codebuf [8 *1024]
 
unsigned char outbuf [8 *1024]
 
unsigned chareout = outbuf
 

Macro Definition Documentation

#define C_DATA   (-3)

Referenced by decode(), and encode().

#define C_ERROR   (-2)

Referenced by decode(), and encode().

#define C_FLUSH   (-5)
#define C_INIT   (-1)

Referenced by decode(), encode(), getcode(), and getdata().

#define C_STOP   (-6) /* not part of V42 spec */

Referenced by decode(), encode(), getcode(), and getdata().

#define C_TRANSFER   (-4)

Referenced by decode(), and encode().

#define ECM   0 /* Enter compress mode */

Referenced by decode(), and encode().

#define EID   1 /* Escape character in data */

Referenced by decode(), and encode().

#define ETM   0 /* Enter transparent mode */

Referenced by decode(), and encode().

#define FLUSH   1 /* Flush data */

Referenced by decode(), encode(), and putcode().

#define N1   11 /* maximum codeword size in bits (V.42bis App II.1) */
#define N2   (1<<N1) /* maximum number of codewords */

Referenced by add_dict(), and init_dict().

#define N3   8 /* character size in bits */

Referenced by decode(), encode(), init_dict(), and putcode().

#define N4   (1<<N3) /* number of characters in alphabet */

Referenced by encode(), and init_dict().

#define N5
Value:
(N4+N6) /* index of first dict entry to use for strings
* 0..N6-1 are reserved for control codewords,
* N6..N5-1 are reserved for individual chars. */
#define N6
Definition: v42.c:16
#define N4
Definition: v42.c:12

Referenced by add_dict(), and init_dict().

#define N6   3 /* number of control codewords */

Referenced by decode(), encode(), init_dict(), and search_dict().

#define N7   250 /* maximum string length */

Referenced by decode(), and encode().

#define RESET   2 /* Force reinitialization */
#define STEPUP   2 /* Step up codeword size */

Referenced by checksize_dict(), and decode().

Function Documentation

void add_dict ( unsigned long  string,
unsigned char  data 
)

References c1, dict::data, dict, dict::kids, last, N2, N5, dict::parent, and dict::sibling.

Referenced by decode(), and encode().

void checksize_dict ( )

References putcode(), and STEPUP.

Referenced by encode().

Here is the call graph for this function:

void decode ( )

References add_dict(), C_DATA, C_ERROR, C_FLUSH, C_INIT, C_STOP, C_TRANSFER, dict::data, ECM, EID, ETM, FLUSH, getcode(), init_dict(), N3, N6, N7, dict::parent, putdata(), RESET, s, search_dict(), and STEPUP.

Referenced by main().

Here is the call graph for this function:

void encode ( )

References add_dict(), c2, C_DATA, C_ERROR, C_FLUSH, C_INIT, C_STOP, C_TRANSFER, checksize_dict(), dict::data, ECM, EID, ETM, FLUSH, getdata(), init_dict(), N3, N4, N6, N7, putcode(), RESET, and search_dict().

Referenced by main(), and usi.cci.parameter::write().

Here is the call graph for this function:

int getcode ( int  size)

References baddr, C_FLUSH, C_INIT, C_STOP, and eaddr.

Referenced by decode().

int getdata ( )

References C_FLUSH, C_INIT, C_STOP, and inbuf.

Referenced by encode().

void init_dict ( )

References dict::data, dict::kids, last, N2, N3, N4, N5, N6, dict::parent, and dict::sibling.

Referenced by decode(), and encode().

int main ( int  argc,
argv   
)

References baddr, decode(), eaddr, encode(), i, outbuf, and s.

Here is the call graph for this function:

void putcode ( unsigned long  code,
int  size 
)

References baddr, C_FLUSH, eaddr, FLUSH, and N3.

Referenced by checksize_dict(), and encode().

void putdata ( int  data)

References C_FLUSH, and dict::data.

Referenced by decode().

unsigned long search_dict ( unsigned long  string,
unsigned char  data 
)

References dict::kids, last, N6, and dict::sibling.

Referenced by decode(), and encode().

Variable Documentation

unsigned long baddr

Referenced by getcode(), main(), and putcode().

int c1

Referenced by add_dict(), and fpu_main().

int c2

Referenced by encode().

int c3
unsigned char codebuf[8 *1024]
int codedone
int compress
struct dict dict[N2+1]
unsigned long eaddr

Referenced by getcode(), main(), and putcode().

unsigned char* eout = outbuf
int escape
unsigned char inbuf[]

Referenced by getdata().

unsigned long last

Referenced by add_dict(), init_dict(), and search_dict().

unsigned char outbuf[8 *1024]

Referenced by main().

int p0

Referenced by mmu_test().

int p1
int p2

Referenced by operator==().