| Remote Access Control | |||||
This file contains the prototypes for the CRC generation functions. The implementation is found in the crc.c file. The CRC polynomial is defined in the config.h file.
Copyright (c) 2006, Atmel Corporation All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. The name of ATMEL may not be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY ATMEL ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Definition in file crc.h.
#include "common.h"
Include dependency graph for crc.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Functions | |
| void | calcCRC (byte nextByte) |
| void | initCRC (void) |
Variables | |
| byte | CRCReg [3] |
| void calcCRC | ( | byte | nextByte | ) |
Process one byte of the message. Also used for the last two 0-bytes.
Definition at line 67 of file crc.c.
References CRC_POLY, and CRCReg.
Referenced by transmitTeachMessage().
00068 { 00069 byte reg0 = CRCReg[0]; 00070 byte reg1 = CRCReg[1]; 00071 byte tempByte = nextByte; 00072 byte count = 8; 00073 do { 00074 if( reg0 >> 7 ) { 00075 reg0 = (reg0 << 1) | (reg1 >> 7); 00076 reg1 = (reg1 << 1) | (tempByte >> 7); 00077 tempByte <<= 1; 00078 00079 reg0 ^= CRC_POLY >> 8; 00080 reg1 ^= CRC_POLY & 0xff; 00081 } else { 00082 reg0 = (reg0 << 1) | (reg1 >> 7); 00083 reg1 = (reg1 << 1) | (tempByte >> 7); 00084 tempByte <<= 1; 00085 } 00086 } while( --count ); 00087 00088 CRCReg[0] = reg0; 00089 CRCReg[1] = reg1; 00090 }
| void initCRC | ( | void | ) |
Stores CRC value during calculation.
Definition at line 54 of file crc.c.
Referenced by calcCRC(), initCRC(), and transmitTeachMessage().
Generated on Fri Aug 8 11:03:25 2008 for AVR411 Secure Rolling Code Algorithm (Transmitter) by 1.4.7
|