| Remote Access Control |

# memory.h

Go to the documentation of this file.

    00001 // This file has been prepared for Doxygen automatic documentation generation.
    00051 #ifndef MEMORY_H
    00052 #define MEMORY_H
    00053
    00054 #include "common.h"
    00055 #include "config.h"
    00056
    00057
    00058
    00060 typedef struct
    00061 {
    00062 #ifdef USE_UART
    00063         byte preamble; // The preamble is actually received when using the UART.
    00064 #endif
    00065         SERIAL_NO_TYPE serialNo;
    00066         SEQ_COUNTER_TYPE lastCounterValue;
    00067 #if KEY_SIZE == 16
    00068         byte secretKey[ BLOCK_SIZE ];
    00069 #elif KEY_SIZE == 24 || KEY_SIZE == 32
    00070         byte secretKey[ BLOCK_SIZE*2 ]; // Two encrypted blocks are received even if key size is 24 bytes.
    00071 #else
    00072   #error Unsupported key size.
    00073 #endif
    00074         byte CRC[2];
    00075 } LearnMessage;
    00076
    00078 typedef struct
    00079 {
    00080 #ifdef USE_UART
    00081         byte preamble;
    00082 #endif
    00083         SERIAL_NO_TYPE serialNo;
    00084         SEQ_COUNTER_TYPE counterValue;
    00085         COMMAND_CODE_TYPE commandCode;
    00086         byte MAC[ MAC_BYTES ];
    00087 } CommandMessage;
    00088
    00090 typedef union
    00091 {
    00092         LearnMessage learnMessage;
    00093         CommandMessage commandMessage;
    00094 } ReceiveBuffer;
    00095
    00097 typedef struct
    00098 {
    00099         byte secretKey[ KEY_SIZE ];
    00100         SERIAL_NO_TYPE serialNo;
    00101         SEQ_COUNTER_TYPE lastCounterValue;
    00102 } TransmitterInfo;
    00103
    00104
    00105
    00106 /* --- EEPROM memory contents --- */
    00107
    00108 // Due to placement at absolute addresses, these variables
    00109 // are defined in the header file without external declaration.
    00110 // This means that every translation unit will have its own
    00111 // copy of the variable, but since they occupy the same place in
    00112 // memory, it doesn't give any extra memory usage.
    00113
    00115 __no_init byte __eeprom sharedKey[ KEY_SIZE ] @ 0;
    00117 __no_init byte __eeprom transmitterCount @ KEY_SIZE;
    00119 __no_init TransmitterInfo __eeprom transmitters[ MAX_TRANSMITTERS ] @ (KEY_SIZE+1);
    00120
    00121
    00122
    00123 /* --- SRAM memory contents --- */
    00124
    00126 extern ReceiveBuffer receiveBuffer;
    00128 extern byte scheduleBuffer[ SCHEDULE_BUFFER_SIZE ];
    00130 extern byte cryptoBlock[ BLOCK_SIZE ];
    00132 extern byte CMACSubkey[ CMAC_SUBKEY_SIZE ];
    00134 extern byte tempKeyStorage[ KEY_SIZE ];
    00135
    00136
    00137
    00138 /* --- Associated functions --- */
    00139
    00141 void eraseTransmitters(void);
    00142
    00143
    00144
    00145 #endif
    00146

@DOC_TITLE@