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
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 adeos_processor_id
00047
#define this_rt_task ptd
00048
00049
#endif
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
00073
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
#define RTAI_NR_TRAPS ADEOS_NR_FAULTS
00130
00131
#if 0
00132
#define DECLR_8254_TSC_EMULATION
00133
#define TICK_8254_TSC_EMULATION
00134
#define SETUP_8254_TSC_EMULATION
00135
#define CLEAR_8254_TSC_EMULATION
00136
#endif
00137
00138
#ifndef __cplusplus
00139
00140
#include <linux/irq.h>
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
static const int __ipi2vec[] = {
00163 INVALIDATE_TLB_VECTOR,
00164 LOCAL_TIMER_VECTOR,
00165 RESCHEDULE_VECTOR,
00166 CALL_FUNCTION_VECTOR,
00167 SPURIOUS_APIC_VECTOR,
00168 ERROR_APIC_VECTOR,
00169 -1,
00170 -1,
00171
RTAI_3_VECTOR,
00172
RTAI_4_VECTOR
00173 };
00174
00175
#define __vec2irq(v) ((v) - FIRST_EXTERNAL_VECTOR)
00176
00177
static const unsigned __ipi2irq[] = {
00178 __vec2irq(INVALIDATE_TLB_VECTOR),
00179 __vec2irq(LOCAL_TIMER_VECTOR),
00180 __vec2irq(RESCHEDULE_VECTOR),
00181 __vec2irq(CALL_FUNCTION_VECTOR),
00182 __vec2irq(SPURIOUS_APIC_VECTOR),
00183 __vec2irq(ERROR_APIC_VECTOR),
00184 (
unsigned)-1,
00185 (
unsigned)-1,
00186 RTAI_APIC3_IPI,
00187 RTAI_APIC4_IPI
00188 };
00189
#endif
00190
00191
00192
00193
00194
static inline int rt_request_cpu_own_irq (
unsigned ipi,
void (*handler)(
void)) {
00195
00196
#ifdef FIXME
00197
return ipi < 10 ?
rt_request_irq(__ipi2irq[ipi],(rt_irq_handler_t)handler,0) : -EINVAL;
00198
#else
00199
return 0;
00200
#endif
00201
}
00202
00203
static inline int rt_free_cpu_own_irq (
unsigned ipi) {
00204
00205
#ifdef FIXME
00206
return ipi < 10 ?
rt_release_irq(__ipi2irq[ipi]) : -EINVAL;
00207
#else
00208
return 0;
00209
#endif
00210
}
00211
00212
#ifdef CONFIG_SMP
00213
00214
static inline void send_ipi_shorthand (
unsigned shorthand,
00215
int irq) {
00216
unsigned long flags;
00217 rtai_hw_lock(flags);
00218 apic_wait_icr_idle();
00219 apic_write_around(APIC_ICR,APIC_DEST_LOGICAL|shorthand|__ipi2vec[irq]);
00220 rtai_hw_unlock(flags);
00221 }
00222
00223
static inline void send_ipi_logical (
unsigned long dest,
00224
int irq) {
00225
unsigned long flags;
00226
00227
if ((dest &= cpu_online_map) != 0)
00228 {
00229 rtai_hw_lock(flags);
00230 apic_wait_icr_idle();
00231 apic_write_around(APIC_ICR2,SET_APIC_DEST_FIELD(dest));
00232 apic_write_around(APIC_ICR,APIC_DEST_LOGICAL|__ipi2vec[irq]);
00233 rtai_hw_unlock(flags);
00234 }
00235 }
00236
00237
#endif
00238
00239
#ifdef FIXME
00240
static inline void *get_intr_handler (
unsigned vector) {
00241
00242
return (
void *)((
idt_table[vector].b & 0xFFFF0000) |
00243 (
idt_table[vector].a & 0x0000FFFF));
00244 }
00245
00246
static inline void set_intr_vect (
unsigned vector,
00247
void (*handler)(
void)) {
00248
00249
idt_table[vector].a = (
idt_table[vector].a & 0xFFFF0000) |
00250 ((
unsigned)
handler & 0x0000FFFF);
00251
idt_table[vector].b = ((
unsigned)
handler & 0xFFFF0000) |
00252 (
idt_table[vector].b & 0x0000FFFF);
00253 }
00254
00255
static inline void *rt_set_intr_handler (
unsigned vector,
00256
void (*handler)(
void)) {
00257
00258 void (*saved_handler)(
void) = get_intr_handler(vector);
00259 set_intr_vect(vector, handler);
00260
return saved_handler;
00261 }
00262
00263
static inline void rt_reset_intr_handler (
unsigned vector,
00264
void (*handler)(
void)) {
00265 set_intr_vect(vector, handler);
00266 }
00267
00268
static inline unsigned long get_cr2 (
void) {
00269
00270
unsigned long address;
00271 __asm__(
"movl %%cr2,%0":
"=r" (address));
00272
return address;
00273 }
00274
#endif
00275
00276
#endif
00277
00278
#endif
00279
00280
#endif
00281
00282
#endif