libosmocore  0.9.6.311-c977
Osmocom core library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
crc16.c File Reference

This was copied from the linux kernel and adjusted for our types. More...

Functions

uint16_t osmo_crc16 (uint16_t crc, uint8_t const *buffer, size_t len)
 compute the CRC-16 for the data buffer More...
 
uint16_t osmo_crc16_ccitt (uint16_t crc, uint8_t const *buffer, size_t len)
 

Variables

uint16_t const osmo_crc16_table [256]
 CRC table for the CRC-16. More...
 
uint16_t const osmo_crc16_ccitt_table [256]
 

Detailed Description

This was copied from the linux kernel and adjusted for our types.

Function Documentation

uint16_t osmo_crc16 ( uint16_t  crc,
uint8_t const *  buffer,
size_t  len 
)

compute the CRC-16 for the data buffer

Parameters
crc[in]previous CRC value
buffer[in]data pointer
len[in]number of bytes in input buffer
Returns
updated CRC value

References osmo_crc16_byte().

uint16_t osmo_crc16_ccitt ( uint16_t  crc,
uint8_t const *  buffer,
size_t  len 
)

Variable Documentation

uint16_t const osmo_crc16_ccitt_table[256]

Referenced by osmo_crc16_ccitt_byte().

uint16_t const osmo_crc16_table[256]

CRC table for the CRC-16.

The poly is 0x8005 (x^16 + x^15 + x^2 + 1)

Referenced by osmo_crc16_byte().