Main Page | File List | Globals

calcrc.c

Go to the documentation of this file.
00001 // This file has been prepared for Doxygen automatic documentation generation.
00023 #include "xmodem.h"
00024 
00025 int calcrc(unsigned char *ptr, int count)
00026 {
00027     int crc;
00028     char i;
00029 
00030     crc = 0;
00031     while (--count >= 0)
00032     {
00033         crc = crc ^ (int) *ptr++ << 8;
00034         i = 8;
00035         do
00036         {
00037             if (crc & 0x8000)
00038                 crc = crc << 1 ^ 0x1021;
00039             else
00040                 crc = crc << 1;
00041         } while(--i);
00042     }
00043     return (crc);
00044 }

Generated on Tue Aug 23 13:47:52 2005 for Atmel AVR Application Note by  doxygen 1.4.4