[rtems commit] tmtests/tmcontext01: Improve cache dirty function

Sebastian Huber sebh at rtems.org
Mon Sep 8 06:46:33 UTC 2014


Module:    rtems
Branch:    master
Commit:    8d30713d42e856def01ac0708847b8b56ca46283
Changeset: http://git.rtems.org/rtems/commit/?id=8d30713d42e856def01ac0708847b8b56ca46283

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Sep  5 13:33:57 2014 +0200

tmtests/tmcontext01: Improve cache dirty function

---

 testsuites/tmtests/tmcontext01/init.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/testsuites/tmtests/tmcontext01/init.c b/testsuites/tmtests/tmcontext01/init.c
index c5162a2..444f2af 100644
--- a/testsuites/tmtests/tmcontext01/init.c
+++ b/testsuites/tmtests/tmcontext01/init.c
@@ -44,14 +44,16 @@ static volatile int *main_data;
 
 static Context_Control ctx;
 
-static void dirty_data_cache(volatile int *d)
+static int dirty_data_cache(volatile int *d, int j)
 {
   size_t n = data_size / sizeof(*d);
   size_t i;
 
   for (i = 0; i < n; ++i) {
-    d[i] = i;
+    d[i] = i + j;
   }
+
+  return i + j;
 }
 
 static int prevent_opt_func(int m, int n)
@@ -88,7 +90,7 @@ static int call_at_level(int start, int fl, int s, bool dirty)
     rtems_counter_ticks b;
 
     if (dirty) {
-      dirty_data_cache(main_data);
+      dirty_data_cache(main_data, fl);
       rtems_cache_invalidate_entire_instruction();
     }
 
@@ -110,9 +112,10 @@ static int call_at_level(int start, int fl, int s, bool dirty)
 static void load_task(rtems_task_argument arg)
 {
   volatile int *load_data = (volatile int *) arg;
+  int j = (int) rtems_get_current_processor();
 
   while (true) {
-    dirty_data_cache(load_data);
+    j = dirty_data_cache(load_data, j);
   }
 }
 



More information about the vc mailing list