diff --git a/memory/include/memory.h b/memory/include/memory.h index 5c1428257a8cbc401dc147a2c16297433a2a6cc9..0753fb187e11ec383e87775ccd72de13d3728da7 100644 --- a/memory/include/memory.h +++ b/memory/include/memory.h @@ -21,6 +21,7 @@ typedef struct TMemModule *mem_modules[MAX_NUM_MEM_MODULES]; unsigned short int (*eeprom_write_data)(unsigned short int address,unsigned short int data); unsigned short int (*eeprom_read_data)(unsigned short int address,unsigned short int *data); + unsigned char device_id; unsigned char data[RAM_SIZE]; unsigned short int total_eeprom; unsigned short int total_ram; diff --git a/memory/src/memory.c b/memory/src/memory.c index a2c9e59c2fdc9d6df8736b5f27c3460dae4ef171..c2bccc1946f5da965797dca4ad9fac676d82b3ec 100644 --- a/memory/src/memory.c +++ b/memory/src/memory.c @@ -30,6 +30,7 @@ void mem_init(TMemory *memory) /* initialize internal variables */ memory->total_eeprom=0; memory->total_ram=0; + memory->device_id=0x00; } void mem_initialize_data(TMemory *memory) @@ -44,7 +45,7 @@ void mem_initialize_data(TMemory *memory) { for(i=0;i<EEPROM_SIZE;i++) { - if(memory->eeprom_read_data(i,&data)) + if(memory->eeprom_read_data((memory->device_id<<8)+i,&data)) eeprom_data[i]=0x00; else eeprom_data[i]=data&0x00FF;