00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef _RTAI_ASM_I386_OLDNAMES_H
00033 #define _RTAI_ASM_I386_OLDNAMES_H
00034
00035 #ifdef __KERNEL__
00036
00037 #define IFLAG RTAI_IFLAG
00038 #define hard_cli() rtai_cli()
00039 #define hard_sti() rtai_sti()
00040 #define hard_save_flags_and_cli(x) rtai_local_irq_save(x)
00041 #define hard_restore_flags(x) rtai_local_irq_restore(x)
00042 #define hard_save_flags(x) rtai_local_irq_flags(x)
00043 #define hard_cpu_id adeos_processor_id
00044 #define this_rt_task ptd
00045
00046 #endif
00047
00048 #ifndef __RTAI_HAL__
00049
00050 #define tuned rtai_tunables
00051 #define NR_RT_CPUS RTAI_NR_CPUS
00052 #define RT_TIME_END RTAI_TIME_LIMIT
00053
00054 #define CPU_FREQ RTAI_CPU_FREQ
00055 #define TIMER_8254_IRQ RTAI_TIMER_8254_IRQ
00056 #define FREQ_8254 RTAI_FREQ_8254
00057 #define LATENCY_8254 RTAI_LATENCY_8254
00058 #define SETUP_TIME_8254 RTAI_SETUP_TIME_8254
00059
00060 #define FREQ_APIC RTAI_FREQ_APIC
00061 #define LATENCY_APIC RTAI_LATENCY_APIC
00062 #define SETUP_TIME_APIC RTAI_SETUP_TIME_APIC
00063
00064 #define CALIBRATED_APIC_FREQ RTAI_CALIBRATED_APIC_FREQ
00065 #define CALIBRATED_CPU_FREQ RTAI_CALIBRATED_CPU_FREQ
00066
00067 #ifdef __KERNEL__
00068
00069 #undef rdtsc
00070 #define rdtsc() rtai_rdtsc()
00071 #define rd_CPU_ts() rtai_rdtsc()
00072
00073 #define rt_set_rtai_trap_handler rt_set_trap_handler
00074 #define rt_mount_rtai rt_mount
00075 #define rt_umount_rtai rt_umount
00076 #define calibrate_8254 rtai_calibrate_8254
00077
00078 #define ulldiv(a,b,c) rtai_ulldiv(a,b,c)
00079 #define imuldiv(a,b,c) rtai_imuldiv(a,b,c)
00080 #define llimd(a,b,c) rtai_llimd(a,b,c)
00081 #define u64div32(a,b,c) rtai_u64div32c(a,b,c)
00082 #define locked_cpus (&rtai_cpu_lock)
00083
00084 #define RTAI_NR_TRAPS ADEOS_NR_FAULTS
00085
00086 #ifdef CONFIG_X86_TSC
00087
00088 #define DECLR_8254_TSC_EMULATION
00089 #define TICK_8254_TSC_EMULATION
00090 #define SETUP_8254_TSC_EMULATION
00091 #define CLEAR_8254_TSC_EMULATION
00092
00093 #else
00094
00095
00096
00097 #define DECLR_8254_TSC_EMULATION \
00098 extern void *kd_mksound; \
00099 static void *linux_mksound; \
00100 static void rtai_mksound(void) { }
00101
00102 #define TICK_8254_TSC_EMULATION rdtsc()
00103
00104 #define SETUP_8254_TSC_EMULATION \
00105 do { \
00106 linux_mksound = kd_mksound; \
00107 kd_mksound = rtai_mksound; \
00108 rt_setup_8254_tsc(); \
00109 } while (0)
00110
00111 #define CLEAR_8254_TSC_EMULATION \
00112 do { \
00113 if (linux_mksound) { \
00114 kd_mksound = linux_mksound; \
00115 } \
00116 } while (0)
00117
00118 #endif
00119
00120 #ifndef __cplusplus
00121
00122 #include <linux/irq.h>
00123 #include <asm/desc.h>
00124
00125 extern struct desc_struct idt_table[];
00126
00127 static inline struct desc_struct rt_set_full_intr_vect (unsigned vector,
00128 int type,
00129 int dpl,
00130 void (*handler)(void)) {
00131 struct desc_struct e = idt_table[vector];
00132 idt_table[vector].a = (__KERNEL_CS << 16) | ((unsigned)handler & 0x0000FFFF);
00133 idt_table[vector].b = ((unsigned)handler & 0xFFFF0000) | (0x8000 + (dpl << 13) + (type << 8));
00134 return e;
00135 }
00136
00137 static inline void rt_reset_full_intr_vect(unsigned vector,
00138 struct desc_struct e) {
00139 idt_table[vector] = e;
00140 }
00141
00142 static inline int rt_request_cpu_own_irq (unsigned irq, void (*handler)(void)) {
00143
00144 return rt_request_irq(irq,(rt_irq_handler_t)handler,NULL);
00145 }
00146
00147 static inline int rt_free_cpu_own_irq (unsigned irq) {
00148
00149 return rt_release_irq(irq);
00150 }
00151
00152 static inline void *get_intr_handler (unsigned vector) {
00153
00154 return (void *)((idt_table[vector].b & 0xFFFF0000) |
00155 (idt_table[vector].a & 0x0000FFFF));
00156 }
00157
00158 static inline void set_intr_vect (unsigned vector,
00159 void (*handler)(void)) {
00160
00161 idt_table[vector].a = (idt_table[vector].a & 0xFFFF0000) |
00162 ((unsigned)handler & 0x0000FFFF);
00163 idt_table[vector].b = ((unsigned)handler & 0xFFFF0000) |
00164 (idt_table[vector].b & 0x0000FFFF);
00165 }
00166
00167 static inline void *rt_set_intr_handler (unsigned vector,
00168 void (*handler)(void)) {
00169
00170 void (*saved_handler)(void) = get_intr_handler(vector);
00171 set_intr_vect(vector, handler);
00172 return saved_handler;
00173 }
00174
00175 static inline void rt_reset_intr_handler (unsigned vector,
00176 void (*handler)(void)) {
00177 set_intr_vect(vector, handler);
00178 }
00179
00180 static inline unsigned long get_cr2 (void) {
00181
00182 unsigned long address;
00183 __asm__("movl %%cr2,%0":"=r" (address));
00184 return address;
00185 }
00186
00187 #endif
00188
00189 #endif
00190
00191 #endif
00192
00193 #endif