Files
Balsam_167/Source/Internal/Include/crc16.h

21 lines
1.3 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* @file crc16.h
* @brief Интерфейс алгоритмов CRC, используемых коммуникационными модулями.
*
* Буфер представлен словами целевого DSP; параметр size трактуется реализацией
* как число обрабатываемых элементов. Вызывающий код выбирает вариант CRC и
* передаёт требуемое протоколом начальное значение.
*/
typedef unsigned short WORD;
typedef unsigned char byte;
/** Вычисляет CRC-CCITT для size слов, продолжая переданное значение crc. */
unsigned int get_crc_ccitt(unsigned int crc, unsigned int *buf, unsigned long size );
/** Вычисляет табличный CRC-16 (полином 0xA001) для size слов. */
unsigned int get_crc_16(unsigned int crc,unsigned int *buf,unsigned long size );
/** Вычисляет побитовый вариант CRC-16 для проверки табличной реализации. */
unsigned int get_crc_16b(unsigned int crc,unsigned int *buf,unsigned long size );
/** Возвращает CRC-16 кадра с принятым в проекте начальным значением. */
int get_crc16(unsigned int *buf, int size );