当前位置:网站首页>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
边栏推荐
- STM32逆变器电源设计方案,基于STM32F103控制器[通俗易懂]
- It is interesting to understand MMAP in this way!
- CodeBlocks 左侧项目栏消失,workspace 自动保存项目,Default workspace,打开上次的workspace,工作区(图文教程,已解决)
- C# [字节数组]与[16进制字符串]互相转换 - CodePlus系列
- How do clients request databases?
- About database: how to avoid deadlock in gbase 8s
- TC8:UDP_USER_INTERFACE_01-08
- scratch大鱼吃小鱼 电子学会图形化编程scratch等级考试二级真题和答案解析2022年6月
- 《天天数学》连载55:二月二十四日
- CSDN's one-stop cloud service is open for internal testing, and new and old users are sincerely invited to grab the fresh
猜你喜欢

硬件中台项目

Apple amplification! It's done so well

渗透常用工具-Goby

Japanese professor sues Intel FPGA and SOC products for infringing a design patent

日本教授起诉英特尔FPGA与SoC产品侵犯一项设计专利

Scratch big fish eat small fish Electronic Society graphical programming scratch grade examination level 2 true questions and answers analysis June 2022

7-Zip boycotted? The callers have committed "three crimes": pseudo open source, unsafe, and the author is from Russia!

Wechat emoticons are written into the judgment, and the OK and bomb you send may become "testimony in court"

What a high commission! The new programmer's partner plan is coming. Everyone can participate!

leetcode:111. 二叉树的最小深度
随机推荐
【论文阅读】Trajectory-guided Control Prediction for End-to-end Autonomous Driving: A Simple yet Strong Ba
SQL server2014 failed to delete the database, with an error offset of 0x0000
[laravel] detailed explanation of faker data filling
项目必用的全局异常处理器,你学会了吗
Module 9: design e-commerce seckill system
BSN long story 10: how to ensure the safety of NFT
Finally, someone made it clear what DRAM and NAND flash are
[dark horse morning post] Yu Minhong said he never looked at the stock price of New Oriental; Hengchi 5 will start pre-sale in July; Naixue virtual stock or suspected of illegal fund-raising; From Jul
Po mode deep encapsulation
硬件中台项目
Thread Basics
Drive away bad emotions and stop worrying
mysql截取_mysql截取字符串的方法[通俗易懂]
请问有没有人知道clickhouse 中 limit语句执行的逻辑,图片中,上面的SQL可以执行成功
Can MySQL CDC take out the op field
If you meet a female driver and drive didi as an amateur, you can earn 500 a day!
Who has the vision to cross the cycle?
PHP string to binary conversion
MySQL common commands
新一代云原生数据库的设计与实践