blob: ae185cc7dc01de7a02bc05b0baccac89484839de [file] [log] [blame]
Julian Halld635ad72022-09-20 15:50:35 +01001/*
2 * Copyright (c) 2022, Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef COMMON_CRC32_H
8#define COMMON_CRC32_H
9
10#include <stddef.h>
11#include <stdint.h>
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
17/**
Balint Dobszay550ce872022-12-15 15:28:40 +010018 * \brief Initialize CRC32 to use HW acceleration if available
19 */
20void crc32_init(void);
21
22/**
Julian Halld635ad72022-09-20 15:50:35 +010023 * \brief Calculate a CRC32 over the provided data
24 *
Balint Dobszay550ce872022-12-15 15:28:40 +010025 * \param[in] crc_prev The starting CRC for previous data
26 * \param[in] buf The buffer to calculate the CRC over
27 * \param[in] size Number of bytes in the buffer
Julian Halld635ad72022-09-20 15:50:35 +010028 *
29 * \return The calculated CRC32
30 */
Balint Dobszay550ce872022-12-15 15:28:40 +010031extern uint32_t (*crc32)(uint32_t crc_prev, const uint8_t *buf, size_t size);
Julian Halld635ad72022-09-20 15:50:35 +010032
33#ifdef __cplusplus
34}
35#endif
36
37#endif /* COMMON_CRC32_H */