comparison packages/hal/powerpc/arch/current/src/hal_misc.c @ 32:5af43b635655 ecos-sw-1999-08-18

Merge from eCos master repository on 1999-08-18-15:20:01-BST
author jlarmour
date Wed, 18 Aug 1999 15:33:44 +0000
parents 7253dcc42a09
children 29bc183297e1
comparison
equal deleted inserted replaced
31:e8319549378c 32:5af43b635655
116 // HAL_SavedRegisters structure into a (bigger) register array. 116 // HAL_SavedRegisters structure into a (bigger) register array.
117 _hal_registers = regs; 117 _hal_registers = regs;
118 118
119 __handle_exception(); 119 __handle_exception();
120 120
121 #ifdef CYGPKG_HAL_QUICC
122 {
123 // This is unpleasant: it appears that if we interrupt the board
124 // using ^C coming in on the QUICC's SMC1, by planting a breakpoint
125 // at the interrupt return address, the decrementer interrupt is
126 // not taken when the bp exception returns AND WORSE no other
127 // interrupt is possible until the decrementer fires again. This
128 // does not apply to simple "incoming character" interrupts; it
129 // seems it has to be combined with an immediate trap on RTI for
130 // this to occur.
131 //
132 // The solution is to test for decrementer underflow after the
133 // (any) exception, and maybe reinitialize the decrementer. If the
134 // decrementer interrupt gets taken, that causes decrementer reinit
135 // too, and no harm is done.
136
137 cyg_uint32 result;
138 asm volatile(
139 "mfdec %0;"
140 : "=r"(result)
141 );
142
143 if ( CYGNUM_HAL_RTC_PERIOD < result ) {
144 // then we missed a tick, but the exception masked it
145 // reset the decrementer here
146 asm volatile(
147 "mtdec %0;"
148 : : "r"(CYGNUM_HAL_RTC_PERIOD)
149 );
150 }
151 }
152 #endif
121 153
122 #elif defined(CYGFUN_HAL_COMMON_KERNEL_SUPPORT) && \ 154 #elif defined(CYGFUN_HAL_COMMON_KERNEL_SUPPORT) && \
123 defined(CYGPKG_HAL_EXCEPTIONS) 155 defined(CYGPKG_HAL_EXCEPTIONS)
124 int vector = regs->vector>>8; 156 int vector = regs->vector>>8;
125 157
187 // Idle thread action 219 // Idle thread action
188 220
189 void 221 void
190 hal_idle_thread_action( cyg_uint32 count ) 222 hal_idle_thread_action( cyg_uint32 count )
191 { 223 {
224 #if 0
225 #ifdef CYG_HAL_POWERPC_MPC860
226 register cyg_uint32 result;
227
228 cyg_uint32 *psivec = (cyg_uint32*)CYGARC_REG_IMM_SIVEC ;
229 cyg_uint32 *psimask = (cyg_uint32*)CYGARC_REG_IMM_SIMASK;
230 cyg_uint32 *psipend = (cyg_uint32*)CYGARC_REG_IMM_SIPEND;
231 cyg_uint16 *ptbscr = (cyg_uint16*)CYGARC_REG_IMM_TBSCR;
232
233 asm volatile(
234 "mfdec %0;"
235 : "=r"(result)
236 );
237 diag_printf( "Dec %08x, TBSCR %04x, vec %d: sivec %08x, simask %08x, sipend %08x\n",
238 result, (cyg_uint32)(*ptbscr), (*psivec)>>26, *psivec, *psimask, *psipend );
239 #endif
240 #endif
192 } 241 }
193 242
194 //--------------------------------------------------------------------------- 243 //---------------------------------------------------------------------------
195 // Use MMU resources to map memory regions. 244 // Use MMU resources to map memory regions.
196 // Takes and returns an int used to ID the MMU resource to use. This ID 245 // Takes and returns an int used to ID the MMU resource to use. This ID
420 # ifdef CYG_HAL_STARTUP_RAM 469 # ifdef CYG_HAL_STARTUP_RAM
421 # define CYGPRI_ENABLE_CACHES 1 470 # define CYGPRI_ENABLE_CACHES 1
422 # endif 471 # endif
423 #endif 472 #endif
424 473
474 #ifdef CYGPKG_HAL_POWERPC_MBX // Enable all caches for MBX860
475 # ifndef CYG_HAL_ROM_MONITOR // unless we are making a stub rom
476 # define CYGPRI_INIT_CACHES 1
477 # define CYGPRI_ENABLE_CACHES 1
478 # endif
479 #endif
425 480
426 // Do not enable caches for the FADS port pro tem; the memory mapping is 481 // Do not enable caches for the FADS port pro tem; the memory mapping is
427 // not set up. 482 // not set up.
428 483
429 // Do not enable caches for the simulator, it just slows it down. 484 // Do not enable caches for the simulator, it just slows it down.