Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
stm32_libraries
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
humanoides
tools
stm32_libraries
Commits
3ecc9a65
Commit
3ecc9a65
authored
5 years ago
by
Sergi Hernandez
Browse files
Options
Downloads
Patches
Plain Diff
Removed the device ID from the EEPROM address generation.
parent
3b077d60
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
memory/include/memory.h
+1
-2
1 addition, 2 deletions
memory/include/memory.h
memory/src/memory.c
+3
-4
3 additions, 4 deletions
memory/src/memory.c
with
4 additions
and
6 deletions
memory/include/memory.h
+
1
−
2
View file @
3ecc9a65
...
@@ -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
);
...
...
This diff is collapsed.
Click to expand it.
memory/src/memory.c
+
3
−
4
View file @
3ecc9a65
...
@@ -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
]);
}
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment