base/include/asm-ppc/rtai_oldnames.h

Go to the documentation of this file.
00001 /*
00002  *   ARTI -- RTAI-compatible Adeos-based Real-Time Interface. Based on
00003  *   the original RTAI layer for PPC and the RTAI/x86 rewrite over ADEOS.
00004  *   This file provides user-visible definitions for compatibility purpose 
00005  *   with the legacy RTHAL. Must be included from rtai_hal.h only.
00006  *
00007  *   Original RTAI/PPC layer implementation: \n
00008  *   Copyright © 2000 Paolo Mantegazza, \n
00009  *   Copyright © 2001 David Schleef, \n
00010  *   Copyright © 2001 Lineo, Inc, \n
00011  *   Copyright © 2002 Wolfgang Grandegger. \n
00012  *
00013  *   RTAI/x86 rewrite over Adeos: \n
00014  *   Copyright &copy 2002 Philippe Gerum.
00015  *
00016  *   RTAI/PPC rewrite over Adeos: \n
00017  *   Copyright &copy 2004 Wolfgang Grandegger.
00018 
00019  *   This program is free software; you can redistribute it and/or modify
00020  *   it under the terms of the GNU General Public License as published by
00021  *   the Free Software Foundation, Inc., 675 Mass Ave, Cambridge MA 02139,
00022  *   USA; either version 2 of the License, or (at your option) any later
00023  *   version.
00024  *
00025  *   This program is distributed in the hope that it will be useful,
00026  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00027  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00028  *   GNU General Public License for more details.
00029  *
00030  *   You should have received a copy of the GNU General Public License
00031  *   along with this program; if not, write to the Free Software
00032  *   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00033  */
00034 
00035 #ifndef _RTAI_ASM_PPC_OLDNAMES_H
00036 #define _RTAI_ASM_PPC_OLDNAMES_H
00037 
00038 #ifdef __KERNEL__
00039 
00040 #define IFLAG                        RTAI_IFLAG
00041 #define hard_cli()                   rtai_cli()
00042 #define hard_sti()                   rtai_sti()
00043 #define hard_save_flags_and_cli(x)   rtai_local_irq_save(x)
00044 #define hard_restore_flags(x)        rtai_local_irq_restore(x)
00045 #define hard_save_flags(x)           rtai_local_irq_flags(x)
00046 #define hard_cpu_id                  hal_processor_id
00047 #define this_rt_task                 ptd
00048 
00049 #endif /* __KERNEL__ */
00050 
00051 #ifndef __RTAI_HAL__
00052 
00053 #define tuned           rtai_tunables
00054 #define NR_RT_CPUS      RTAI_NR_CPUS
00055 #define RT_TIME_END     RTAI_TIME_LIMIT
00056 
00057 #define CPU_FREQ        RTAI_CPU_FREQ
00058 #define TIMER_8254_IRQ  RTAI_TIMER_8254_IRQ
00059 #define FREQ_8254       RTAI_FREQ_8254
00060 #define LATENCY_8254    RTAI_LATENCY_8254
00061 #define SETUP_TIME_8254 RTAI_SETUP_TIME_8254
00062 
00063 #define FREQ_APIC       RTAI_FREQ_APIC
00064 #define LATENCY_APIC    RTAI_LATENCY_APIC
00065 #define SETUP_TIME_APIC RTAI_SETUP_TIME_APIC
00066 
00067 #define CALIBRATED_APIC_FREQ  RTAI_CALIBRATED_APIC_FREQ
00068 #define CALIBRATED_CPU_FREQ   RTAI_CALIBRATED_CPU_FREQ
00069 
00070 #ifdef __KERNEL__
00071 
00072 /* For compatibility reasons with RTHAL, IPIs numbers are indices into
00073    the __ipi2vec[] array, instead of actual interrupt numbers. */
00074 
00075 #define RTAI_1_VECTOR  RTAI_APIC1_VECTOR
00076 #define RTAI_1_IPI     6
00077 #define RTAI_2_VECTOR  RTAI_APIC2_VECTOR
00078 #define RTAI_2_IPI     7
00079 #define RTAI_3_VECTOR  RTAI_APIC3_VECTOR
00080 #define RTAI_3_IPI     8
00081 #define RTAI_4_VECTOR  RTAI_APIC4_VECTOR
00082 #define RTAI_4_IPI     9
00083 
00084 #define broadcast_to_local_timers rtai_broadcast_to_timers
00085 #define rtai_signal_handler       rtai_signal_handler
00086 #define rt_set_rtai_trap_handler  rt_set_trap_handler
00087 #define rt_mount_rtai             rt_mount
00088 #define rt_umount_rtai            rt_umount
00089 #define calibrate_8254            rtai_calibrate_8254
00090 
00091 static inline int rt_request_global_irq_ext(unsigned irq,
00092                         void (*handler)(void),
00093                         unsigned long cookie) {
00094 
00095     return rt_request_irq(irq,(int (*)(unsigned,void *))handler,(void *)cookie, 0);
00096 }
00097 
00098 static inline int rt_request_global_irq(unsigned irq,
00099                     void (*handler)(void)) {
00100 
00101     return rt_request_irq(irq,(int (*)(unsigned,void *))handler, 0, 0);
00102 }
00103 
00104 static inline void rt_set_global_irq_ext(unsigned irq,
00105                      int ext,
00106                      unsigned long cookie) {
00107 
00108     rt_set_irq_cookie(irq,(void *)cookie);
00109 }
00110 
00111 static inline int rt_free_global_irq(unsigned irq) {
00112 
00113     return rt_release_irq(irq);
00114 }
00115 
00116 #undef  rdtsc
00117 #define rdtsc()     rtai_rdtsc()
00118 #define rd_CPU_ts() rdtsc()
00119 
00120 #define ulldiv(a,b,c)  rtai_ulldiv(a,b,c)
00121 #define imuldiv(a,b,c) rtai_imuldiv(a,b,c)
00122 #define llimd(a,b,c)   rtai_llimd(a,b,c)
00123 
00124 #define locked_cpus                        (&rtai_cpu_lock)
00125 
00126 #define lxrt_hrt_flags        rtai_cpu_lxrt
00127 #define rtai_print_to_screen  rt_printk
00128 
00129 #if 0
00130 #define DECLR_8254_TSC_EMULATION
00131 #define TICK_8254_TSC_EMULATION
00132 #define SETUP_8254_TSC_EMULATION
00133 #define CLEAR_8254_TSC_EMULATION
00134 #endif
00135 
00136 #ifndef __cplusplus
00137 
00138 #include <linux/irq.h>
00139 
00140 #if 0
00141 
00142 extern struct desc_struct idt_table[];
00143 
00144 extern struct rt_hal rthal;
00145 
00146 #ifdef FIXME
00147 static inline struct desc_struct rt_set_full_intr_vect (unsigned vector,
00148                             int type,
00149                             int dpl,
00150                             void (*handler)(void)) {
00151     struct desc_struct e = idt_table[vector];
00152     idt_table[vector].a = (__KERNEL_CS << 16) | ((unsigned)handler & 0x0000FFFF);
00153     idt_table[vector].b = ((unsigned)handler & 0xFFFF0000) | (0x8000 + (dpl << 13) + (type << 8));
00154     return e;
00155 }
00156 
00157 static inline void rt_reset_full_intr_vect(unsigned vector,
00158                        struct desc_struct e) {
00159     idt_table[vector] = e;
00160 }
00161 
00162 #endif
00163 
00164 static const int __ipi2vec[] = {
00165     INVALIDATE_TLB_VECTOR,
00166     LOCAL_TIMER_VECTOR,
00167     RESCHEDULE_VECTOR,
00168     CALL_FUNCTION_VECTOR,
00169     SPURIOUS_APIC_VECTOR,
00170     ERROR_APIC_VECTOR,
00171     -1,         /* RTAI_1_VECTOR: reserved */
00172     -1,         /* RTAI_2_VECTOR: reserved */
00173     RTAI_3_VECTOR,
00174     RTAI_4_VECTOR
00175 };
00176 
00177 #define __vec2irq(v) ((v) - FIRST_EXTERNAL_VECTOR)
00178 
00179 static const unsigned __ipi2irq[] = {
00180     __vec2irq(INVALIDATE_TLB_VECTOR),
00181     __vec2irq(LOCAL_TIMER_VECTOR),
00182     __vec2irq(RESCHEDULE_VECTOR),
00183     __vec2irq(CALL_FUNCTION_VECTOR),
00184     __vec2irq(SPURIOUS_APIC_VECTOR),
00185     __vec2irq(ERROR_APIC_VECTOR),
00186     (unsigned)-1,   /* RTAI_1_IPI: reserved */
00187     (unsigned)-1,   /* RTAI_2_IPI: reserved */
00188     RTAI_APIC3_IPI,
00189     RTAI_APIC4_IPI
00190 };
00191 #endif
00192 
00193 /* cpu_own_irq() routines are RTHAL-specific and emulated here for
00194    compatibility purposes. */
00195 
00196 static inline int rt_request_cpu_own_irq (unsigned ipi, void (*handler)(void)) {
00197 
00198 #ifdef FIXME
00199     return ipi < 10 ? rt_request_irq(__ipi2irq[ipi],(rt_irq_handler_t)handler,0) : -EINVAL;
00200 #else
00201     return 0;
00202 #endif
00203 }
00204 
00205 static inline int rt_free_cpu_own_irq (unsigned ipi) {
00206 
00207 #ifdef FIXME
00208     return ipi < 10 ? rt_release_irq(__ipi2irq[ipi]) : -EINVAL;
00209 #else
00210     return 0;
00211 #endif
00212 }
00213 
00214 #ifdef CONFIG_SMP
00215 
00216 static inline void send_ipi_shorthand (unsigned shorthand,
00217                        int irq) {
00218     unsigned long flags;
00219     rtai_hw_lock(flags);
00220     apic_wait_icr_idle();
00221     apic_write_around(APIC_ICR,APIC_DEST_LOGICAL|shorthand|__ipi2vec[irq]);
00222     rtai_hw_unlock(flags);
00223 }
00224 
00225 static inline void send_ipi_logical (unsigned long dest,
00226                      int irq) {
00227     unsigned long flags;
00228 
00229     if ((dest &= cpu_online_map) != 0)
00230     {
00231     rtai_hw_lock(flags);
00232     apic_wait_icr_idle();
00233     apic_write_around(APIC_ICR2,SET_APIC_DEST_FIELD(dest));
00234     apic_write_around(APIC_ICR,APIC_DEST_LOGICAL|__ipi2vec[irq]);
00235     rtai_hw_unlock(flags);
00236     }
00237 }
00238 
00239 #endif /* CONFIG_SMP */
00240 
00241 #ifdef FIXME
00242 static inline void *get_intr_handler (unsigned vector) {
00243 
00244     return (void *)((idt_table[vector].b & 0xFFFF0000) | 
00245             (idt_table[vector].a & 0x0000FFFF));
00246 }
00247 
00248 static inline void set_intr_vect (unsigned vector,
00249                   void (*handler)(void)) {
00250 
00251     idt_table[vector].a = (idt_table[vector].a & 0xFFFF0000) | 
00252     ((unsigned)handler & 0x0000FFFF);
00253     idt_table[vector].b = ((unsigned)handler & 0xFFFF0000) | 
00254     (idt_table[vector].b & 0x0000FFFF);
00255 }
00256 
00257 static inline void *rt_set_intr_handler (unsigned vector,
00258                      void (*handler)(void)) {
00259 
00260     void (*saved_handler)(void) = get_intr_handler(vector);
00261     set_intr_vect(vector, handler);
00262     return saved_handler;
00263 }
00264 
00265 static inline void rt_reset_intr_handler (unsigned vector,
00266                       void (*handler)(void)) {
00267     set_intr_vect(vector, handler);
00268 }
00269 
00270 static inline unsigned long get_cr2 (void) {
00271 
00272     unsigned long address;
00273     __asm__("movl %%cr2,%0":"=r" (address));
00274     return address;
00275 }
00276 #endif
00277 
00278 #endif /* __KERNEL__ */
00279 
00280 #endif /* !__cplusplus */
00281 
00282 #endif /* __RTAI_HAL__ */
00283 
00284 #endif /* !_RTAI_ASM_PPC_OLDNAMES_H */

Generated on Tue Feb 2 17:46:04 2010 for RTAI API by  doxygen 1.4.7