Mercurial > flash_v2
comparison packages/hal/i386/pc/current/src/hal_startup.c @ 76:435cced73e2f ecos-v1_3_1-release
eCos v1.3.1 merged from eCos master repository on 2000-03-27-23:22:51-BST
| author | jlarmour |
|---|---|
| date | Tue, 28 Mar 2000 14:10:45 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 75:41bf073c0c32 | 76:435cced73e2f |
|---|---|
| 1 //============================================================================= | |
| 2 // | |
| 3 // hal_startup.c | |
| 4 // | |
| 5 // HAL bootstrap code | |
| 6 // | |
| 7 //============================================================================= | |
| 8 //####COPYRIGHTBEGIN#### | |
| 9 // | |
| 10 // ------------------------------------------- | |
| 11 // The contents of this file are subject to the Red Hat eCos Public License | |
| 12 // Version 1.1 (the "License"); you may not use this file except in | |
| 13 // compliance with the License. You may obtain a copy of the License at | |
| 14 // http://www.redhat.com/ | |
| 15 // | |
| 16 // Software distributed under the License is distributed on an "AS IS" | |
| 17 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the | |
| 18 // License for the specific language governing rights and limitations under | |
| 19 // the License. | |
| 20 // | |
| 21 // The Original Code is eCos - Embedded Configurable Operating System, | |
| 22 // released September 30, 1998. | |
| 23 // | |
| 24 // The Initial Developer of the Original Code is Red Hat. | |
| 25 // Portions created by Red Hat are | |
| 26 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc. | |
| 27 // All Rights Reserved. | |
| 28 // ------------------------------------------- | |
| 29 // | |
| 30 //####COPYRIGHTEND#### | |
| 31 //============================================================================= | |
| 32 //#####DESCRIPTIONBEGIN#### | |
| 33 // | |
| 34 // Author(s): proven | |
| 35 // Contributors:proven, jskov | |
| 36 // Date: 1998-10-06 | |
| 37 // Purpose: HAL diagnostic output | |
| 38 // Description: Implementations of HAL diagnostic output support. | |
| 39 // | |
| 40 //####DESCRIPTIONEND#### | |
| 41 // | |
| 42 //============================================================================= | |
| 43 | |
| 44 #include <pkgconf/hal.h> | |
| 45 | |
| 46 #ifdef CYGPKG_KERNEL | |
| 47 #include <pkgconf/kernel.h> | |
| 48 #include <cyg/kernel/kapi.h> // cyg_scheduler_lock | |
| 49 #endif | |
| 50 | |
| 51 #include <cyg/hal/hal_intr.h> // interrupt stuff | |
| 52 #include <cyg/hal/hal_arch.h> // Architecture specific definitions | |
| 53 | |
| 54 #include <cyg/infra/diag.h> // diag_printf | |
| 55 #include <cyg/infra/cyg_ass.h> // ASSERTION macros | |
| 56 | |
| 57 | |
| 58 //---------------------------------------------------------------------------- | |
| 59 // ISR tables | |
| 60 volatile CYG_ADDRESS cyg_hal_interrupt_handlers[CYGNUM_HAL_ISR_COUNT]; | |
| 61 volatile CYG_ADDRWORD cyg_hal_interrupt_data[CYGNUM_HAL_ISR_COUNT]; | |
| 62 volatile CYG_ADDRESS cyg_hal_interrupt_objects[CYGNUM_HAL_ISR_COUNT]; | |
| 63 | |
| 64 // VSR table | |
| 65 volatile CYG_ADDRESS cyg_hal_vsr_table[CYGNUM_HAL_VSR_COUNT]; | |
| 66 | |
| 67 // Interrupts start disabled | |
| 68 volatile int cyg_hal_interrupts_disabled = 1; | |
| 69 volatile int cyg_hal_interrupts_deferred; | |
| 70 volatile int cyg_hal_interrupts_unhandled[CYGNUM_HAL_ISR_COUNT]; | |
| 71 | |
| 72 //----------------------------------------------------------------------------- | |
| 73 | |
| 74 typedef cyg_uint32 (*callsig_t)(int vector, cyg_uint32); | |
| 75 | |
| 76 externC void interrupt_end(CYG_ADDRESS, CYG_ADDRESS, CYG_ADDRESS); | |
| 77 extern volatile cyg_uint32 cyg_scheduler_sched_lock; | |
| 78 | |
| 79 externC void cyg_hal_default_interrupt_vsr(int vector) | |
| 80 { | |
| 81 callsig_t func; | |
| 82 cyg_uint32 ret; | |
| 83 | |
| 84 if (cyg_hal_interrupts_disabled) { | |
| 85 cyg_hal_interrupts_unhandled[vector] = 1; | |
| 86 cyg_hal_interrupts_deferred = 1; | |
| 87 return; | |
| 88 } | |
| 89 | |
| 90 #ifdef CYGFUN_HAL_COMMON_KERNEL_SUPPORT | |
| 91 // Increment the scheduler lock when the kernel is present. | |
| 92 cyg_scheduler_sched_lock++; | |
| 93 #endif | |
| 94 | |
| 95 cyg_hal_interrupts_unhandled[vector] = 0; | |
| 96 func = (callsig_t) cyg_hal_interrupt_handlers[vector]; | |
| 97 ret = func(vector, cyg_hal_interrupt_data[vector]); | |
| 98 | |
| 99 #ifdef CYGFUN_HAL_COMMON_KERNEL_SUPPORT | |
| 100 // We only need to call _interrupt_end() when there is a kernel | |
| 101 // present to do any tidying up. | |
| 102 interrupt_end(ret, cyg_hal_interrupt_objects[vector], (CYG_ADDRESS) NULL); | |
| 103 #endif | |
| 104 } | |
| 105 | |
| 106 externC void cyg_hal_default_exception_vsr(int vector) | |
| 107 { | |
| 108 #if defined(CYGFUN_HAL_COMMON_KERNEL_SUPPORT) && \ | |
| 109 defined(CYGPKG_HAL_EXCEPTIONS) | |
| 110 | |
| 111 { | |
| 112 int __pre_state = cyg_hal_interrupts_disabled++; | |
| 113 | |
| 114 cyg_hal_deliver_exception( vector, 0 ); | |
| 115 | |
| 116 cyg_hal_interrupts_disabled = __pre_state; | |
| 117 } | |
| 118 | |
| 119 #else | |
| 120 | |
| 121 CYG_FAIL("Exception!!!"); | |
| 122 | |
| 123 #endif | |
| 124 } | |
| 125 | |
| 126 //--------------------------------------------------------------------------- | |
| 127 // Default ISR | |
| 128 | |
| 129 externC cyg_uint32 | |
| 130 cyg_hal_default_isr(CYG_ADDRWORD vector, CYG_ADDRWORD data) | |
| 131 { | |
| 132 diag_printf("Interrupt: %d\n", vector); | |
| 133 | |
| 134 CYG_FAIL("Spurious Interrupt!!!"); | |
| 135 return 0; | |
| 136 } | |
| 137 | |
| 138 //----------------------------------------------------------------------------- | |
| 139 // Initialization on the VSRs. | |
| 140 | |
| 141 externC void cyg_hal_isr_init(void) | |
| 142 { | |
| 143 int i; | |
| 144 | |
| 145 // ISR setup | |
| 146 for (i = 0; i < CYGNUM_HAL_ISR_COUNT; i++) { | |
| 147 cyg_hal_interrupt_handlers[i] = (CYG_ADDRESS) &cyg_hal_default_isr; | |
| 148 } | |
| 149 | |
| 150 } | |
| 151 | |
| 152 //----------------------------------------------------------------------------- | |
| 153 // End of hal_startup.c |
