sdspi: support crc16_be for esp32s2

This commit is contained in:
Michael (XIAO Xufeng)
2020-02-11 16:36:22 +08:00
parent c1d0daf36d
commit 278634dcbd
4 changed files with 55 additions and 48 deletions

View File

@@ -17,6 +17,13 @@
#include <stdint.h>
#define ESP_ROM_HAS_CRC8LE 1
#define ESP_ROM_HAS_CRC16LE 1
#define ESP_ROM_HAS_CRC32LE 1
#define ESP_ROM_HAS_CRC8BE 1
#define ESP_ROM_HAS_CRC16BE 1
#define ESP_ROM_HAS_CRC32BE 1
#ifdef __cplusplus
extern "C" {
#endif
@@ -37,7 +44,7 @@ extern "C" {
* CRC-8 x8+x2+x1+1 0x07
* CRC16-CCITT x16+x12+x5+1 0x1021
* CRC32 x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x1+1 0x04c11db7
*
*
* These group of CRC APIs are designed to calculate the data in buffers either continuous or not.
* To make it easy, we had added a `~` at the beginning and the end of the functions.
* To calculate non-continuous buffers, we can write the code like this:
@@ -57,7 +64,7 @@ extern "C" {
* Here are some examples for CRC16:
* CRC-16/CCITT, poly = 0x1021, init = 0x0000, refin = true, refout = true, xorout = 0x0000
* crc = ~crc16_le((uint16_t)~0x0000, buf, length);
*
*
* CRC-16/CCITT-FALSE, poly = 0x1021, init = 0xffff, refin = false, refout = false, xorout = 0x0000
* crc = ~crc16_be((uint16_t)~0xffff, buf, length);
*
@@ -67,7 +74,7 @@ extern "C" {
* CRC-16/XMODEM, poly= 0x1021, init = 0x0000, refin = false, refout = false, xorout = 0x0000
* crc = ~crc16_be((uint16_t)~0x0000, buf, length);
*
*
*
*/
/**