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_bbf.h File Reference
#include <stdint.h>
#include <stdlib.h>
Include dependency graph for crc_16_dnp_bbf.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define CRC_ALGO_BIT_BY_BIT_FAST   1
 

Typedefs

typedef uint_fast16_t crc_16_dnp_bbf_t
 

Functions

crc_16_dnp_bbf_t crc_16_dnp_bbf_reflect (crc_16_dnp_bbf_t data, size_t data_len)
 
static crc_16_dnp_bbf_t crc_16_dnp_bbf_init (void)
 
crc_16_dnp_bbf_t crc_16_dnp_bbf_update (crc_16_dnp_bbf_t crc, const void *data, size_t data_len)
 
static crc_16_dnp_bbf_t crc_16_dnp_bbf_finalize (crc_16_dnp_bbf_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_bbf_init(), crc_16_dnp_bbf_update() and crc_16_dnp_bbf_finalize().

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

The crc_16_dnp_bbf_update() function can be called any number of times (including zero times) in between the crc_16_dnp_bbf_init() and crc_16_dnp_bbf_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_bbf_update(crc, data, data_len);
}
crc_16_dnp_bbf_t crc_16_dnp_bbf_update(crc_16_dnp_bbf_t crc, const void *data, size_t data_len)
uint_fast16_t crc_16_dnp_bbf_t
static crc_16_dnp_bbf_t crc_16_dnp_bbf_init(void)
static crc_16_dnp_bbf_t crc_16_dnp_bbf_finalize(crc_16_dnp_bbf_t crc)

Definition in file crc_16_dnp_bbf.h.

Macro Definition Documentation

◆ CRC_ALGO_BIT_BY_BIT_FAST

#define CRC_ALGO_BIT_BY_BIT_FAST   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 57 of file crc_16_dnp_bbf.h.

Typedef Documentation

◆ crc_16_dnp_bbf_t

typedef uint_fast16_t crc_16_dnp_bbf_t

The type of the CRC values.

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

Definition at line 64 of file crc_16_dnp_bbf.h.

Function Documentation

◆ crc_16_dnp_bbf_finalize()

static crc_16_dnp_bbf_t crc_16_dnp_bbf_finalize ( crc_16_dnp_bbf_t crc)
inlinestatic

Calculate the final crc value.

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

Definition at line 99 of file crc_16_dnp_bbf.h.

References crc_16_dnp_bbf_reflect().

◆ crc_16_dnp_bbf_init()

static crc_16_dnp_bbf_t crc_16_dnp_bbf_init ( void )
inlinestatic

Calculate the initial crc value.

Returns
The initial crc value.

Definition at line 80 of file crc_16_dnp_bbf.h.

◆ crc_16_dnp_bbf_reflect()

crc_16_dnp_bbf_t crc_16_dnp_bbf_reflect ( crc_16_dnp_bbf_t data,
size_t data_len )

Reflect all bits of a data word of data_len bytes.

Parameters
[in]dataThe data word to be reflected.
[in]data_lenThe width of data expressed in number of bits.
Returns
The reflected data.

Definition at line 21 of file crc_16_dnp_bbf.c.

Referenced by crc_16_dnp_bbf_finalize().

◆ crc_16_dnp_bbf_update()

crc_16_dnp_bbf_t crc_16_dnp_bbf_update ( crc_16_dnp_bbf_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 34 of file crc_16_dnp_bbf.c.