summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormlu <mlu@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-09-14 22:36:27 +0000
committermlu <mlu@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2009-09-14 22:36:27 +0000
commitd4e4d65d284fa0347e601f30aebf4291074d9888 (patch)
tree6500db7864e43910e68bcc8cdc9985eb82f53d04 /src
parent14dc22612b2997ab536b7f984a3174bb8847b4e8 (diff)
downloadopenocd+libswd-d4e4d65d284fa0347e601f30aebf4291074d9888.tar.gz
openocd+libswd-d4e4d65d284fa0347e601f30aebf4291074d9888.tar.bz2
openocd+libswd-d4e4d65d284fa0347e601f30aebf4291074d9888.tar.xz
openocd+libswd-d4e4d65d284fa0347e601f30aebf4291074d9888.zip
Cache invalidation when writing to memory
git-svn-id: svn://svn.berlios.de/openocd/trunk@2708 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src')
-rw-r--r--src/target/cortex_a8.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/target/cortex_a8.c b/src/target/cortex_a8.c
index 7a705153..e73994e9 100644
--- a/src/target/cortex_a8.c
+++ b/src/target/cortex_a8.c
@@ -1253,6 +1253,24 @@ int cortex_a8_write_memory(struct target_s *target, uint32_t address,
exit(-1);
}
+ /* The Cache handling will NOT work with MMU active, the wrong addresses will be invalidated */
+ /* invalidate I-Cache */
+ if (armv7a->armv4_5_mmu.armv4_5_cache.i_cache_enabled)
+ {
+ /* Invalidate ICache single entry with MVA, repeat this for all cache
+ lines in the address range, Cortex-A8 has fixed 64 byte line length */
+ /* Invalidate Cache single entry with MVA to PoU */
+ for (uint32_t cacheline=address; cacheline<address+size*count; cacheline+=64)
+ armv7a->write_cp15(target, 0, 1, 7, 5, cacheline); /* I-Cache to PoU */
+ }
+ /* invalidate D-Cache */
+ if (armv7a->armv4_5_mmu.armv4_5_cache.d_u_cache_enabled)
+ {
+ /* Invalidate Cache single entry with MVA to PoC */
+ for (uint32_t cacheline=address; cacheline<address+size*count; cacheline+=64)
+ armv7a->write_cp15(target, 0, 1, 7, 6, cacheline); /* U/D cache to PoC */
+ }
+
return retval;
}