Definition in file hal_misc.c.
Go to the source code of this file.
Functions | |
| void | cyg_hal_invoke_constructors (void) |
| This calls static constructors before program start. | |
| cyg_uint32 | hal_lsbit_index (cyg_uint32 mask) |
| Determine the index of the ls bit of the supplied mask. | |
| cyg_uint32 | hal_msbit_index (cyg_uint32 mask) |
| Determine the index of the ms bit of the supplied mask. | |
| externC cyg_uint32 | hal_arch_default_isr (CYG_ADDRWORD vector, CYG_ADDRWORD data) |
| Default architecture interrupt service routine. | |
| externC void | __handle_exception (void) |
| GDB exception handler. | |
| void | cyg_hal_exception_handler (HAL_SavedRegisters *regs, CYG_WORD vector) |
| First level C exception handler. | |
| externC void | hal_idle_thread_action (cyg_uint32 loop_count) |
| Idle thread action called from idle thread. | |
| void | h8s_reset_manual (void) |
| Resets board by jumping to manual reset vector. | |
Variables | |
| cyg_bool | cyg_hal_stop_constructors |
| Set to 1 when constructors should no longer be invoked. | |
| externC HAL_SavedRegisters * | _hal_registers |
| saved machine state for GDB | |
|
|
GDB exception handler.
Referenced by cyg_hal_exception_handler(). |
|
||||||||||||
|
First level C exception handler. This function is called from the exception VSR. It usually does extra decoding of the exception and invokes any special handlers for things like FPU traps, bus errors or memory exceptions. If there is nothing special to be done for an exception, then it either calls into the GDB stubs, by calling __handle_exception(), or invokes the kernel by calling cyg_hal_deliver_exception()
Definition at line 231 of file hal_misc.c. References __handle_exception(), _hal_registers, and cyg_hal_deliver_exception().
00232 {
00233 //
00234 // if GDB is included then we let GDB handle the exception
00235 //
00236 #ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
00237 //
00238 // Set the pointer to the registers of the current exception
00239 // context. At entry the GDB stub will expand the
00240 // HAL_SavedRegisters structure into a (bigger) register array.
00241 //
00242 _hal_registers = regs;
00243
00244 __handle_exception();
00245 #endif
00246 //
00247 // If exception handling is enabled for hall then
00248 //
00249 #if defined(CYGPKG_HAL_EXCEPTIONS)
00250 //
00251 // We should decode the vector and pass a more appropriate
00252 // value as the second argument. For now we simply pass a
00253 // pointer to the saved registers. We should also divert
00254 // breakpoint and other debug vectors into the debug stubs.
00255 //
00256 cyg_hal_deliver_exception( vector, (CYG_ADDRWORD)regs );
00257 #endif
00258 return;
00259 }
|
Here is the call graph for this function:

|
|
This calls static constructors before program start. This calls the constructors for all static objects before the program starts. eCos relies on these being called in the correct order for it to function correctly. The exact way in which constructors are handled may differ between architectures, although most use a simple table of function pointers between labels __CTOR_LIST__ and __CTOR_END__ which must called in order from the top down. Generally, this function can be copied directly from an existing architecture HAL. Definition at line 106 of file hal_misc.c. References cyg_hal_stop_constructors.
00107 {
00108 typedef void (*pfunc) (void);
00109 extern pfunc _CTOR_LIST__[];
00110 extern pfunc _CTOR_END__[];
00111
00112 #ifdef CYGSEM_HAL_STOP_CONSTRUCTORS_ON_FLAG
00113 static pfunc *p = &_CTOR_END__[-1];
00114
00115 cyg_hal_stop_constructors = 0;
00116 for (; p >= _CTOR_LIST__; p--) {
00117 (*p) ();
00118 if (cyg_hal_stop_constructors) {
00119 p--;
00120 break;
00121 }
00122 }
00123 #else
00124 pfunc *p;
00125
00126 for (p = &_CTOR_END__[-1]; p >= _CTOR_LIST__; p--)
00127 (*p) ();
00128 #endif
00129 } // cyg_hal_invoke_constructors()
|
|
|
Resets board by jumping to manual reset vector. This istruction will bring us to the to the address stored in the exception vector MANUAL RESET of the hardware vector table. This will bring us to _start.
Definition at line 297 of file hal_misc.c.
00298 {
00299 __asm__ ("jmp @@4\n\t");
00300 }
|
|
||||||||||||
|
Default architecture interrupt service routine. The real default ISR, hal_default_isr, is in hal/common/.../src/hal_misc.c and calls this architecture ISR. Normally this function should just return
Definition at line 208 of file hal_misc.c.
00209 {
00210 return 0;
00211 }
|
|
|
Idle thread action called from idle thread. This function is called from the idle thread via the HAL_IDLE_THREAD_ACTION() macro, if so defined. While normally this function does nothing, during development this is often a good place to report various important system parameters on LCDs, LED or other displays. This function can also monitor system state and report any anomalies. If the architecture supports a halt instruction then this is a good place to put an inline assembly fragment to execute it. It is also a good place to handle any power saving activity.
Definition at line 278 of file hal_misc.c.
00279 {
00280 }
|
|
|
Determine the index of the ls bit of the supplied mask. Because the H8S does not support these by hardware we have to implement the macro HAL_LSBIT_INDEX( index, mask ) as call to this function
Definition at line 143 of file hal_misc.c.
00144 {
00145 cyg_uint32 n = mask;
00146
00147 static const signed char tab[64] =
00148 { -1, 0, 1, 12, 2, 6, 0, 13, 3, 0, 7, 0, 0, 0, 0, 14, 10,
00149 4, 0, 0, 8, 0, 0, 25, 0, 0, 0, 0, 0, 21, 27 , 15, 31, 11,
00150 5, 0, 0, 0, 0, 0, 9, 0, 0, 24, 0, 0 , 20, 26, 30, 0, 0, 0,
00151 0, 23, 0, 19, 29, 0, 22, 18, 28, 17, 16, 0
00152 };
00153
00154 n &= ~(n-1UL);
00155 n = (n<<16)-n;
00156 n = (n<<6)+n;
00157 n = (n<<4)+n;
00158
00159 return tab[n>>26];
00160 }
|
|
|
Determine the index of the ms bit of the supplied mask. Because the H8S does not support these by hardware we have to implement the macro HAL_MSBIT_INDEX( index, mask ) as call to this function
Definition at line 174 of file hal_misc.c.
00175 {
00176 cyg_uint32 x = mask;
00177 cyg_uint32 w;
00178
00179 // Phase 1: make word with all ones from that one to the right
00180 x |= x >> 16;
00181 x |= x >> 8;
00182 x |= x >> 4;
00183 x |= x >> 2;
00184 x |= x >> 1;
00185
00186 // Phase 2: calculate number of "1" bits in the word
00187 w = (x & 0x55555555) + ((x >> 1) & 0x55555555);
00188 w = (w & 0x33333333) + ((w >> 2) & 0x33333333);
00189 w = w + (w >> 4);
00190 w = (w & 0x000F000F) + ((w >> 8) & 0x000F000F);
00191 return (cyg_uint32)((w + (w >> 16)) & 0xFF) - 1;
00192 }
|
|
|
saved machine state for GDB
Definition at line 216 of file hal_misc.c. Referenced by cyg_hal_exception_handler(). |
|
|
Set to 1 when constructors should no longer be invoked. It is up to some other package to deal with the rest of the constructors. In the current version this is only possible with the C library. Definition at line 89 of file hal_misc.c. Referenced by cyg_hal_invoke_constructors(). |
1.3.5