base/include/rtai_hal_names.h

Go to the documentation of this file.
00001 /*
00002  * Copyright 2005 Paolo Mantegazza <mantegazza@aero.polimi.it>
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License as
00006  * published by the Free Software Foundation; either version 2 of the
00007  * License, or (at your option) any later version.
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 #ifndef _RTAI_HAL_NAMES_H
00021 #define _RTAI_HAL_NAMES_H
00022 
00023 #include <linux/version.h>
00024 
00025 #define TSKEXT0  (HAL_ROOT_NPTDKEYS - 4)
00026 #define TSKEXT1  (HAL_ROOT_NPTDKEYS - 3)
00027 #define TSKEXT2  (HAL_ROOT_NPTDKEYS - 2)
00028 #define TSKEXT3  (HAL_ROOT_NPTDKEYS - 1)
00029 
00030 #if !defined(CONFIG_PPC) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,32) || (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13)))
00031 
00032 #define HAL_VERSION_STRING   ADEOS_VERSION_STRING
00033 
00034 #define HAL_NR_CPUS          ADEOS_NR_CPUS
00035 #define HAL_NR_FAULTS        ADEOS_NR_FAULTS
00036 #define HAL_NR_EVENTS        ADEOS_NR_EVENTS
00037 #define HAL_ROOT_NPTDKEYS    ADEOS_ROOT_NPTDKEYS
00038 
00039 #define HAL_APIC_HIGH_VECTOR  ADEOS_SERVICE_VECTOR3
00040 #define HAL_APIC_LOW_VECTOR   ADEOS_SERVICE_VECTOR2
00041 
00042 #define HAL_SCHEDULE_HEAD     ADEOS_SCHEDULE_HEAD
00043 #define HAL_SCHEDULE_TAIL     ADEOS_SCHEDULE_TAIL
00044 #define HAL_SYSCALL_PROLOGUE  ADEOS_SYSCALL_PROLOGUE
00045 #define HAL_SYSCALL_EPILOGUE  1000000 // invalid for sure, will be rejected, OK ADEOS_SYSCALL_EPILOGUE
00046 #define HAL_EXIT_PROCESS      ADEOS_EXIT_PROCESS
00047 #define HAL_KICK_PROCESS      ADEOS_KICK_PROCESS
00048 
00049 extern struct list_head __adeos_pipeline;
00050 
00051 #define hal_pipeline           __adeos_pipeline
00052 #define hal_domain_struct      adomain 
00053 #define hal_root_domain        adp_root 
00054 #define hal_current_domain(x)  adp_cpu_current[x] 
00055 
00056 #define hal_propagate_irq  adeos_propagate_irq
00057 #define hal_schedule_irq   adeos_schedule_irq
00058 
00059 #define hal_critical_enter  adeos_critical_enter
00060 #define hal_critical_exit   adeos_critical_exit
00061 
00062 #define hal_clear_irq   __adeos_clear_irq
00063 #define hal_lock_irq    __adeos_lock_irq
00064 #define hal_unlock_irq  __adeos_unlock_irq
00065 
00066 #define hal_std_irq_dtype        __adeos_std_irq_dtype
00067 #define hal_adeos_std_irq_dtype  __adeos_std_irq_dtype
00068 
00069 #define hal_tick_regs  __adeos_tick_regs
00070 #define hal_tick_irq   __adeos_tick_irq
00071 
00072 #define hal_sync_stage  __adeos_sync_stage
00073 
00074 #define hal_set_irq_affinity  adeos_set_irq_affinity
00075 
00076 #define hal_set_irq_handler   adeos_set_irq_handler
00077 
00078 #define hal_propagate_event  adeos_propagate_event
00079 
00080 #define hal_get_sysinfo  adeos_get_sysinfo
00081 
00082 #define INTERCEPT_WAKE_UP_TASK(data)  (((struct sig_wakeup_t *)data)->task)
00083 
00084 #define FIRST_LINE_OF_RTAI_DOMAIN_ENTRY  static void rtai_domain_entry(int iflag) { if (iflag)
00085 #define LAST_LINE_OF_RTAI_DOMAIN_ENTRY   }
00086 
00087 #ifdef CONFIG_ADEOS_NOTHREADS
00088 #define HAL_TYPE  "ADEOS-NOTHREADS"
00089 #define hal_suspend_domain()  break
00090 #else
00091 #define HAL_TYPE  "ADEOS-THREADS"
00092 #define hal_suspend_domain()  adeos_suspend_domain()
00093 #endif
00094 
00095 #define hal_alloc_irq       adeos_alloc_irq
00096 #define hal_free_irq        adeos_free_irq
00097 #define hal_virtualize_irq  adeos_virtualize_irq_from
00098 #define hal_irq_hits_pp(irq, domain, cpuid) \
00099 do { \
00100     domain->cpudata[cpuid].irq_hits[irq]++; \
00101 } while (0)
00102 
00103 #define hal_sysinfo_struct         adsysinfo
00104 #define hal_attr_struct            adattr
00105 #define hal_init_attr              adeos_init_attr
00106 #define hal_register_domain        adeos_register_domain
00107 #define hal_unregister_domain      adeos_unregister_domain
00108 #define hal_catch_event            adeos_catch_event_from
00109 #define hal_event_handler          adeos_event_handler
00110 #define hal_event_handler_fun(e)   events[e].handler
00111 
00112 #define hal_set_printk_sync   adeos_set_printk_sync
00113 #define hal_set_printk_async  adeos_set_printk_async
00114 
00115 #define hal_schedule_back_root(prev) \
00116 do { \
00117     if ((prev)->rtai_tskext(HAL_ROOT_NPTDKEYS - 1)) { \
00118         __adeos_schedule_back_root((prev)->rtai_tskext(HAL_ROOT_NPTDKEYS - 1)); \
00119         (prev)->rtai_tskext(HAL_ROOT_NPTDKEYS - 1) = NULL; \
00120     } else { \
00121         __adeos_schedule_back_root(prev); \
00122     } \
00123 } while (0)
00124 
00125 #define hal_processor_id  adeos_processor_id
00126 
00127 #define hal_hw_cli                adeos_hw_cli
00128 #define hal_hw_sti                adeos_hw_sti
00129 #define hal_hw_local_irq_save     adeos_hw_local_irq_save
00130 #define hal_hw_local_irq_restore  adeos_hw_local_irq_restore
00131 #define hal_hw_local_irq_flags    adeos_hw_local_irq_flags
00132 
00133 #define hal_unstall_pipeline_from  adeos_unstall_pipeline_from
00134 
00135 #define hal_ack_system_irq  __adeos_ack_system_irq
00136 
00137 #define hal_irq_handler  adeos_extern_irq_handler
00138 
00139 #define hal_tskext  ptd
00140 
00141 #define hal_set_linux_task_priority  __adeos_setscheduler_root
00142 
00143 #else
00144 
00145 #define HAL_VERSION_STRING   IPIPE_VERSION_STRING
00146 
00147 #define HAL_NR_CPUS          IPIPE_NR_CPUS
00148 #define HAL_NR_FAULTS        IPIPE_NR_FAULTS
00149 #define HAL_NR_EVENTS        IPIPE_NR_EVENTS
00150 #define HAL_ROOT_NPTDKEYS    IPIPE_ROOT_NPTDKEYS
00151 
00152 #define HAL_APIC_HIGH_VECTOR  IPIPE_SERVICE_VECTOR3
00153 #define HAL_APIC_LOW_VECTOR   IPIPE_SERVICE_VECTOR2
00154 
00155 #define HAL_SCHEDULE_HEAD     IPIPE_EVENT_SCHEDULE
00156 #define HAL_SCHEDULE_TAIL     (IPIPE_FIRST_EVENT - 2)  // safely unused, cared
00157 #define HAL_SYSCALL_PROLOGUE  IPIPE_EVENT_SYSCALL
00158 #define HAL_SYSCALL_EPILOGUE  1000000 // invalid for sure, will be rejected, OK
00159 #define HAL_EXIT_PROCESS      IPIPE_EVENT_EXIT
00160 #define HAL_KICK_PROCESS      IPIPE_EVENT_SIGWAKE
00161 
00162 #define hal_pipeline        __ipipe_pipeline
00163 #define hal_domain_struct   ipipe_domain 
00164 #define hal_root_domain     ipipe_root_domain 
00165 
00166 // temporary fix for using PPC
00167 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17) || (defined(CONFIG_PPC) && LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13))
00168 #define hal_current_domain(cpuid)  per_cpu(ipipe_percpu_domain, cpuid) 
00169 #else
00170 #define hal_current_domain(cpuid)  (ipipe_percpu_domain[cpuid])
00171 #endif
00172 
00173 #define hal_propagate_irq   ipipe_propagate_irq
00174 #define hal_schedule_irq    ipipe_schedule_irq
00175 
00176 #define hal_critical_enter  ipipe_critical_enter
00177 #define hal_critical_exit   ipipe_critical_exit
00178 
00179 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
00180 #define hal_clear_irq   __ipipe_clear_irq
00181 #else
00182 #define hal_clear_irq(a, b)
00183 #endif
00184 
00185 #define hal_lock_irq    __ipipe_lock_irq
00186 #define hal_unlock_irq  __ipipe_unlock_irq
00187 
00188 #define hal_std_irq_dtype        __ipipe_std_irq_dtype
00189 #define hal_ipipe_std_irq_dtype  __adeos_std_irq_dtype
00190 
00191 #define hal_tick_regs  __ipipe_tick_regs
00192 #define hal_tick_irq   __ipipe_tick_irq
00193 
00194 #define hal_sync_stage  __ipipe_sync_stage
00195 
00196 #define hal_set_irq_affinity  ipipe_set_irq_affinity
00197 
00198 #define hal_propagate_event  ipipe_propagate_event
00199 
00200 #define hal_get_sysinfo  ipipe_get_sysinfo
00201 
00202 #define HAL_TYPE  "IPIPE-NOTHREADS"
00203 
00204 #define INTERCEPT_WAKE_UP_TASK(data)  ((struct task_struct *)data)
00205 
00206 #define FIRST_LINE_OF_RTAI_DOMAIN_ENTRY  static void rtai_domain_entry(void) { if (1)
00207 #define LAST_LINE_OF_RTAI_DOMAIN_ENTRY   }
00208 
00209 #define hal_suspend_domain()  break
00210 
00211 #define hal_alloc_irq       ipipe_alloc_virq
00212 #define hal_free_irq        ipipe_free_virq
00213 
00214 #if !defined(CONFIG_PPC) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,32) || (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)))
00215 #define hal_virtualize_irq  ipipe_virtualize_irq
00216 #define hal_irq_hits_pp(irq, domain, cpuid) \
00217 do { \
00218     domain->cpudata[cpuid].irq_hits[irq]++; \
00219 } while (0)
00220 #else
00221 #define hal_virtualize_irq(d, n, h, a, m) \
00222     ipipe_virtualize_irq(d, n, (void *)h, NULL, a, m)
00223 #define hal_irq_hits_pp(irq, domain, cpuid) \
00224 do { \
00225 /*  domain->cpudata[cpuid].irq_counters[irq].total_hits++; REMIND ME TOO */\
00226     domain->cpudata[cpuid].irq_counters[irq].pending_hits++; \
00227 } while (0)
00228 #endif
00229 
00230 #define hal_sysinfo_struct         ipipe_sysinfo
00231 #define hal_attr_struct            ipipe_domain_attr
00232 #define hal_init_attr              ipipe_init_attr
00233 #define hal_register_domain        ipipe_register_domain
00234 #define hal_unregister_domain      ipipe_unregister_domain
00235 #define hal_catch_event            ipipe_catch_event
00236 #define hal_event_handler          ipipe_event_handler
00237 #define hal_event_handler_fun(e)   evhand[e]
00238 
00239 #define hal_set_printk_sync   ipipe_set_printk_sync
00240 #define hal_set_printk_async  ipipe_set_printk_async
00241 
00242 #define hal_schedule_back_root(prev) \
00243 do { \
00244     if ((prev)->rtai_tskext(HAL_ROOT_NPTDKEYS - 1)) { \
00245         ipipe_reenter_root((prev)->rtai_tskext(HAL_ROOT_NPTDKEYS - 1), (prev)->policy, (prev)->rt_priority); \
00246         (prev)->rtai_tskext(HAL_ROOT_NPTDKEYS - 1) = NULL; \
00247     } else { \
00248         ipipe_reenter_root(prev, (prev)->policy, (prev)->rt_priority); \
00249     } \
00250 } while (0)
00251 
00252 #define hal_processor_id  ipipe_processor_id
00253 
00254 #define hal_hw_cli                local_irq_disable_hw
00255 #define hal_hw_sti                local_irq_enable_hw
00256 #define hal_hw_local_irq_save     local_irq_save_hw
00257 #define hal_hw_local_irq_restore  local_irq_restore_hw
00258 #define hal_hw_local_irq_flags    local_save_flags_hw
00259 
00260 #define hal_set_timer(ns)  ipipe_tune_timer(ns, 0)
00261 #define hal_reset_timer()  ipipe_tune_timer(0, IPIPE_RESET_TIMER)
00262 
00263 #define hal_unstall_pipeline_from  ipipe_unstall_pipeline_from
00264 
00265 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
00266 #define hal_ack_system_irq  __ipipe_ack_system_irq
00267 #else
00268 #define hal_ack_system_irq  __ipipe_ack_apic
00269 #endif
00270 
00271 #define hal_irq_handler     ipipe_irq_handler
00272 
00273 #define hal_tskext  ptd
00274 
00275 #define hal_set_linux_task_priority  ipipe_setscheduler_root
00276 
00277 #endif
00278 
00279 #if defined(IPIPE_ROOT_NPTDKEYS) && TSKEXT0 < 0
00280 #error *** TSKEXTs WILL CAUSE MEMORY LEAKS, CHECK BOUNDS IN HAL PATCHES ***
00281 #endif
00282 
00283 #endif

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