| Remote Access Control | |||||
This file contains the function implementation for the CRC generation functions. Refer to the crc.h file for more details.
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.c.
#include "crc.h"
#include "common.h"
#include "config.h"
Include dependency graph for crc.c:

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