rtai-core/include/asm-arm/rtai_sched.h

00001 /* 020219 /rtai/include/asm-arm/rtai_sched.h
00002 Copyright (c) 2001 Alex Züpke, SYSGO RTS GmbH (azu@sysgo.de)
00003 COPYRIGHT (C) 2002 Wolfgang Müller (wolfgang.mueller@dsa-ac.de)
00004 
00005 This program is free software; you can redistribute it and/or modify
00006 it under the terms of version 2 of the GNU General Public License as
00007 published by the Free Software Foundation.
00008 
00009 This program is distributed in the hope that it will be useful,
00010 but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 GNU General Public License for more details.
00013 
00014 You should have received a copy of the GNU General Public License
00015 along with this program; if not, write to the Free Software
00016 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017 */
00018 /*
00019 --------------------------------------------------------------------------
00020 Acknowledgements
00021 - Paolo Mantegazza      (mantegazza@aero.polimi.it)
00022         creator of RTAI 
00023 */
00024 
00025 #ifndef _ASM_ARM_RTAI_SCHED_H_
00026 #define _ASM_ARM_RTAI_SCHED_H_
00027 
00028 #define rt_switch_to(new_task) up_task_sw(&rt_current, (new_task), &rt_linux_task);
00029 
00030 #define rt_exchange_tasks(old_task, new_task) up_task_sw(&(old_task), (new_task), &rt_linux_task);
00031 
00032 static inline unsigned long current_domain_access_control(void)
00033 {
00034         unsigned long domain_access_control;
00035         asm volatile ("mrc p15, 0, %0, c3, c0" : "=r" (domain_access_control));
00036         return domain_access_control;
00037 }
00038 
00039 #define init_arch_stack()                                               \
00040 do {                                                                    \
00041         unsigned long init_arch_flags;                                  \
00042         unsigned long init_domain_access_control;                       \
00043                                                                         \
00044         hard_save_flags(init_arch_flags);                               \
00045         init_domain_access_control = current_domain_access_control();   \
00046                                                                         \
00047         task->stack -=  +15;                                            \
00048                                                                         \
00049         *(task->stack   +14) = (int) rt_startup;                        \
00050         *(task->stack   +03) = (int) data;                              \
00051         *(task->stack   +02) = (int) rt_thread;                         \
00052         *(task->stack   +01) = (int) init_arch_flags;                   \
00053         *(task->stack   +00) = (int) init_domain_access_control;        \
00054 } while (0)
00055 //      previous                now our stack frame looks like this : (refer also to up_task_sw)
00056 //      task->stack     +15                     remember startup code in up-scheduler :
00057 //      |               +14     r14=lr          void rt_startup(void(*rt_tread)(int), int data)
00058 //      |               +13     r11=fp          {       //      ^^ = r0               ^^ = r1
00059 //      |               +12     r10=sl                  hard_sti();
00060 //      |               +11     r9                      rt_thread(data);
00061 //      |               +10     r8                      rt_task_delete(rt_current);
00062 //      |               +09     r7              }
00063 //      |               +08     r6              
00064 //      |               +07     r5              
00065 //      |               +06     r4              
00066 //      |               +05     r3              
00067 //      |               +04     r2              
00068 //      |               +03     r1              int data                // user defined
00069 //      |               +02     r0              void rt_thread(int data) { user defined }
00070 //      V               +01     cpsr_SVC        unsigned long init_arch_flags
00071 //      task->stack     +00     domain_..._...  unsigned long init_domain_access_control
00072 
00073 #define DEFINE_LINUX_CR0
00074 
00075 #define DEFINE_LINUX_SMP_CR0
00076 
00077 #ifdef CONFIG_RTAI_FP_SUPPORT
00078 #define init_fp_env() \
00079 do { \
00080         memset(&task->fpu_reg, 0, sizeof(task->fpu_reg)); \
00081 }while(0)
00082 #else
00083 #define init_fp_env() 
00084 #endif
00085 
00086 static inline void *get_stack_pointer(void)
00087 {
00088         void *sp;
00089         asm volatile ("mov %0, sp" : "=r" (sp));
00090         return sp;
00091 }
00092 
00093 #define RT_SET_RTAI_TRAP_HANDLER(x)
00094 
00095 /* Handle spurious timer interrupts */
00096 #define DO_TIMER_PROPER_OP() \
00097         if ( timer_irq_ack() < 0 ) \
00098                 return
00099 
00100 #endif
00101 
00102 /* eof */

Generated on Sat Jul 24 19:36:02 2004 for RTAI API by doxygen 1.3.4