N-sim
Emulation and simulation of
Wireless Sensor Networks



   Home


   Project Page


   Download


   CVS



   Installation


   Configuration


   Plug-ins




 Hosted by
SourceForge.net Logo

/home/brennan/n-sim/OrbisQuartus/server/l4/patches/crc16.h

Go to the documentation of this file.
00001 /*
00002  *      crc16.h - CRC-16 routine
00003  *
00004  * Implements the standard CRC-16:
00005  *   Width 16
00006  *   Poly  0x8005 (x^16 + x^15 + x^2 + 1)
00007  *   Init  0
00008  *
00009  * Copyright (c) 2005 Ben Gardner <bgardner@wabtec.com>
00010  *
00011  * This source code is licensed under the GNU General Public License,
00012  * Version 2. See the file COPYING for more details.
00013  */
00014 
00015 #ifndef __CRC16_H
00016 #define __CRC16_H
00017 
00018 #include <linux/types.h>
00019 
00020 extern u16 const crc16_table[256];
00021 
00022 extern u16 crc16(u16 crc, const u8 *buffer, size_t len);
00023 
00024 static inline u16 crc16_byte(u16 crc, const u8 data)
00025 {
00026         return (crc >> 8) ^ crc16_table[(crc ^ data) & 0xff];
00027 }
00028 
00029 #endif /* __CRC16_H */
00030 


© 2007, Los Alamos National Security, LLC.