Skip to content
Snippets Groups Projects
Commit 3ecc9a65 authored by Sergi Hernandez's avatar Sergi Hernandez
Browse files

Removed the device ID from the EEPROM address generation.

parent 3b077d60
No related branches found
No related tags found
No related merge requests found
...@@ -19,7 +19,6 @@ typedef struct ...@@ -19,7 +19,6 @@ typedef struct
{ {
unsigned char num_mem_modules; unsigned char num_mem_modules;
TMemModule *mem_modules[MAX_NUM_MEM_MODULES]; TMemModule *mem_modules[MAX_NUM_MEM_MODULES];
unsigned char device_id;
unsigned short int (*eeprom_write_data)(unsigned short int address,unsigned short int data); 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 short int (*eeprom_read_data)(unsigned short int address,unsigned short int *data);
unsigned char data[RAM_SIZE]; unsigned char data[RAM_SIZE];
...@@ -27,7 +26,7 @@ typedef struct ...@@ -27,7 +26,7 @@ typedef struct
unsigned char total_ram; unsigned char total_ram;
}TMemory; }TMemory;
void mem_init(TMemory *memory,unsigned char device_id); void mem_init(TMemory *memory);
void mem_initialize_data(TMemory *memory); void mem_initialize_data(TMemory *memory);
unsigned char mem_add_module(TMemory *memory, TMemModule *module); unsigned char mem_add_module(TMemory *memory, TMemModule *module);
void mem_do_write(TMemory *memory,unsigned short int start_address,unsigned short int length,unsigned char *data); void mem_do_write(TMemory *memory,unsigned short int start_address,unsigned short int length,unsigned char *data);
......
...@@ -17,7 +17,7 @@ unsigned char mem_in_window(unsigned short int mem_start_address,unsigned short ...@@ -17,7 +17,7 @@ unsigned char mem_in_window(unsigned short int mem_start_address,unsigned short
} }
/* public functions */ /* public functions */
void mem_init(TMemory *memory,unsigned char device_id) void mem_init(TMemory *memory)
{ {
unsigned char i; unsigned char i;
...@@ -26,7 +26,6 @@ void mem_init(TMemory *memory,unsigned char device_id) ...@@ -26,7 +26,6 @@ void mem_init(TMemory *memory,unsigned char device_id)
memory->mem_modules[i]=0x00000000; memory->mem_modules[i]=0x00000000;
memory->eeprom_write_data=0x00000000; memory->eeprom_write_data=0x00000000;
memory->eeprom_read_data=0x00000000; memory->eeprom_read_data=0x00000000;
memory->device_id=device_id;
/* initialize internal variables */ /* initialize internal variables */
memory->total_eeprom=0; memory->total_eeprom=0;
...@@ -45,7 +44,7 @@ void mem_initialize_data(TMemory *memory) ...@@ -45,7 +44,7 @@ void mem_initialize_data(TMemory *memory)
{ {
for(i=0;i<EEPROM_SIZE;i++) for(i=0;i<EEPROM_SIZE;i++)
{ {
if(memory->eeprom_read_data((memory->device_id<<8)+i,&data)) if(memory->eeprom_read_data(i,&data))
eeprom_data[i]=0x00; eeprom_data[i]=0x00;
else else
eeprom_data[i]=data&0x00FF; eeprom_data[i]=data&0x00FF;
...@@ -192,7 +191,7 @@ void mem_do_write(TMemory *memory,unsigned short int start_address,unsigned shor ...@@ -192,7 +191,7 @@ void mem_do_write(TMemory *memory,unsigned short int start_address,unsigned shor
mem_module->write_cmd(mem_module->data,actual_address,actual_length,&data[actual_address-start_address]); mem_module->write_cmd(mem_module->data,actual_address,actual_length,&data[actual_address-start_address]);
if(memory->eeprom_write_data!=0x00000000) if(memory->eeprom_write_data!=0x00000000)
for(k=actual_address;k<(actual_address+actual_length);k++) for(k=actual_address;k<(actual_address+actual_length);k++)
memory->eeprom_write_data((memory->device_id<<8)+k,data[k-start_address]); memory->eeprom_write_data(k,data[k-start_address]);
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment