aboutsummaryrefslogtreecommitdiffstats
path: root/src/gos/gos_qt.h
blob: d9836e7d9de5f2be15f7dab1ed9bea16c7aec760 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
 * 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
 */

#ifndef _GOS_QT_H
#define _GOS_QT_H

#if GFX_USE_OS_QT

#define DECLARE_THREAD_FUNCTION(fnName, param)	gThreadreturn fnName(void *param)
#define DECLARE_THREAD_STACK(name, sz)          uint8_t name[0]
#define THREAD_RETURN(retval)					return retval

#define gDelayNone					0
#define gDelayForever				((gDelay)-1)
#define MAX_SEMAPHORE_COUNT			((gSemcount)(((unsigned long)((gSemcount)(-1))) >> 1))
#define gThreadpriorityLow				2
#define gThreadpriorityNormal				3
#define gThreadpriorityHigh				4

typedef int gTicks;
typedef int gDelay;
typedef void* gfxMutex;
typedef void* gfxSem;
typedef int gSemcount;
typedef int gThreadreturn;
typedef int gThreadpriority;
typedef void* gThread;

void _gosInit();
void _gosDeinit();

void gfxHalt(const char* msg);
void gfxExit(void);
void* gfxAlloc(size_t sz);
void* gfxRealloc(void *ptr, size_t oldsz, size_t newsz);
void gfxFree(void* ptr);
void gfxYield(void);
void gfxSleepMilliseconds(gDelay ms);
void gfxSleepMicroseconds(gDelay us);
gTicks gfxSystemTicks(void);
gTicks gfxMillisecondsToTicks(gDelay ms);
void gfxSystemLock(void);
void gfxSystemUnlock(void);
void gfxMutexInit(gfxMutex *pmutex);
void gfxMutexDestroy(gfxMutex *pmutex);
void gfxMutexEnter(gfxMutex *pmutex);
void gfxMutexExit(gfxMutex *pmutex);
void gfxSemInit(gfxSem *psem, gSemcount val, gSemcount limit);
void gfxSemDestroy(gfxSem *psem);
gBool gfxSemWait(gfxSem *psem, gDelay ms);
gBool gfxSemWaitI(gfxSem *psem);
void gfxSemSignal(gfxSem *psem);
void gfxSemSignalI(gfxSem *psem);
gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
gThreadreturn gfxThreadWait(gThread thread);
gThread gfxThreadMe(void);
void gfxThreadClose(gThread thread);

#endif /* GFX_USE_OS_QT */
#endif /* _GOS_QT_H */