aboutsummaryrefslogtreecommitdiffstats
path: root/src/gos
diff options
context:
space:
mode:
authorinmarket <andrewh@inmarket.com.au>2018-11-03 10:51:23 +1000
committerinmarket <andrewh@inmarket.com.au>2018-11-03 10:51:23 +1000
commit7c5a6c928fa7129cf754c9c73c5c7ae39372ba9d (patch)
tree95cf152ef65ff19c7b2515b427bbe86b92b611d0 /src/gos
parent8bd70d953bcd3e32ceb4e45a4e561c973726280a (diff)
downloaduGFX-7c5a6c928fa7129cf754c9c73c5c7ae39372ba9d.tar.gz
uGFX-7c5a6c928fa7129cf754c9c73c5c7ae39372ba9d.tar.bz2
uGFX-7c5a6c928fa7129cf754c9c73c5c7ae39372ba9d.zip
For all source files update integer types to the new gI8 etc type names
Diffstat (limited to 'src/gos')
-rw-r--r--src/gos/gos.h8
-rw-r--r--src/gos/gos_arduino.c4
-rw-r--r--src/gos/gos_chibios.c4
-rw-r--r--src/gos/gos_chibios.h4
-rw-r--r--src/gos/gos_cmsis.c2
-rw-r--r--src/gos/gos_cmsis.h14
-rw-r--r--src/gos/gos_cmsis2.c2
-rw-r--r--src/gos/gos_cmsis2.h10
-rw-r--r--src/gos/gos_ecos.c2
-rw-r--r--src/gos/gos_ecos.h2
-rw-r--r--src/gos/gos_freertos.c4
-rw-r--r--src/gos/gos_freertos.h10
-rw-r--r--src/gos/gos_linux.c2
-rw-r--r--src/gos/gos_linux.h6
-rw-r--r--src/gos/gos_nios.c4
-rw-r--r--src/gos/gos_options.h15
-rw-r--r--src/gos/gos_osx.c2
-rw-r--r--src/gos/gos_osx.h6
-rw-r--r--src/gos/gos_qt.cpp10
-rw-r--r--src/gos/gos_qt.h8
-rw-r--r--src/gos/gos_raw32.c4
-rw-r--r--src/gos/gos_rawrtos.c2
-rw-r--r--src/gos/gos_rawrtos.h8
-rw-r--r--src/gos/gos_win32.c2
-rw-r--r--src/gos/gos_win32.h4
-rw-r--r--src/gos/gos_x_heap.c14
-rw-r--r--src/gos/gos_x_heap.h6
-rw-r--r--src/gos/gos_x_threads.c24
-rw-r--r--src/gos/gos_x_threads.h10
29 files changed, 104 insertions, 89 deletions
diff --git a/src/gos/gos.h b/src/gos/gos.h
index d01bc070..a41712ce 100644
--- a/src/gos/gos.h
+++ b/src/gos/gos.h
@@ -82,7 +82,7 @@
* Many platforms will round the size to ensure correct stack alignment.
* Other platforms may entirely ignore the suggested size.
*/
- #define DECLARE_THREAD_STACK(name, sz) uint8_t name[sz];
+ #define DECLARE_THREAD_STACK(name, sz) gU8 name[sz];
/*
* @brief Return from a thread
@@ -153,7 +153,7 @@
*
* @api
*/
- void *gfxAlloc(size_t sz);
+ void *gfxAlloc(gMemSize sz);
/**
* @brief Re-allocate memory
@@ -173,7 +173,7 @@
*
* @api
*/
- void *gfxRealloc(void *ptr, size_t oldsz, size_t newsz);
+ void *gfxRealloc(void *ptr, gMemSize oldsz, gMemSize newsz);
/**
* @brief Free memory
@@ -420,7 +420,7 @@
*
* @api
*/
- gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
+ gThread gfxThreadCreate(void *stackarea, gMemSize stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
/**
* @brief Wait for a thread to finish.
diff --git a/src/gos/gos_arduino.c b/src/gos/gos_arduino.c
index 09241a28..30e731f1 100644
--- a/src/gos/gos_arduino.c
+++ b/src/gos/gos_arduino.c
@@ -53,7 +53,7 @@ void _gosDeinit(void)
*********************************************************/
void gfxHalt(const char *msg) {
- volatile uint32_t dummy;
+ volatile gU32 dummy;
(void) msg;
while(1)
@@ -61,7 +61,7 @@ void gfxHalt(const char *msg) {
}
void gfxExit(void) {
- volatile uint32_t dummy;
+ volatile gU32 dummy;
while(1)
dummy++;
diff --git a/src/gos/gos_chibios.c b/src/gos/gos_chibios.c
index d393251a..be7cd935 100644
--- a/src/gos/gos_chibios.c
+++ b/src/gos/gos_chibios.c
@@ -64,7 +64,7 @@ void _gosDeinit(void)
/* ToDo */
}
-void *gfxRealloc(void *ptr, size_t oldsz, size_t newsz)
+void *gfxRealloc(void *ptr, gMemSize oldsz, gMemSize newsz)
{
void *np;
@@ -175,7 +175,7 @@ void gfxSemSignalI(gfxSem *psem)
#endif
}
-gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param)
+gThread gfxThreadCreate(void *stackarea, gMemSize stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param)
{
if (!stackarea) {
if (!stacksz) stacksz = 256;
diff --git a/src/gos/gos_chibios.h b/src/gos/gos_chibios.h
index 497c6776..5dfcad07 100644
--- a/src/gos/gos_chibios.h
+++ b/src/gos/gos_chibios.h
@@ -101,7 +101,7 @@ typedef tprio_t gThreadpriority;
#define gfxSystemUnlock() chSysUnlock()
#define gfxMutexDestroy(pmutex) (void)pmutex
#define gfxMutexEnter(pmutex) chMtxLock(pmutex)
-void *gfxRealloc(void *ptr, size_t oldsz, size_t newsz);
+void *gfxRealloc(void *ptr, gMemSize oldsz, gMemSize newsz);
void gfxSleepMilliseconds(gDelay ms);
void gfxSleepMicroseconds(gDelay ms);
void gfxSemInit(gfxSem *psem, gSemcount val, gSemcount limit);
@@ -110,7 +110,7 @@ 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);
+gThread gfxThreadCreate(void *stackarea, gMemSize stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
#define gfxThreadWait(thread) chThdWait(thread)
#define gfxThreadMe() chThdSelf()
#define gfxThreadClose(thread) (void)thread
diff --git a/src/gos/gos_cmsis.c b/src/gos/gos_cmsis.c
index 2dcb0d19..4ab652e0 100644
--- a/src/gos/gos_cmsis.c
+++ b/src/gos/gos_cmsis.c
@@ -88,7 +88,7 @@ void gfxSemSignalI(gfxSem* psem)
}
}
-gThread gfxThreadCreate(void* stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void* param)
+gThread gfxThreadCreate(void* stackarea, gMemSize stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void* param)
{
osThreadDef_t def;
diff --git a/src/gos/gos_cmsis.h b/src/gos/gos_cmsis.h
index 17b8c295..3c1c8a73 100644
--- a/src/gos/gos_cmsis.h
+++ b/src/gos/gos_cmsis.h
@@ -27,9 +27,9 @@
#define gDelayNone 0
#define gDelayForever osWaitForever
-typedef uint32_t gDelay;
-typedef uint32_t gTicks;
-typedef uint16_t gSemcount;
+typedef gU32 gDelay;
+typedef gU32 gTicks;
+typedef gU16 gSemcount;
typedef void gThreadreturn;
typedef osPriority gThreadpriority;
@@ -39,19 +39,19 @@ typedef osPriority gThreadpriority;
#define gThreadpriorityHigh osPriorityHigh
typedef struct gfxSem {
- uint32_t semaphore[2];
+ gU32 semaphore[2];
osSemaphoreId id;
gSemcount available;
} gfxSem;
typedef struct gfxMutex {
- uint32_t mutex[4];
+ gU32 mutex[4];
osMutexId id;
} gfxMutex;
typedef osThreadId gThread;
-#define DECLARE_THREAD_STACK(name, sz) uint8_t name[1]; // Some compilers don't allow zero sized arrays. Let's waste one byte
+#define DECLARE_THREAD_STACK(name, sz) gU8 name[1]; // Some compilers don't allow zero sized arrays. Let's waste one byte
#define DECLARE_THREAD_FUNCTION(fnName, param) gThreadreturn fnName(void* param)
#define THREAD_RETURN(retval)
@@ -79,7 +79,7 @@ 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);
+gThread gfxThreadCreate(void* stackarea, gMemSize stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void* param);
#define gfxYield() osThreadYield()
#define gfxThreadMe() osThreadGetId()
#define gfxThreadClose(thread) {}
diff --git a/src/gos/gos_cmsis2.c b/src/gos/gos_cmsis2.c
index b1dd1dd6..9bc5e112 100644
--- a/src/gos/gos_cmsis2.c
+++ b/src/gos/gos_cmsis2.c
@@ -76,7 +76,7 @@ gBool gfxSemWait(gfxSem* psem, gDelay ms)
return gFalse;
}
-gThread gfxThreadCreate(void* stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void* param)
+gThread gfxThreadCreate(void* stackarea, gMemSize stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void* param)
{
osThreadAttr_t def;
diff --git a/src/gos/gos_cmsis2.h b/src/gos/gos_cmsis2.h
index fd702027..e45dd91f 100644
--- a/src/gos/gos_cmsis2.h
+++ b/src/gos/gos_cmsis2.h
@@ -27,9 +27,9 @@
#define gDelayNone 0
#define gDelayForever osWaitForever
-typedef uint32_t gDelay;
-typedef uint32_t gTicks;
-typedef uint16_t gSemcount;
+typedef gU32 gDelay;
+typedef gU32 gTicks;
+typedef gU16 gSemcount;
typedef void gThreadreturn;
typedef osPriority_t gThreadpriority;
@@ -44,7 +44,7 @@ typedef osMutexId_t gfxMutex;
typedef osThreadId_t gThread;
-#define DECLARE_THREAD_STACK(name, sz) uint8_t name[1]; // Some compilers don't allow zero sized arrays. Let's waste one byte
+#define DECLARE_THREAD_STACK(name, sz) gU8 name[1]; // Some compilers don't allow zero sized arrays. Let's waste one byte
#define DECLARE_THREAD_FUNCTION(fnName, param) gThreadreturn fnName(void* param)
#define THREAD_RETURN(retval)
@@ -72,7 +72,7 @@ gBool gfxSemWait(gfxSem* psem, gDelay ms);
#define gfxSemSignal(psem) osSemaphoreRelease(*(psem))
#define gfxSemSignalI(psem) osSemaphoreRelease(*(psem))
-gThread gfxThreadCreate(void* stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void* param);
+gThread gfxThreadCreate(void* stackarea, gMemSize stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void* param);
#define gfxYield() osThreadYield()
#define gfxThreadMe() osThreadGetId()
#define gfxThreadClose(thread) {}
diff --git a/src/gos/gos_ecos.c b/src/gos/gos_ecos.c
index 1842acda..bbd4f87c 100644
--- a/src/gos/gos_ecos.c
+++ b/src/gos/gos_ecos.c
@@ -96,7 +96,7 @@ void gfxSemSignalI(gfxSem *psem)
cyg_semaphore_post(&psem->sem);
}
-gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param)
+gThread gfxThreadCreate(void *stackarea, gMemSize stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param)
{
gThread th;
diff --git a/src/gos/gos_ecos.h b/src/gos/gos_ecos.h
index e529e88e..7971be8d 100644
--- a/src/gos/gos_ecos.h
+++ b/src/gos/gos_ecos.h
@@ -77,7 +77,7 @@ 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);
+gThread gfxThreadCreate(void *stackarea, gMemSize stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
#define gfxThreadWait(thread) NOTIMPLEMENTED_YET
#define gfxThreadMe() cyg_thread_self()
#define gfxThreadClose(thread) (void)thread
diff --git a/src/gos/gos_freertos.c b/src/gos/gos_freertos.c
index fee852c9..7680cd4c 100644
--- a/src/gos/gos_freertos.c
+++ b/src/gos/gos_freertos.c
@@ -66,7 +66,7 @@ void _gosDeinit(void)
#endif
}
-void* gfxRealloc(void *ptr, size_t oldsz, size_t newsz)
+void* gfxRealloc(void *ptr, gMemSize oldsz, gMemSize newsz)
{
void *np;
@@ -146,7 +146,7 @@ void gfxSemSignalI(gfxSem* psem)
xSemaphoreGiveFromISR(*psem,&xHigherPriorityTaskWoken);
}
-gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param)
+gThread gfxThreadCreate(void *stackarea, gMemSize stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param)
{
gThread task;
(void) stackarea;
diff --git a/src/gos/gos_freertos.h b/src/gos/gos_freertos.h
index 1a2e6f99..37711b93 100644
--- a/src/gos/gos_freertos.h
+++ b/src/gos/gos_freertos.h
@@ -26,9 +26,9 @@
#define gDelayNone 0
#define gDelayForever ((gDelay)-1)
-typedef uint32_t gDelay;
+typedef gU32 gDelay;
typedef portTickType gTicks;
-typedef int32_t gSemcount;
+typedef gI32 gSemcount;
typedef void gThreadreturn;
typedef portBASE_TYPE gThreadpriority;
@@ -38,7 +38,7 @@ typedef portBASE_TYPE gThreadpriority;
#define gThreadpriorityHigh configMAX_PRIORITIES-1
/* FreeRTOS will allocate the stack when creating the thread */
-#define DECLARE_THREAD_STACK(name, sz) uint8_t name[1]
+#define DECLARE_THREAD_STACK(name, sz) gU8 name[1]
#define DECLARE_THREAD_FUNCTION(fnName, param) gThreadreturn fnName(void *param)
#define THREAD_RETURN(retval)
@@ -65,7 +65,7 @@ void gfxMutexInit(gfxMutex* s);
#define gfxMutexEnter(pmutex) xSemaphoreTake(*(pmutex),portMAX_DELAY)
#define gfxMutexExit(pmutex) xSemaphoreGive(*(pmutex))
-void *gfxRealloc(void *ptr, size_t oldsz, size_t newsz);
+void *gfxRealloc(void *ptr, gMemSize oldsz, gMemSize newsz);
void gfxSleepMilliseconds(gDelay ms);
void gfxSleepMicroseconds(gDelay ms);
@@ -75,7 +75,7 @@ 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);
+gThread gfxThreadCreate(void *stackarea, gMemSize stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
#define gfxThreadMe() xTaskGetCurrentTaskHandle()
#if INCLUDE_eTaskGetState == 1
diff --git a/src/gos/gos_linux.c b/src/gos/gos_linux.c
index b5754d86..5a098509 100644
--- a/src/gos/gos_linux.c
+++ b/src/gos/gos_linux.c
@@ -109,7 +109,7 @@ gTicks gfxSystemTicks(void) {
return ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
}
-gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param) {
+gThread gfxThreadCreate(void *stackarea, gMemSize stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param) {
gThread th;
(void) stackarea;
(void) stacksz;
diff --git a/src/gos/gos_linux.h b/src/gos/gos_linux.h
index 583c0c0f..4f47cd4d 100644
--- a/src/gos/gos_linux.h
+++ b/src/gos/gos_linux.h
@@ -28,11 +28,11 @@ typedef void * gThreadreturn;
typedef unsigned long gDelay;
typedef pthread_t gThread;
typedef int gThreadpriority;
-typedef uint32_t gSemcount;
+typedef gU32 gSemcount;
typedef pthread_mutex_t gfxMutex;
#define DECLARE_THREAD_FUNCTION(fnName, param) gThreadreturn fnName(void *param)
-#define DECLARE_THREAD_STACK(name, sz) uint8_t name[0];
+#define DECLARE_THREAD_STACK(name, sz) gU8 name[0];
#define THREAD_RETURN(retval) return retval
#define gfxExit() exit(0)
@@ -85,7 +85,7 @@ void gfxSemInit(gfxSem *psem, gSemcount val, gSemcount limit);
void gfxSemDestroy(gfxSem *psem);
gBool gfxSemWait(gfxSem *psem, gDelay ms);
void gfxSemSignal(gfxSem *psem);
-gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
+gThread gfxThreadCreate(void *stackarea, gMemSize stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
gThreadreturn gfxThreadWait(gThread thread);
#endif /* GFX_USE_OS_LINUX */
diff --git a/src/gos/gos_nios.c b/src/gos/gos_nios.c
index 154be3d0..ba1126ea 100644
--- a/src/gos/gos_nios.c
+++ b/src/gos/gos_nios.c
@@ -35,7 +35,7 @@ void _gosDeinit(void)
void gfxHalt(const char *msg)
{
- volatile uint32_t dummy;
+ volatile gU32 dummy;
(void)msg;
@@ -45,7 +45,7 @@ void gfxHalt(const char *msg)
}
void gfxExit(void) {
- volatile uint32_t dummy;
+ volatile gU32 dummy;
while(1) {
dummy++;
diff --git a/src/gos/gos_options.h b/src/gos/gos_options.h
index e0187e6a..bdb2b139 100644
--- a/src/gos/gos_options.h
+++ b/src/gos/gos_options.h
@@ -260,6 +260,21 @@
#ifndef GFX_EMULATE_MALLOC
#define GFX_EMULATE_MALLOC GFXOFF
#endif
+ /**
+ * @brief Is the maximum memory allocation less than 64K
+ * @details Defaults to GFXOFF
+ * @note Many CPU's cannot allocate memory blocks larger than 64K. Note that this
+ * is not necessarily mean that a pointer is 16 bit but a 16 bit pointer
+ * will definitely impose this restriction. An example is the x86 processor
+ * running in "FAR" mode. Pointers are 32 bit but the maximum size memory block is 64K.
+ * @note Specifying this only leads to code and memory optimisations. uGFX should still work
+ * on these processors even if it is not set although obviously an attempted memory
+ * allocation larger than 64K will fail.
+ */
+ #ifndef GFX_MEM_LT64K
+ #define GFX_MEM_LT64K GFXOFF
+ #endif
+
/** @} */
#endif /* _GOS_OPTIONS_H */
diff --git a/src/gos/gos_osx.c b/src/gos/gos_osx.c
index 425e6345..b64d3d40 100644
--- a/src/gos/gos_osx.c
+++ b/src/gos/gos_osx.c
@@ -92,7 +92,7 @@ gTicks gfxSystemTicks(void) {
return ts.tv_sec * 1000UL + ts.tv_nsec / 1000000;
}
-gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param) {
+gThread gfxThreadCreate(void *stackarea, gMemSize stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param) {
gThread th;
(void) stackarea;
(void) stacksz;
diff --git a/src/gos/gos_osx.h b/src/gos/gos_osx.h
index 90316f2d..c81f84ae 100644
--- a/src/gos/gos_osx.h
+++ b/src/gos/gos_osx.h
@@ -19,11 +19,11 @@ typedef void * gThreadreturn;
typedef unsigned long gDelay;
typedef pthread_t gThread;
typedef int gThreadpriority;
-typedef uint32_t gSemcount;
+typedef gU32 gSemcount;
typedef pthread_mutex_t gfxMutex;
#define DECLARE_THREAD_FUNCTION(fnName, param) gThreadreturn fnName(void *param)
-#define DECLARE_THREAD_STACK(name, sz) uint8_t name[0];
+#define DECLARE_THREAD_STACK(name, sz) gU8 name[0];
#define THREAD_RETURN(retval) return retval
#define gfxExit() exit(0)
@@ -69,7 +69,7 @@ void gfxSemInit(gfxSem *psem, gSemcount val, gSemcount limit);
void gfxSemDestroy(gfxSem *psem);
gBool gfxSemWait(gfxSem *psem, gDelay ms);
void gfxSemSignal(gfxSem *psem);
-gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
+gThread gfxThreadCreate(void *stackarea, gMemSize stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
gThreadreturn gfxThreadWait(gThread thread);
#endif /* GFX_USE_OS_OSX */
diff --git a/src/gos/gos_qt.cpp b/src/gos/gos_qt.cpp
index 2e15fc0f..5a9c613a 100644
--- a/src/gos/gos_qt.cpp
+++ b/src/gos/gos_qt.cpp
@@ -64,7 +64,7 @@ void _gosDeinit(void)
void gfxHalt(const char *msg)
{
- volatile uint32_t dummy;
+ volatile gU32 dummy;
(void)msg;
@@ -75,19 +75,19 @@ void gfxHalt(const char *msg)
void gfxExit(void)
{
- volatile uint32_t dummy;
+ volatile gU32 dummy;
while(1) {
dummy++;
}
}
-void* gfxAlloc(size_t sz)
+void* gfxAlloc(gMemSize sz)
{
return malloc(sz);
}
-void* gfxRealloc(void* ptr, size_t oldsz, size_t newsz)
+void* gfxRealloc(void* ptr, gMemSize oldsz, gMemSize newsz)
{
Q_UNUSED(oldsz)
return realloc(ptr, newsz);
@@ -185,7 +185,7 @@ void gfxSemSignalI(gfxSem *psem)
static_cast<QSemaphore*>(*psem)->release(1);
}
-gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param)
+gThread gfxThreadCreate(void *stackarea, gMemSize stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param)
{
Q_UNUSED(stackarea)
diff --git a/src/gos/gos_qt.h b/src/gos/gos_qt.h
index 69a3c256..5e061228 100644
--- a/src/gos/gos_qt.h
+++ b/src/gos/gos_qt.h
@@ -11,7 +11,7 @@
#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 DECLARE_THREAD_STACK(name, sz) gU8 name[0]
#define THREAD_RETURN(retval) return retval
#define gDelayNone 0
@@ -35,8 +35,8 @@ 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* gfxAlloc(gMemSize sz);
+void* gfxRealloc(void *ptr, gMemSize oldsz, gMemSize newsz);
void gfxFree(void* ptr);
void gfxYield(void);
void gfxSleepMilliseconds(gDelay ms);
@@ -55,7 +55,7 @@ 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);
+gThread gfxThreadCreate(void *stackarea, gMemSize stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
gThreadreturn gfxThreadWait(gThread thread);
gThread gfxThreadMe(void);
void gfxThreadClose(gThread thread);
diff --git a/src/gos/gos_raw32.c b/src/gos/gos_raw32.c
index 5351e7df..71c37865 100644
--- a/src/gos/gos_raw32.c
+++ b/src/gos/gos_raw32.c
@@ -87,7 +87,7 @@ void gfxHalt(const char *msg) {
fprintf(stderr, "%s\n", msg);
ExitProcess(1);
#else
- volatile uint32_t dummy;
+ volatile gU32 dummy;
(void) msg;
while(1)
@@ -99,7 +99,7 @@ void gfxExit(void) {
#if defined(WIN32)
ExitProcess(0);
#else
- volatile uint32_t dummy;
+ volatile gU32 dummy;
while(1)
dummy++;
diff --git a/src/gos/gos_rawrtos.c b/src/gos/gos_rawrtos.c
index 32e19017..2f66bc06 100644
--- a/src/gos/gos_rawrtos.c
+++ b/src/gos/gos_rawrtos.c
@@ -75,7 +75,7 @@ gBool gfxSemWaitI(gfxSem* psem)
return gFalse;
}
-gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param)
+gThread gfxThreadCreate(void *stackarea, gMemSize stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param)
{
RAW_U16 ret;
gThread taskobj;
diff --git a/src/gos/gos_rawrtos.h b/src/gos/gos_rawrtos.h
index ed42c404..51852fb7 100644
--- a/src/gos/gos_rawrtos.h
+++ b/src/gos/gos_rawrtos.h
@@ -7,10 +7,10 @@
#define gDelayNone (RAW_NO_WAIT)
#define gDelayForever (RAW_WAIT_FOREVER)
-typedef uint32_t gDelay;
+typedef gU32 gDelay;
typedef RAW_TICK_TYPE gTicks;
-typedef int32_t gSemcount;
-typedef uint32_t gThreadreturn;
+typedef gI32 gSemcount;
+typedef gU32 gThreadreturn;
typedef RAW_U8 gThreadpriority;
#define MAX_SEMAPHORE_COUNT RAW_SEMAPHORE_COUNT
@@ -67,7 +67,7 @@ void gfxSleepMilliseconds(gDelay ms);
void gfxSleepMicroseconds(gDelay us);
gBool gfxSemWait(gfxSem* psem, gDelay ms);
gBool gfxSemWaitI(gfxSem* psem);
-gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
+gThread gfxThreadCreate(void *stackarea, gMemSize stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
#endif
diff --git a/src/gos/gos_win32.c b/src/gos/gos_win32.c
index 88936ce8..54797c98 100644
--- a/src/gos/gos_win32.c
+++ b/src/gos/gos_win32.c
@@ -103,7 +103,7 @@ gSemcount gfxSemCounter(gfxSem *pSem) {
}
*/
-gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION(*fn,p), void *param) {
+gThread gfxThreadCreate(void *stackarea, gMemSize stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION(*fn,p), void *param) {
(void) stackarea;
HANDLE thd;
diff --git a/src/gos/gos_win32.h b/src/gos/gos_win32.h
index f9ac10b4..1d74952f 100644
--- a/src/gos/gos_win32.h
+++ b/src/gos/gos_win32.h
@@ -32,7 +32,7 @@ typedef DWORD gThreadreturn;
typedef int gThreadpriority;
#define DECLARE_THREAD_FUNCTION(fnName, param) gThreadreturn (WINAPI fnName)(void *param)
-#define DECLARE_THREAD_STACK(name, sz) uint8_t name[1];
+#define DECLARE_THREAD_STACK(name, sz) gU8 name[1];
#define THREAD_RETURN(retval) return retval
#define gDelayNone 0
@@ -75,7 +75,7 @@ void gfxSleepMicroseconds(gDelay ms);
gBool gfxSemWait(gfxSem *psem, gDelay ms);
void gfxSystemLock(void);
void gfxSystemUnlock(void);
-gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION(*fn,p), void *param);
+gThread gfxThreadCreate(void *stackarea, gMemSize stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION(*fn,p), void *param);
gThreadreturn gfxThreadWait(gThread thread);
#endif /* GFX_USE_OS_WIN32 */
diff --git a/src/gos/gos_x_heap.c b/src/gos/gos_x_heap.c
index 1a8f1061..d8f28a3a 100644
--- a/src/gos/gos_x_heap.c
+++ b/src/gos/gos_x_heap.c
@@ -17,11 +17,11 @@
void _gosHeapInit(void) {
}
- void *gfxAlloc(size_t sz) {
+ void *gfxAlloc(gMemSize sz) {
return malloc(sz);
}
- void *gfxRealloc(void *ptr, size_t oldsz, size_t newsz) {
+ void *gfxRealloc(void *ptr, gMemSize oldsz, gMemSize newsz) {
(void) oldsz;
return realloc(ptr, newsz);
}
@@ -34,7 +34,7 @@
// Slot structure - user memory follows
typedef struct memslot {
- size_t sz; // Includes the size of this memslot.
+ gMemSize sz; // Includes the size of this memslot.
} memslot;
// Free Slot - immediately follows the memslot structure
@@ -54,7 +54,7 @@
gfxAddHeapBlock(heap, GFX_OS_HEAP_SIZE);
}
- void gfxAddHeapBlock(void *ptr, size_t sz) {
+ void gfxAddHeapBlock(void *ptr, gMemSize sz) {
if (sz < sizeof(memslot)+sizeof(freeslot))
return;
@@ -62,7 +62,7 @@
gfxFree(Slot2Ptr((memslot *)ptr));
}
- void *gfxAlloc(size_t sz) {
+ void *gfxAlloc(gMemSize sz) {
register memslot *prev, *p, *pnew;
if (!sz) return 0;
@@ -94,7 +94,7 @@
return 0;
}
- void *gfxRealloc(void *ptr, size_t oldsz, size_t sz) {
+ void *gfxRealloc(void *ptr, gMemSize oldsz, gMemSize sz) {
register memslot *prev, *p, *pfree;
(void) oldsz;
@@ -187,7 +187,7 @@
#include <stdlib.h>
void* malloc(size_t size) {
- return gfxAlloc(size);
+ return gfxAlloc((gMemSize)size);
}
void free(void *ptr) {
gfxFree(ptr);
diff --git a/src/gos/gos_x_heap.h b/src/gos/gos_x_heap.h
index 205591ca..26b3e43b 100644
--- a/src/gos/gos_x_heap.h
+++ b/src/gos/gos_x_heap.h
@@ -25,11 +25,11 @@
* @pre GFX_OS_HEAP_SIZE != 0 and an operating system that uses the
* internal ugfx heap allocator rather than its own allocator.
*/
- void gfxAddHeapBlock(void *ptr, size_t sz);
+ void gfxAddHeapBlock(void *ptr, gMemSize sz);
#endif
-void *gfxAlloc(size_t sz);
-void *gfxRealloc(void *ptr, size_t oldsz, size_t newsz);
+void *gfxAlloc(gMemSize sz);
+void *gfxRealloc(void *ptr, gMemSize oldsz, gMemSize newsz);
void gfxFree(void *ptr);
#endif /* GOS_NEED_X_HEAP */
diff --git a/src/gos/gos_x_threads.c b/src/gos/gos_x_threads.c
index a07a2feb..f9c57460 100644
--- a/src/gos/gos_x_threads.c
+++ b/src/gos/gos_x_threads.c
@@ -175,7 +175,7 @@ typedef struct thread {
#define FLG_THD_MAIN 0x0002
#define FLG_THD_DEAD 0x0004
#define FLG_THD_WAIT 0x0008
- size_t size; // Size of the thread stack (including this structure)
+ gMemSize size; // Size of the thread stack (including this structure)
gThreadreturn (*fn)(void *param); // Thread function
void * param; // Parameter for the thread function
void * cxt; // The current thread context.
@@ -244,9 +244,9 @@ static thread mainthread; // The main thread context
*
* AUTO_DETECT_STACKFRAME GFXON/GFXOFF - GFXON to auto-detect stack frame structure
* STACK_DIR_UP Macro/gBool - GFXON if the stack grows up instead of down
- * MASK1 Macro/uint32_t - The 1st mask of jmp_buf elements that need relocation
- * MASK2 Macro/uint32_t - The 2nd mask of jmp_buf elements that need relocation
- * STACK_BASE Macro/size_t - The base of the stack frame relative to the local variables
+ * MASK1 Macro/gU32 - The 1st mask of jmp_buf elements that need relocation
+ * MASK2 Macro/gU32 - The 2nd mask of jmp_buf elements that need relocation
+ * STACK_BASE Macro/gMemSize - The base of the stack frame relative to the local variables
* _gfxThreadsInit() Macro/Function - Initialise the scheduler
*
*/
@@ -276,9 +276,9 @@ static thread mainthread; // The main thread context
} saveloc;
static gBool stackdirup;
- static uint32_t jmpmask1;
- static uint32_t jmpmask2;
- static size_t stackbase;
+ static gU32 jmpmask1;
+ static gU32 jmpmask2;
+ static gMemSize stackbase;
static saveloc *pframeinfo;
// These two functions are not static to prevent the compiler removing them as functions
@@ -293,10 +293,10 @@ static thread mainthread; // The main thread context
pframeinfo--;
}
static void _gfxThreadsInit(void) {
- uint32_t i;
+ gU32 i;
char ** pout;
char ** pin;
- size_t diff;
+ gPtrDiff diff;
char * framebase;
saveloc tmpsaveloc[2];
@@ -320,7 +320,7 @@ static thread mainthread; // The main thread context
framebase = pframeinfo[0].localptr;
jmpmask1 = jmpmask2 = 0;
for (i = 0; i < sizeof(jmp_buf)/sizeof(char *); i++, pout++, pin++) {
- if ((size_t)(*pout - *pin) == diff) {
+ if ((gPtrDiff)(*pout - *pin) == diff) {
if (i < 32)
jmpmask1 |= 1 << i;
else
@@ -345,7 +345,7 @@ static thread mainthread; // The main thread context
char ** s;
char * nf;
int diff;
- uint32_t i;
+ gU32 i;
// Copy the stack frame
s = 0;
@@ -508,7 +508,7 @@ void gfxThreadExit(gThreadreturn ret) {
// We never get back here as we didn't re-queue ourselves
}
-gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param) {
+gThread gfxThreadCreate(void *stackarea, gMemSize stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param) {
thread * t;
thread * me;
(void) prio;
diff --git a/src/gos/gos_x_threads.h b/src/gos/gos_x_threads.h
index 5b1b7260..175c1b94 100644
--- a/src/gos/gos_x_threads.h
+++ b/src/gos/gos_x_threads.h
@@ -24,14 +24,14 @@
#if GOS_NEED_X_THREADS
-typedef uint32_t gDelay;
-typedef uint32_t gTicks;
+typedef gU32 gDelay;
+typedef gU32 gTicks;
typedef short gSemcount;
typedef int gThreadreturn;
typedef int gThreadpriority;
#define DECLARE_THREAD_FUNCTION(fnName, param) gThreadreturn fnName(void *param)
-#define DECLARE_THREAD_STACK(name, sz) uint8_t name[(sz) & ~3];
+#define DECLARE_THREAD_STACK(name, sz) gU8 name[(sz) & ~3];
#define THREAD_RETURN(retval) return retval
#define gDelayNone 0
@@ -46,7 +46,7 @@ typedef struct {
gSemcount limit;
} gfxSem;
-typedef uint32_t gfxMutex;
+typedef gU32 gfxMutex;
typedef void * gThread;
// Required timing functions - supplied by the user or the operating system
@@ -77,7 +77,7 @@ void gfxSemSignal(gfxSem *psem);
void gfxSemSignalI(gfxSem *psem);
// Threads
-gThread gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
+gThread gfxThreadCreate(void *stackarea, gMemSize stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
#define gfxThreadClose(thread)
gThreadreturn gfxThreadWait(gThread thread);
gThread gfxThreadMe(void);