crc: Move crc7 into CRC single header

Move crc7 into CRC single header

Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
This commit is contained in:
Yannis Damigos 2018-12-28 12:09:05 +02:00 committed by Anas Nashif
commit 33f1951c9d
4 changed files with 18 additions and 39 deletions

View file

@ -3,6 +3,7 @@
* Copyright (c) 2017 Intel Corporation.
* Copyright (c) 2017 Nordic Semiconductor ASA
* Copyright (c) 2015 Runtime Inc
* Copyright (c) 2018 Google LLC.
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -155,6 +156,21 @@ u32_t crc32_ieee_update(u32_t crc, const u8_t *data, size_t len);
*/
u8_t crc8_ccitt(u8_t initial_value, const void *buf, size_t len);
/**
* @brief Compute the CRC-7 checksum of a buffer.
*
* See JESD84-A441. Used by the MMC protocol. Uses 0x09 as the
* polynomial with no reflection. The CRC is left
* justified, so bit 7 of the result is bit 6 of the CRC.
*
* @param seed Value to seed the CRC with
* @param src Input bytes for the computation
* @param len Length of the input in bytes
*
* @return The computed CRC7 value
*/
u8_t crc7_be(u8_t seed, const u8_t *src, size_t len);
/**
* @}
*/

View file

@ -1,36 +0,0 @@
/*
* Copyright (c) 2018 Google LLC.
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef __CRC7_H_
#define __CRC7_H_
#include <zephyr/types.h>
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Compute the CRC-7 checksum of a buffer.
*
* See JESD84-A441. Used by the MMC protocol. Uses 0x09 as the
* polynomial with no reflection. The CRC is left
* justified, so bit 7 of the result is bit 6 of the CRC.
*
* @param seed Value to seed the CRC with
* @param src Input bytes for the computation
* @param len Length of the input in bytes
*
* @return The computed CRC7 value
*/
u8_t crc7_be(u8_t seed, const u8_t *src, size_t len);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
#include <crc7.h>
#include <crc.h>
u8_t crc7_be(u8_t seed, const u8_t *src, size_t len)
{

View file

@ -12,8 +12,7 @@ LOG_MODULE_REGISTER(sdhc);
#include <gpio.h>
#include <misc/byteorder.h>
#include <spi.h>
#include <crc7.h>
#include <crc16.h>
#include <crc.h>
#define SDHC_SECTOR_SIZE 512
#define SDHC_CMD_SIZE 6