diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-02-26 12:59:47 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-02-28 08:59:02 +0100 |
commit | 31494ab26468902d6c67bab4fd83b2e86a15721e (patch) | |
tree | 3bf9cefae554c96ebe1f8e392bff02c01aa9ac2b /testsuites/sptests/spcache01/init.c | |
parent | bsp/leon3: Use ambapp_freq_get() for CPU counter (diff) | |
download | rtems-31494ab26468902d6c67bab4fd83b2e86a15721e.tar.bz2 |
sptests/spcache01: Detect write-through cache
Diffstat (limited to '')
-rw-r--r-- | testsuites/sptests/spcache01/init.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/testsuites/sptests/spcache01/init.c b/testsuites/sptests/spcache01/init.c index 9f27a797fa..d9eb05327a 100644 --- a/testsuites/sptests/spcache01/init.c +++ b/testsuites/sptests/spcache01/init.c @@ -44,6 +44,7 @@ static void test_data_flush_and_invalidate(void) int n = 32; int i; size_t data_size = n * sizeof(data[0]); + bool write_through; printf("data cache flush and invalidate test\n"); @@ -65,8 +66,15 @@ static void test_data_flush_and_invalidate(void) rtems_cache_invalidate_multiple_data_lines(&data[0], data_size); - for (i = 0; i < n; ++i) { - rtems_test_assert(vdata[i] == i); + write_through = vdata[0] == ~0; + if (write_through) { + for (i = 0; i < n; ++i) { + rtems_test_assert(vdata[i] == ~i); + } + } else { + for (i = 0; i < n; ++i) { + rtems_test_assert(vdata[i] == i); + } } for (i = 0; i < n; ++i) { @@ -82,7 +90,10 @@ static void test_data_flush_and_invalidate(void) rtems_interrupt_lock_release(&lock, level); - printf("data cache operations by line passed the test\n"); + printf( + "data cache operations by line passed the test (%s cache detected)\n", + write_through ? "write-through" : "copy-back" + ); } else { printf( "skip data cache flush and invalidate test" |