-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'remotes/philmd-gitlab/tags/sdmmc-202101…
…24' into staging SD/MMC patches - Various improvements for SD cards in SPI mode (Bin Meng) # gpg: Signature made Sun 24 Jan 2021 19:16:55 GMT # gpg: using RSA key FAABE75E12917221DCFD6BB2E3E32C2CDEADC0DE # gpg: Good signature from "Philippe Mathieu-Daudé (F4BUG) <f4bug@amsat.org>" [full] # Primary key fingerprint: FAAB E75E 1291 7221 DCFD 6BB2 E3E3 2C2C DEAD C0DE * remotes/philmd-gitlab/tags/sdmmc-20210124: hw/sd: sd.h: Cosmetic change of using spaces hw/sd: ssi-sd: Use macros for the dummy value and tokens in the transfer hw/sd: ssi-sd: Fix the wrong command index for STOP_TRANSMISSION hw/sd: ssi-sd: Add a state representing Nac hw/sd: ssi-sd: Suffix a data block with CRC16 util: Add CRC16 (CCITT) calculation routines hw/sd: sd: Drop sd_crc16() hw/sd: sd: Support CMD59 for SPI mode hw/sd: ssi-sd: Fix incorrect card response sequence Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
- Loading branch information
Showing
6 changed files
with
229 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* CRC16 (CCITT) Checksum Algorithm | ||
* | ||
* Copyright (c) 2021 Wind River Systems, Inc. | ||
* | ||
* Author: | ||
* Bin Meng <bin.meng@windriver.com> | ||
* | ||
* From Linux kernel v5.10 include/linux/crc-ccitt.h | ||
* | ||
* SPDX-License-Identifier: GPL-2.0 | ||
*/ | ||
|
||
#ifndef _CRC_CCITT_H | ||
#define _CRC_CCITT_H | ||
|
||
extern uint16_t const crc_ccitt_table[256]; | ||
extern uint16_t const crc_ccitt_false_table[256]; | ||
|
||
extern uint16_t crc_ccitt(uint16_t crc, const uint8_t *buffer, size_t len); | ||
extern uint16_t crc_ccitt_false(uint16_t crc, const uint8_t *buffer, size_t len); | ||
|
||
static inline uint16_t crc_ccitt_byte(uint16_t crc, const uint8_t c) | ||
{ | ||
return (crc >> 8) ^ crc_ccitt_table[(crc ^ c) & 0xff]; | ||
} | ||
|
||
static inline uint16_t crc_ccitt_false_byte(uint16_t crc, const uint8_t c) | ||
{ | ||
return (crc << 8) ^ crc_ccitt_false_table[(crc >> 8) ^ c]; | ||
} | ||
|
||
#endif /* _CRC_CCITT_H */ |
Oops, something went wrong.