comparison packages/kernel/current/tests/kclock1.c @ 2:443894e2e912 ecos-v1_2_1-release

Block commit of eCos version 1.2.1
author jlarmour
date Tue, 11 May 1999 12:24:34 +0000
parents 3111d98ba7b3
children c38311975d4f
comparison
equal deleted inserted replaced
1:72f549f0d891 2:443894e2e912
20 // 20 //
21 // The Original Code is eCos - Embedded Cygnus Operating System, released 21 // The Original Code is eCos - Embedded Cygnus Operating System, released
22 // September 30, 1998. 22 // September 30, 1998.
23 // 23 //
24 // The Initial Developer of the Original Code is Cygnus. Portions created 24 // The Initial Developer of the Original Code is Cygnus. Portions created
25 // by Cygnus are Copyright (C) 1998 Cygnus Solutions. All Rights Reserved. 25 // by Cygnus are Copyright (C) 1998,1999 Cygnus Solutions. All Rights Reserved.
26 // ------------------------------------------- 26 // -------------------------------------------
27 // 27 //
28 //####COPYRIGHTEND#### 28 //####COPYRIGHTEND####
29 //========================================================================== 29 //==========================================================================
30 //#####DESCRIPTIONBEGIN#### 30 //#####DESCRIPTIONBEGIN####
48 // CYGVAR_KERNEL_COUNTERS_CLOCK 48 // CYGVAR_KERNEL_COUNTERS_CLOCK
49 // CYGNUM_KERNEL_COUNTERS_MULTI_LIST_SIZE 49 // CYGNUM_KERNEL_COUNTERS_MULTI_LIST_SIZE
50 //####DESCRIPTIONEND#### 50 //####DESCRIPTIONEND####
51 */ 51 */
52 52
53 #include <cyg/hal/hal_arch.h> // CYGNUM_HAL_STACK_SIZE_TYPICAL
54
53 #include <cyg/kernel/kapi.h> 55 #include <cyg/kernel/kapi.h>
54 56
55 #include <cyg/infra/testcase.h> 57 #include <cyg/infra/testcase.h>
56 58
57 #if defined(CYG_HAL_MIPS_SIM)
58 59
59 // Reduce time in simulated TX39 so that 60 static cyg_uint64 TEST_DELAY;
60 // it runs within the timeout.
61 61
62 #define TEST_DELAY 1000000000ll 62 #ifdef CYGFUN_KERNEL_THREADS_TIMER
63
64 #else
65
66 #define TEST_DELAY 5000000000ll
67
68 #endif
69
70 #if defined(CYGVAR_KERNEL_COUNTERS_CLOCK) \
71 && defined(CYGFUN_KERNEL_THREADS_TIMER)
72 63
73 #ifdef CYGFUN_KERNEL_API_C 64 #ifdef CYGFUN_KERNEL_API_C
74 65
75 #include "testaux.h" 66 #include "testaux.h"
76 67
77 #define NTHREADS 1 68 #define NTHREADS 1
78 #define STACKSIZE 4096 69 #define STACKSIZE CYGNUM_HAL_STACK_SIZE_TYPICAL
79 70
80 static cyg_handle_t thread[NTHREADS]; 71 static cyg_handle_t thread[NTHREADS];
81 72
82 static cyg_thread thread_obj[NTHREADS]; 73 static cyg_thread thread_obj[NTHREADS];
83 static char stack[NTHREADS][STACKSIZE]; 74 static char stack[NTHREADS][STACKSIZE];
111 102
112 void kclock1_main( void ) 103 void kclock1_main( void )
113 { 104 {
114 CYG_TEST_INIT(); 105 CYG_TEST_INIT();
115 106
107 if (cyg_test_is_simulator) {
108 TEST_DELAY = 100000000ll;
109 } else {
110 TEST_DELAY = 3000000000ll;
111 }
112
116 cyg_thread_create(4, entry0 , (cyg_addrword_t)0, "kclock1", 113 cyg_thread_create(4, entry0 , (cyg_addrword_t)0, "kclock1",
117 (void *)stack[0], STACKSIZE, &thread[0], &thread_obj[0]); 114 (void *)stack[0], STACKSIZE, &thread[0], &thread_obj[0]);
118 cyg_thread_resume(thread[0]); 115 cyg_thread_resume(thread[0]);
119 116
120 cyg_scheduler_start(); 117 cyg_scheduler_start();
121 } 118 }
122 119
124 cyg_start( void ) 121 cyg_start( void )
125 { 122 {
126 kclock1_main(); 123 kclock1_main();
127 } 124 }
128 125
129 #else // def CYGFUN_KERNEL_API_C 126 #else // def CYGFUN_KERNEL_API_C
130 #define N_A_MSG "Kernel C API layer disabled" 127 #define N_A_MSG "Kernel C API layer disabled"
131 #endif // def CYGFUN_KERNEL_API_C 128 #endif // def CYGFUN_KERNEL_API_C
132 #else // def CYGVAR_KERNEL_COUNTERS_CLOCK && CYGFUN_KERNEL_THREADS_TIMER 129 #else // def CYGFUN_KERNEL_THREADS_TIMER
133 #define N_A_MSG "Kernel real-time clock/threads timer disabled" 130 #define N_A_MSG "Kernel threads timer disabled"
134 #endif // def CYGVAR_KERNEL_COUNTERS_CLOCK && CYGFUN_KERNEL_THREADS_TIMER 131 #endif // def CYGFUN_KERNEL_THREADS_TIMER
135 132
136 #ifdef N_A_MSG 133 #ifdef N_A_MSG
137 externC void 134 externC void
138 cyg_start( void ) 135 cyg_start( void )
139 { 136 {
140 CYG_TEST_INIT(); 137 CYG_TEST_INIT();
141 CYG_TEST_PASS_FINISH("N/A: " N_A_MSG); 138 CYG_TEST_NA( N_A_MSG );
142 } 139 }
143 #endif // N_A_MSG 140 #endif // N_A_MSG
144 141
145 // EOF kclock1.c 142 // EOF kclock1.c