include/df/crc.hpp

00001 class CRC : virtual public SystemCode {
00002   _PROTECTED_:
00003     PTR table;
00004     uint32 poly;  //poly used
00005     uint8 bits;   //16 or 32
00006     uint32 flgs;  //flgs used
00007     void Init16();
00008     void Init32();
00009     uint16 Gen16(uint16 crc, PTR, uint32);
00010     uint32 Gen32(uint32 crc, PTR, uint32);
00011   public:
00012     CRC() { table = NULL; }
00013     ~CRC() { if (table) SystemCode::MemFree(table); }
00014     void Init(uint8 bits, uint32 poly, uint32 flgs);
00015     //set crc=0 to start CRC checking
00016     uint32 Generate(uint32 crc, PTR data, uint32 datasiz);
00017 };
00018 
00019 //bits for Init()
00020 #define CRC_16 16
00021 #define CRC_32 32
00022 
00023 //Flags for Init()
00024 #define CRC_FLAG_SHIFT_NORM  0
00025 #define CRC_FLAG_SHIFT_REV   1
00026 
00027 #define CRC_FLAG_METHOD1    0
00028 #define CRC_FLAG_METHOD2    2
00029 
00030 //CCITT standard polynomials (you can use your own if you wish)
00031 #define CRC_POLY16_XYZMODEM       0x1021
00032 #define CRC_POLY16_KERMIT         0x8404
00033 #define CRC_POLY32_ZMODEM     0x04c11db7
00034 

Generated on Mon Mar 5 09:49:13 2007 for DigiForce by  doxygen 1.4.7