comparison packages/hal/common/current/tests/intr.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 ece80412419a
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####
38 #include <pkgconf/hal.h> 38 #include <pkgconf/hal.h>
39 39
40 #include <cyg/infra/testcase.h> 40 #include <cyg/infra/testcase.h>
41 41
42 #include <cyg/hal/hal_intr.h> 42 #include <cyg/hal/hal_intr.h>
43
44 #ifdef CYGPKG_KERNEL
45 #include <pkgconf/kernel.h> // Need to look for the RTC config.
46
47 // These are redefined below.
48 #undef CYGNUM_KERNEL_COUNTERS_RTC_RESOLUTION
49 #undef CYGNUM_KERNEL_COUNTERS_RTC_PERIOD
50 #endif
43 51
44 // ------------------------------------------------------------------------- 52 // -------------------------------------------------------------------------
45 53
46 #if defined(CYG_HAL_MN10300_STDEVAL1) 54 #if defined(CYG_HAL_MN10300_STDEVAL1)
47 55
60 68
61 #define CYGNUM_KERNEL_COUNTERS_RTC_RESOLUTION {1000000000, 100} 69 #define CYGNUM_KERNEL_COUNTERS_RTC_RESOLUTION {1000000000, 100}
62 #define CYGNUM_KERNEL_COUNTERS_RTC_PERIOD 15625 70 #define CYGNUM_KERNEL_COUNTERS_RTC_PERIOD 15625
63 71
64 #endif 72 #endif
65
66 #if defined(CYG_HAL_MIPS_SIM) 73 #if defined(CYG_HAL_MIPS_SIM)
67 74
68 #define CYGNUM_KERNEL_COUNTERS_RTC_RESOLUTION {1000000000, 1000} 75 #define CYGNUM_KERNEL_COUNTERS_RTC_RESOLUTION {1000000000, 1000}
69 #define CYGNUM_KERNEL_COUNTERS_RTC_PERIOD 999 76 #define CYGNUM_KERNEL_COUNTERS_RTC_PERIOD 999
70 77
71 #endif 78 #endif
72 79
73 #if defined(CYG_HAL_POWERPC_MP860) 80 #if defined(CYG_HAL_POWERPC_COGENT)
74 81
75 #define CYGNUM_KERNEL_COUNTERS_RTC_RESOLUTION {1000000000, 100} 82 #define CYGNUM_KERNEL_COUNTERS_RTC_RESOLUTION {1000000000, 100}
76 #define CYGNUM_KERNEL_COUNTERS_RTC_PERIOD 20625 83 #define CYGNUM_KERNEL_COUNTERS_RTC_PERIOD 20625
77 84
85 #endif
86 #if defined(CYGPKG_HAL_POWERPC_SIM)
87
88 #define CYGNUM_KERNEL_COUNTERS_RTC_RESOLUTION {1000000000, 100}
89 #define CYGNUM_KERNEL_COUNTERS_RTC_PERIOD 999
90
91 #endif
92
93 #if defined(CYG_HAL_I386_LINUX)
94 #define CYGNUM_KERNEL_COUNTERS_RTC_RESOLUTION {1000000000, 100}
95 #define CYGNUM_KERNEL_COUNTERS_RTC_PERIOD 10000
78 #endif 96 #endif
79 97
80 #ifndef CYGNUM_KERNEL_COUNTERS_RTC_RESOLUTION 98 #ifndef CYGNUM_KERNEL_COUNTERS_RTC_RESOLUTION
81 99
82 #define CYGNUM_KERNEL_COUNTERS_RTC_RESOLUTION {1000000000, 100} 100 #define CYGNUM_KERNEL_COUNTERS_RTC_RESOLUTION {1000000000, 100}
95 // ------------------------------------------------------------------------- 113 // -------------------------------------------------------------------------
96 114
97 cyg_uint32 isr( cyg_uint32 vector, CYG_ADDRWORD data ) 115 cyg_uint32 isr( cyg_uint32 vector, CYG_ADDRWORD data )
98 { 116 {
99 CYG_TEST_CHECK( ISR_DATA == data , "Bad data passed to ISR"); 117 CYG_TEST_CHECK( ISR_DATA == data , "Bad data passed to ISR");
100 CYG_TEST_CHECK( CYG_VECTOR_RTC == vector , "Bad vector passed to ISR"); 118 CYG_TEST_CHECK( CYGNUM_HAL_INTERRUPT_RTC == vector ,
119 "Bad vector passed to ISR");
101 120
102 HAL_CLOCK_RESET( vector, CYGNUM_KERNEL_COUNTERS_RTC_PERIOD ); 121 HAL_CLOCK_RESET( vector, CYGNUM_KERNEL_COUNTERS_RTC_PERIOD );
103 122
104 HAL_INTERRUPT_ACKNOWLEDGE( vector ); 123 HAL_INTERRUPT_ACKNOWLEDGE( vector );
105 124
111 // ------------------------------------------------------------------------- 130 // -------------------------------------------------------------------------
112 131
113 void intr_main( void ) 132 void intr_main( void )
114 { 133 {
115 CYG_INTERRUPT_STATE oldints; 134 CYG_INTERRUPT_STATE oldints;
116
117 CYG_TEST_INIT();
118 135
119 HAL_INTERRUPT_ATTACH( CYG_VECTOR_RTC, isr, ISR_DATA, 0 ); 136 HAL_INTERRUPT_ATTACH( CYGNUM_HAL_INTERRUPT_RTC, isr, ISR_DATA, 0 );
120 137
121 HAL_CLOCK_INITIALIZE( CYGNUM_KERNEL_COUNTERS_RTC_PERIOD ); 138 HAL_CLOCK_INITIALIZE( CYGNUM_KERNEL_COUNTERS_RTC_PERIOD );
122 139
123 HAL_INTERRUPT_UNMASK( CYG_VECTOR_RTC ); 140 HAL_INTERRUPT_UNMASK( CYGNUM_HAL_INTERRUPT_RTC );
124 141
125 HAL_ENABLE_INTERRUPTS(); 142 HAL_ENABLE_INTERRUPTS();
126 143
127 while( ticks < 10 ) 144 while( ticks < 10 )
128 { 145 {
130 } 147 }
131 148
132 HAL_DISABLE_INTERRUPTS(oldints); 149 HAL_DISABLE_INTERRUPTS(oldints);
133 150
134 CYG_TEST_PASS_FINISH("HAL interrupt test"); 151 CYG_TEST_PASS_FINISH("HAL interrupt test");
152
135 } 153 }
136 154
137 155
138 // ------------------------------------------------------------------------- 156 // -------------------------------------------------------------------------
139 157
140 externC void 158 externC void
141 cyg_start( void ) 159 cyg_start( void )
142 { 160 {
161 CYG_TEST_INIT();
162
163 // Attaching the ISR will not succeed if the kernel real-time
164 // clock has been configured in.
165 #ifndef CYGVAR_KERNEL_COUNTERS_CLOCK
166
143 intr_main(); 167 intr_main();
168
169 #else
170
171 CYG_TEST_PASS_FINISH("N/A: Cannot override kernel real-time clock.");
172
173 #endif
144 } 174 }
145 175
146 176
147 // ------------------------------------------------------------------------- 177 // -------------------------------------------------------------------------
148 /* EOF intr.c */ 178 /* EOF intr.c */