comparison packages/kernel/current/tests/kcache1.c @ 84:489eb5632bc3 ecos-sw-2000-04-28

Merge from eCos master repository on 2000-04-28-18:44:39-BST
author jlarmour
date Fri, 28 Apr 2000 18:18:36 +0000
parents 59d97b6ba612
children 97d9d85b42c0
comparison
equal deleted inserted replaced
83:1094d5fdd3e0 84:489eb5632bc3
41 41
42 #include <cyg/kernel/kapi.h> 42 #include <cyg/kernel/kapi.h>
43 43
44 #include <cyg/infra/testcase.h> 44 #include <cyg/infra/testcase.h>
45 45
46 #ifdef HAL_DCACHE_SIZE 46 #include <cyg/hal/hal_cache.h>
47
48 #if defined(HAL_DCACHE_SIZE) || defined(HAL_UCACHE_SIZE)
47 #ifdef CYGVAR_KERNEL_COUNTERS_CLOCK 49 #ifdef CYGVAR_KERNEL_COUNTERS_CLOCK
48 #ifdef CYGFUN_KERNEL_API_C 50 #ifdef CYGFUN_KERNEL_API_C
49 51
50 #include <cyg/infra/diag.h> 52 #include <cyg/infra/diag.h>
51 #include <cyg/hal/hal_cache.h>
52 #include <cyg/hal/hal_intr.h> 53 #include <cyg/hal/hal_intr.h>
53 54
54 // ------------------------------------------------------------------------- 55 // -------------------------------------------------------------------------
55 // If the HAL does not supply this, we supply our own version 56 // If the HAL does not supply this, we supply our own version
56 57
173 // With a DCache invalidate in the middle: 174 // With a DCache invalidate in the middle:
174 #ifdef HAL_DCACHE_INVALIDATE_ALL 175 #ifdef HAL_DCACHE_INVALIDATE_ALL
175 static void time0DI(register cyg_uint32 stride) 176 static void time0DI(register cyg_uint32 stride)
176 { 177 {
177 register cyg_uint32 j,k; 178 register cyg_uint32 j,k;
178 cyg_tick_count_t count0, count1; 179 volatile cyg_tick_count_t count0;
180 cyg_tick_count_t count1;
179 cyg_ucount32 t; 181 cyg_ucount32 t;
180 register char c; 182 register char c;
181 183
182 count0 = cyg_current_time(); 184 count0 = cyg_current_time();
183 185
215 // in a given number of ticks. 217 // in a given number of ticks.
216 218
217 static void entry0( cyg_addrword_t data ) 219 static void entry0( cyg_addrword_t data )
218 { 220 {
219 register CYG_INTERRUPT_STATE oldints; 221 register CYG_INTERRUPT_STATE oldints;
220 222
221 #ifdef HAL_CACHE_UNIFIED 223 #ifdef HAL_CACHE_UNIFIED
222 224
223 HAL_DISABLE_INTERRUPTS(oldints); 225 HAL_DISABLE_INTERRUPTS(oldints);
224 HAL_DCACHE_PURGE_ALL(); // rely on above definition 226 HAL_DCACHE_PURGE_ALL(); // rely on above definition
225 HAL_UCACHE_INVALIDATE_ALL(); 227 HAL_UCACHE_INVALIDATE_ALL();
233 HAL_UCACHE_INVALIDATE_ALL(); 235 HAL_UCACHE_INVALIDATE_ALL();
234 HAL_UCACHE_ENABLE(); 236 HAL_UCACHE_ENABLE();
235 HAL_RESTORE_INTERRUPTS(oldints); 237 HAL_RESTORE_INTERRUPTS(oldints);
236 CYG_TEST_INFO("Cache on"); 238 CYG_TEST_INFO("Cache on");
237 time1(); 239 time1();
240
241 #ifdef HAL_DCACHE_INVALIDATE_ALL
242 HAL_DISABLE_INTERRUPTS(oldints);
243 HAL_DCACHE_PURGE_ALL();
244 HAL_UCACHE_INVALIDATE_ALL();
245 HAL_UCACHE_ENABLE();
246 HAL_RESTORE_INTERRUPTS(oldints);
247 CYG_TEST_INFO("Cache on: invalidate Cache (expect bogus times)");
248 time1DI();
249 #endif
238 250
239 #else // HAL_CACHE_UNIFIED 251 #else // HAL_CACHE_UNIFIED
240 252
241 HAL_DISABLE_INTERRUPTS(oldints); 253 HAL_DISABLE_INTERRUPTS(oldints);
242 HAL_DCACHE_PURGE_ALL(); 254 HAL_DCACHE_PURGE_ALL();
311 // slow on the simulator, even with reduced loop counts. 323 // slow on the simulator, even with reduced loop counts.
312 if (cyg_test_is_simulator) 324 if (cyg_test_is_simulator)
313 CYG_TEST_PASS_FINISH("End of test"); 325 CYG_TEST_PASS_FINISH("End of test");
314 326
315 cyg_test_is_simulator = 1; 327 cyg_test_is_simulator = 1;
316 #endif 328 #endif
317
318 #ifdef HAL_ICACHE_INVALIDATE_ALL 329 #ifdef HAL_ICACHE_INVALIDATE_ALL
319 HAL_DISABLE_INTERRUPTS(oldints); 330 HAL_DISABLE_INTERRUPTS(oldints);
320 HAL_DCACHE_PURGE_ALL(); 331 HAL_DCACHE_PURGE_ALL();
321 HAL_ICACHE_INVALIDATE_ALL(); 332 HAL_ICACHE_INVALIDATE_ALL();
322 HAL_DCACHE_INVALIDATE_ALL(); 333 HAL_DCACHE_INVALIDATE_ALL();