ASCII Serial Com
Serial communication library between computers, microcontrollers, FPGAs, etc. Uses only ASCII. Not the most efficient protocol, but meant to be easy to read
Loading...
Searching...
No Matches
Macros | Typedefs | Functions
crc_16_dnp_tbl4bit.h File Reference
#include <stdint.h>
#include <stdlib.h>
Include dependency graph for crc_16_dnp_tbl4bit.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define CRC_ALGO_TABLE_DRIVEN   1
 

Typedefs

typedef uint_fast16_t crc_16_dnp_tbl4bit_t
 

Functions

static crc_16_dnp_tbl4bit_t crc_16_dnp_tbl4bit_init (void)
 
crc_16_dnp_tbl4bit_t crc_16_dnp_tbl4bit_update (crc_16_dnp_tbl4bit_t crc, const void *data, size_t data_len)
 
static crc_16_dnp_tbl4bit_t crc_16_dnp_tbl4bit_finalize (crc_16_dnp_tbl4bit_t crc)
 

Detailed Description

Functions and types for CRC checks.

Generated on Mon Aug 24 06:27:49 2020 by pycrc v0.9.2, https://pycrc.org using the configuration:

This file defines the functions crc_16_dnp_tbl4bit_init(), crc_16_dnp_tbl4bit_update() and crc_16_dnp_tbl4bit_finalize().

The crc_16_dnp_tbl4bit_init() function returns the inital crc value and must be called before the first call to crc_16_dnp_tbl4bit_update(). Similarly, the crc_16_dnp_tbl4bit_finalize() function must be called after the last call to crc_16_dnp_tbl4bit_update(), before the crc is being used. is being used.

The crc_16_dnp_tbl4bit_update() function can be called any number of times (including zero times) in between the crc_16_dnp_tbl4bit_init() and crc_16_dnp_tbl4bit_finalize() calls.

This pseudo-code shows an example usage of the API:

unsigned char data[MAX_DATA_LEN];
size_t data_len;
while ((data_len = read_data(data, MAX_DATA_LEN)) > 0) {
crc = crc_16_dnp_tbl4bit_update(crc, data, data_len);
}
crc_16_dnp_tbl4bit_t crc_16_dnp_tbl4bit_update(crc_16_dnp_tbl4bit_t crc, const void *data, size_t data_len)
static crc_16_dnp_tbl4bit_t crc_16_dnp_tbl4bit_init(void)
uint_fast16_t crc_16_dnp_tbl4bit_t
static crc_16_dnp_tbl4bit_t crc_16_dnp_tbl4bit_finalize(crc_16_dnp_tbl4bit_t crc)

Definition in file crc_16_dnp_tbl4bit.h.

Macro Definition Documentation

◆ CRC_ALGO_TABLE_DRIVEN

#define CRC_ALGO_TABLE_DRIVEN   1

The definition of the used algorithm.

This is not used anywhere in the generated code, but it may be used by the application code to call algorithm-specific code, if desired.

Definition at line 58 of file crc_16_dnp_tbl4bit.h.

Typedef Documentation

◆ crc_16_dnp_tbl4bit_t

typedef uint_fast16_t crc_16_dnp_tbl4bit_t

The type of the CRC values.

This type must be big enough to contain at least 16 bits.

Definition at line 65 of file crc_16_dnp_tbl4bit.h.

Function Documentation

◆ crc_16_dnp_tbl4bit_finalize()

static crc_16_dnp_tbl4bit_t crc_16_dnp_tbl4bit_finalize ( crc_16_dnp_tbl4bit_t crc)
inlinestatic

Calculate the final crc value.

Parameters
[in]crcThe current crc value.
Returns
The final crc value.

Definition at line 95 of file crc_16_dnp_tbl4bit.h.

◆ crc_16_dnp_tbl4bit_init()

static crc_16_dnp_tbl4bit_t crc_16_dnp_tbl4bit_init ( void )
inlinestatic

Calculate the initial crc value.

Returns
The initial crc value.

Definition at line 72 of file crc_16_dnp_tbl4bit.h.

◆ crc_16_dnp_tbl4bit_update()

crc_16_dnp_tbl4bit_t crc_16_dnp_tbl4bit_update ( crc_16_dnp_tbl4bit_t crc,
const void * data,
size_t data_len )

Update the crc value with new data.

Parameters
[in]crcThe current crc value.
[in]dataPointer to a buffer of data_len bytes.
[in]data_lenNumber of bytes in the data buffer.
Returns
The updated crc value.

Definition at line 27 of file crc_16_dnp_tbl4bit.c.

References crc_table.