当前位置:网站首页>CRC verification
CRC verification
2022-07-01 10:15:00 【@Boring people】
1. summary :
The demo The main implementation CRC check
quote CRC The address of the library is :https://github.com/whik/crc-lib-c
2. test :
/* demo_crc.c crc demo : CRC check quote crcLib.h crcLib.c github Address : https://github.com/whik/crc-lib-c */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include "crcLib.h"
int main(int argc, char *argv[]) {
char str[16] = "Hello World!";
printf("crc4_itu\t \"%s\" = 0x%0X\n", str, crc4_itu((uint8_t *)str, (uint16_t)(strlen(str))));
printf("crc5_epc\t \"%s\" = 0x%0X\n", str, crc5_epc((uint8_t *)str, (uint16_t)(strlen(str))));
printf("crc5_itu\t \"%s\" = 0x%0X\n", str, crc5_itu((uint8_t *)str, (uint16_t)(strlen(str))));
printf("crc5_usb\t \"%s\" = 0x%0X\n", str, crc5_usb((uint8_t *)str, (uint16_t)(strlen(str))));
printf("crc6_itu\t \"%s\" = 0x%0X\n", str, crc6_itu((uint8_t *)str, (uint16_t)(strlen(str))));
printf("crc7_mmc\t \"%s\" = 0x%0X\n", str, crc7_mmc((uint8_t *)str, (uint16_t)(strlen(str))));
printf("crc8\t\t \"%s\" = 0x%0X\n", str, crc8((uint8_t *)str, (uint16_t)(strlen(str))));
printf("crc8_itu\t \"%s\" = 0x%0X\n", str, crc8_itu((uint8_t *)str, (uint16_t)(strlen(str))));
printf("crc8_rohc\t \"%s\" = 0x%0X\n", str, crc8_rohc((uint8_t *)str, (uint16_t)(strlen(str))));
printf("crc8_maxim\t \"%s\" = 0x%0X\n", str, crc8_maxim((uint8_t *)str, (uint16_t)(strlen(str))));
printf("crc16_ibm\t \"%s\" = 0x%0X\n", str, crc16_ibm((uint8_t *)str, (uint16_t)(strlen(str))));
printf("crc16_maxim\t \"%s\" = 0x%0X\n", str, crc16_maxim((uint8_t *)str, (uint16_t)(strlen(str))));
printf("crc16_usb\t \"%s\" = 0x%0X\n", str, crc16_usb((uint8_t *)str, (uint16_t)(strlen(str))));
printf("crc16_modbus\t \"%s\" = 0x%0X\n", str, crc16_modbus((uint8_t *)str, (uint16_t)(strlen(str))));
printf("crc16_ccitt\t \"%s\" = 0x%0X\n", str, crc16_ccitt((uint8_t *)str, (uint16_t)(strlen(str))));
printf("crc16_ccitt_false\t \"%s\" = 0x%0X\n", str, crc16_ccitt_false((uint8_t *)str, (uint16_t)(strlen(str))));
printf("crc16_x25\t \"%s\" = 0x%0X\n", str, crc16_x25((uint8_t *)str, (uint16_t)(strlen(str))));
printf("crc16_xmodem\t \"%s\" = 0x%0X\n", str, crc16_xmodem((uint8_t *)str, (uint16_t)(strlen(str))));
printf("crc16_dnp\t \"%s\" = 0x%0X\n", str, crc16_dnp((uint8_t *)str, (uint16_t)(strlen(str))));
printf("crc32\t\t \"%s\" = 0x%0X\n", str, crc32((uint8_t *)str, (uint16_t)(strlen(str))));
printf("crc32_mpeg_2\t \"%s\" = 0x%0X\n", str, crc32_mpeg_2((uint8_t *)str, (uint16_t)(strlen(str))));
return 0;
}
#Makefile
CC := gcc
AR := ar
all:
$(CC) -c crcLib.c -o crcLib.o -Wall -Werror
$(AR) cr libcrcLib.a crcLib.o
#-L Specify the path to the library -l Specify the name of the library to connect to
#-Wl,-Bstatic The instructions follow -lxxx Options are linked to static libraries
#-Wl,-Bdynamic The instructions follow -lxxx Options are linked to dynamic libraries
$(CC) demo_crc.c -o demo_crc -lm -L. -Wl,-Bstatic -lcrcLib -Wl,-Bdynamic -Wall -Werror
clean:
rm demo_crc *.o *.a
边栏推荐
- I like two men...
- 京东与腾讯续签三年战略合作协议;起薪涨至26万元!韩国三星SK争相加薪留住半导体人才;Firefox 102 发布|极客头条...
- STM32 inverter power supply design scheme, based on STM32F103 controller [easy to understand]
- MySQL常用命令
- Japanese professor sues Intel FPGA and SOC products for infringing a design patent
- In the new database era, don't just learn Oracle and MySQL
- CodeBlocks 左侧项目栏消失,workspace 自动保存项目,Default workspace,打开上次的workspace,工作区(图文教程,已解决)
- Sleeping second brother...
- Which securities company has a low, safe and reliable Commission for stock trading and account opening
- 这样理解mmap,挺有意思!
猜你喜欢

新一代云原生数据库的设计与实践

106. 从中序与后序遍历序列构造二叉树

uniapp微信小程序组件按需引入

历史上的今天:九十年代末的半导体大战;冯·诺依曼发表第一份草案;CBS 收购 CNET...

北汽蓝谷:业绩承压,极狐难期

新数据库时代,不要只学 Oracle、MySQL

Meituan P4 carefully collated microservice system architecture design manual to see the world of microservice architecture

Tearful eyes, it's not easy to change jobs. Three rounds of interviews, four hours of soul torture

机器学习之线性回归详解

关于#SQL#的问题,如何解决?
随机推荐
How to understand JS promise
问下群里的各位,有使用flink oracle cdc的logminer方案,在生产上稳定运行的实际
直播管理项目
关于OpenCV中图像的widthStep
微信表情符号写入判决书,你发的OK、炸弹都可能成为“呈堂证供”
The programmer was beaten.
Button button clear border
哪个券商公司炒股开户佣金低又安全又可靠
Eat a rich woman's melon...
京东与腾讯续签三年战略合作协议;起薪涨至26万元!韩国三星SK争相加薪留住半导体人才;Firefox 102 发布|极客头条...
Superscalar processor design yaoyongbin Chapter 4 branch prediction -- Excerpt from subsection 4.1
Venv: directory structure of venv
Scratch big fish eat small fish Electronic Society graphical programming scratch grade examination level 2 true questions and answers analysis June 2022
C one line code calculates the MD5 value of the file - codeplus series
Fried money, lost 10million.
Precautions for lvgl v8.2 string display on keil MDK (take little bear pie as an example)
CCNP Part XII BGP (IV)
442. 数组中重复的数据
TC8:UDP_ USER_ INTERFACE_ 01-08
Does anyone know why? The table structure is the source table MySQL CDC that has just been directly copied