Skip to content

Commit 33f1951

Browse files
ydamigosnashif
authored andcommitted
crc: Move crc7 into CRC single header
Move crc7 into CRC single header Signed-off-by: Yannis Damigos <[email protected]>
1 parent 10cf245 commit 33f1951

File tree

4 files changed

+18
-39
lines changed

4 files changed

+18
-39
lines changed

include/crc.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright (c) 2017 Intel Corporation.
44
* Copyright (c) 2017 Nordic Semiconductor ASA
55
* Copyright (c) 2015 Runtime Inc
6+
* Copyright (c) 2018 Google LLC.
67
*
78
* SPDX-License-Identifier: Apache-2.0
89
*/
@@ -155,6 +156,21 @@ u32_t crc32_ieee_update(u32_t crc, const u8_t *data, size_t len);
155156
*/
156157
u8_t crc8_ccitt(u8_t initial_value, const void *buf, size_t len);
157158

159+
/**
160+
* @brief Compute the CRC-7 checksum of a buffer.
161+
*
162+
* See JESD84-A441. Used by the MMC protocol. Uses 0x09 as the
163+
* polynomial with no reflection. The CRC is left
164+
* justified, so bit 7 of the result is bit 6 of the CRC.
165+
*
166+
* @param seed Value to seed the CRC with
167+
* @param src Input bytes for the computation
168+
* @param len Length of the input in bytes
169+
*
170+
* @return The computed CRC7 value
171+
*/
172+
u8_t crc7_be(u8_t seed, const u8_t *src, size_t len);
173+
158174
/**
159175
* @}
160176
*/

include/crc7.h

Lines changed: 0 additions & 36 deletions
This file was deleted.

lib/crc/crc7_sw.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7-
#include <crc7.h>
7+
#include <crc.h>
88

99
u8_t crc7_be(u8_t seed, const u8_t *src, size_t len)
1010
{

subsys/disk/disk_access_sdhc.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ LOG_MODULE_REGISTER(sdhc);
1212
#include <gpio.h>
1313
#include <misc/byteorder.h>
1414
#include <spi.h>
15-
#include <crc7.h>
16-
#include <crc16.h>
15+
#include <crc.h>
1716

1817
#define SDHC_SECTOR_SIZE 512
1918
#define SDHC_CMD_SIZE 6

0 commit comments

Comments
 (0)