# rtai_sched.h

    00001 /*
    00002 COPYRIGHT (C) 2000  Paolo Mantegazza (mantegazza@aero.polimi.it)
    00003                     Stuart Hughes    (shughes@zentropix.com)
    00004
    00005 This library is free software; you can redistribute it and/or
    00006 modify it under the terms of the GNU Lesser General Public
    00007 License as published by the Free Software Foundation; either
    00008 version 2 of the License, or (at your option) any later version.
    00009
    00010 This library is distributed in the hope that it will be useful,
    00011 but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00013 Lesser General Public License for more details.
    00014
    00015 You should have received a copy of the GNU Lesser General Public
    00016 License along with this library; if not, write to the Free Software
    00017 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
    00018 */
    00019
    00020
    00021 #ifndef RTAI_SCHED_H
    00022 #define RTAI_SCHED_H
    00023
    00024 extern void up_task_sw(void *, void *);
    00025
    00026 #ifdef CONFIG_RTAI_ADEOS
    00027 #define rt_switch_to(new_task) \
    00028 do { \
    00029         unsigned long flags; \
    00030         rtai_hw_lock(flags); \
    00031         up_task_sw(&rt_current, (new_task)); \
    00032         rtai_hw_unlock(flags); \
    00033 } while(0)
    00034 #define RTAI_MSR_FLAGS  (MSR_KERNEL | MSR_FP | MSR_EE)
    00035 #else  /* !CONFIG_RTAI_ADEOS */
    00036 #define rt_switch_to(new_task) up_task_sw(&rt_current, (new_task))
    00037 #define RTAI_MSR_FLAGS  (MSR_KERNEL | MSR_FP)
    00038 #endif  /* CONFIG_RTAI_ADEOS */
    00039
    00040 #define rt_exchange_tasks(oldtask, newtask) up_task_sw(&(oldtask), (new_task))
    00041
    00042 #define init_arch_stack() \
    00043 do { \
    00044         *(task->stack - 28) = data;                     \
    00045         *(task->stack - 29) = (int)rt_thread;           \
    00046         *(task->stack - 35) = (int)rt_startup;          \
    00047         *(task->stack - 36) = RTAI_MSR_FLAGS;           \
    00048 } while(0)
    00049
    00050 #define DEFINE_LINUX_CR0
    00051
    00052 #define DEFINE_LINUX_SMP_CR0
    00053
    00054 #ifdef CONFIG_RTAI_FPU_SUPPORT
    00055 #define init_fp_env() \
    00056 do { \
    00057         memset(&task->fpu_reg, 0, sizeof(task->fpu_reg)); \
    00058 }while(0)
    00059 #else
    00060 #define init_fp_env() do { } while(0)
    00061 #endif
    00062
    00063 static inline void *get_stack_pointer(void)
    00064 {
    00065         void *sp;
    00066         asm volatile ("mr 1, %0" : "=r" (sp));
    00067         return sp;
    00068 }
    00069
    00070 #define RT_SET_RTAI_TRAP_HANDLER(x)
    00071
    00072 #define DO_TIMER_PROPER_OP()
    00073
    00074 #endif