c - LTO CM CRC 功能

标签 c crc

我正在寻求一些关于编写 C 函数来计算 LTO RFID 芯片的 16 位 CRC 的建议。

规范说:

For commands and data that are protected by the 16-bit CRC, the generator polynomial shall be G(x) = x16 + x12 + x5 + 1 The CRC bytes shall be generated by processing all bytes through a generator circuit. See figure F.11. Registers R0 to R15 shall be 1 bit wide where R0 shall be the least significant bit and R15 the most significant bit. These registers shall be set to (6363) prior to the beginning of processing. The bytes shall be fed sequentially into the encoder, least significant bit first. After the bytes have been processed, the content of R0 is CRC0 and shall be the least significant bit. The content of R15 is CRC15 and shall be the most significant bit.

但我只是一个谦虚的自学成才的 C 程序员,这对我来说毫无意义。

有人可以帮助我编写一些代码或公式的解释吗?

最佳答案

ECMA 319 Standard中的图表显示要做什么:

shift register

虽然它包含一个错误。 R11 和 R10 之间的异或应该有另一个输入从连接到 R15 的线路上分接。

输入的位来自顶部的线路,从第一个输入字节的最低有效位开始。在每个时钟,每个寄存器都被设置为其输入。圆圈中的加号是异或门。

您可以使用 C 语言中的按位运算 ^&>> 来实现这一点。享受吧!

关于c - LTO CM CRC 功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35470541/

相关文章:

c - 使用指针从另一个函数打印字符串

php - PHP 中的 CRC8 校验

java - C 中的#define 类似于Java 中的静态变量吗?

c - 如何接受字符数组输入到 C 结构中?

c - 头文件的重要性

compiler-errors - 无法在 rust include 中编译 CRC 库!(concat!(env!("OUT_DIR"), "/crc16_constants.rs"));

java - 这个 C++ CRC32 函数的 Java 端口有什么问题?

c - bash + c 管道参数

javascript - CRC-16-IBM 实现 (JS) 不工作

python - 如何使用 Python 计算此 CRC?