feat: twifs - pseudo file system for lunaix kernel state exposure
[lunaix-os.git] / lunaix-os / includes / lunaix / spike.h
index 6f91924dc19a174d280cb3bb7c98905f8cd91837..8297f0e9af5ffc9a9308f1985093b6fea80d8825 100644 (file)
@@ -17,6 +17,9 @@
 // 获取v最近的最小k倍数
 #define ROUNDDOWN(v, k) ((v) & ~((k)-1))
 
+#define MIN(a, b) ((a) < (b) ? (a) : (b))
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
+
 #define __USER__ __attribute__((section(".usrtext")))
 
 inline static void
@@ -57,7 +60,7 @@ panick(const char* msg);
 #define wait_until_expire(cond, max)                                           \
     ({                                                                         \
         unsigned int __wcounter__ = (max);                                     \
-        while (!(cond) && __wcounter__-- > 0)                                  \
+        while (!(cond) && __wcounter__-- > 1)                                  \
             ;                                                                  \
         __wcounter__;                                                          \
     })