| Remote Access Control | |||||
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 serialNo, nextCounterValue, secretKey and sharedKey variables.
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 | MessagePayload |
| Structure containing message payload without MAC. More... | |
| union | SharedBlock |
Functions | |
| void | createMessage (COMMAND_CODE_TYPE commandCode) |
| void | initializeMessage (void) |
| void | startCounterUpdate () |
| void | waitForCounterUpdate () |
Variables | |
| byte | cryptoBlock [BLOCK_SIZE+1] |
| __no_init byte __eeprom secretKey[KEY_SIZE] | SECRET_KEY_ADDRESS |
| __no_init SEQ_COUNTER_TYPE __eeprom nextCounterValue | SEQ_COUNTER_ADDRESS |
| __no_init SERIAL_NO_TYPE __eeprom serialNo | SERIAL_NO_ADDRESS |
| __no_init byte __eeprom sharedKey[KEY_SIZE] | SHARED_KEY_ADDRESS |
| SharedBlock | sharedBlock |
| void createMessage | ( | COMMAND_CODE_TYPE | commandCode | ) |
Prepare non-constant fields for message payload in 'sharedBlock'.
Definition at line 79 of file memory.c.
References MessagePayload::commandCode, MessagePayload::counterValue, SharedBlock::messagePayload, and sharedBlock.
Referenced by transmitCommandMessage().
00080 { 00081 sharedBlock.messagePayload.commandCode = commandCode; 00082 sharedBlock.messagePayload.counterValue = nextCounterValue; 00083 }
| void initializeMessage | ( | void | ) |
Prepare constant fields for message payload in 'sharedBlock'.
Definition at line 69 of file memory.c.
References SharedBlock::messagePayload, MessagePayload::preamble, MessagePayload::serialNo, and sharedBlock.
Referenced by main(), and transmitTeachMessage().
00070 { 00071 // The preamble is used as a synch-and-start indicator for 00072 // the RF receiver. 00073 sharedBlock.messagePayload.preamble = 0xfe; // 11111110 00074 sharedBlock.messagePayload.serialNo = serialNo; 00075 }
| void startCounterUpdate | ( | ) |
Start interrupt controlled update of 'nextCounterValue' in EEPROM.
Definition at line 92 of file memory.c.
References counterBytesLeft, and SEQ_COUNTER_BYTES.
Referenced by transmitCommandMessage().
00093 { 00094 // Make sure EEPROM is ready. 00095 do {} while( EECR & (1<<EEWE) ); 00096 // Prepare control variables. 00097 EEDR = 0xff; // 0xff indicates that we just started. 00098 EEAR = (uint16_t) &nextCounterValue; 00099 counterBytesLeft = SEQ_COUNTER_BYTES; 00100 // Enable EEPROM Ready Interrupt. 00101 EECR |= (1<<EERIE); 00102 }
| void waitForCounterUpdate | ( | ) |
Wait for counter value update to finish.
Definition at line 106 of file memory.c.
References counterBytesLeft.
Referenced by transmitCommandMessage().
00107 { 00108 while( counterBytesLeft ) { __sleep(); } 00109 }
| byte cryptoBlock[BLOCK_SIZE+1] |
Common workspace for encrypting and decrypting.
Definition at line 62 of file memory.c.
Referenced by main(), transmitCommandMessage(), and transmitTeachMessage().
| __no_init byte __eeprom secretKey [ KEY_SIZE ] SECRET_KEY_ADDRESS |
| __no_init SEQ_COUNTER_TYPE __eeprom nextCounterValue SEQ_COUNTER_ADDRESS |
| __no_init SERIAL_NO_TYPE __eeprom serialNo SERIAL_NO_ADDRESS |
| __no_init byte __eeprom sharedKey [ KEY_SIZE ] SHARED_KEY_ADDRESS |
| union SharedBlock sharedBlock |
Common workspace for message payloads and a second crypto block.
Definition at line 63 of file memory.c.
Referenced by createMessage(), initializeMessage(), transmitCommandMessage(), and transmitTeachMessage().
Generated on Fri Aug 8 11:03:28 2008 for AVR411 Secure Rolling Code Algorithm (Transmitter) by 1.4.7
|