From bed4afb01e2a30646dab92c1c0a620819864cbd9 Mon Sep 17 00:00:00 2001 From: whik <1490789115@qq.com> Date: Sun, 20 Sep 2020 18:15:08 +0800 Subject: [PATCH] create respository --- bin/Debug/project.exe | Bin 0 -> 64426 bytes crcLib.c | 570 ++++++++++++++++++++++++++++++++++++++++++ crcLib.h | 29 +++ main.c | 15 ++ obj/Debug/crcLib.o | Bin 0 -> 11698 bytes obj/Debug/main.o | Bin 0 -> 2974 bytes project.bmarks | 16 ++ project.cbp | 45 ++++ project.depend | 12 + project.layout | 20 ++ 10 files changed, 707 insertions(+) create mode 100644 bin/Debug/project.exe create mode 100644 crcLib.c create mode 100644 crcLib.h create mode 100644 main.c create mode 100644 obj/Debug/crcLib.o create mode 100644 obj/Debug/main.o create mode 100644 project.bmarks create mode 100644 project.cbp create mode 100644 project.depend create mode 100644 project.layout diff --git a/bin/Debug/project.exe b/bin/Debug/project.exe new file mode 100644 index 0000000000000000000000000000000000000000..df300b507d4eb293b36483da42783611e84d58d6 GIT binary patch literal 64426 zcmeIb4SbZeAL)s{G9Fd+xo@ z+dN5-)ZOm?_xJf^a_>F&+;h%7_uO+|p8Gsc-Sxw)kTGV*Z*-Kgg9z#J@c$G4+k@;G z7e6+GJyiVcB?oPxXD?~#j-}j*WM5Y@+~bafdwcuR?)IoVndx=MdfmQ;W_M3tN3?SK z^r_{NbfcfKj@w-9<;%Mib|+)cLXcDJGB&NC;38H5Bp-fL89O!`VJQ{z&_59`5OPz} z!H}TKW8=W1KeF+9G3MrAQI?{dh!z+i0&keH_!JT4|J#rz1%1G)t&wrD^U+`WJY#o5 zwDGRWbhJN>%!7;Zk3^)pQ==HJHrCiy*%3~M0Xs@?4}MhbrT7^x4{IE$ObWy*2QnZN zE5fhRfP|=rwRtKN0*}|R4M5^qgP-B@uqsbwzrZ_1{1W&P-WmfEq8zV1l_Kb#V){oh z>$Qiqja0@YU()q3eop+>nQ=jHq_VcDg`nN^Z$Ey---n;!@-WXxWjfCJmJ<8`euT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oX)P%{7wO z?Z)y`s-{dUInwJGPD`69^rUu@_lNoGQw62ArJ+fzC1@R?4%h0ki#n^mYazJGTTOX` zE=En%fJER!O=C2PeJkt*MPS*OqiQn;xrHcD(i0X^+ehmMD>Ou-WL@Lzz%!9r> zG$M2|Zbuf`6V1)k_7lCp;Lk}+bqCr!9fXaW=YA>;!Obwq!Q3N{qPTA>5e?JramEQQ z1kGVgt88t)#Roj&t1o1VF>z4k6hOIc}h#&PHgv@w=RY13=`0?`=_z(4Ewd*_Bb<9 z6Ldj-k2lY?8r*~4*VJjfkifhMRP9}iaK^c9yf2KcI;Arn?h=z~CDOekmENKB&{8tb z`$^9!j8=64-N9b;5qJ;27BDV@^ybqhdS+LICXt?q29gOT%<6nVH!EWuAP?pW*18Ez z&{SOO4&#kFLf!HNgx)xEJ683z{AhueJJH-?qQ${jGl{cLkf<`cLe+_`CX6^ns18hN LZO)L_-`M{JgB6S3 literal 0 HcmV?d00001 diff --git a/crcLib.c b/crcLib.c new file mode 100644 index 0000000..0c3423e --- /dev/null +++ b/crcLib.c @@ -0,0 +1,570 @@ +#include "crcLib.h" + +/****************************************************************************** + * Name: CRC-4/ITU x4+x+1 + * Poly: 0x03 + * Init: 0x00 + * Refin: True + * Refout: True + * Xorout: 0x00 + * Note: + *****************************************************************************/ +uint8_t crc4_itu(uint8_t *data, uint16_t length) +{ + uint8_t i; + uint8_t crc = 0; // Initial value + while(length--) + { + crc ^= *data++; // crc ^= *data; data++; + for (i = 0; i < 8; ++i) + { + if (crc & 1) + crc = (crc >> 1) ^ 0x0C;// 0x0C = (reverse 0x03)>>(8-4) + else + crc = (crc >> 1); + } + } + return crc; +} + +/****************************************************************************** + * Name: CRC-5/EPC x5+x3+1 + * Poly: 0x09 + * Init: 0x09 + * Refin: False + * Refout: False + * Xorout: 0x00 + * Note: + *****************************************************************************/ +uint8_t crc5_epc(uint8_t *data, uint16_t length) +{ + uint8_t i; + uint8_t crc = 0x48; // Initial value: 0x48 = 0x09<<(8-5) + while(length--) + { + crc ^= *data++; // crc ^= *data; data++; + for ( i = 0; i < 8; i++ ) + { + if ( crc & 0x80 ) + crc = (crc << 1) ^ 0x48; // 0x48 = 0x09<<(8-5) + else + crc <<= 1; + } + } + return crc >> 3; +} + +/****************************************************************************** + * Name: CRC-5/ITU x5+x4+x2+1 + * Poly: 0x15 + * Init: 0x00 + * Refin: True + * Refout: True + * Xorout: 0x00 + * Note: + *****************************************************************************/ +uint8_t crc5_itu(uint8_t *data, uint16_t length) +{ + uint8_t i; + uint8_t crc = 0; // Initial value + while(length--) + { + crc ^= *data++; // crc ^= *data; data++; + for (i = 0; i < 8; ++i) + { + if (crc & 1) + crc = (crc >> 1) ^ 0x15;// 0x15 = (reverse 0x15)>>(8-5) + else + crc = (crc >> 1); + } + } + return crc; +} + +/****************************************************************************** + * Name: CRC-5/USB x5+x2+1 + * Poly: 0x05 + * Init: 0x1F + * Refin: True + * Refout: True + * Xorout: 0x1F + * Note: + *****************************************************************************/ +uint8_t crc5_usb(uint8_t *data, uint16_t length) +{ + uint8_t i; + uint8_t crc = 0x1F; // Initial value + while(length--) + { + crc ^= *data++; // crc ^= *data; data++; + for (i = 0; i < 8; ++i) + { + if (crc & 1) + crc = (crc >> 1) ^ 0x14;// 0x14 = (reverse 0x05)>>(8-5) + else + crc = (crc >> 1); + } + } + return crc ^ 0x1F; +} + +/****************************************************************************** + * Name: CRC-6/ITU x6+x+1 + * Poly: 0x03 + * Init: 0x00 + * Refin: True + * Refout: True + * Xorout: 0x00 + * Note: + *****************************************************************************/ +uint8_t crc6_itu(uint8_t *data, uint16_t length) +{ + uint8_t i; + uint8_t crc = 0; // Initial value + while(length--) + { + crc ^= *data++; // crc ^= *data; data++; + for (i = 0; i < 8; ++i) + { + if (crc & 1) + crc = (crc >> 1) ^ 0x30;// 0x30 = (reverse 0x03)>>(8-6) + else + crc = (crc >> 1); + } + } + return crc; +} + +/****************************************************************************** + * Name: CRC-7/MMC x7+x3+1 + * Poly: 0x09 + * Init: 0x00 + * Refin: False + * Refout: False + * Xorout: 0x00 + * Use: MultiMediaCard,SD,ect. + *****************************************************************************/ +uint8_t crc7_mmc(uint8_t *data, uint16_t length) +{ + uint8_t i; + uint8_t crc = 0; // Initial value + while(length--) + { + crc ^= *data++; // crc ^= *data; data++; + for ( i = 0; i < 8; i++ ) + { + if ( crc & 0x80 ) + crc = (crc << 1) ^ 0x12; // 0x12 = 0x09<<(8-7) + else + crc <<= 1; + } + } + return crc >> 1; +} + +/****************************************************************************** + * Name: CRC-8 x8+x2+x+1 + * Poly: 0x07 + * Init: 0x00 + * Refin: False + * Refout: False + * Xorout: 0x00 + * Note: + *****************************************************************************/ +uint8_t crc8(uint8_t *data, uint16_t length) +{ + uint8_t i; + uint8_t crc = 0; // Initial value + while(length--) + { + crc ^= *data++; // crc ^= *data; data++; + for ( i = 0; i < 8; i++ ) + { + if ( crc & 0x80 ) + crc = (crc << 1) ^ 0x07; + else + crc <<= 1; + } + } + return crc; +} + +/****************************************************************************** + * Name: CRC-8/ITU x8+x2+x+1 + * Poly: 0x07 + * Init: 0x00 + * Refin: False + * Refout: False + * Xorout: 0x55 + * Alias: CRC-8/ATM + *****************************************************************************/ +uint8_t crc8_itu(uint8_t *data, uint16_t length) +{ + uint8_t i; + uint8_t crc = 0; // Initial value + while(length--) + { + crc ^= *data++; // crc ^= *data; data++; + for ( i = 0; i < 8; i++ ) + { + if ( crc & 0x80 ) + crc = (crc << 1) ^ 0x07; + else + crc <<= 1; + } + } + return crc ^ 0x55; +} + +/****************************************************************************** + * Name: CRC-8/ROHC x8+x2+x+1 + * Poly: 0x07 + * Init: 0xFF + * Refin: True + * Refout: True + * Xorout: 0x00 + * Note: + *****************************************************************************/ +uint8_t crc8_rohc(uint8_t *data, uint16_t length) +{ + uint8_t i; + uint8_t crc = 0xFF; // Initial value + while(length--) + { + crc ^= *data++; // crc ^= *data; data++; + for (i = 0; i < 8; ++i) + { + if (crc & 1) + crc = (crc >> 1) ^ 0xE0; // 0xE0 = reverse 0x07 + else + crc = (crc >> 1); + } + } + return crc; +} + +/****************************************************************************** + * Name: CRC-8/MAXIM x8+x5+x4+1 + * Poly: 0x31 + * Init: 0x00 + * Refin: True + * Refout: True + * Xorout: 0x00 + * Alias: DOW-CRC,CRC-8/IBUTTON + * Use: Maxim(Dallas)'s some devices,e.g. DS18B20 + *****************************************************************************/ +uint8_t crc8_maxim(uint8_t *data, uint16_t length) +{ + uint8_t i; + uint8_t crc = 0; // Initial value + while(length--) + { + crc ^= *data++; // crc ^= *data; data++; + for (i = 0; i < 8; i++) + { + if (crc & 1) + crc = (crc >> 1) ^ 0x8C; // 0x8C = reverse 0x31 + else + crc >>= 1; + } + } + return crc; +} + +/****************************************************************************** + * Name: CRC-16/IBM x16+x15+x2+1 + * Poly: 0x8005 + * Init: 0x0000 + * Refin: True + * Refout: True + * Xorout: 0x0000 + * Alias: CRC-16,CRC-16/ARC,CRC-16/LHA + *****************************************************************************/ +uint16_t crc16_ibm(uint8_t *data, uint16_t length) +{ + uint8_t i; + uint16_t crc = 0; // Initial value + while(length--) + { + crc ^= *data++; // crc ^= *data; data++; + for (i = 0; i < 8; ++i) + { + if (crc & 1) + crc = (crc >> 1) ^ 0xA001; // 0xA001 = reverse 0x8005 + else + crc = (crc >> 1); + } + } + return crc; +} + +/****************************************************************************** + * Name: CRC-16/MAXIM x16+x15+x2+1 + * Poly: 0x8005 + * Init: 0x0000 + * Refin: True + * Refout: True + * Xorout: 0xFFFF + * Note: + *****************************************************************************/ +uint16_t crc16_maxim(uint8_t *data, uint16_t length) +{ + uint8_t i; + uint16_t crc = 0; // Initial value + while(length--) + { + crc ^= *data++; // crc ^= *data; data++; + for (i = 0; i < 8; ++i) + { + if (crc & 1) + crc = (crc >> 1) ^ 0xA001; // 0xA001 = reverse 0x8005 + else + crc = (crc >> 1); + } + } + return ~crc; // crc^0xffff +} + +/****************************************************************************** + * Name: CRC-16/USB x16+x15+x2+1 + * Poly: 0x8005 + * Init: 0xFFFF + * Refin: True + * Refout: True + * Xorout: 0xFFFF + * Note: + *****************************************************************************/ +uint16_t crc16_usb(uint8_t *data, uint16_t length) +{ + uint8_t i; + uint16_t crc = 0xffff; // Initial value + while(length--) + { + crc ^= *data++; // crc ^= *data; data++; + for (i = 0; i < 8; ++i) + { + if (crc & 1) + crc = (crc >> 1) ^ 0xA001; // 0xA001 = reverse 0x8005 + else + crc = (crc >> 1); + } + } + return ~crc; // crc^0xffff +} + +/****************************************************************************** + * Name: CRC-16/MODBUS x16+x15+x2+1 + * Poly: 0x8005 + * Init: 0xFFFF + * Refin: True + * Refout: True + * Xorout: 0x0000 + * Note: + *****************************************************************************/ +uint16_t crc16_modbus(uint8_t *data, uint16_t length) +{ + uint8_t i; + uint16_t crc = 0xffff; // Initial value + while(length--) + { + crc ^= *data++; // crc ^= *data; data++; + for (i = 0; i < 8; ++i) + { + if (crc & 1) + crc = (crc >> 1) ^ 0xA001; // 0xA001 = reverse 0x8005 + else + crc = (crc >> 1); + } + } + return crc; +} + +/****************************************************************************** + * Name: CRC-16/CCITT x16+x12+x5+1 + * Poly: 0x1021 + * Init: 0x0000 + * Refin: True + * Refout: True + * Xorout: 0x0000 + * Alias: CRC-CCITT,CRC-16/CCITT-TRUE,CRC-16/KERMIT + *****************************************************************************/ +uint16_t crc16_ccitt(uint8_t *data, uint16_t length) +{ + uint8_t i; + uint16_t crc = 0; // Initial value + while(length--) + { + crc ^= *data++; // crc ^= *data; data++; + for (i = 0; i < 8; ++i) + { + if (crc & 1) + crc = (crc >> 1) ^ 0x8408; // 0x8408 = reverse 0x1021 + else + crc = (crc >> 1); + } + } + return crc; +} + +/****************************************************************************** + * Name: CRC-16/CCITT-FALSE x16+x12+x5+1 + * Poly: 0x1021 + * Init: 0xFFFF + * Refin: False + * Refout: False + * Xorout: 0x0000 + * Note: + *****************************************************************************/ +uint16_t crc16_ccitt_false(uint8_t *data, uint16_t length) +{ + uint8_t i; + uint16_t crc = 0xffff; //Initial value + while(length--) + { + crc ^= (uint16_t)(*data++) << 8; // crc ^= (uint6_t)(*data)<<8; data++; + for (i = 0; i < 8; ++i) + { + if ( crc & 0x8000 ) + crc = (crc << 1) ^ 0x1021; + else + crc <<= 1; + } + } + return crc; +} + +/****************************************************************************** + * Name: CRC-16/X25 x16+x12+x5+1 + * Poly: 0x1021 + * Init: 0xFFFF + * Refin: True + * Refout: True + * Xorout: 0XFFFF + * Note: + *****************************************************************************/ +uint16_t crc16_x25(uint8_t *data, uint16_t length) +{ + uint8_t i; + uint16_t crc = 0xffff; // Initial value + while(length--) + { + crc ^= *data++; // crc ^= *data; data++; + for (i = 0; i < 8; ++i) + { + if (crc & 1) + crc = (crc >> 1) ^ 0x8408; // 0x8408 = reverse 0x1021 + else + crc = (crc >> 1); + } + } + return ~crc; // crc^Xorout +} + +/****************************************************************************** + * Name: CRC-16/XMODEM x16+x12+x5+1 + * Poly: 0x1021 + * Init: 0x0000 + * Refin: False + * Refout: False + * Xorout: 0x0000 + * Alias: CRC-16/ZMODEM,CRC-16/ACORN + *****************************************************************************/ +uint16_t crc16_xmodem(uint8_t *data, uint16_t length) +{ + uint8_t i; + uint16_t crc = 0; // Initial value + while(length--) + { + crc ^= (uint16_t)(*data++) << 8; // crc ^= (uint16_t)(*data)<<8; data++; + for (i = 0; i < 8; ++i) + { + if ( crc & 0x8000 ) + crc = (crc << 1) ^ 0x1021; + else + crc <<= 1; + } + } + return crc; +} + +/****************************************************************************** + * Name: CRC-16/DNP x16+x13+x12+x11+x10+x8+x6+x5+x2+1 + * Poly: 0x3D65 + * Init: 0x0000 + * Refin: True + * Refout: True + * Xorout: 0xFFFF + * Use: M-Bus,ect. + *****************************************************************************/ +uint16_t crc16_dnp(uint8_t *data, uint16_t length) +{ + uint8_t i; + uint16_t crc = 0; // Initial value + while(length--) + { + crc ^= *data++; // crc ^= *data; data++; + for (i = 0; i < 8; ++i) + { + if (crc & 1) + crc = (crc >> 1) ^ 0xA6BC; // 0xA6BC = reverse 0x3D65 + else + crc = (crc >> 1); + } + } + return ~crc; // crc^Xorout +} + +/****************************************************************************** + * Name: CRC-32 x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1 + * Poly: 0x4C11DB7 + * Init: 0xFFFFFFF + * Refin: True + * Refout: True + * Xorout: 0xFFFFFFF + * Alias: CRC_32/ADCCP + * Use: WinRAR,ect. + *****************************************************************************/ +uint32_t crc32(uint8_t *data, uint16_t length) +{ + uint8_t i; + uint32_t crc = 0xffffffff; // Initial value + while(length--) + { + crc ^= *data++; // crc ^= *data; data++; + for (i = 0; i < 8; ++i) + { + if (crc & 1) + crc = (crc >> 1) ^ 0xEDB88320;// 0xEDB88320= reverse 0x04C11DB7 + else + crc = (crc >> 1); + } + } + return ~crc; +} + +/****************************************************************************** + * Name: CRC-32/MPEG-2 x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1 + * Poly: 0x4C11DB7 + * Init: 0xFFFFFFF + * Refin: False + * Refout: False + * Xorout: 0x0000000 + * Note: + *****************************************************************************/ +uint32_t crc32_mpeg_2(uint8_t *data, uint16_t length) +{ + uint8_t i; + uint32_t crc = 0xffffffff; // Initial value + while(length--) + { + crc ^= (uint32_t)(*data++) << 24;// crc ^=(uint32_t)(*data)<<24; data++; + for (i = 0; i < 8; ++i) + { + if ( crc & 0x80000000 ) + crc = (crc << 1) ^ 0x04C11DB7; + else + crc <<= 1; + } + } + return crc; +} diff --git a/crcLib.h b/crcLib.h new file mode 100644 index 0000000..9029f6a --- /dev/null +++ b/crcLib.h @@ -0,0 +1,29 @@ +#ifndef __CRCLIB_H__ +#define __CRCLIB_H__ + +#include "stdint.h" + +uint8_t crc4_itu(uint8_t *data, uint16_t length); +uint8_t crc5_epc(uint8_t *data, uint16_t length); +uint8_t crc5_itu(uint8_t *data, uint16_t length); +uint8_t crc5_usb(uint8_t *data, uint16_t length); +uint8_t crc6_itu(uint8_t *data, uint16_t length); +uint8_t crc7_mmc(uint8_t *data, uint16_t length); +uint8_t crc8(uint8_t *data, uint16_t length); +uint8_t crc8_itu(uint8_t *data, uint16_t length); +uint8_t crc8_rohc(uint8_t *data, uint16_t length); +uint8_t crc8_maxim(uint8_t *data, uint16_t length);//DS18B20 +uint16_t crc16_ibm(uint8_t *data, uint16_t length); +uint16_t crc16_maxim(uint8_t *data, uint16_t length); +uint16_t crc16_usb(uint8_t *data, uint16_t length); +uint16_t crc16_modbus(uint8_t *data, uint16_t length); +uint16_t crc16_ccitt(uint8_t *data, uint16_t length); +uint16_t crc16_ccitt_false(uint8_t *data, uint16_t length); +uint16_t crc16_x25(uint8_t *data, uint16_t length); +uint16_t crc16_xmodem(uint8_t *data, uint16_t length); +uint16_t crc16_dnp(uint8_t *data, uint16_t length); +uint32_t crc32(uint8_t *data, uint16_t length); +uint32_t crc32_mpeg_2(uint8_t *data, uint16_t length); + + +#endif // __CRCLIB_H__ diff --git a/main.c b/main.c new file mode 100644 index 0000000..3d7279e --- /dev/null +++ b/main.c @@ -0,0 +1,15 @@ +#include +#include +#include "crcLib.h" + +int main() +{ + uint8_t data; + uint8_t crc; + + data = 0x34; + crc = crc8_maxim(&data, 1); + + printf("data:%02x, crc:%02x\n", data, crc); + return 0; +} diff --git a/obj/Debug/crcLib.o b/obj/Debug/crcLib.o new file mode 100644 index 0000000000000000000000000000000000000000..e6f914b3d701f7e7435302cf1afd560c3e91e55f GIT binary patch literal 11698 zcmd^F3v67)6`k4ji#Psme#KT2vPlhb+<0v#{v~x9<9LZlLTXgPr%L3{de>f9@0$G( zClD#B1BnY%K~SJoilPWw6h$Fa2oQy4p-~`$R*s-xXi?KP1Pce%5)>j~*}Zq>?cF!C zw#kpCQb&3_ch0?Y&ztYNZ{Bv?pTjUYmoQc?qzvYc`FdkQmOlg28T*1;01#cQxz*j# z7Hd=Cv{F55PPp5n(KLky>_od>)!``E9LrV>>sfidyC>Z)0nKP!ByCqihIVC@YTc92 zj#qLSd$~yB4Z_aZP*zc`7`_9ghpti}@CSCwWe+7aSZXa`Y~x~y*dP;jl~q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$yAS$8!^ z((?~VdV;ji5_Xg%TSl^OAxN_B5|X+}yNj?#N%}Ks&k{CD(rP%3k#}_qNYb;Pq~DPC z_k{h4BqwyVth*Q_S+|Cyt)%@KVZS2j1JaHVHcnCv9EwQK8$ptuw~+J;(jFn~C`n(F zcBUg)cOgkzK$4zgg!Pehl(g>=_AyBd;SFBatp!Qm)moDJNc$LJPm=^qV~fOGbHcCm z@&HNmKynMMi?Bw*ng|OL)F1>wui7ogdHL5UBd7HO}2cLFnp<&SP@8)qnNM_gf$ZuBdnLOeT3~N>=_ zNq!sw5xzX)_ZTTzQ9SN8QTee;7QFaP&r}H6{Jtl(z3^qxl;r13S-@|oAf-MLe_O5m E4{hcGLI3~& literal 0 HcmV?d00001 diff --git a/obj/Debug/main.o b/obj/Debug/main.o new file mode 100644 index 0000000000000000000000000000000000000000..01b91a49a05977ebf5d61181f9c83852df7797c2 GIT binary patch literal 2974 zcmb7G+iM(U6hGfwvXgAmrj5NsTRVl+8`(?KG)ZGG+gzHIS_wiag_L!6c6KxET$Y*L z>^3Nf)ndegeG#oieeglS>WdT+!Fr(&3epz^{{X=U@kL)$NImD9nazxwKKQ|$Ip=qN z=X__r+kE9KeL(FC1z-=?B*@l{R-NmCSisjV0UzX0lkibt;n{3it7{y&zbL@M?QF^S z@6QN4FA&d5CREX7VZZT)`3l)qlGlrb*E)FlLble)dlPvx;dh7_SAcvWHyZB&;5<6s zM_wuRy#?r>%IzOZ5U-=fx)KoPL*9XW0wn8gf^!_)z9^k9Pb16toB@12mxBHqFA z1aBjQ_d7O`a23#cE0ut---SYM{7?cU-p|PUAW>go>dgG=FY}jw%l}I3JF{z}^H*or zKBubYSHI%mE3@}D-#UZO?AqpAw~w#hUHy9gDqm3C{TT($U;Z|K{+rja(QHia%a62% zRo&CM)XC#r)g2VPy@PczVAGGEG6gKzt8FhO9xH^&DpUtZoyWVh&Bf9Gu zBWP%zzI4QKb=T3JIBKDWD%u+^Qv^CSo>ac+;>}|bY0tD8jFKHeK zO3HGbs>(&f@y)7ZlvUHIqeou%5Fj=wqF4v1wDU_!A*B2z*Q=|^FiGaoQV>nLq&$ao zN%@4!A1PEy{U<1>A_+33ZHKi=Ww%kX42+j5maAcr{Sq%S#N}eqv}?s;(JmGBhF7$; z76^X-pV(y=&D`@i$*Gr60g#LSCBJBRo@M%&=c7k#^aY@UCx*8$JS%QxWM>)iVa*H6S$z{p}{>^upr36 zf}%y!O$!>BEYmDRE!sKkMh`y%S*j0k6A9Ox9^47Ql+bkX0NcX$DFbOyc}Us9wx;@b zAZ-ZJ>7xh%h}%I_Ceu%*52a5I;CO6C4=M6!3_mt_cn}v3VYIiU9ATWbB_!eJB|Y z7U08XCUe0-kZT_Vcmm`WJh$p;wn|5YpPP2e#+2pi7yaC6)0sP)YfX$5$3`mGWdk5QMliWwFXPFQU7}iT&B6qMu6y;eQSk!n7$GM=%VA6BOtrd3xI2i#Rz})w+F<>pVH>JEsV}Wfbc(r9Tn#VWwUlFGJx`eqq$mZ^Dl)Lbe z;9-=zxki5&I+ZhnApJOBg z-p6f?>UfZQ)i#!`;Jl$lZS5XFm4&ksKwR?O5!wt?+*&bbsK)O* + + + + + + + + + + + + + + + diff --git a/project.cbp b/project.cbp new file mode 100644 index 0000000..8340e13 --- /dev/null +++ b/project.cbp @@ -0,0 +1,45 @@ + + + + + + diff --git a/project.depend b/project.depend new file mode 100644 index 0000000..36d7ebd --- /dev/null +++ b/project.depend @@ -0,0 +1,12 @@ +# depslib dependency file v1.0 +1600584609 source:d:\myfile\crc-lib-c\crclib.c + "crcLib.h" + +1600596279 d:\myfile\crc-lib-c\crclib.h + "stdint.h" + +1600596694 source:d:\myfile\crc-lib-c\main.c + + + "crcLib.h" + diff --git a/project.layout b/project.layout new file mode 100644 index 0000000..c791b34 --- /dev/null +++ b/project.layout @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + +