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

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

#include <stdint.h>
#include <sys/types.h>

Go to the source code of this file.

Functions

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

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().

static uint16_t osmo_crc16_byte ( uint16_t  crc,
const uint8_t  data 
)
inlinestatic

References osmo_crc16_table.

Referenced by osmo_crc16().

uint16_t osmo_crc16_ccitt ( uint16_t  crc,
const uint8_t *  buffer,
size_t  len 
)
static uint16_t osmo_crc16_ccitt_byte ( uint16_t  crc,
const uint8_t  data 
)
inlinestatic

References osmo_crc16_ccitt_table.

Referenced by osmo_crc16_ccitt().

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().