24 #if defined(__DOXYGEN__)
36 typedef unsigned char gBool;
37 typedef signed char gI8;
38 typedef unsigned char gU8;
40 typedef unsigned short gU16;
42 typedef unsigned long gU32;
51 typedef long long gI64;
52 typedef unsigned long long gU64;
60 typedef unsigned long gDelay;
61 typedef unsigned long gTicks;
62 typedef short gSemcount;
63 typedef int gThreadreturn;
64 typedef int gThreadpriority;
73 #define GFX_THREAD_FUNCTION(fnName, param) gThreadreturn fnName(void *param)
85 #define GFX_THREAD_STACK(name, sz) gU8 name[sz];
93 #define gDelayForever ((gDelay)-1)
94 #define gSemMaxCount ((gSemcount)(((unsigned long)((gSemcount)(-1))) >> 1))
95 #define gThreadpriorityLow 0
96 #define gThreadpriorityNormal 1
97 #define gThreadpriorityHigh 2
190 #ifndef GFX_EMULATE_MALLOC
191 #define GFX_EMULATE_MALLOC GFXOFF
455 #define gfxThreadReturn(retval) return retval
461 #elif GFX_USE_OS_RAWRTOS
462 #include "gos_rawrtos.h"
463 #elif GFX_USE_OS_CHIBIOS
464 #include "gos_chibios.h"
465 #elif GFX_USE_OS_FREERTOS
467 #elif GFX_USE_OS_WIN32
469 #elif GFX_USE_OS_LINUX
470 #include "gos_linux.h"
473 #elif GFX_USE_OS_RAW32
474 #include "gos_raw32.h"
475 #elif GFX_USE_OS_ECOS
476 #include "gos_ecos.h"
477 #elif GFX_USE_OS_ARDUINO
478 #include "gos_arduino.h"
479 #elif GFX_USE_OS_CMSIS
481 #elif GFX_USE_OS_CMSIS2
483 #elif GFX_USE_OS_KEIL
485 #elif GFX_USE_OS_RTX5
487 #elif GFX_USE_OS_NIOS
488 #include "gos_nios.h"
489 #elif GFX_USE_OS_ZEPHYR
494 #error "Your operating system is not supported yet"
498 typedef gDelay delaytime_t;
499 #if !GFX_USE_OS_CHIBIOS
501 #define TIME_IMMEDIATE gDelayNone
502 #define TIME_INFINITE gDelayForever
504 typedef gTicks systemticks_t;
505 typedef gThread gfxThreadHandle;
506 #define DECLARE_THREAD_FUNCTION GFX_THREAD_FUNCTION
507 #define DECLARE_THREAD_STACK GFX_THREAD_STACK
508 typedef gThreadreturn threadreturn_t;
509 #define THREAD_RETURN gfxThreadReturn
510 typedef gThreadpriority threadpriority_t;
511 #define LOW_PRIORITY gThreadpriorityLow
512 #define NORMAL_PRIORITY gThreadpriorityNormal
513 #define HIGH_PRIORITY gThreadpriorityHigh
515 #define MAX_SEMAPHORE_COUNT gSemMaxCount
GOS - Operating System Support header file for CMSIS 2.0 RTOS.
GOS - Operating System Support header file for CMSIS RTOS.
GOS - Operating System Support header file for FreeRTOS.
GOS - Operating System Support header file for Keil RTX.
GOS - Operating System Support header file for Keil RTX.
GOS - Operating System Support header file for WIN32.
GOS - Operating System Support header file for Zephyr RTOS. Zephyr SDK 0.9.1.
gThreadreturn gfxThreadWait(gThread thread)
Wait for a thread to finish.
void gfxSemSignal(gSem *psem)
Signal a semaphore.
void * gThread
A thread handle.
gTicks gfxSystemTicks(void)
Get the current operating system tick time.
void gfxYield(void)
Yield the current thread.
#define GFX_THREAD_FUNCTION(fnName, param)
Declare a thread function.
void gfxMutexExit(gMutex *pmutex)
Exit the critical code region protected by the mutex.
gTicks gfxMillisecondsToTicks(gDelay ms)
Convert a given number of millseconds to a number of operating system ticks.
gBool gfxSemWait(gSem *psem, gDelay ms)
Wait on a semaphore.
void gfxExit(void)
Exit the GFX application.
void gfxSystemUnlock(void)
Unlock the operating system previous locked by gfxSystemLock()
void gfxSleepMicroseconds(gDelay us)
Put the current thread to sleep for the specified period in microseconds.
void gfxMutexEnter(gMutex *pmutex)
Enter the critical code region protected by the mutex.
gThread gfxThreadMe(void)
Get the current thread handle.
void * gfxAlloc(gMemSize sz)
Allocate memory.
void gfxSystemLock(void)
Lock the operating system to protect a sequence of code.
void gfxMutexInit(gMutex *pmutex)
Initialise a mutex to protect a region of code from other threads.
gThread gfxThreadCreate(void *stackarea, gMemSize stacksz, gThreadpriority prio, GFX_THREAD_FUNCTION((*fn), p), void *param)
Start a new thread.
gBool gfxSemWaitI(gSem *psem)
Test if a wait on a semaphore can be satisfied immediately.
void gfxHalt(const char *msg)
Halt the GFX application due to an error.
void gfxSemDestroy(gSem *psem)
Destroy a Counted Semaphore.
void gfxSemInit(gSem *psem, gSemcount val, gSemcount limit)
Initialise a Counted Semaphore.
void * gfxRealloc(void *ptr, gMemSize oldsz, gMemSize newsz)
Re-allocate memory.
void gfxMutexDestroy(gMutex *pmutex)
Destroy a Mutex.
void gfxFree(void *ptr)
Free memory.
void gfxSemSignalI(gSem *psem)
Signal a semaphore.
void gfxSleepMilliseconds(gDelay ms)
Put the current thread to sleep for the specified period in milliseconds.
void gfxThreadClose(gThread thread)
Close the thread handle.