zephyr/tests/unit
Carles Cufi 7f6524949a lib: os: crc: Rework the crc16() implementation
As described in #42403, there was an issue with the existing crc16_ansi()
implementation, since it was not calculating the CRC-16-ANSI (aka
CRC-16-MODBUS). This is because the  existing crc16() function only
supported non-reflected input and output (and the CRC-16-ANSI requires
reflection on both) and also it did not seem to support correctly inial
seeds different from 0x0000 (and, again, the CRC-16-ANSI requires 0xffff
as an initial seed).

This commit replaces the existing crc16() with a functional pair,
crc16() and crc16_reflect(), that also work with any poly, any initial seed
and allow to select whether reflection is performed.
It also adapts crc16_ansi() so that it actually returns the correct CRC.

Fixes #42403.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2022-02-04 12:33:22 -05:00
..
base64 cmake: tests: add cmake_minimum_required() to tests 2021-12-18 14:58:55 +01:00
cbprintf cmake: tests: add cmake_minimum_required() to tests 2021-12-18 14:58:55 +01:00
crc lib: os: crc: Rework the crc16() implementation 2022-02-04 12:33:22 -05:00
intmath cmake: tests: add cmake_minimum_required() to tests 2021-12-18 14:58:55 +01:00
list cmake: tests: add cmake_minimum_required() to tests 2021-12-18 14:58:55 +01:00
math_extras cmake: tests: add cmake_minimum_required() to tests 2021-12-18 14:58:55 +01:00
net_timeout cmake: tests: add cmake_minimum_required() to tests 2021-12-18 14:58:55 +01:00
rbtree cmake: tests: add cmake_minimum_required() to tests 2021-12-18 14:58:55 +01:00
timeutil cmake: tests: add cmake_minimum_required() to tests 2021-12-18 14:58:55 +01:00
util cmake: tests: add cmake_minimum_required() to tests 2021-12-18 14:58:55 +01:00
winstream lib/os: Add sys_winstream lockless shared memory byte stream IPC 2022-01-13 14:01:23 -05:00