src/crc.c File Reference

#include "crc.h"

Include dependency graph for crc.c:


Defines

#define WIDTH   (8 * sizeof(crc))
#define TOPBIT   (1 << (WIDTH - 1))
#define REFLECT_DATA(X)   ((unsigned char) reflect((X), 8))
#define REFLECT_REMAINDER(X)   ((crc) reflect((X), WIDTH))

Functions

static unsigned long reflect (unsigned long data, unsigned char nBits)
crc crcSlow (unsigned char const message[], int nBytes)
void crcInit (void)
crc crcFast (unsigned char const message[], int nBytes)
unsigned char generate_crc7 (unsigned char *buf, unsigned char bytes)
 Generate CRC7.

Variables

crc crcTable [256]

Define Documentation

#define REFLECT_DATA (  )     ((unsigned char) reflect((X), 8))

#define REFLECT_REMAINDER (  )     ((crc) reflect((X), WIDTH))

#define TOPBIT   (1 << (WIDTH - 1))

#define WIDTH   (8 * sizeof(crc))


Function Documentation

crc crcFast ( unsigned char const   message[],
int  nBytes 
)

void crcInit ( void   ) 

crc crcSlow ( unsigned char const   message[],
int  nBytes 
)

unsigned char generate_crc7 ( unsigned char *  buf,
unsigned char  bytes 
)

Generate CRC7.

This function generates a 7 bit CRC using the X^7 + X^3 + 1 polynomial

Parameters:

Parameters:
buf Pointer to the first data byte to be calculated
bytes Total number of bytes to be included in crc calculation
Returns:
7 bit CRC value

static unsigned long reflect ( unsigned long  data,
unsigned char  nBits 
) [static]


Variable Documentation

crc crcTable[256]


Generated on 3 Mar 2014 for PAL bare-c Library by  doxygen 1.4.7