From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8A4CEC433F5 for ; Tue, 12 Apr 2022 09:22:45 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8C1CC83E06; Tue, 12 Apr 2022 11:22:27 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="GCEgNwJ8"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 707DF83DCD; Tue, 12 Apr 2022 11:22:07 +0200 (CEST) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6A4F983E03 for ; Tue, 12 Apr 2022 11:21:55 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E687161798; Tue, 12 Apr 2022 09:21:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 321D7C385A6; Tue, 12 Apr 2022 09:21:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1649755313; bh=kotg9WNYcCM3xWXCtjitdCBpLULQUWhs14uHdZ7mP84=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GCEgNwJ8OXQz1/sBcD+MzpCtXhIWUaixoZjuskLJ4t4qoycAUrgGeiGJA2w9Um9Z8 p8xNUDBLWf4Djl5cwkQ5WwyFvQ3BwxUIRGo+FwbFonnYXUByf5sOKDJsXBRvc7R7FD 3HtM/OvW01/m3PlI/03uZy0ik1KNNvBSqjpYIY0GcPcfYAAXDslTPNDy/oHbEP5scV 35y5LbqNiyzDeeMY4Npza8MWjA3bCIUDUdvOAJSTQUPAyUIv/4+mVd4xVPaGgvPyqs Xx3CCyyRoJvZQQdozaMd70y7bDYxoZl78gp8w3R1hvxbI909/dRQQYVE3OoXY/CylX ZUvie2I22CnLQ== Received: by pali.im (Postfix) id 766EE2AB8; Tue, 12 Apr 2022 11:21:50 +0200 (CEST) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Simon Glass , Bin Meng , Adrian Fiergolski , =?UTF-8?q?Marek=20Beh=C3=BAn?= , Stefan Roese Cc: u-boot@lists.denx.de Subject: [PATCH 3/5] crc16: Move standard CRC-16 implementation from ubifs to lib Date: Tue, 12 Apr 2022 11:20:42 +0200 Message-Id: <20220412092044.25133-4-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220412092044.25133-1-pali@kernel.org> References: <20220412092044.25133-1-pali@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean This implementation provides standard CRC-16 algorithm with polynomial x^16 + x^15 + x^2 + 1. Signed-off-by: Pali Rohár --- fs/ubifs/Makefile | 2 +- include/u-boot/crc.h | 3 +++ lib/Makefile | 1 + {fs/ubifs => lib}/crc16.c | 0 4 files changed, 5 insertions(+), 1 deletion(-) rename {fs/ubifs => lib}/crc16.c (100%) diff --git a/fs/ubifs/Makefile b/fs/ubifs/Makefile index 64d64472945e..631ba5f438cf 100644 --- a/fs/ubifs/Makefile +++ b/fs/ubifs/Makefile @@ -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 diff --git a/include/u-boot/crc.h b/include/u-boot/crc.h index eba8edfb4f31..5174bd7ac413 100644 --- a/include/u-boot/crc.h +++ b/include/u-boot/crc.h @@ -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); /** diff --git a/lib/Makefile b/lib/Makefile index b4f03cc149d3..0d0261b8986f 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -37,6 +37,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 diff --git a/fs/ubifs/crc16.c b/lib/crc16.c similarity index 100% rename from fs/ubifs/crc16.c rename to lib/crc16.c -- 2.20.1