Remote Access Control


memory.h File Reference


Detailed Description

Header file for EEPROM and SRAM variables and support functions.

This file contains variable declarations and function prototypes for common data in EEPROM and SRAM. The implementation is found in the memory.c file. Note that the cryptographic key management PC tools relies upon the specific placement in EEPROM of the sharedKey, transmitterCount and transmitters variables.

Author:
Atmel Corporation: http://www.atmel.com
Support email: avr@atmel.com
Name
Revision
1193
Date
2006-10-31 14:21:08 +0100 (ti, 31 okt 2006)

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 memory.h.

#include "common.h"
#include "config.h"

Include dependency graph for memory.h:

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

Go to the source code of this file.

Data Structures

struct  CommandMessage
 Command message payload fields including the CMAC value. More...
struct  LearnMessage
 Learn message fields. More...
union  ReceiveBuffer
 Dual-use receive buffer. More...
struct  TransmitterInfo
 Collects info for one associated transmitter. More...

Functions

void eraseTransmitters (void)
__no_init TransmitterInfo
__eeprom 
transmitters (KEY_SIZE+1)

Variables

byte CMACSubkey [CMAC_SUBKEY_SIZE]
byte cryptoBlock [BLOCK_SIZE]
__no_init byte __eeprom transmitterCount KEY_SIZE
ReceiveBuffer receiveBuffer
byte scheduleBuffer [SCHEDULE_BUFFER_SIZE]
__no_init byte __eeprom sharedKey [KEY_SIZE]
byte tempKeyStorage [KEY_SIZE]


Function Documentation

void eraseTransmitters ( void   ) 

Clear array containing transmitter info.

Definition at line 103 of file memory.c.

References bytesToErase, EEPM0, EEPM1, and transmitters().

Referenced by learnMode().

00104 {
00105         bytesToErase = sizeof( TransmitterInfo ) * transmitterCount;
00106         do {} while( EECR & (1<<EEPE) );
00107         EECR = (0<<EEPM1) | (1<<EEPM0); // Erase-Only Mode.
00108         EEAR = ((uint16_t) transmitters) - 1;
00109         EECR |= (1<<EERIE);
00110         while( bytesToErase ) {
00111                 __sleep();
00112         }
00113         do {} while( EECR & (1<<EEPE) );
00114         EECR = (0<<EEPM1) | (0<<EEPM0); // Back to Atomic Mode.
00115         transmitterCount = 0;
00116 }

Here is the call graph for this function:

__no_init TransmitterInfo __eeprom transmitters ( KEY_SIZE 1  ) 

Array of associated tranasmitters.

Referenced by eraseTransmitters(), learnMode(), and main().


Variable Documentation

byte CMACSubkey[CMAC_SUBKEY_SIZE]

Precalculated subkey for generating AES-CMAC for a transmitters.

Definition at line 65 of file memory.c.

Referenced by main().

byte cryptoBlock[BLOCK_SIZE]

Workspace for AES encryption and decryption.

Definition at line 64 of file memory.c.

Referenced by main().

__no_init byte __eeprom transmitterCount KEY_SIZE

Number of transmitters currently associated.

Definition at line 117 of file memory.h.

ReceiveBuffer receiveBuffer

Buffer containing recevied message frames.

Definition at line 62 of file memory.c.

Referenced by enableReception(), learnMode(), and main().

byte scheduleBuffer[SCHEDULE_BUFFER_SIZE]

Storage for current round key when calculating AES key schedule.

Definition at line 63 of file memory.c.

Referenced by learnMode(), and main().

__no_init byte __eeprom sharedKey[KEY_SIZE]

Shared key for this system. Transmitters must have the same key programmed.

Definition at line 115 of file memory.h.

Referenced by learnMode().

byte tempKeyStorage[KEY_SIZE]

Stores a copy of a transmitter's secret key from EEPROM.

Definition at line 66 of file memory.c.

Referenced by learnMode(), and main().

@DOC_TITLE@
Generated on Fri Aug 8 11:04:04 2008 for AVR411 Secure Rolling Code Algorithm (Receiver) by doxygen 1.4.7