00001 /* atomic.h */ 00002 00003 #include <routix/system.h> 00004 00005 typedef volatile int spinlock_t; 00006 00007 int TestAndSet(spinlock_t *); 00008 00009 void spin_lock (spinlock_t *); 00010 void spin_unlock (spinlock_t *); 00011 00012 // Operaciones basicas atomizadas 00013 inline int atomic_inc (int *p); // Incremento 00014 inline int atomic_dec (int *p); // Decremento 00015 inline int atomic_asign (int *p, int x); // Asignacion 00016 inline int atomic_add (int *p, int x); // Suma 00017 inline int atomic_sub (int *p, int x); // Resta 00018 00019 00020 // Macros 00021 #define START_ATOMIC_OPERATION cli() 00022 #define FINISH_ATOMIC_OPERATION sti() 00023