mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-13 03:15:06 +00:00
Add crc32_ctx.. functions to take context parameter. This allows for multiple instances to exist in parallel. Signed-off-by: mschilder@google.com TEST=make buildall -j8 succeeds BRANCH=none BUG=b:73832883 Change-Id: I66bbc56377eeebf01c790caad0bc4c7a51a1bc58 Reviewed-on: https://chromium-review.googlesource.com/935825 Commit-Ready: Marius Schilder <mschilder@chromium.org> Tested-by: Marius Schilder <mschilder@chromium.org> Reviewed-by: Marius Schilder <mschilder@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
42 lines
907 B
C
42 lines
907 B
C
/* Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#ifndef __CROS_EC_CRC_H
|
|
#define __CROS_EC_CRC_H
|
|
/* CRC-32 implementation with USB constants */
|
|
/* Note: it's a stateful CRC-32 to match the hardware block interface */
|
|
|
|
#ifdef CONFIG_HW_CRC
|
|
#include "crc_hw.h"
|
|
#else
|
|
|
|
/* Use software implementation */
|
|
|
|
/* Static context variant */
|
|
|
|
void crc32_init(void);
|
|
|
|
void crc32_hash32(uint32_t val);
|
|
|
|
void crc32_hash16(uint16_t val);
|
|
|
|
uint32_t crc32_result(void);
|
|
|
|
/* Provided context variant */
|
|
|
|
void crc32_ctx_init(uint32_t *ctx);
|
|
|
|
void crc32_ctx_hash32(uint32_t *ctx, uint32_t val);
|
|
|
|
void crc32_ctx_hash16(uint32_t *ctx, uint16_t val);
|
|
|
|
void crc32_ctx_hash8(uint32_t *ctx, uint8_t val);
|
|
|
|
uint32_t crc32_ctx_result(uint32_t *ctx);
|
|
|
|
#endif /* CONFIG_HW_CRC */
|
|
|
|
#endif /* __CROS_EC_CRC_H */
|