Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
2a5e6538
Commit
2a5e6538
authored
11 years ago
by
Damien George
Browse files
Options
Downloads
Patches
Plain Diff
stm: Add comments for storage read from cache.
parent
cb3b6ce7
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
stm/storage.c
+4
-1
4 additions, 1 deletion
stm/storage.c
with
4 additions
and
1 deletion
stm/storage.c
+
4
−
1
View file @
2a5e6538
...
...
@@ -53,8 +53,10 @@ static uint8_t *cache_get_addr_for_read(uint32_t flash_addr) {
uint32_t
flash_sector_start
;
uint32_t
flash_sector_size
;
uint32_t
flash_sector_id
=
flash_get_sector_info
(
flash_addr
,
&
flash_sector_start
,
&
flash_sector_size
);
if
(
cache_flash_sector_id
==
flash_sector_id
)
if
(
cache_flash_sector_id
==
flash_sector_id
)
{
// in cache, copy from there
return
(
uint8_t
*
)
CACHE_MEM_START_ADDR
+
flash_addr
-
flash_sector_start
;
}
// not in cache, copy straight from flash
return
(
uint8_t
*
)
flash_addr
;
}
...
...
@@ -141,6 +143,7 @@ bool storage_read_block(uint8_t *dest, uint32_t block) {
return
true
;
}
else
if
(
FLASH_PART1_START_BLOCK
<=
block
&&
block
<
FLASH_PART1_START_BLOCK
+
FLASH_PART1_NUM_BLOCKS
)
{
// non-MBR block, get data from flash memory, possibly via cache
uint32_t
flash_addr
=
FLASH_MEM_START_ADDR
+
(
block
-
FLASH_PART1_START_BLOCK
)
*
BLOCK_SIZE
;
uint8_t
*
src
=
cache_get_addr_for_read
(
flash_addr
);
memcpy
(
dest
,
src
,
BLOCK_SIZE
);
...
...
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