00001
00002
00011
00012
00013
00014
00015
00016
00017 #include <l4/lock/lock.h>
00018
00019 #include <l4/dde_linux/dde.h>
00020
00021
00022 #include <asm/system.h>
00023
00024
00025 #include <stdlib.h>
00026
00027
00028 #include "__config.h"
00029 #include "internal.h"
00030
00040 static l4lock_t irq_lock = L4LOCK_UNLOCKED_INITIALIZER;
00041
00046 void __global_cli()
00047 {
00048 if (!l4thread_equal(l4thread_myself(), l4lock_owner(&irq_lock)))
00049 l4lock_lock(&irq_lock);
00050 }
00051
00056 void __global_sti()
00057 {
00058 l4lock_unlock(&irq_lock);
00059 }
00060
00073 unsigned long __global_save_flags()
00074 {
00075 l4thread_t me = l4thread_myself();
00076
00077 return l4thread_equal(me, l4lock_owner(&irq_lock)) ? 1 : 0;
00078 }
00079
00087 void __global_restore_flags(unsigned long flags)
00088 {
00089 switch (flags)
00090 {
00091 case 0:
00092 __global_sti();
00093 break;
00094
00095 case 1:
00096 __global_cli();
00097 break;
00098 default:
00099 LOGd(DEBUG_MSG, "__global_restore_flags: unknown flags");
00100 }
00101 }
00102
00110 int get_option (char **str, int *pint)
00111 {
00112 char *cur = *str;
00113
00114 if (!cur || !(*cur))
00115 return 0;
00116 *pint = strtol (cur, str, 0);
00117 if (cur == *str)
00118 return 0;
00119 if (**str == ',')
00120 {
00121 (*str)++;
00122 return 2;
00123 }
00124
00125 return 1;
00126 }
00127
00131 char *get_options (char *str, int nints, int *ints)
00132 {
00133 int res, i = 1;
00134
00135 while (i < nints)
00136 {
00137 res = get_option(&str, ints + i);
00138 if (res == 0)
00139 break;
00140 i++;
00141 if (res == 1)
00142 break;
00143 }
00144 ints[0] = i - 1;
00145 return str;
00146 }
00147
00150 #include <linux/spinlock.h>
00151 spinlock_cacheline_t kernel_flag_cacheline = {SPIN_LOCK_UNLOCKED};
00152
00158 #include <asm/delay.h>
00159 void udelay(unsigned long usecs)
00160 {
00161 l4thread_usleep(usecs);
00162 }
00163
00166 int l4dde_driver_classes_init(void)
00167 {
00168 LOGd(DEBUG_MSG, "l4dde_driver_classes_init() should not be used with DDE2.4\n");
00169
00170 return 0;
00171 }