From 95b15971584cbfdad533411bcb8d8cec82e996fa Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Tue, 23 Jul 2013 02:12:52 +0200 Subject: removed POSIX, now having dedicated Linux and MAC OS-X ports --- include/gfx_rules.h | 4 +-- include/gos/gos.h | 6 ++-- include/gos/linux.h | 2 +- include/gos/options.h | 13 +++++-- include/gos/posix.h | 96 --------------------------------------------------- 5 files changed, 17 insertions(+), 104 deletions(-) delete mode 100644 include/gos/posix.h (limited to 'include') diff --git a/include/gfx_rules.h b/include/gfx_rules.h index c0f1e6d6..32a6ca87 100644 --- a/include/gfx_rules.h +++ b/include/gfx_rules.h @@ -26,14 +26,14 @@ #define GFX_DISPLAY_RULE_WARNINGS FALSE #endif -#if !GFX_USE_OS_CHIBIOS && !GFX_USE_OS_WIN32 && !GFX_USE_OS_POSIX +#if !GFX_USE_OS_CHIBIOS && !GFX_USE_OS_WIN32 && !GFX_USE_OS_LINUX && !GFX_USE_OS_OSX #if GFX_DISPLAY_RULE_WARNINGS #warning "GOS: No Operating System has been defined. ChibiOS (GFX_USE_OS_CHIBIOS) has been turned on for you." #endif #undef GFX_USE_OS_CHIBIOS #define GFX_USE_OS_CHIBIOS TRUE #endif -#if GFX_USE_OS_CHIBIOS + GFX_USE_OS_WIN32 + GFX_USE_OS_POSIX != 1 * TRUE +#if GFX_USE_OS_CHIBIOS + GFX_USE_OS_WIN32 + GFX_USE_OS_LINUX + GFX_USE_OS_OSX != 1 * TRUE #error "GOS: More than one operation system has been defined as TRUE." #endif diff --git a/include/gos/gos.h b/include/gos/gos.h index 32e0b654..cf143ded 100644 --- a/include/gos/gos.h +++ b/include/gos/gos.h @@ -431,8 +431,10 @@ #include "gos/chibios.h" #elif GFX_USE_OS_WIN32 #include "gos/win32.h" -#elif GFX_USE_OS_POSIX - #include "gos/posix.h" +#elif GFX_USE_OS_LINUX + #include "gos/linux.h" +#elif GFX_USE_OS_OSX + #include "gos/osx.h" #else #error "Your operating system is not supported yet" #endif diff --git a/include/gos/linux.h b/include/gos/linux.h index 6653c81c..8be737b3 100644 --- a/include/gos/linux.h +++ b/include/gos/linux.h @@ -7,7 +7,7 @@ /** * @file include/gos/linux.h - * @brief GOS - Operating System Support header file for POSIX. + * @brief GOS - Operating System Support header file for LINUX. */ #ifndef _GOS_LINUX_H diff --git a/include/gos/options.h b/include/gos/options.h index ac48e144..f1762134 100644 --- a/include/gos/options.h +++ b/include/gos/options.h @@ -35,11 +35,18 @@ #define GFX_USE_OS_WIN32 FALSE #endif /** - * @brief Use a unix variant with posix threads + * @brief Use a linux based system running X11 * @details Defaults to FALSE */ - #ifndef GFX_USE_OS_POSIX - #define GFX_USE_OS_POSIX FALSE + #ifndef GFX_USE_OS_LINUX + #define GFX_USE_OS_LINUX FALSE + #endif + /** + * @brief Use a Mac OS-X based system + * @details Defaults to FALSE + */ + #ifndef GFX_USE_OS_OSX + #define GFX_USE_OS_OSX FALSE #endif /** * @} diff --git a/include/gos/posix.h b/include/gos/posix.h deleted file mode 100644 index 2f344169..00000000 --- a/include/gos/posix.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * This file is subject to the terms of the GFX License. If a copy of - * the license was not distributed with this file, you can obtain one at: - * - * http://ugfx.org/license.html - */ - -/** - * @file include/gos/posix.h - * @brief GOS - Operating System Support header file for POSIX. - */ - -#ifndef _GOS_POSIX_H -#define _GOS_POSIX_H - -#if GFX_USE_OS_POSIX - -#include -#include -#include - -/* Already defined int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, size_t */ - -typedef int8_t bool_t; -typedef unsigned long systemticks_t; -typedef void * threadreturn_t; -typedef unsigned long delaytime_t; -typedef pthread_t gfxThreadHandle; -typedef int threadpriority_t; -typedef uint32_t semcount_t; -typedef pthread_mutex_t gfxMutex; - -#define DECLARE_THREAD_FUNCTION(fnName, param) threadreturn_t fnName(void *param) -#define DECLARE_THREAD_STACK(name, sz) uint8_t name[0]; - -#define gfxExit() exit(0) -#define gfxAlloc(sz) malloc(sz) -#define gfxRealloc(p,osz,nsz) realloc(p, nsz) -#define gfxFree(ptr) free(ptr) -#define gfxMillisecondsToTicks(ms) (ms) -#define gfxYield() pthread_yield() -#define gfxThreadMe() pthread_self() -#define gfxThreadClose(th) {} -#define gfxMutexInit(pmtx) pthread_mutex_init(pmtx, 0) -#define gfxMutexDestroy(pmtx) pthread_mutex_destroy(pmtx) -#define gfxMutexEnter(pmtx) pthread_mutex_lock(pmtx) -#define gfxMutexExit(pmtx) pthread_mutex_unlock(pmtx) -#define gfxSemSignalI(psem) gfxSemSignal(psem) -#define gfxSemCounterI(pSem) ((pSem)->cnt) - - -#define FALSE 0 -#define TRUE 1 -#define TIME_IMMEDIATE 0 -#define TIME_INFINITE ((delaytime_t)-1) -#define MAX_SEMAPHORE_COUNT ((semcount_t)-1) -#define LOW_PRIORITY 10 -#define NORMAL_PRIORITY 0 -#define HIGH_PRIORITY -10 - -typedef struct gfxSem { - pthread_mutex_t mtx; - pthread_cond_t cond; - semcount_t cnt; - semcount_t max; - } gfxSem; - -/*===========================================================================*/ -/* Function declarations. */ -/*===========================================================================*/ - -#ifdef __cplusplus -extern "C" { -#endif - -void gfxHalt(const char *msg); -void gfxSleepMilliseconds(delaytime_t ms); -void gfxSleepMicroseconds(delaytime_t ms); -systemticks_t gfxSystemTicks(void); -void gfxSystemLock(void); -void gfxSystemUnlock(void); -void gfxSemInit(gfxSem *psem, semcount_t val, semcount_t limit); -void gfxSemDestroy(gfxSem *psem); -bool_t gfxSemWait(gfxSem *psem, delaytime_t ms); -void gfxSemSignal(gfxSem *psem); -semcount_t gfxSemCounter(gfxSem *pSem); -gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param); -threadreturn_t gfxThreadWait(gfxThreadHandle thread); - -#ifdef __cplusplus -} -#endif - -#endif /* GFX_USE_OS_POSIX */ - -#endif /* _GOS_POSIX_H */ -- cgit v1.2.3