crc8.h 652 字节
#ifndef __CRC_8_H_737827914_
#define __CRC_8_H_737827914_

#include "stdint.h"


#define		CRC_START_8		0x00


/*
 * uint8_t crc_8( const unsigned char *input_str, size_t num_bytes );
 *
 * The function crc_8() calculates the 8 bit wide CRC of an input string of a
 * given length.
 */
uint8_t crc_8( const uint8_t *input_str, uint32_t num_bytes );


/*
 * uint8_t update_crc_8( unsigned char crc, unsigned char val );
 *
 * Given a databyte and the previous value of the CRC value, the function
 * update_crc_8() calculates and returns the new actual CRC value of the data
 * comming in.
 */

uint8_t update_crc_8( uint8_t crc, uint8_t val );


#endif