version 2.8
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  gfxSem
 A semaphore. More...
 
struct  gfxMutex
 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 (size_t sz)
 Allocate memory. More...
 
void * gfxRealloc (void *ptr, size_t oldsz, size_t newsz)
 Re-allocate memory. More...
 
void gfxFree (void *ptr)
 Free memory. More...
 
void gfxYield (void)
 Yield the current thread. More...
 
void gfxSleepMilliseconds (delaytime_t ms)
 Put the current thread to sleep for the specified period in milliseconds. More...
 
void gfxSleepMicroseconds (delaytime_t us)
 Put the current thread to sleep for the specified period in microseconds. More...
 
systemticks_t gfxSystemTicks (void)
 Get the current operating system tick time. More...
 
systemticks_t gfxMillisecondsToTicks (delaytime_t 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 (gfxMutex *pmutex)
 Initialise a mutex to protect a region of code from other threads. More...
 
void gfxMutexDestroy (gfxMutex *pmutex)
 Destroy a Mutex. More...
 
void gfxMutexEnter (gfxMutex *pmutex)
 Enter the critical code region protected by the mutex. More...
 
void gfxMutexExit (gfxMutex *pmutex)
 Exit the critical code region protected by the mutex. More...
 
void gfxSemInit (gfxSem *psem, semcount_t val, semcount_t limit)
 Initialise a Counted Semaphore. More...
 
void gfxSemDestroy (gfxSem *psem)
 Destroy a Counted Semaphore. More...
 
bool_t gfxSemWait (gfxSem *psem, delaytime_t ms)
 Wait on a semaphore. More...
 
bool_t gfxSemWaitI (gfxSem *psem)
 Test if a wait on a semaphore can be satisfied immediately. More...
 
void gfxSemSignal (gfxSem *psem)
 Signal a semaphore. More...
 
void gfxSemSignalI (gfxSem *psem)
 Signal a semaphore. More...
 
gfxThreadHandle gfxThreadCreate (void *stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION((*fn), p), void *param)
 Start a new thread. More...
 
threadreturn_t gfxThreadWait (gfxThreadHandle thread)
 Wait for a thread to finish. More...
 
gfxThreadHandle gfxThreadMe (void)
 Get the current thread handle. More...
 
void gfxThreadClose (gfxThreadHandle thread)
 Close the thread handle. More...
 

Macros

#define DECLARE_THREAD_FUNCTION(fnName, param)   threadreturn_t fnName(void *param)
 Declare a thread function. More...
 
#define DECLARE_THREAD_STACK(name, sz)   uint8_t name[sz];
 Declare a thread stack. More...
 
#define GFX_EMULATE_MALLOC   FALSE
 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 FALSE   0
 
#define TRUE   1
 
#define TIME_IMMEDIATE   0
 
#define TIME_INFINITE   ((delaytime_t)-1)
 
#define MAX_SEMAPHORE_COUNT   ((semcount_t)(((unsigned long)((semcount_t)(-1))) >> 1))
 
#define LOW_PRIORITY   0
 
#define NORMAL_PRIORITY   1
 
#define HIGH_PRIORITY   2
 

Typedefs

typedef void * gfxThreadHandle
 A thread handle. More...
 
Various integer sizes
Note
Your platform may use slightly different definitions to these
typedef unsigned char bool_t
 
typedef char int8_t
 
typedef unsigned char uint8_t
 
typedef short int16_t
 
typedef unsigned short uint16_t
 
typedef long int32_t
 
typedef unsigned long uint32_t
 
Various platform (and operating system) dependent types
Note
Your platform may use slightly different definitions to these
typedef unsigned long size_t
 
typedef unsigned long delaytime_t
 
typedef unsigned long systemticks_t
 
typedef short semcount_t
 
typedef int threadreturn_t
 
typedef int threadpriority_t