* the GNU General Public License.
*
* Copyright 2004, 2005 Develer S.r.l. (http://www.develer.com/)
- *
+ * Copyright 2008 Bernie Innocenti <bernie@codewiz.org>
* -->
*
* \brief OS-specific definitions
*
* \version $Id$
- *
- * \author Bernardo Innocenti <bernie@develer.com>
+ * \author Bernie Innocenti <bernie@codewiz.org>
*/
-#ifndef DEVLIB_OS_H
-#define DEVLIB_OS_H
-
-/** Macro to include OS-specific versions of the headers. */
-#define OS_HEADER(module) PP_STRINGIZE(PP_CAT3(module, _, OS_ID).h)
-#define OS_CSOURCE(module) PP_STRINGIZE(PP_CAT3(module, _, OS_ID).c)
+#ifndef CFG_OS_H
+#define CFG_OS_H
/*
* OS autodetection (Some systems trigger multiple OS definitions)
#define OS_ID win32
// FIXME: Maybe disable Win32 exceptions?
- typedef int cpuflags_t;
- #define IRQ_DISABLE /* FIXME */
- #define IRQ_ENABLE /* FIXME */
- #define IRQ_SAVE_DISABLE(old_sigs) /* FIXME */
- #define IRQ_RESTORE(old_sigs) /* FIXME */
+ typedef int cpu_flags_t;
+ #define IRQ_DISABLE FIXME
+ #define IRQ_ENABLE FIXME
+ #define IRQ_SAVE_DISABLE(old_sigs) FIXME
+ #define IRQ_RESTORE(old_sigs) FIXME
#else
#define OS_WIN32 0
* The POSIX moral equivalent of disabling IRQs is disabling signals.
*/
#include <signal.h>
- typedef sigset_t cpuflags_t;
+ typedef sigset_t cpu_flags_t;
#define SET_ALL_SIGNALS(sigs) \
do { \
#define IRQ_ENABLED() \
({ \
- sigset_t sigs; \
- sigprocmask(SIG_SETMASK, NULL, &sigs); \
- sigismember(&sigs, SIGALRM) ? false : true; \
+ sigset_t sigs__; \
+ sigprocmask(SIG_SETMASK, NULL, &sigs__); \
+ sigismember(&sigs__, SIGALRM) ? false : true; \
})
#else
#define OS_DARWIN 0
#endif
+
+#include <cfg/cfg_arch.h> /* For ARCH_QT */
+
/*
* We want Qt and other frameworks to look like OSes because you would
* tipically want their portable abstractions if you're using one of these.
*/
-#if defined(_QT)
+#if defined(_QT) || (defined(ARCH_QT) && (ARCH & ARCH_QT))
#define OS_QT 1
#undef OS_ID
#define OS_ID qt
#error Neither hosted nor embedded OS environment
#endif
-#endif /* DEVLIB_OS_H */
+#if OS_HOSTED
+
+ /// Macro to include OS-specific headers.
+ #define OS_HEADER(module) PP_STRINGIZE(emul/PP_CAT3(module, _, OS_ID).h)
+
+ /// Macro to include OS-specific source files.
+ #define OS_CSOURCE(module) PP_STRINGIZE(emul/PP_CAT3(module, _, OS_ID).c)
+
+#else
+ // Fallbacks for embedded systems
+ #define OS_HEADER(module) CPU_HEADER(module)
+ #define OS_CSOURCE(module) CPU_CSOURCE(module)
+#endif
+
+#endif /* CFG_OS_H */