µGFX  2.9
version 2.9
gos_qt.h
1 /*
2  * This file is subject to the terms of the GFX License. If a copy of
3  * the license was not distributed with this file, you can obtain one at:
4  *
5  * http://ugfx.io/license.html
6  */
7 
8 #ifndef _GOS_QT_H
9 #define _GOS_QT_H
10 
11 #if GFX_USE_OS_QT
12 
13 #define GFX_THREAD_FUNCTION(fnName, param) gThreadreturn fnName(void *param)
14 #define GFX_THREAD_STACK(name, sz) gU8 name[0]
15 #define gfxThreadReturn(retval) return retval
16 
17 #define gDelayNone 0
18 #define gDelayForever ((gDelay)-1)
19 #define gSemMaxCount ((gSemcount)(((unsigned long)((gSemcount)(-1))) >> 1))
20 #define gThreadpriorityLow 2
21 #define gThreadpriorityNormal 3
22 #define gThreadpriorityHigh 4
23 
24 typedef int gTicks;
25 typedef int gDelay;
26 typedef void* gMutex;
27 typedef void* gSem;
28 typedef int gSemcount;
29 typedef int gThreadreturn;
30 typedef int gThreadpriority;
31 typedef void* gThread;
32 
33 void _gosInit();
34 void _gosDeinit();
35 
36 void gfxHalt(const char* msg);
37 void gfxExit(void);
38 void* gfxAlloc(gMemSize sz);
39 void* gfxRealloc(void *ptr, gMemSize oldsz, gMemSize newsz);
40 void gfxFree(void* ptr);
41 void gfxYield(void);
42 void gfxSleepMilliseconds(gDelay ms);
43 void gfxSleepMicroseconds(gDelay us);
44 gTicks gfxSystemTicks(void);
45 gTicks gfxMillisecondsToTicks(gDelay ms);
46 void gfxSystemLock(void);
47 void gfxSystemUnlock(void);
48 void gfxMutexInit(gMutex *pmutex);
49 void gfxMutexDestroy(gMutex *pmutex);
50 void gfxMutexEnter(gMutex *pmutex);
51 void gfxMutexExit(gMutex *pmutex);
52 void gfxSemInit(gSem *psem, gSemcount val, gSemcount limit);
53 void gfxSemDestroy(gSem *psem);
54 gBool gfxSemWait(gSem *psem, gDelay ms);
55 gBool gfxSemWaitI(gSem *psem);
56 void gfxSemSignal(gSem *psem);
57 void gfxSemSignalI(gSem *psem);
58 gThread gfxThreadCreate(void *stackarea, gMemSize stacksz, gThreadpriority prio, GFX_THREAD_FUNCTION((*fn),p), void *param);
59 gThreadreturn gfxThreadWait(gThread thread);
60 gThread gfxThreadMe(void);
61 void gfxThreadClose(gThread thread);
62 
63 #endif /* GFX_USE_OS_QT */
64 #endif /* _GOS_QT_H */
gThreadreturn gfxThreadWait(gThread thread)
Wait for a thread to finish.
void gfxSemSignal(gSem *psem)
Signal a semaphore.
void * gThread
A thread handle.
Definition: gos.h:116
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.
Definition: gos.h:73
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.
A mutex.
Definition: gos.h:110
A semaphore.
Definition: gos.h:104