Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
NuttX RTOS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
f4grx
NuttX RTOS
Commits
4c140532
Commit
4c140532
authored
11 years ago
by
Gregory Nutt
Browse files
Options
Downloads
Patches
Plain Diff
SAM4E CMCC: Fix some errors introducted in last check-in
parent
fb41a110
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
arch/arm/src/sam34/chip/sam_cmcc.h
+3
-0
3 additions, 0 deletions
arch/arm/src/sam34/chip/sam_cmcc.h
arch/arm/src/sam34/sam_cmcc.c
+20
-13
20 additions, 13 deletions
arch/arm/src/sam34/sam_cmcc.c
with
23 additions
and
13 deletions
arch/arm/src/sam34/chip/sam_cmcc.h
+
3
−
0
View file @
4c140532
...
...
@@ -51,6 +51,9 @@
****************************************************************************************/
/* This information is available in the Cache Type Register. How every, it is more
* efficient if we do not to do the decoding on each cache access.
*
* CacheSize = CacheLineSize * NCacheLines * NWays
* CacheAddressRange = CacheLineSize * NCacheLines = CacheSize / NWays
*/
#ifdef CONFIG_ARCH_CHIP_SAM4E
...
...
This diff is collapsed.
Click to expand it.
arch/arm/src/sam34/sam_cmcc.c
+
20
−
13
View file @
4c140532
...
...
@@ -39,6 +39,7 @@
#include
<nuttx/config.h>
#include
<sys/types.h>
#include
<stdint.h>
#include
<assert.h>
...
...
@@ -144,24 +145,31 @@ void sam_cmcc_invalidate(uintptr_t start, uintptr_t end)
{
uintptr_t
addr
;
uint32_t
regval
;
uint32_t
way
uint32_t
index
;
size_t
size
;
int
nlines
;
ssize_t
size
;
int
index
;
int
way
;
/* Get the aligned addresses and size for the memory region
to be
* invalidated.
/* Get the aligned addresses and size
(in bytes)
for the memory region
*
to be
invalidated.
*/
start
=
ALIGN_DOWN
(
start
);
end
=
ALIGN_
up
(
end
);
size
=
end
-
start
;
end
=
ALIGN_
UP
(
end
);
size
=
end
-
start
+
1
;
/* If this is a large region (as big as the cache), then just invalidate
* the entire cache the easy way.
*
* CacheSize = CacheLineSize * NCacheLines * NWays
* CacheAddressRange = CacheLineSize * NCacheLines = CacheSize / NWays
*
* Example: CacheSize = 2048, CacheLineSize=16, NWays=4:
*
* CacheAddressRange = 2048 / 4 = 512
* NCacheLines = 32
*/
if
(
size
>=
(
CMCC_CACHE_SIZE
/
CMCC_CACHE_LINE_SIZE
/
CMCC_NWAYS
)
if
(
size
>=
(
CMCC_CACHE_SIZE
/
CMCC_NWAYS
)
)
{
sam_cmcc_invalidateall
();
return
;
...
...
@@ -189,10 +197,9 @@ void sam_cmcc_invalidate(uintptr_t start, uintptr_t end)
/* Invalidate the address region */
index
=
(
start
>>
CMCC_SHIFT
)
nlines
=
((
end
-
start
)
>>
CMCC_SHIFT
);
for
(
addr
=
start
;
addr
<
end
;
addr
+=
CMCC_CACHE_LINE_SIZE
,
index
++
)
for
(
addr
=
start
,
index
=
(
int
)(
start
>>
CMCC_SHIFT
);
addr
<=
end
;
addr
+=
CMCC_CACHE_LINE_SIZE
,
index
++
)
{
regval
=
CMCC_MAINT1_INDEX
(
index
);
for
(
way
=
0
;
way
<
CMCC_NWAYS
;
way
++
)
...
...
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