Merge branch 'master' of git://git.ucc.asn.au/tpg/acess2
[tpg/acess2.git] / Tools / DiskTool / src / include / acess.h
index 8493078..7eff8c9 100644 (file)
@@ -18,6 +18,7 @@
 extern char    __buildnum[];
 #define BUILD_NUM      ((int)(Uint)&__buildnum)
 extern const char gsGitHash[];
+extern const char gsBuildInfo[];
 
 #define BITS   32
 #define NULL   ((void*)0)
@@ -48,12 +49,12 @@ typedef uint32_t    tGID;
 typedef uint32_t       tTID;
 
 // NOTE: Since this is single-threaded (for now) mutexes can be implimented as simple locks
-typedef char   tMutex;
 typedef char   tShortSpinlock;
 
 typedef int64_t        tTime;
 extern tTime   now(void);
 extern int64_t timestamp(int sec, int min, int hr, int day, int month, int year);
+extern void    format_date(tTime TS, int *year, int *month, int *day, int *hrs, int *mins, int *sec, int *ms);
 
 #define PACKED __attribute__((packed))
 #define DEPRECATED
@@ -82,6 +83,33 @@ extern tGID  Threads_GetGID(void);
 // Kinda hacky way of not colliding with native errno
 #define errno  (*(Threads_GetErrno()))
 
+/**
+ * \name Endianness Swapping
+ * \{
+ */
+#ifdef __BIG_ENDIAN__
+#define        LittleEndian16(_val)    SwapEndian16(_val)
+#define        LittleEndian32(_val)    SwapEndian32(_val)
+#define        LittleEndian64(_val)    SwapEndian32(_val)
+#define        BigEndian16(_val)       (_val)
+#define        BigEndian32(_val)       (_val)
+#define        BigEndian64(_val)       (_val)
+#else
+#define        LittleEndian16(_val)    (_val)
+#define        LittleEndian32(_val)    (_val)
+#define        LittleEndian64(_val)    (_val)
+#define        BigEndian16(_val)       SwapEndian16(_val)
+#define        BigEndian32(_val)       SwapEndian32(_val)
+#define        BigEndian64(_val)       SwapEndian64(_val)
+#endif
+extern Uint16  SwapEndian16(Uint16 Val);
+extern Uint32  SwapEndian32(Uint32 Val);
+extern Uint64  SwapEndian64(Uint64 Val);
+/**
+ * \}
+ */
+
+
 #include <string.h>
 extern int     strucmp(const char *s1, const char *s2);
 extern int     strpos(const char *Str, char Ch);
@@ -92,35 +120,19 @@ extern int ReadUTF8(const Uint8 *str, Uint32 *Val);
 extern int     WriteUTF8(Uint8 *str, Uint32 Val);
 #define CheckString(str)       (1)
 #define CheckMem(mem,sz)       (1)
+#include <ctype.h>
 
 // TODO: Move out?
 extern int     DivUp(int value, int divisor);
 extern uint64_t        DivMod64U(uint64_t Num, uint64_t Den, uint64_t *Rem);
 
-#if DEBUG
-# define ENTER(str, v...)      Log("%s:%i: ENTER "str, __func__, __LINE__)
-# define LOG(fmt, v...)        Log("%s:%i: "fmt, __func__, __LINE__, ##v)
-# define LEAVE(...)    do{}while(0)
-# define LEAVE_RET(t,v)        return v;
-#else
-# define ENTER(...)    do{}while(0)
-# define LOG(...)      do{}while(0)
-# define LEAVE(...)    do{}while(0)
-# define LEAVE_RET(t,v)        return v;
-#endif
-
-static inline int Mutex_Acquire(tMutex *m) {
-       if(*m)  Log_KernelPanic("---", "Double mutex lock");
-       *m = 1;
-       return 0;
-}
-static inline void Mutex_Release(tMutex *m) { *m = 0; }
-
 static inline void SHORTLOCK(tShortSpinlock *Lock) {
        if(*Lock)       Log_KernelPanic("---", "Double short lock");
        *Lock = 1;
 }
 static inline void SHORTREL(tShortSpinlock *m) { *m = 0; }
 
+static inline intptr_t MM_GetPhysAddr(void *Ptr) { return 1; }
+
 #endif
 

UCC git Repository :: git.ucc.asn.au