Mercurial > ecos
comparison packages/kernel/current/tests/kcache2.c @ 583:c0ed1c4642f8
Fix some bitrot. Always run basic DATA cache test.
| author | gthomas |
|---|---|
| date | Mon, 10 Feb 2003 21:04:00 +0000 |
| parents | a2a11bab520d |
| children | 2c3a824f07b9 |
comparison
equal
deleted
inserted
replaced
| 582:f2d369dad95f | 583:c0ed1c4642f8 |
|---|---|
| 74 #define TIME_DLOCK_LOOPS 10000 // default number of loops for time_dlock() | 74 #define TIME_DLOCK_LOOPS 10000 // default number of loops for time_dlock() |
| 75 | 75 |
| 76 // Define this to enable a simple, but hopefully useful, data cache | 76 // Define this to enable a simple, but hopefully useful, data cache |
| 77 // test. It may help discover if the cache support has been defined | 77 // test. It may help discover if the cache support has been defined |
| 78 // properly (in terms of size and shape) | 78 // properly (in terms of size and shape) |
| 79 #ifdef HAL_DCACHE_SIZE | 79 #ifdef HAL_DCACHE_LINE_SIZE |
| 80 //#define _TEST_DCACHE_OPERATION | 80 #define _TEST_DCACHE_OPERATION |
| 81 #endif | 81 #endif |
| 82 | 82 |
| 83 static cyg_handle_t thread[NTHREADS]; | 83 static cyg_handle_t thread[NTHREADS]; |
| 84 | 84 |
| 85 static cyg_thread thread_obj[NTHREADS]; | 85 static cyg_thread thread_obj[NTHREADS]; |
| 313 static void | 313 static void |
| 314 test_dcache_operation(void) | 314 test_dcache_operation(void) |
| 315 { | 315 { |
| 316 long *lp = (long *)m; | 316 long *lp = (long *)m; |
| 317 int i, errs; | 317 int i, errs; |
| 318 cyg_uint32 oldints; | |
| 318 | 319 |
| 319 CYG_TEST_INFO("Data cache basic"); | 320 CYG_TEST_INFO("Data cache basic"); |
| 320 | 321 |
| 321 HAL_DISABLE_INTERRUPTS(oldints); | 322 HAL_DISABLE_INTERRUPTS(oldints); |
| 322 HAL_DCACHE_SYNC(); | 323 HAL_DCACHE_SYNC(); |
| 327 lp[i] = i; | 328 lp[i] = i; |
| 328 } | 329 } |
| 329 HAL_DCACHE_INVALIDATE_ALL(); | 330 HAL_DCACHE_INVALIDATE_ALL(); |
| 330 HAL_DCACHE_ENABLE(); | 331 HAL_DCACHE_ENABLE(); |
| 331 // Now push data through the cache | 332 // Now push data through the cache |
| 333 // Note: 256 seems like a reasonable offset. It may be useful to actually | |
| 334 // compute this (and the size of the test region) based on cache geometry | |
| 332 for (i = 256; i < 256+HAL_DCACHE_SIZE/sizeof(*lp); i++) { | 335 for (i = 256; i < 256+HAL_DCACHE_SIZE/sizeof(*lp); i++) { |
| 333 lp[i] = 0xFF000000 + i; | 336 lp[i] = 0xFF000000 + i; |
| 334 } | 337 } |
| 335 // Now force cache clean and off | 338 // Now force cache clean and off |
| 336 HAL_DCACHE_SYNC(); | 339 HAL_DCACHE_SYNC(); |
| 353 i, lp[i], i); | 356 i, lp[i], i); |
| 354 } | 357 } |
| 355 } | 358 } |
| 356 } | 359 } |
| 357 } | 360 } |
| 361 CYG_TEST_CHECK(0 == errs, "dcache basic failed"); | |
| 362 #if 0 // Additional information | |
| 358 diag_printf("%d total errors during compare\n", errs); | 363 diag_printf("%d total errors during compare\n", errs); |
| 359 diag_dump_buf(&lp[240], 128); | 364 diag_dump_buf(&lp[240], 128); |
| 365 #endif | |
| 360 HAL_RESTORE_INTERRUPTS(oldints); | 366 HAL_RESTORE_INTERRUPTS(oldints); |
| 361 } | 367 } |
| 362 #endif | 368 #endif |
| 363 | 369 |
| 364 static void test_dsync(void) | 370 static void test_dsync(void) |
| 816 | 822 |
| 817 // ------------------------------------------------------------------------- | 823 // ------------------------------------------------------------------------- |
| 818 static void entry0( cyg_addrword_t data ) | 824 static void entry0( cyg_addrword_t data ) |
| 819 { | 825 { |
| 820 int numtests = 0; | 826 int numtests = 0; |
| 821 #ifdef _TEST_DCACHE_OPERATION | |
| 822 test_dcache_operation(); | |
| 823 #endif | |
| 824 #ifdef HAL_DCACHE_QUERY_WRITE_MODE | 827 #ifdef HAL_DCACHE_QUERY_WRITE_MODE |
| 825 int wmode; | 828 int wmode; |
| 826 #endif | 829 #endif |
| 827 #ifdef HAL_DCACHE_LOCK | 830 #ifdef HAL_DCACHE_LOCK |
| 828 time_dlock(); numtests++; | 831 time_dlock(); numtests++; |
| 833 #ifdef HAL_DCACHE_LINE_SIZE // So we can find our way around memory | 836 #ifdef HAL_DCACHE_LINE_SIZE // So we can find our way around memory |
| 834 test_dsync(); numtests++; | 837 test_dsync(); numtests++; |
| 835 #endif | 838 #endif |
| 836 #ifdef HAL_DCACHE_STORE | 839 #ifdef HAL_DCACHE_STORE |
| 837 test_dstore(); numtests++; | 840 test_dstore(); numtests++; |
| 841 #endif | |
| 842 #ifdef _TEST_DCACHE_OPERATION | |
| 843 test_dcache_operation(); numtests++; | |
| 838 #endif | 844 #endif |
| 839 #ifdef HAL_DCACHE_READ_HINT | 845 #ifdef HAL_DCACHE_READ_HINT |
| 840 test_dread_hint(); numtests++; | 846 test_dread_hint(); numtests++; |
| 841 #endif | 847 #endif |
| 842 #ifdef HAL_DCACHE_WRITE_HINT | 848 #ifdef HAL_DCACHE_WRITE_HINT |
