]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
crc16: Move standard CRC-16 implementation from ubifs to lib
authorPali Rohár <pali@kernel.org>
Tue, 12 Apr 2022 09:20:42 +0000 (11:20 +0200)
committerTom Rini <trini@konsulko.com>
Thu, 21 Apr 2022 18:32:40 +0000 (14:32 -0400)
This implementation provides standard CRC-16 algorithm with polynomial
x^16 + x^15 + x^2 + 1.

Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
fs/ubifs/Makefile
include/u-boot/crc.h
lib/Makefile
lib/crc16.c [moved from fs/ubifs/crc16.c with 100% similarity]

index 64d64472945e7aaee4e24b228e49fc2e1fd7d7ef..631ba5f438cfb43ce3fbcac6b62b23621ac43d02 100644 (file)
@@ -9,5 +9,5 @@
 
 obj-y := ubifs.o io.o super.o sb.o master.o lpt.o
 obj-y += lpt_commit.o scan.o lprops.o
-obj-y += tnc.o tnc_misc.o debug.o crc16.o budget.o
+obj-y += tnc.o tnc_misc.o debug.o budget.o
 obj-y += log.o orphan.o recovery.o replay.o gc.o
index eba8edfb4f319348377de4d1198570e0beea1e42..5174bd7ac413e5567dfff71ec698d7c5bf6c3e7d 100644 (file)
@@ -25,6 +25,9 @@
  */
 unsigned int crc8(unsigned int crc_start, const unsigned char *vptr, int len);
 
+/* lib/crc16.c - 16 bit CRC with polynomial x^16 + x^15 + x^2 + 1 */
+uint16_t crc16(uint16_t crc, const unsigned char *buffer, size_t len);
+
 /* lib/crc16-ccitt.c - 16 bit CRC with polynomial x^16+x^12+x^5+1 (CRC-CCITT) */
 uint16_t crc16_ccitt(uint16_t crc_start, const unsigned char *s, int len);
 /**
index cf662a765a474cbecd1f247bc05a8d364912c273..d9b1811f7506382abaafda81202705fa038bde5e 100644 (file)
@@ -35,6 +35,7 @@ obj-$(CONFIG_CIRCBUF) += circbuf.o
 endif
 
 obj-y += crc8.o
+obj-y += crc16.o
 obj-y += crc16-ccitt.o
 obj-$(CONFIG_ERRNO_STR) += errno_str.o
 obj-$(CONFIG_FIT) += fdtdec_common.o
similarity index 100%
rename from fs/ubifs/crc16.c
rename to lib/crc16.c