00001
00002
00011
00012
00013
00014
00015
00016
00017 #include <l4/lock/lock.h>
00018 #include <l4/dde_linux/dde.h>
00019
00020
00021 #include <asm/system.h>
00022
00023
00024 #include "internal.h"
00025
00026 #include <stdlib.h>
00027
00037 static l4lock_t irq_lock = L4LOCK_UNLOCKED_INITIALIZER;
00038
00043 void __global_cli()
00044 {
00045 if (!l4thread_equal(l4thread_myself(), l4lock_owner(&irq_lock)))
00046 l4lock_lock(&irq_lock);
00047 }
00048
00053 void __global_sti()
00054 {
00055 l4lock_unlock(&irq_lock);
00056 }
00057
00070 unsigned long __global_save_flags()
00071 {
00072 l4thread_t me = l4thread_myself();
00073
00074 return l4thread_equal(me, l4lock_owner(&irq_lock)) ? 1 : 0;
00075 }
00076
00084 void __global_restore_flags(unsigned long flags)
00085 {
00086 switch (flags)
00087 {
00088 case 0:
00089 __global_sti();
00090 break;
00091
00092 case 1:
00093 __global_cli();
00094 break;
00095 default:
00096 LOGd(DEBUG_MSG, "__global_restore_flags: unknown flags");
00097 }
00098 }
00099
00107 int get_option (char **str, int *pint)
00108 {
00109 char *cur = *str;
00110
00111 if (!cur || !(*cur))
00112 return 0;
00113 *pint = strtol (cur, str, 0);
00114 if (cur == *str)
00115 return 0;
00116 if (**str == ',')
00117 {
00118 (*str)++;
00119 return 2;
00120 }
00121
00122 return 1;
00123 }
00124
00128 char *get_options (char *str, int nints, int *ints)
00129 {
00130 int res, i = 1;
00131
00132 while (i < nints)
00133 {
00134 res = get_option(&str, ints + i);
00135 if (res == 0)
00136 break;
00137 i++;
00138 if (res == 1)
00139 break;
00140 }
00141 ints[0] = i - 1;
00142 return str;
00143 }
00144
00147 #include <linux/spinlock.h>
00148 spinlock_cacheline_t kernel_flag_cacheline = {SPIN_LOCK_UNLOCKED};
00149
00155 #include <asm/delay.h>
00156 void udelay(unsigned long usecs)
00157 {
00158 l4thread_usleep(usecs);
00159 }
00160
00163 int l4dde_driver_classes_init(void)
00164 {
00165 LOGd(DEBUG_MSG, "l4dde_driver_classes_init() should not be used with DDE2.4\n");
00166
00167 return 0;
00168 }
00169
00170 #include <linux/reboot.h>
00172 int register_reboot_notifier(struct notifier_block *arg0)
00173 {
00174 #if DEBUG_MSG
00175 LOG_Enter();
00176 #endif
00177 return 0;
00178 }
00179
00181 int unregister_reboot_notifier(struct notifier_block *arg0)
00182 {
00183 #if DEBUG_MSG
00184 LOG_Enter();
00185 #endif
00186 return 0;
00187 }
00188
00189