µGFX  2.9
version 2.9
gos.h File Reference

Detailed Description

GOS - Operating System Support header file.

Definition in file gos.h.

Go to the source code of this file.

Data Structures

struct  gSem
 A semaphore. More...
 
struct  gMutex
 A mutex. More...
 

Functions

void gfxHalt (const char *msg)
 Halt the GFX application due to an error. More...
 
void gfxExit (void)
 Exit the GFX application. More...
 
void * gfxAlloc (gMemSize sz)
 Allocate memory. More...
 
void * gfxRealloc (void *ptr, gMemSize oldsz, gMemSize newsz)
 Re-allocate memory. More...
 
void gfxFree (void *ptr)
 Free memory. More...
 
void gfxYield (void)
 Yield the current thread. More...
 
void gfxSleepMilliseconds (gDelay ms)
 Put the current thread to sleep for the specified period in milliseconds. More...
 
void gfxSleepMicroseconds (gDelay us)
 Put the current thread to sleep for the specified period in microseconds. More...
 
gTicks gfxSystemTicks (void)
 Get the current operating system tick time. More...
 
gTicks gfxMillisecondsToTicks (gDelay ms)
 Convert a given number of millseconds to a number of operating system ticks. More...
 
void gfxSystemLock (void)
 Lock the operating system to protect a sequence of code. More...
 
void gfxSystemUnlock (void)
 Unlock the operating system previous locked by gfxSystemLock() More...
 
void gfxMutexInit (gMutex *pmutex)
 Initialise a mutex to protect a region of code from other threads. More...
 
void gfxMutexDestroy (gMutex *pmutex)
 Destroy a Mutex. More...
 
void gfxMutexEnter (gMutex *pmutex)
 Enter the critical code region protected by the mutex. More...
 
void gfxMutexExit (gMutex *pmutex)
 Exit the critical code region protected by the mutex. More...
 
void gfxSemInit (gSem *psem, gSemcount val, gSemcount limit)
 Initialise a Counted Semaphore. More...
 
void gfxSemDestroy (gSem *psem)
 Destroy a Counted Semaphore. More...
 
gBool gfxSemWait (gSem *psem, gDelay ms)
 Wait on a semaphore. More...
 
gBool gfxSemWaitI (gSem *psem)
 Test if a wait on a semaphore can be satisfied immediately. More...
 
void gfxSemSignal (gSem *psem)
 Signal a semaphore. More...
 
void gfxSemSignalI (gSem *psem)
 Signal a semaphore. More...
 
gThread gfxThreadCreate (void *stackarea, gMemSize stacksz, gThreadpriority prio, GFX_THREAD_FUNCTION((*fn), p), void *param)
 Start a new thread. More...
 
gThreadreturn gfxThreadWait (gThread thread)
 Wait for a thread to finish. More...
 
gThread gfxThreadMe (void)
 Get the current thread handle. More...
 
void gfxThreadClose (gThread thread)
 Close the thread handle. More...
 

Macros

#define GFX_THREAD_FUNCTION(fnName, param)   gThreadreturn fnName(void *param)
 Declare a thread function. More...
 
#define GFX_THREAD_STACK(name, sz)   gU8 name[sz];
 Declare a thread stack. More...
 
#define GFX_EMULATE_MALLOC   GFXOFF
 Use gfxAlloc and gfxFree to implement malloc() and free() More...
 
Various platform (and operating system) constants
Note
Your platform may use slightly different definitions to these
#define gDelayNone   0
 
#define gDelayForever   ((gDelay)-1)
 
#define gSemMaxCount   ((gSemcount)(((unsigned long)((gSemcount)(-1))) >> 1))
 
#define gThreadpriorityLow   0
 
#define gThreadpriorityNormal   1
 
#define gThreadpriorityHigh   2
 

Typedefs

typedef void * gThread
 A thread handle. More...
 
Various integer sizes
Note
Your platform may define these differently to these.
These sizes are guaranteed minimum sizes for the type. It might actually be larger. eg gI8 may actually be 9 bits.
typedef unsigned char gBool
 
typedef signed char gI8
 
typedef unsigned char gU8
 
typedef short gI16
 
typedef unsigned short gU16
 
typedef long gI32
 
typedef unsigned long gU32
 
More integer sizes
Precondition
These are only available if GFX_TYPE_64 is GFXON as not all compilers support 64 bit.
Note
GFX_TYPE_64 is set to GFXON or GFXOFF by the compiler detector. It is not a user configuration macro.
typedef long long gI64
 
typedef unsigned long long gU64
 
Various platform (and operating system) dependent types
Note
Your platform may use slightly different definitions to these
typedef unsigned long gDelay
 
typedef unsigned long gTicks
 
typedef short gSemcount
 
typedef int gThreadreturn
 
typedef int gThreadpriority