| Remote Access Control |

# memory.c

Go to the documentation of this file.

    00001 // This file has been prepared for Doxygen automatic documentation generation.
    00048 #include "memory.h"
    00049 #include "common.h"
    00050 #include "config.h"
    00051
    00052
    00053
    00054 /* --- EEPROM memory contents --- */
    00055
    00056 // Variables at absolute addresses are defined in the header file only.
    00057
    00058
    00059
    00060 /* --- SRAM memory contents --- */
    00061
    00062 ReceiveBuffer receiveBuffer;
    00063 byte scheduleBuffer[ SCHEDULE_BUFFER_SIZE ];
    00064 byte cryptoBlock[ BLOCK_SIZE ];
    00065 byte CMACSubkey[ CMAC_SUBKEY_SIZE ];
    00066 byte tempKeyStorage[ KEY_SIZE ];
    00067
    00068
    00069
    00070 /* --- Associated functions --- */
    00071
    00073 static uint16_t bytesToErase;
    00074
    00075
    00076
    00077 #pragma vector = EE_RDY_vect
    00079 __interrupt void eepromHandler(void)
    00080 {
    00081         if( bytesToErase ) {
    00082                 ++EEAR;
    00083                 EECR |= (1<<EEMPE);
    00084                 EECR |= (1<<EEPE);
    00085                 --bytesToErase;
    00086         } else {
    00087                 EECR &= ~(1<<EERIE); // Disable further interrupts.
    00088         }
    00089 }
    00090
    00091
    00092
    00093 /* IAR header file bug fix */
    00094 #ifndef EEPM1
    00095   #define EEPM1 5
    00096 #endif
    00097 #ifndef EEPM0
    00098   #define EEPM0 4
    00099 #endif
    00100
    00101
    00102
    00103 void eraseTransmitters(void)
    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 }
    00117

@DOC_TITLE@