rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Functions
crc8hondak.cpp File Reference

Functions

static uint8_t crc_init (void)
 
static uint8_t crc_next (uint8_t crc, uint8_t data)
 
static uint8_t crc_final (uint8_t crc)
 
uint8_t crc_hondak_calc (const uint8_t *data, size_t len)
 

Function Documentation

◆ crc_final()

static uint8_t crc_final ( uint8_t  crc)
inlinestatic

Definition at line 27 of file crc8hondak.cpp.

27 {
28 return ~crc;
29}

Referenced by crc_hondak_calc().

Here is the caller graph for this function:

◆ crc_hondak_calc()

uint8_t crc_hondak_calc ( const uint8_t *  data,
size_t  len 
)

Definition at line 31 of file crc8hondak.cpp.

31 {
32 uint8_t crc = crc_init();
33
34 if (len) do {
35 crc = crc_next(crc, *data++);
36 } while (--len);
37
38 return crc_final(crc);
39}
static uint8_t crc_init(void)
Definition crc8hondak.cpp:6
static uint8_t crc_final(uint8_t crc)
static uint8_t crc_next(uint8_t crc, uint8_t data)

Referenced by kLineThread().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ crc_init()

static uint8_t crc_init ( void  )
inlinestatic

Definition at line 6 of file crc8hondak.cpp.

7{
8 return 0xff;
9}

Referenced by crc_hondak_calc().

Here is the caller graph for this function:

◆ crc_next()

static uint8_t crc_next ( uint8_t  crc,
uint8_t  data 
)
inlinestatic

Definition at line 11 of file crc8hondak.cpp.

12{
13 uint8_t eor;
14 unsigned int i = 8;
15
16 crc ^= data;
17 do {
18 /* This might produce branchless code */
19 eor = crc & 1 ? 0xb8 : 0;
20 crc >>= 1;
21 crc ^= eor;
22 } while (--i);
23
24 return crc;
25}

Referenced by crc_hondak_calc().

Here is the caller graph for this function:

Go to the source code of this file.