BeRTOS
|
00001 00038 #include "cfg/cfg_proc.h" /* CONFIG_KERN_PREEMPT */ 00039 #include "switch_ctx_cm3.h" 00040 00041 #include <cfg/compiler.h> 00042 #include <cfg/debug.h> 00043 00044 #include <cpu/attr.h> /* PAUSE */ 00045 #include <cpu/irq.h> /* IRQ_DISABLE */ 00046 #include <cpu/types.h> 00047 00048 #include <drv/irq_cm3.h> 00049 #include <drv/clock_cm3.h> 00050 00051 #include <kern/proc_p.h> 00052 00053 #include <io/cm3.h> 00054 00055 #ifndef __IAR_SYSTEMS_ICC__ 00056 extern size_t __text_end, __data_start, __data_end, __bss_start, __bss_end; 00057 #endif 00058 00059 extern void __init2(void); 00060 00061 /* Architecture's entry point */ 00062 void __init2(void) 00063 { 00064 /* 00065 * The main application expects IRQs disabled. 00066 */ 00067 IRQ_DISABLE; 00068 00069 /* Set the appropriate clocking configuration */ 00070 clock_init(); 00071 00072 /* Initialize IRQ vector table in RAM */ 00073 sysirq_init(); 00074 00075 #if (CONFIG_KERN && CONFIG_KERN_PREEMPT) 00076 /* 00077 * Voluntary context switch handler. 00078 * 00079 * This software interrupt can always be triggered and must be 00080 * dispatched as soon as possible, thus we just disable IRQ priority 00081 * for it. 00082 */ 00083 sysirq_setHandler(FAULT_SVCALL, svcall_handler); 00084 sysirq_setPriority(FAULT_SVCALL, IRQ_PRIO_MAX); 00085 /* 00086 * Preemptible context switch handler 00087 * 00088 * The priority of this IRQ must be the lowest priority in the system 00089 * in order to run last in the interrupt service routines' chain. 00090 */ 00091 sysirq_setHandler(FAULT_PENDSV, pendsv_handler); 00092 sysirq_setPriority(FAULT_PENDSV, IRQ_PRIO_MIN); 00093 #endif 00094 }