crc.h

来自「CRC16, CRC8 source code Algorithm = tab」· C头文件 代码 · 共 72 行

H
72
字号
/**
 * \file crc.h
 * Functions and types for CRC checks.
 *
 * Generated on Thu Oct 30 17:31:34 2008,
 * by pycrc v0.6.6, http://www.tty1.net/pycrc/
 * using the configuration:
 *    Width        = 8
 *    Poly         = 0x07
 *    XorIn        = 0x00
 *    ReflectIn    = False
 *    XorOut       = 0x00
 *    ReflectOut   = False
 *    Algorithm    = table-driven
 *
 * table-driven                         5byte crc-8 拌魂 矫埃 1.2usec
 *    256byte table
 * table-driven table-idx-width 4	5byte crc-8 拌魂 矫埃 2.5usec
 *    16byte table
 * bit-by-bit-fast			5byte crc-8 拌魂 矫埃 13usec
 *****************************************************************************/
#ifndef __CRC_H__
#define __CRC_H__

#ifdef __cplusplus
extern "C"
{
#endif

#include "stm32f10x_type.h"

  /**
   * The definition of the used algorithm.
   *****************************************************************************/
#define CRC_ALGO_TABLE_DRIVEN 1
#define TABLE_IDX_WIDTH_4     1

#define crc8_init(x)		x = 0x00
#define crc8_finalize(x)	x ^= 0x00


#define crc16_init(x)		x = 0x0000
#define crc16_finalize(x)	x ^= 0x0000


  /**
   * Update the crc value with new data.
   *
   * \param crc      The current crc value.
   * \param data     Pointer to a buffer of \a data_len bytes.
   * \param data_len Number of bytes in the \a data buffer.
   * \return         The updated crc value.
   *****************************************************************************/
  u16 crc16_update (u16 crc, u8 *data, u8 data_len);

  /**
   * Update the crc value with new data.
   *
   * \param crc      The current crc value.
   * \param data     Pointer to a buffer of \a data_len bytes.
   * \param data_len Number of bytes in the \a data buffer.
   * \return         The updated crc value.
   *****************************************************************************/
  u8 crc8_update (u8 crc, u8 *data, u8 data_len);


#ifdef __cplusplus
}           /* closing brace for extern "C" */
#endif

#endif      /* __CRC_H__ */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?