aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--boards/base/STM32F439i-Eval/CubeHal/stm32f439i_raw32_ugfx.c4
-rw-r--r--boards/base/STM32F469i-Discovery/stm32f469i_raw32_ugfx.c4
-rw-r--r--boards/base/STM32F746-Discovery/stm32f746g_discovery_sdram.c2
-rw-r--r--boards/base/STM32F746-Discovery/stm32f746g_raw32_ugfx.c4
-rw-r--r--changelog.txt26
-rw-r--r--demos/games/justget10/jg10.c4
-rw-r--r--demos/games/tetris/tetris.c6
-rw-r--r--demos/modules/gdisp/images_animated/main.c2
-rw-r--r--demos/modules/gos/threads/main.c8
-rw-r--r--demos/modules/gos/threads_advanced/main.c4
-rw-r--r--src/gadc/gadc.c2
-rw-r--r--src/gadc/gadc.h2
-rw-r--r--src/gaudio/gaudio.c4
-rw-r--r--src/gaudio/gaudio.h4
-rw-r--r--src/gdisp/gdisp_image.c14
-rw-r--r--src/gdisp/gdisp_image.h2
-rw-r--r--src/gdisp/gdisp_image_bmp.c2
-rw-r--r--src/gdisp/gdisp_image_gif.c6
-rw-r--r--src/gdisp/gdisp_image_jpg.c2
-rw-r--r--src/gdisp/gdisp_image_native.c2
-rw-r--r--src/gdisp/gdisp_image_png.c2
-rw-r--r--src/gevent/gevent.c2
-rw-r--r--src/gevent/gevent.h2
-rw-r--r--src/gfile/gfile_fatfs_wrapper.c2
-rw-r--r--src/ginput/ginput_driver_mouse.h2
-rw-r--r--src/gos/gos.h39
-rw-r--r--src/gos/gos_arduino.c4
-rw-r--r--src/gos/gos_arduino.h4
-rw-r--r--src/gos/gos_chibios.c10
-rw-r--r--src/gos/gos_chibios.h30
-rw-r--r--src/gos/gos_cmsis.c8
-rw-r--r--src/gos/gos_cmsis.h20
-rw-r--r--src/gos/gos_cmsis2.c8
-rw-r--r--src/gos/gos_cmsis2.h18
-rw-r--r--src/gos/gos_ecos.c10
-rw-r--r--src/gos/gos_ecos.h24
-rw-r--r--src/gos/gos_freertos.c12
-rw-r--r--src/gos/gos_freertos.h32
-rw-r--r--src/gos/gos_linux.c20
-rw-r--r--src/gos/gos_linux.h36
-rw-r--r--src/gos/gos_nios.c4
-rw-r--r--src/gos/gos_nios.h8
-rw-r--r--src/gos/gos_osx.c16
-rw-r--r--src/gos/gos_osx.h34
-rw-r--r--src/gos/gos_qt.cpp24
-rw-r--r--src/gos/gos_qt.h32
-rw-r--r--src/gos/gos_raw32.c4
-rw-r--r--src/gos/gos_raw32.h4
-rw-r--r--src/gos/gos_rawrtos.c14
-rw-r--r--src/gos/gos_rawrtos.h20
-rw-r--r--src/gos/gos_win32.c10
-rw-r--r--src/gos/gos_win32.h22
-rw-r--r--src/gos/gos_x_threads.c24
-rw-r--r--src/gos/gos_x_threads.h40
-rw-r--r--src/gos/gos_zephyr.c2
-rw-r--r--src/gos/gos_zephyr.h16
-rw-r--r--src/gqueue/gqueue.c12
-rw-r--r--src/gqueue/gqueue.h12
-rw-r--r--src/gtimer/gtimer.c10
-rw-r--r--src/gtimer/gtimer.h6
-rw-r--r--src/gwin/gwin_image.c2
-rw-r--r--src/gwin/gwin_progressbar.c2
-rw-r--r--src/gwin/gwin_progressbar.h2
63 files changed, 360 insertions, 349 deletions
diff --git a/boards/base/STM32F439i-Eval/CubeHal/stm32f439i_raw32_ugfx.c b/boards/base/STM32F439i-Eval/CubeHal/stm32f439i_raw32_ugfx.c
index fd2dbdef..975f5401 100644
--- a/boards/base/STM32F439i-Eval/CubeHal/stm32f439i_raw32_ugfx.c
+++ b/boards/base/STM32F439i-Eval/CubeHal/stm32f439i_raw32_ugfx.c
@@ -13,12 +13,12 @@
{
}
- systemticks_t gfxSystemTicks(void)
+ gTicks gfxSystemTicks(void)
{
return HAL_GetTick();
}
- systemticks_t gfxMillisecondsToTicks(delaytime_t ms)
+ gTicks gfxMillisecondsToTicks(gDelay ms)
{
return ms;
}
diff --git a/boards/base/STM32F469i-Discovery/stm32f469i_raw32_ugfx.c b/boards/base/STM32F469i-Discovery/stm32f469i_raw32_ugfx.c
index 35b7a5e3..4c1940ec 100644
--- a/boards/base/STM32F469i-Discovery/stm32f469i_raw32_ugfx.c
+++ b/boards/base/STM32F469i-Discovery/stm32f469i_raw32_ugfx.c
@@ -8,12 +8,12 @@
#include "stm32f4xx_hal.h"
#if !GFX_USE_OS_CHIBIOS
- systemticks_t gfxSystemTicks(void)
+ gTicks gfxSystemTicks(void)
{
return HAL_GetTick();
}
- systemticks_t gfxMillisecondsToTicks(delaytime_t ms)
+ gTicks gfxMillisecondsToTicks(gDelay ms)
{
return ms;
}
diff --git a/boards/base/STM32F746-Discovery/stm32f746g_discovery_sdram.c b/boards/base/STM32F746-Discovery/stm32f746g_discovery_sdram.c
index a973a0b6..35a60a97 100644
--- a/boards/base/STM32F746-Discovery/stm32f746g_discovery_sdram.c
+++ b/boards/base/STM32F746-Discovery/stm32f746g_discovery_sdram.c
@@ -259,7 +259,7 @@ static HAL_StatusTypeDef _HAL_SDRAM_SendCommand(SDRAM_HandleTypeDef *hsdram, FMC
static HAL_StatusTypeDef _FMC_SDRAM_SendCommand(FMC_SDRAM_TypeDef *Device, FMC_SDRAM_CommandTypeDef *Command, uint32_t Timeout)
{
__IO uint32_t tmpr = 0;
- systemticks_t tickstart = 0;
+ gTicks tickstart = 0;
/* Set command register */
tmpr = (uint32_t)((Command->CommandMode) |\
diff --git a/boards/base/STM32F746-Discovery/stm32f746g_raw32_ugfx.c b/boards/base/STM32F746-Discovery/stm32f746g_raw32_ugfx.c
index f521b865..77183b8a 100644
--- a/boards/base/STM32F746-Discovery/stm32f746g_raw32_ugfx.c
+++ b/boards/base/STM32F746-Discovery/stm32f746g_raw32_ugfx.c
@@ -9,12 +9,12 @@
#if GFX_USE_OS_CHIBIOS
#define HAL_GPIO_Init(port, ptr) palSetGroupMode(port, (ptr)->Pin, 0, (ptr)->Mode|((ptr)->Speed<<3)|((ptr)->Pull<<5)|((ptr)->Alternate<<7))
#else
- systemticks_t gfxSystemTicks(void)
+ gTicks gfxSystemTicks(void)
{
return HAL_GetTick();
}
- systemticks_t gfxMillisecondsToTicks(delaytime_t ms)
+ gTicks gfxMillisecondsToTicks(gDelay ms)
{
return ms;
}
diff --git a/changelog.txt b/changelog.txt
index feed5d4b..071cba4f 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -15,17 +15,21 @@ FEATURE: Added GFX_COMPAT_OLDCOLORS to allow V2.x Red, Green, Blue color names.
CHANGE: Added GFX_RED, GFX_BLUE, GFX_GREEN etc to replace V2.x Red, Gree, Blue color names
CHANGE: Added GFXON/GFXOFF to replace V2.x TRUE/FALSE for configuration options.
CHANGE: Added types gI8, gU8 .. gI32, gU32 to replace V2.x int8_t etc
-CHANGE: Added type gBool to replace V2.x bool_t, and values gTrue/gFalse to replace TRUE/FALSE
-CHANGE: Added type gPoint to replace V2.x point and point_t
-CHANGE: Added type gCoord to replace V2.x coord_t
-CHANGE: Added type gPixel to replace V2.x pixel_t
-CHANGE: Added type gColor to replace V2.x color_t
-CHANGE: Added type gColorformat to replace V2.x colorformat
-CHANGE: Added type gFont to replace V2.x font_t
-CHANGE: Added type gPowermode to replace V2.x powermode_t, and values gPowerXXX replace powerXXX
-CHANGE: Added type gJustify to replace V2.x justify_t, and values gJustifyXXX replace justifyXXX
-CHANGE: Added type gFontmetric to replace V2.x fontmetric_t, and values gFontXXX replace fontXXX
-CHANGE: Added type gOrientation to replace V2.x orientation_t, and values gOrientationX replace GDISP_ROTATE_X
+CHANGE: Added type gBool to replace V2.x bool_t, and values gTrue/gFalse to replace TRUE/FALSE
+CHANGE: Added type gDelay to replace V2.x delaytime_t
+CHANGE: Added type gTicks to replace V2.x systemticks_t
+CHANGE: Added type gThreadreturn to replace V2.x threadreturn_t
+CHANGE: Added type gThreadpriority to replace V2.x threadpriority_t
+CHANGE: Added type gPoint to replace V2.x point and point_t
+CHANGE: Added type gCoord to replace V2.x coord_t
+CHANGE: Added type gPixel to replace V2.x pixel_t
+CHANGE: Added type gColor to replace V2.x color_t
+CHANGE: Added type gColorformat to replace V2.x colorformat
+CHANGE: Added type gFont to replace V2.x font_t
+CHANGE: Added type gPowermode to replace V2.x powermode_t, and values gPowerXXX replace powerXXX
+CHANGE: Added type gJustify to replace V2.x justify_t, and values gJustifyXXX replace justifyXXX
+CHANGE: Added type gFontmetric to replace V2.x fontmetric_t, and values gFontXXX replace fontXXX
+CHANGE: Added type gOrientation to replace V2.x orientation_t, and values gOrientationX replace GDISP_ROTATE_X
CHANGE: Added macros JUSTIFYMASK_HORIZONTAL, JUSTIFYMASK_VERTICAL to replace macros JUSTIFYMASK_LEFTRIGHT, JUSTIFYMASK_TOPBOTTOM
FEATURE: Added types gPtr and gPtrDiff
FEATURE: Added gI64 and gU64 when the compiler supports it. GFX_TYPE_64 macro is defined as GFXON if it does.
diff --git a/demos/games/justget10/jg10.c b/demos/games/justget10/jg10.c
index 160be7a7..d824ca06 100644
--- a/demos/games/justget10/jg10.c
+++ b/demos/games/justget10/jg10.c
@@ -102,8 +102,8 @@ static void clean_SelCheck(void) {
static void remove_Selected(void) {
uint16_t i ,j, step;
- systemticks_t delay_start = 0;
- systemticks_t delay=0;
+ gTicks delay_start = 0;
+ gTicks delay=0;
for (step = 0; step < JG10_ANIM_IMAGES; step++) {
delay_start = gfxSystemTicks();
for (i = 0; i < JG10_FIELD_WIDTH; i++) {
diff --git a/demos/games/tetris/tetris.c b/demos/games/tetris/tetris.c
index 53c0e34b..ad8debd7 100644
--- a/demos/games/tetris/tetris.c
+++ b/demos/games/tetris/tetris.c
@@ -78,8 +78,8 @@ const int tetrisShapes[TETRIS_SHAPE_COUNT][4][2] = {
int tetrisField[TETRIS_FIELD_HEIGHT][TETRIS_FIELD_WIDTH]; // main tetris field array
unsigned int tetrisGameSpeed = 500; // game auto-move speed in ms
unsigned int tetrisKeySpeed = 140; // game key repeat speed in ms
-systemticks_t tetrisPreviousGameTime = 0;
-systemticks_t tetrisPreviousKeyTime = 0;
+gTicks tetrisPreviousGameTime = 0;
+gTicks tetrisPreviousKeyTime = 0;
int tetrisCurrentShape[4][2];
int tetrisNextShape[4][2];
int tetrisOldShape[4][2];
@@ -474,7 +474,7 @@ static DECLARE_THREAD_FUNCTION(thdTetris, arg) {
tetrisPreviousKeyTime = gfxSystemTicks();
}
}
- return (threadreturn_t)0;
+ return (gThreadreturn)0;
}
static void tetrisDeinit(void) {
diff --git a/demos/modules/gdisp/images_animated/main.c b/demos/modules/gdisp/images_animated/main.c
index 09d46304..5891de4f 100644
--- a/demos/modules/gdisp/images_animated/main.c
+++ b/demos/modules/gdisp/images_animated/main.c
@@ -55,7 +55,7 @@ static gdispImage myImage;
*/
int main(void) {
gCoord swidth, sheight, errx, erry, errcx, errcy;
- delaytime_t delay;
+ gDelay delay;
gfxInit(); // Initialize the display
diff --git a/demos/modules/gos/threads/main.c b/demos/modules/gos/threads/main.c
index 56ea4bb9..4ef81411 100644
--- a/demos/modules/gos/threads/main.c
+++ b/demos/modules/gos/threads/main.c
@@ -22,7 +22,7 @@
#error "--"
#endif
-threadreturn_t heartbeat1(void* param)
+gThreadreturn heartbeat1(void* param)
{
(void)param;
@@ -31,10 +31,10 @@ threadreturn_t heartbeat1(void* param)
gfxSleepMilliseconds(500);
}
- return (threadreturn_t)0;
+ return (gThreadreturn)0;
}
-threadreturn_t heartbeat2(void* param)
+gThreadreturn heartbeat2(void* param)
{
(void)param;
@@ -43,7 +43,7 @@ threadreturn_t heartbeat2(void* param)
gfxSleepMilliseconds(900);
}
- return (threadreturn_t)0;
+ return (gThreadreturn)0;
}
int main(void)
diff --git a/demos/modules/gos/threads_advanced/main.c b/demos/modules/gos/threads_advanced/main.c
index 8527194e..0ae8649c 100644
--- a/demos/modules/gos/threads_advanced/main.c
+++ b/demos/modules/gos/threads_advanced/main.c
@@ -63,7 +63,7 @@ gfxThreadHandle thd;
* Thread function
* Prints a message
*/
-threadreturn_t Thread_function(void* param)
+gThreadreturn Thread_function(void* param)
{
/* Cast the paramter into a gBool pointer so we can use it */
gBool* doExit = (gBool*)param;
@@ -75,7 +75,7 @@ threadreturn_t Thread_function(void* param)
}
/* Don't return anything */
- return (threadreturn_t)0;
+ return (gThreadreturn)0;
}
/*
diff --git a/src/gadc/gadc.c b/src/gadc/gadc.c
index 8e8553df..ee5b9fdf 100644
--- a/src/gadc/gadc.c
+++ b/src/gadc/gadc.c
@@ -224,7 +224,7 @@ void gadcHighSpeedSetISRCallback(GADCISRCallbackFunction isrfn) {
hsISRcallback = isrfn;
}
-GDataBuffer *gadcHighSpeedGetData(delaytime_t ms) {
+GDataBuffer *gadcHighSpeedGetData(gDelay ms) {
return (GDataBuffer *)gfxQueueGSyncGet(&hsListDone, ms);
}
diff --git a/src/gadc/gadc.h b/src/gadc/gadc.h
index 3e995db6..2743af94 100644
--- a/src/gadc/gadc.h
+++ b/src/gadc/gadc.h
@@ -172,7 +172,7 @@ void gadcHighSpeedSetISRCallback(GADCISRCallbackFunction isrfn);
* @api
* @{
*/
-GDataBuffer *gadcHighSpeedGetData(delaytime_t ms);
+GDataBuffer *gadcHighSpeedGetData(gDelay ms);
GDataBuffer *gadcHighSpeedGetDataI(void);
/** @} */
diff --git a/src/gaudio/gaudio.c b/src/gaudio/gaudio.c
index 8311d8cb..273e927f 100644
--- a/src/gaudio/gaudio.c
+++ b/src/gaudio/gaudio.c
@@ -119,7 +119,7 @@ void _gaudioDeinit(void)
return gaudio_play_lld_set_volume(vol);
}
- gBool gaudioPlayWait(delaytime_t ms) {
+ gBool gaudioPlayWait(gDelay ms) {
if (!(playFlags & PLAYFLG_PLAYING))
return gTrue;
return gfxSemWait(&playComplete, ms);
@@ -213,7 +213,7 @@ void _gaudioDeinit(void)
gfxBufferRelease(pd);
}
- GDataBuffer *gaudioRecordGetData(delaytime_t ms) {
+ GDataBuffer *gaudioRecordGetData(gDelay ms) {
return (GDataBuffer *)gfxQueueGSyncGet(&recordList, ms);
}
diff --git a/src/gaudio/gaudio.h b/src/gaudio/gaudio.h
index a318bab5..0f11c0b4 100644
--- a/src/gaudio/gaudio.h
+++ b/src/gaudio/gaudio.h
@@ -193,7 +193,7 @@
*
* @api
*/
- gBool gaudioPlayWait(delaytime_t ms);
+ gBool gaudioPlayWait(gDelay ms);
#endif
#if GAUDIO_NEED_RECORD || defined(__DOXYGEN__)
@@ -260,7 +260,7 @@
*
* @api
*/
- GDataBuffer *gaudioRecordGetData(delaytime_t ms);
+ GDataBuffer *gaudioRecordGetData(gDelay ms);
#if GFX_USE_GEVENT || defined(__DOXYGEN__)
/**
diff --git a/src/gdisp/gdisp_image.c b/src/gdisp/gdisp_image.c
index 03f3523e..dff13932 100644
--- a/src/gdisp/gdisp_image.c
+++ b/src/gdisp/gdisp_image.c
@@ -16,7 +16,7 @@
extern void gdispImageClose_NATIVE(gdispImage *img);
extern gdispImageError gdispImageCache_NATIVE(gdispImage *img);
extern gdispImageError gdispGImageDraw_NATIVE(GDisplay *g, gdispImage *img, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord sx, gCoord sy);
- extern delaytime_t gdispImageNext_NATIVE(gdispImage *img);
+ extern gDelay gdispImageNext_NATIVE(gdispImage *img);
#endif
#if GDISP_NEED_IMAGE_GIF
@@ -24,7 +24,7 @@
extern void gdispImageClose_GIF(gdispImage *img);
extern gdispImageError gdispImageCache_GIF(gdispImage *img);
extern gdispImageError gdispGImageDraw_GIF(GDisplay *g, gdispImage *img, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord sx, gCoord sy);
- extern delaytime_t gdispImageNext_GIF(gdispImage *img);
+ extern gDelay gdispImageNext_GIF(gdispImage *img);
#endif
#if GDISP_NEED_IMAGE_BMP
@@ -32,7 +32,7 @@
extern void gdispImageClose_BMP(gdispImage *img);
extern gdispImageError gdispImageCache_BMP(gdispImage *img);
extern gdispImageError gdispGImageDraw_BMP(GDisplay *g, gdispImage *img, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord sx, gCoord sy);
- extern delaytime_t gdispImageNext_BMP(gdispImage *img);
+ extern gDelay gdispImageNext_BMP(gdispImage *img);
extern uint16_t gdispImageGetPaletteSize_BMP(gdispImage *img);
extern gColor gdispImageGetPalette_BMP(gdispImage *img, uint16_t index);
extern gBool gdispImageAdjustPalette_BMP(gdispImage *img, uint16_t index, gColor newColor);
@@ -43,7 +43,7 @@
extern void gdispImageClose_JPG(gdispImage *img);
extern gdispImageError gdispImageCache_JPG(gdispImage *img);
extern gdispImageError gdispGImageDraw_JPG(GDisplay *g, gdispImage *img, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord sx, gCoord sy);
- extern delaytime_t gdispImageNext_JPG(gdispImage *img);
+ extern gDelay gdispImageNext_JPG(gdispImage *img);
#endif
#if GDISP_NEED_IMAGE_PNG
@@ -51,7 +51,7 @@
extern void gdispImageClose_PNG(gdispImage *img);
extern gdispImageError gdispImageCache_PNG(gdispImage *img);
extern gdispImageError gdispGImageDraw_PNG(GDisplay *g, gdispImage *img, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord sx, gCoord sy);
- extern delaytime_t gdispImageNext_PNG(gdispImage *img);
+ extern gDelay gdispImageNext_PNG(gdispImage *img);
#endif
/* The structure defining the routines for image drawing */
@@ -64,7 +64,7 @@ typedef struct gdispImageHandlers {
gCoord x, gCoord y,
gCoord cx, gCoord cy,
gCoord sx, gCoord sy); /* The draw function */
- delaytime_t (*next)(gdispImage *img); /* The next frame function */
+ gDelay (*next)(gdispImage *img); /* The next frame function */
uint16_t (*getPaletteSize)(gdispImage *img); /* Retrieve the size of the palette (number of entries) */
gColor (*getPalette)(gdispImage *img, uint16_t index); /* Retrieve a specific color value of the palette */
gBool (*adjustPalette)(gdispImage *img, uint16_t index, gColor newColor); /* Replace a color value in the palette */
@@ -186,7 +186,7 @@ gdispImageError gdispGImageDraw(GDisplay *g, gdispImage *img, gCoord x, gCoord y
return img->fns->draw(g, img, x, y, cx, cy, sx, sy);
}
-delaytime_t gdispImageNext(gdispImage *img) {
+gDelay gdispImageNext(gdispImage *img) {
if (!img) return GDISP_IMAGE_ERR_NULLPOINTER;
if (!img->fns) return GDISP_IMAGE_ERR_BADFORMAT;
return img->fns->next(img);
diff --git a/src/gdisp/gdisp_image.h b/src/gdisp/gdisp_image.h
index cf0ada32..1f0acffb 100644
--- a/src/gdisp/gdisp_image.h
+++ b/src/gdisp/gdisp_image.h
@@ -243,7 +243,7 @@ gdispImageError gdispGImageDraw(GDisplay *g, gdispImage *img, gCoord x, gCoord y
* @note Calling gdispImageDraw() after getting a TIME_INFINITE will go back to drawing the first
* frame/page.
*/
-delaytime_t gdispImageNext(gdispImage *img);
+gDelay gdispImageNext(gdispImage *img);
/**
* @brief Get the number of entries in the color palette.
diff --git a/src/gdisp/gdisp_image_bmp.c b/src/gdisp/gdisp_image_bmp.c
index 61b801ad..0647e9ab 100644
--- a/src/gdisp/gdisp_image_bmp.c
+++ b/src/gdisp/gdisp_image_bmp.c
@@ -815,7 +815,7 @@ gdispImageError gdispGImageDraw_BMP(GDisplay *g, gdispImage *img, gCoord x, gCoo
return GDISP_IMAGE_ERR_OK;
}
-delaytime_t gdispImageNext_BMP(gdispImage *img) {
+gDelay gdispImageNext_BMP(gdispImage *img) {
(void) img;
/* No more frames/pages */
diff --git a/src/gdisp/gdisp_image_gif.c b/src/gdisp/gdisp_image_gif.c
index edfa30c2..bad2a150 100644
--- a/src/gdisp/gdisp_image_gif.c
+++ b/src/gdisp/gdisp_image_gif.c
@@ -1106,15 +1106,15 @@ baddatacleanup:
return GDISP_IMAGE_ERR_BADDATA;
}
-delaytime_t gdispImageNext_GIF(gdispImage *img) {
+gDelay gdispImageNext_GIF(gdispImage *img) {
gdispImagePrivate_GIF * priv;
- delaytime_t delay;
+ gDelay delay;
uint8_t blocksz;
priv = (gdispImagePrivate_GIF *)img->priv;
// Save the delay and convert to millisecs
- delay = (delaytime_t)priv->frame.delay * 10;
+ delay = (gDelay)priv->frame.delay * 10;
// We need to get to the end of this frame
if (!priv->frame.posend) {
diff --git a/src/gdisp/gdisp_image_jpg.c b/src/gdisp/gdisp_image_jpg.c
index 8056ac42..1deaaa0b 100644
--- a/src/gdisp/gdisp_image_jpg.c
+++ b/src/gdisp/gdisp_image_jpg.c
@@ -198,7 +198,7 @@ gdispImageError gdispGImageDraw_JPG(GDisplay *g, gdispImage *img, gCoord x, gCoo
return GDISP_IMAGE_ERR_OK;
}
-delaytime_t gdispImageNext_JPG(gdispImage *img) {
+gDelay gdispImageNext_JPG(gdispImage *img) {
(void) img;
/* No more frames/pages */
diff --git a/src/gdisp/gdisp_image_native.c b/src/gdisp/gdisp_image_native.c
index f97b7539..3ac5eb36 100644
--- a/src/gdisp/gdisp_image_native.c
+++ b/src/gdisp/gdisp_image_native.c
@@ -140,7 +140,7 @@ gdispImageError gdispGImageDraw_NATIVE(GDisplay *g, gdispImage *img, gCoord x, g
return GDISP_IMAGE_ERR_OK;
}
-delaytime_t gdispImageNext_NATIVE(gdispImage *img) {
+gDelay gdispImageNext_NATIVE(gdispImage *img) {
(void) img;
/* No more frames/pages */
diff --git a/src/gdisp/gdisp_image_png.c b/src/gdisp/gdisp_image_png.c
index 782db31f..f714b779 100644
--- a/src/gdisp/gdisp_image_png.c
+++ b/src/gdisp/gdisp_image_png.c
@@ -1621,7 +1621,7 @@ baddata:
return GDISP_IMAGE_ERR_BADDATA;
}
-delaytime_t gdispImageNext_PNG(gdispImage *img) {
+gDelay gdispImageNext_PNG(gdispImage *img) {
(void) img;
/* No more frames/pages */
diff --git a/src/gevent/gevent.c b/src/gevent/gevent.c
index 311d94fb..f91b6179 100644
--- a/src/gevent/gevent.c
+++ b/src/gevent/gevent.c
@@ -115,7 +115,7 @@ void geventDetachSource(GListener *pl, GSourceHandle gsh) {
}
}
-GEvent *geventEventWait(GListener *pl, delaytime_t timeout) {
+GEvent *geventEventWait(GListener *pl, gDelay timeout) {
/* NOTE:
We no longer try to protect against two threads trying to listen on the
one listener. This was never allowed, it makes little sense to try to do so,
diff --git a/src/gevent/gevent.h b/src/gevent/gevent.h
index 121895ba..203fbb9a 100644
--- a/src/gevent/gevent.h
+++ b/src/gevent/gevent.h
@@ -157,7 +157,7 @@ void geventDetachSource(GListener *pl, GSourceHandle gsh);
*
* @return NULL on timeout
*/
-GEvent *geventEventWait(GListener *pl, delaytime_t timeout);
+GEvent *geventEventWait(GListener *pl, gDelay timeout);
/**
* @brief Release the GEvent buffer associated with a listener.
diff --git a/src/gfile/gfile_fatfs_wrapper.c b/src/gfile/gfile_fatfs_wrapper.c
index 7f3a3e39..95f3685e 100644
--- a/src/gfile/gfile_fatfs_wrapper.c
+++ b/src/gfile/gfile_fatfs_wrapper.c
@@ -48,7 +48,7 @@
/*------------------------------------------------------------------------*/
int ff_req_grant(_SYNC_t sobj)
{
- if (gfxSemWait( (gfxSem*)&sobj, (delaytime_t)_FS_TIMEOUT) )
+ if (gfxSemWait( (gfxSem*)&sobj, (gDelay)_FS_TIMEOUT) )
return gTrue;
return gFalse;
}
diff --git a/src/ginput/ginput_driver_mouse.h b/src/ginput/ginput_driver_mouse.h
index 8b239517..773ca150 100644
--- a/src/ginput/ginput_driver_mouse.h
+++ b/src/ginput/ginput_driver_mouse.h
@@ -51,7 +51,7 @@ typedef struct GMouse {
#define GMOUSE_FLG_NEEDREAD 0x0040 // The mouse needs reading
#define GMOUSE_FLG_DRIVER_FIRST 0x0100 // The first flag available for the driver
gPoint clickpos; // The position of the last click event
- systemticks_t clicktime; // The time of the last click event
+ gTicks clicktime; // The time of the last click event
GDisplay * display; // The display the mouse is associated with
#if !GINPUT_TOUCH_NOCALIBRATE
GMouseCalibration caldata; // The calibration data
diff --git a/src/gos/gos.h b/src/gos/gos.h
index f68c9fda..5db10fef 100644
--- a/src/gos/gos.h
+++ b/src/gos/gos.h
@@ -57,11 +57,11 @@
* @note Your platform may use slightly different definitions to these
* @{
*/
- typedef unsigned long delaytime_t;
- typedef unsigned long systemticks_t;
- typedef short semcount_t;
- typedef int threadreturn_t;
- typedef int threadpriority_t;
+ typedef unsigned long gDelay;
+ typedef unsigned long gTicks;
+ typedef short gSemcount;
+ typedef int gThreadreturn;
+ typedef int gThreadpriority;
/** @} */
/**
@@ -70,7 +70,7 @@
* @param[in] fnName The name of the function
* @param[in] param A custom parameter that is passed to the function
*/
- #define DECLARE_THREAD_FUNCTION(fnName, param) threadreturn_t fnName(void *param)
+ #define DECLARE_THREAD_FUNCTION(fnName, param) gThreadreturn fnName(void *param)
/**
* @brief Declare a thread stack
@@ -100,8 +100,8 @@
* @{
*/
#define TIME_IMMEDIATE 0
- #define TIME_INFINITE ((delaytime_t)-1)
- #define MAX_SEMAPHORE_COUNT ((semcount_t)(((unsigned long)((semcount_t)(-1))) >> 1))
+ #define TIME_INFINITE ((gDelay)-1)
+ #define MAX_SEMAPHORE_COUNT ((gSemcount)(((unsigned long)((gSemcount)(-1))) >> 1))
#define LOW_PRIORITY 0
#define NORMAL_PRIORITY 1
#define HIGH_PRIORITY 2
@@ -221,7 +221,7 @@
*
* @api
*/
- void gfxSleepMilliseconds(delaytime_t ms);
+ void gfxSleepMilliseconds(gDelay ms);
/**
* @brief Put the current thread to sleep for the specified period in microseconds
@@ -233,7 +233,7 @@
*
* @api
*/
- void gfxSleepMicroseconds(delaytime_t us);
+ void gfxSleepMicroseconds(gDelay us);
/**
* @brief Get the current operating system tick time
@@ -249,7 +249,7 @@
*
* @api
*/
- systemticks_t gfxSystemTicks(void);
+ gTicks gfxSystemTicks(void);
/**
* @brief Convert a given number of millseconds to a number of operating system ticks
@@ -262,7 +262,7 @@
*
* @api
*/
- systemticks_t gfxMillisecondsToTicks(delaytime_t ms);
+ gTicks gfxMillisecondsToTicks(gDelay ms);
/**
* @brief Lock the operating system to protect a sequence of code
@@ -344,7 +344,7 @@
*
* @api
*/
- void gfxSemInit(gfxSem *psem, semcount_t val, semcount_t limit);
+ void gfxSemInit(gfxSem *psem, gSemcount val, gSemcount limit);
/**
* @brief Destroy a Counted Semaphore
@@ -368,7 +368,7 @@
*
* @api
*/
- gBool gfxSemWait(gfxSem *psem, delaytime_t ms);
+ gBool gfxSemWait(gfxSem *psem, gDelay ms);
/**
* @brief Test if a wait on a semaphore can be satisfied immediately
@@ -420,7 +420,7 @@
*
* @api
*/
- gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
+ gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
/**
* @brief Wait for a thread to finish.
@@ -432,7 +432,7 @@
* once the thread has ended.
* @api
*/
- threadreturn_t gfxThreadWait(gfxThreadHandle thread);
+ gThreadreturn gfxThreadWait(gfxThreadHandle thread);
/**
* @brief Get the current thread handle.
@@ -493,5 +493,12 @@
#error "Your operating system is not supported yet"
#endif
+#if GFX_COMPAT_V2
+ typedef gDelay delaytime_t;
+ typedef gTicks systemticks_t;
+ typedef gThreadreturn threadreturn_t;
+ typedef gThreadpriority threadpriority_t;
+#endif
+
#endif /* _GOS_H */
/** @} */
diff --git a/src/gos/gos_arduino.c b/src/gos/gos_arduino.c
index 0eec8957..f1e0b340 100644
--- a/src/gos/gos_arduino.c
+++ b/src/gos/gos_arduino.c
@@ -72,10 +72,10 @@ void gfxExit(void) {
* Sleep functions
*********************************************************/
-systemticks_t gfxSystemTicks(void) {
+gTicks gfxSystemTicks(void) {
return millis();
}
-systemticks_t gfxMillisecondsToTicks(delaytime_t ms) {
+gTicks gfxMillisecondsToTicks(gDelay ms) {
return ms;
}
diff --git a/src/gos/gos_arduino.h b/src/gos/gos_arduino.h
index b14f812a..7aadfa75 100644
--- a/src/gos/gos_arduino.h
+++ b/src/gos/gos_arduino.h
@@ -17,8 +17,8 @@
* malloc(), realloc and free() - if GOS_RAW_HEAP_SIZE == 0
*
* You must also define the following routines in your own code so that timing functions will work...
- * systemticks_t gfxSystemTicks(void);
- * systemticks_t gfxMillisecondsToTicks(delaytime_t ms);
+ * gTicks gfxSystemTicks(void);
+ * gTicks gfxMillisecondsToTicks(gDelay ms);
*/
#ifndef _GOS_ARDUINO_H
#define _GOS_ARDUINO_H
diff --git a/src/gos/gos_chibios.c b/src/gos/gos_chibios.c
index 4d2358b5..ef7a3336 100644
--- a/src/gos/gos_chibios.c
+++ b/src/gos/gos_chibios.c
@@ -81,7 +81,7 @@ void *gfxRealloc(void *ptr, size_t oldsz, size_t newsz)
return np;
}
-void gfxSleepMilliseconds(delaytime_t ms)
+void gfxSleepMilliseconds(gDelay ms)
{
switch(ms) {
case TIME_IMMEDIATE: chThdYield(); return;
@@ -90,7 +90,7 @@ void gfxSleepMilliseconds(delaytime_t ms)
}
}
-void gfxSleepMicroseconds(delaytime_t ms)
+void gfxSleepMicroseconds(gDelay ms)
{
switch(ms) {
case TIME_IMMEDIATE: return;
@@ -99,7 +99,7 @@ void gfxSleepMicroseconds(delaytime_t ms)
}
}
-void gfxSemInit(gfxSem *psem, semcount_t val, semcount_t limit)
+void gfxSemInit(gfxSem *psem, gSemcount val, gSemcount limit)
{
if (val > limit)
val = limit;
@@ -118,7 +118,7 @@ void gfxSemDestroy(gfxSem *psem)
chSemReset(&psem->sem, 1);
}
-gBool gfxSemWait(gfxSem *psem, delaytime_t ms)
+gBool gfxSemWait(gfxSem *psem, gDelay ms)
{
#if CH_KERNEL_MAJOR <= 2
switch(ms) {
@@ -175,7 +175,7 @@ void gfxSemSignalI(gfxSem *psem)
#endif
}
-gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param)
+gfxThreadHandle gfxThreadCreate(void *stackarea, size_t 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 e1c5839f..77680a9c 100644
--- a/src/gos/gos_chibios.h
+++ b/src/gos/gos_chibios.h
@@ -31,28 +31,28 @@
*/
#if CH_KERNEL_MAJOR <= 4
- typedef systime_t delaytime_t;
+ typedef systime_t gDelay;
#else
- typedef sysinterval_t delaytime_t;
+ typedef sysinterval_t gDelay;
#endif
-typedef systime_t systemticks_t;
-typedef cnt_t semcount_t;
-typedef msg_t threadreturn_t;
-typedef tprio_t threadpriority_t;
+typedef systime_t gTicks;
+typedef cnt_t gSemcount;
+typedef msg_t gThreadreturn;
+typedef tprio_t gThreadpriority;
-#define MAX_SEMAPHORE_COUNT ((semcount_t)(((unsigned long)((semcount_t)(-1))) >> 1))
+#define MAX_SEMAPHORE_COUNT ((gSemcount)(((unsigned long)((gSemcount)(-1))) >> 1))
#define LOW_PRIORITY LOWPRIO
#define NORMAL_PRIORITY NORMALPRIO
#define HIGH_PRIORITY HIGHPRIO
#define DECLARE_THREAD_STACK(name, sz) WORKING_AREA(name, sz)
-#define DECLARE_THREAD_FUNCTION(fnName, param) threadreturn_t fnName(void *param)
+#define DECLARE_THREAD_FUNCTION(fnName, param) gThreadreturn fnName(void *param)
#define THREAD_RETURN(retval) return retval
#if CH_KERNEL_MAJOR <= 2
typedef struct {
Semaphore sem;
- semcount_t limit;
+ gSemcount limit;
} gfxSem;
typedef Mutex gfxMutex;
@@ -63,7 +63,7 @@ typedef tprio_t threadpriority_t;
typedef struct {
semaphore_t sem;
- semcount_t limit;
+ gSemcount limit;
} gfxSem;
typedef mutex_t gfxMutex;
@@ -104,15 +104,15 @@ typedef tprio_t threadpriority_t;
#define gfxMutexDestroy(pmutex) (void)pmutex
#define gfxMutexEnter(pmutex) chMtxLock(pmutex)
void *gfxRealloc(void *ptr, size_t oldsz, size_t newsz);
-void gfxSleepMilliseconds(delaytime_t ms);
-void gfxSleepMicroseconds(delaytime_t ms);
-void gfxSemInit(gfxSem *psem, semcount_t val, semcount_t limit);
+void gfxSleepMilliseconds(gDelay ms);
+void gfxSleepMicroseconds(gDelay ms);
+void gfxSemInit(gfxSem *psem, gSemcount val, gSemcount limit);
void gfxSemDestroy(gfxSem *psem);
-gBool gfxSemWait(gfxSem *psem, delaytime_t ms);
+gBool gfxSemWait(gfxSem *psem, gDelay ms);
gBool gfxSemWaitI(gfxSem *psem);
void gfxSemSignal(gfxSem *psem);
void gfxSemSignalI(gfxSem *psem);
-gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
+gfxThreadHandle gfxThreadCreate(void *stackarea, size_t 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 5859752b..00316142 100644
--- a/src/gos/gos_cmsis.c
+++ b/src/gos/gos_cmsis.c
@@ -46,7 +46,7 @@ void gfxMutexInit(gfxMutex* pmutex)
pmutex->id = osMutexCreate(&def);
}
-void gfxSemInit(gfxSem* psem, semcount_t val, semcount_t limit)
+void gfxSemInit(gfxSem* psem, gSemcount val, gSemcount limit)
{
osSemaphoreDef_t def;
def.semaphore = psem->semaphore;
@@ -61,7 +61,7 @@ void gfxSemDestroy(gfxSem* psem)
osSemaphoreDelete(psem->id);
}
-gBool gfxSemWait(gfxSem* psem, delaytime_t ms)
+gBool gfxSemWait(gfxSem* psem, gDelay ms)
{
if (osSemaphoreWait(psem->id, ms) > 0) {
psem->available++;
@@ -88,7 +88,7 @@ void gfxSemSignalI(gfxSem* psem)
}
}
-gfxThreadHandle gfxThreadCreate(void* stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION((*fn),p), void* param)
+gfxThreadHandle gfxThreadCreate(void* stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void* param)
{
osThreadDef_t def;
@@ -102,7 +102,7 @@ gfxThreadHandle gfxThreadCreate(void* stackarea, size_t stacksz, threadpriority_
return osThreadCreate(&def, param);
}
-threadreturn_t gfxThreadWait(gfxThreadHandle thread) {
+gThreadreturn gfxThreadWait(gfxThreadHandle thread) {
while(osThreadGetPriority(thread) == osPriorityError)
gfxYield();
}
diff --git a/src/gos/gos_cmsis.h b/src/gos/gos_cmsis.h
index 72b59ce9..4473b9d1 100644
--- a/src/gos/gos_cmsis.h
+++ b/src/gos/gos_cmsis.h
@@ -27,11 +27,11 @@
#define TIME_IMMEDIATE 0
#define TIME_INFINITE osWaitForever
-typedef uint32_t delaytime_t;
-typedef uint32_t systemticks_t;
-typedef uint16_t semcount_t;
-typedef void threadreturn_t;
-typedef osPriority threadpriority_t;
+typedef uint32_t gDelay;
+typedef uint32_t gTicks;
+typedef uint16_t gSemcount;
+typedef void gThreadreturn;
+typedef osPriority gThreadpriority;
#define MAX_SEMAPHORE_COUNT osFeature_Semaphore
#define LOW_PRIORITY osPriorityLow
@@ -41,7 +41,7 @@ typedef osPriority threadpriority_t;
typedef struct gfxSem {
uint32_t semaphore[2];
osSemaphoreId id;
- semcount_t available;
+ gSemcount available;
} gfxSem;
typedef struct gfxMutex {
@@ -52,7 +52,7 @@ typedef struct gfxMutex {
typedef osThreadId gfxThreadHandle;
#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_FUNCTION(fnName, param) threadreturn_t fnName(void* param)
+#define DECLARE_THREAD_FUNCTION(fnName, param) gThreadreturn fnName(void* param)
#define THREAD_RETURN(retval)
/*===========================================================================*/
@@ -72,14 +72,14 @@ void gfxMutexInit(gfxMutex* pmutex);
#define gfxMutexEnter(pmutex) osMutexWait((pmutex)->id, TIME_INFINITE)
#define gfxMutexExit(pmutex) osMutexRelease((pmutex)->id)
-void gfxSemInit(gfxSem* psem, semcount_t val, semcount_t limit);
+void gfxSemInit(gfxSem* psem, gSemcount val, gSemcount limit);
void gfxSemDestroy(gfxSem* psem);
-gBool gfxSemWait(gfxSem* psem, delaytime_t ms);
+gBool gfxSemWait(gfxSem* psem, gDelay ms);
gBool gfxSemWaitI(gfxSem* psem);
void gfxSemSignal(gfxSem* psem);
void gfxSemSignalI(gfxSem* psem);
-gfxThreadHandle gfxThreadCreate(void* stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION((*fn),p), void* param);
+gfxThreadHandle gfxThreadCreate(void* stackarea, size_t 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 46ee79cb..31c79164 100644
--- a/src/gos/gos_cmsis2.c
+++ b/src/gos/gos_cmsis2.c
@@ -64,19 +64,19 @@ void gfxMutexInit(gfxMutex* pmutex)
*pmutex = osMutexNew(NULL);
}
-void gfxSemInit(gfxSem* psem, semcount_t val, semcount_t limit)
+void gfxSemInit(gfxSem* psem, gSemcount val, gSemcount limit)
{
*psem = osSemaphoreNew(limit, val, NULL);
}
-gBool gfxSemWait(gfxSem* psem, delaytime_t ms)
+gBool gfxSemWait(gfxSem* psem, gDelay ms)
{
if (osSemaphoreAcquire(*psem, gfxMillisecondsToTicks(ms)) == osOK)
return gTrue;
return gFalse;
}
-gfxThreadHandle gfxThreadCreate(void* stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION((*fn),p), void* param)
+gfxThreadHandle gfxThreadCreate(void* stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void* param)
{
osThreadAttr_t def;
@@ -93,7 +93,7 @@ gfxThreadHandle gfxThreadCreate(void* stackarea, size_t stacksz, threadpriority_
return osThreadNew((osThreadFunc_t)fn, param, &def);
}
-threadreturn_t gfxThreadWait(gfxThreadHandle thread) {
+gThreadreturn gfxThreadWait(gfxThreadHandle thread) {
while(1) {
switch(osThreadGetState(thread)) {
case osThreadReady:
diff --git a/src/gos/gos_cmsis2.h b/src/gos/gos_cmsis2.h
index 7504d530..a6cde139 100644
--- a/src/gos/gos_cmsis2.h
+++ b/src/gos/gos_cmsis2.h
@@ -27,11 +27,11 @@
#define TIME_IMMEDIATE 0
#define TIME_INFINITE osWaitForever
-typedef uint32_t delaytime_t;
-typedef uint32_t systemticks_t;
-typedef uint16_t semcount_t;
-typedef void threadreturn_t;
-typedef osPriority_t threadpriority_t;
+typedef uint32_t gDelay;
+typedef uint32_t gTicks;
+typedef uint16_t gSemcount;
+typedef void gThreadreturn;
+typedef osPriority_t gThreadpriority;
#define MAX_SEMAPHORE_COUNT 65535UL
#define LOW_PRIORITY osPriorityLow
@@ -45,7 +45,7 @@ typedef osMutexId_t gfxMutex;
typedef osThreadId_t gfxThreadHandle;
#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_FUNCTION(fnName, param) threadreturn_t fnName(void* param)
+#define DECLARE_THREAD_FUNCTION(fnName, param) gThreadreturn fnName(void* param)
#define THREAD_RETURN(retval)
/*===========================================================================*/
@@ -65,14 +65,14 @@ void gfxMutexInit(gfxMutex* pmutex);
#define gfxMutexEnter(pmutex) osMutexAcquire(*(pmutex), TIME_INFINITE)
#define gfxMutexExit(pmutex) osMutexRelease(*(pmutex))
-void gfxSemInit(gfxSem* psem, semcount_t val, semcount_t limit);
+void gfxSemInit(gfxSem* psem, gSemcount val, gSemcount limit);
#define gfxSemDestroy(psem) osSemaphoreDelete(*(psem))
-gBool gfxSemWait(gfxSem* psem, delaytime_t ms);
+gBool gfxSemWait(gfxSem* psem, gDelay ms);
#define gfxSemWaitI(psem) gfxSemWait((psem), 0)
#define gfxSemSignal(psem) osSemaphoreRelease(*(psem))
#define gfxSemSignalI(psem) osSemaphoreRelease(*(psem))
-gfxThreadHandle gfxThreadCreate(void* stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION((*fn),p), void* param);
+gfxThreadHandle gfxThreadCreate(void* stackarea, size_t 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 2f875f0f..9b38d3b0 100644
--- a/src/gos/gos_ecos.c
+++ b/src/gos/gos_ecos.c
@@ -32,7 +32,7 @@ void _gosDeinit(void)
/* ToDo */
}
-void gfxSleepMilliseconds(delaytime_t ms)
+void gfxSleepMilliseconds(gDelay ms)
{
switch(ms) {
case TIME_IMMEDIATE: cyg_thread_yield(); return;
@@ -41,7 +41,7 @@ void gfxSleepMilliseconds(delaytime_t ms)
}
}
-void gfxSleepMicroseconds(delaytime_t ms)
+void gfxSleepMicroseconds(gDelay ms)
{
switch(ms) {
case TIME_IMMEDIATE: return;
@@ -50,7 +50,7 @@ void gfxSleepMicroseconds(delaytime_t ms)
}
}
-void gfxSemInit(gfxSem *psem, semcount_t val, semcount_t limit)
+void gfxSemInit(gfxSem *psem, gSemcount val, gSemcount limit)
{
if (val > limit)
val = limit;
@@ -64,7 +64,7 @@ void gfxSemDestroy(gfxSem *psem)
cyg_semaphore_destroy(&psem->sem);
}
-gBool gfxSemWait(gfxSem *psem, delaytime_t ms)
+gBool gfxSemWait(gfxSem *psem, gDelay ms)
{
switch(ms) {
case TIME_IMMEDIATE: return cyg_semaphore_trywait(&psem->sem);
@@ -96,7 +96,7 @@ void gfxSemSignalI(gfxSem *psem)
cyg_semaphore_post(&psem->sem);
}
-gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param)
+gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param)
{
gfxThreadHandle th;
diff --git a/src/gos/gos_ecos.h b/src/gos/gos_ecos.h
index 910924c0..6f360ba1 100644
--- a/src/gos/gos_ecos.h
+++ b/src/gos/gos_ecos.h
@@ -21,11 +21,11 @@
#define TIME_IMMEDIATE 0
#define TIME_INFINITE 0xFFFFFFFF
-typedef cyg_ucount32 delaytime_t;
-typedef cyg_tick_count_t systemticks_t;
-typedef cyg_count32 semcount_t;
-typedef void threadreturn_t;
-typedef cyg_addrword_t threadpriority_t;
+typedef cyg_ucount32 gDelay;
+typedef cyg_tick_count_t gTicks;
+typedef cyg_count32 gSemcount;
+typedef void gThreadreturn;
+typedef cyg_addrword_t gThreadpriority;
typedef cyg_handle_t gfxThreadHandle;
#define MAX_SEMAPHORE_COUNT 0x7FFFFFFF
@@ -34,12 +34,12 @@ typedef cyg_handle_t gfxThreadHandle;
#define HIGH_PRIORITY 0
#define DECLARE_THREAD_STACK(name, sz) struct { cyg_thread t; unsigned char stk[(sz) & ~3]; } name[1]
-#define DECLARE_THREAD_FUNCTION(fnName, param) threadreturn_t fnName(cyg_addrword_t param)
+#define DECLARE_THREAD_FUNCTION(fnName, param) gThreadreturn fnName(cyg_addrword_t param)
#define THREAD_RETURN(retval)
typedef struct {
cyg_sem_t sem;
- semcount_t limit;
+ gSemcount limit;
} gfxSem;
typedef cyg_mutex_t gfxMutex;
@@ -55,8 +55,8 @@ typedef cyg_mutex_t gfxMutex;
#define gfxYield() cyg_thread_yield()
#define gfxMillisecondsToTicks(ms) (((ms)*(CYGNUM_HAL_RTC_DENOMINATOR*1000))/(CYGNUM_HAL_RTC_NUMERATOR/1000))
-void gfxSleepMilliseconds(delaytime_t ms);
-void gfxSleepMicroseconds(delaytime_t ms);
+void gfxSleepMilliseconds(gDelay ms);
+void gfxSleepMicroseconds(gDelay ms);
#define gfxAlloc(sz) malloc(sz)
#define gfxFree(ptr) free(ptr)
@@ -70,14 +70,14 @@ void gfxSleepMicroseconds(delaytime_t ms);
#define gfxMutexDestroy(pmutex) cyg_mutex_destroy(pmutex)
#define gfxMutexEnter(pmutex) cyg_mutex_lock(pmutex)
-void gfxSemInit(gfxSem *psem, semcount_t val, semcount_t limit);
+void gfxSemInit(gfxSem *psem, gSemcount val, gSemcount limit);
void gfxSemDestroy(gfxSem *psem);
-gBool gfxSemWait(gfxSem *psem, delaytime_t ms);
+gBool gfxSemWait(gfxSem *psem, gDelay ms);
gBool gfxSemWaitI(gfxSem *psem);
void gfxSemSignal(gfxSem *psem);
void gfxSemSignalI(gfxSem *psem);
-gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
+gfxThreadHandle gfxThreadCreate(void *stackarea, size_t 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 025d57b2..d4aa0462 100644
--- a/src/gos/gos_freertos.c
+++ b/src/gos/gos_freertos.c
@@ -85,12 +85,12 @@ void* gfxRealloc(void *ptr, size_t oldsz, size_t newsz)
return np;
}
-void gfxSleepMilliseconds(delaytime_t ms)
+void gfxSleepMilliseconds(gDelay ms)
{
vTaskDelay(gfxMillisecondsToTicks(ms));
}
-void gfxSleepMicroseconds(delaytime_t ms)
+void gfxSleepMicroseconds(gDelay ms)
{
// delay milli seconds - microsecond resolution delay is not supported in FreeRTOS
@@ -106,7 +106,7 @@ void gfxMutexInit(gfxMutex *pmutex)
#endif
}
-void gfxSemInit(gfxSem* psem, semcount_t val, semcount_t limit)
+void gfxSemInit(gfxSem* psem, gSemcount val, gSemcount limit)
{
if (val > limit)
val = limit;
@@ -117,7 +117,7 @@ void gfxSemInit(gfxSem* psem, semcount_t val, semcount_t limit)
#endif
}
-gBool gfxSemWait(gfxSem* psem, delaytime_t ms)
+gBool gfxSemWait(gfxSem* psem, gDelay ms)
{
if (xSemaphoreTake(*psem, gfxMillisecondsToTicks(ms)) == pdPASS)
return gTrue;
@@ -146,7 +146,7 @@ void gfxSemSignalI(gfxSem* psem)
xSemaphoreGiveFromISR(*psem,&xHigherPriorityTaskWoken);
}
-gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param)
+gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param)
{
gfxThreadHandle task;
(void) stackarea;
@@ -165,7 +165,7 @@ gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_
}
#if INCLUDE_eTaskGetState == 1
- threadreturn_t gfxThreadWait(gfxThreadHandle thread) {
+ gThreadreturn gfxThreadWait(gfxThreadHandle thread) {
while (eTaskGetState(thread) != eDeleted)
gfxYield();
}
diff --git a/src/gos/gos_freertos.h b/src/gos/gos_freertos.h
index e7ee43b8..68831d02 100644
--- a/src/gos/gos_freertos.h
+++ b/src/gos/gos_freertos.h
@@ -25,21 +25,21 @@
/*===========================================================================*/
#define TIME_IMMEDIATE 0
-#define TIME_INFINITE ((delaytime_t)-1)
-typedef uint32_t delaytime_t;
-typedef portTickType systemticks_t;
-typedef int32_t semcount_t;
-typedef void threadreturn_t;
-typedef portBASE_TYPE threadpriority_t;
-
-#define MAX_SEMAPHORE_COUNT ((semcount_t)(((unsigned long)((semcount_t)(-1))) >> 1))
+#define TIME_INFINITE ((gDelay)-1)
+typedef uint32_t gDelay;
+typedef portTickType gTicks;
+typedef int32_t gSemcount;
+typedef void gThreadreturn;
+typedef portBASE_TYPE gThreadpriority;
+
+#define MAX_SEMAPHORE_COUNT ((gSemcount)(((unsigned long)((gSemcount)(-1))) >> 1))
#define LOW_PRIORITY 0
#define NORMAL_PRIORITY configMAX_PRIORITIES/2
#define HIGH_PRIORITY 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_FUNCTION(fnName, param) threadreturn_t fnName(void *param)
+#define DECLARE_THREAD_FUNCTION(fnName, param) gThreadreturn fnName(void *param)
#define THREAD_RETURN(retval)
typedef xSemaphoreHandle gfxSem;
@@ -56,7 +56,7 @@ typedef xTaskHandle gfxThreadHandle;
#define gfxFree(ptr) vPortFree(ptr)
#define gfxYield() taskYIELD()
#define gfxSystemTicks() xTaskGetTickCount()
-#define gfxMillisecondsToTicks(ms) ((systemticks_t)((ms) / portTICK_PERIOD_MS))
+#define gfxMillisecondsToTicks(ms) ((gTicks)((ms) / portTICK_PERIOD_MS))
#define gfxSystemLock() taskENTER_CRITICAL()
#define gfxSystemUnlock() taskEXIT_CRITICAL()
@@ -66,20 +66,20 @@ void gfxMutexInit(gfxMutex* s);
#define gfxMutexExit(pmutex) xSemaphoreGive(*(pmutex))
void *gfxRealloc(void *ptr, size_t oldsz, size_t newsz);
-void gfxSleepMilliseconds(delaytime_t ms);
-void gfxSleepMicroseconds(delaytime_t ms);
+void gfxSleepMilliseconds(gDelay ms);
+void gfxSleepMicroseconds(gDelay ms);
-void gfxSemInit(gfxSem* psem, semcount_t val, semcount_t limit);
+void gfxSemInit(gfxSem* psem, gSemcount val, gSemcount limit);
#define gfxSemDestroy(psem) vSemaphoreDelete(*(psem))
-gBool gfxSemWait(gfxSem* psem, delaytime_t ms);
+gBool gfxSemWait(gfxSem* psem, gDelay ms);
gBool gfxSemWaitI(gfxSem* psem);
void gfxSemSignal(gfxSem* psem);
void gfxSemSignalI(gfxSem* psem);
-gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
+gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
#define gfxThreadMe() xTaskGetCurrentTaskHandle()
#if INCLUDE_eTaskGetState == 1
- threadreturn_t gfxThreadWait(gfxThreadHandle thread);
+ gThreadreturn gfxThreadWait(gfxThreadHandle thread);
#endif
#define gfxThreadClose(thread)
diff --git a/src/gos/gos_linux.c b/src/gos/gos_linux.c
index 7e71ca95..ca6b2576 100644
--- a/src/gos/gos_linux.c
+++ b/src/gos/gos_linux.c
@@ -60,7 +60,7 @@ void gfxHalt(const char *msg) {
exit(1);
}
-void gfxSleepMilliseconds(delaytime_t ms) {
+void gfxSleepMilliseconds(gDelay ms) {
struct timespec ts;
switch(ms) {
@@ -81,7 +81,7 @@ void gfxSleepMilliseconds(delaytime_t ms) {
}
}
-void gfxSleepMicroseconds(delaytime_t us) {
+void gfxSleepMicroseconds(gDelay us) {
struct timespec ts;
switch(us) {
@@ -102,14 +102,14 @@ void gfxSleepMicroseconds(delaytime_t us) {
}
}
-systemticks_t gfxSystemTicks(void) {
+gTicks gfxSystemTicks(void) {
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
return ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
}
-gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param) {
+gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param) {
gfxThreadHandle th;
(void) stackarea;
(void) stacksz;
@@ -128,8 +128,8 @@ gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_
return th;
}
-threadreturn_t gfxThreadWait(gfxThreadHandle thread) {
- threadreturn_t retval;
+gThreadreturn gfxThreadWait(gfxThreadHandle thread) {
+ gThreadreturn retval;
if (pthread_join(thread, &retval))
return 0;
@@ -138,14 +138,14 @@ threadreturn_t gfxThreadWait(gfxThreadHandle thread) {
}
#if GFX_USE_POSIX_SEMAPHORES
- void gfxSemInit(gfxSem *pSem, semcount_t val, semcount_t limit) {
+ void gfxSemInit(gfxSem *pSem, gSemcount val, gSemcount limit) {
pSem->max = limit;
sem_init(&pSem->sem, 0, val);
}
void gfxSemDestroy(gfxSem *pSem) {
sem_destroy(&pSem->sem);
}
- gBool gfxSemWait(gfxSem *pSem, delaytime_t ms) {
+ gBool gfxSemWait(gfxSem *pSem, gDelay ms) {
switch (ms) {
case TIME_INFINITE:
return sem_wait(&pSem->sem) ? gFalse : gTrue;
@@ -173,7 +173,7 @@ threadreturn_t gfxThreadWait(gfxThreadHandle thread) {
sem_post(&pSem->sem);
}
#else
- void gfxSemInit(gfxSem *pSem, semcount_t val, semcount_t limit) {
+ void gfxSemInit(gfxSem *pSem, gSemcount val, gSemcount limit) {
pthread_mutex_init(&pSem->mtx, 0);
pthread_cond_init(&pSem->cond, 0);
pthread_mutex_lock(&pSem->mtx);
@@ -185,7 +185,7 @@ threadreturn_t gfxThreadWait(gfxThreadHandle thread) {
pthread_mutex_destroy(&pSem->mtx);
pthread_cond_destroy(&pSem->cond);
}
- gBool gfxSemWait(gfxSem *pSem, delaytime_t ms) {
+ gBool gfxSemWait(gfxSem *pSem, gDelay ms) {
pthread_mutex_lock(&pSem->mtx);
switch (ms) {
diff --git a/src/gos/gos_linux.h b/src/gos/gos_linux.h
index 3d463226..201ee61c 100644
--- a/src/gos/gos_linux.h
+++ b/src/gos/gos_linux.h
@@ -23,15 +23,15 @@
#include <semaphore.h>
#endif
-typedef unsigned long systemticks_t;
-typedef void * threadreturn_t;
-typedef unsigned long delaytime_t;
+typedef unsigned long gTicks;
+typedef void * gThreadreturn;
+typedef unsigned long gDelay;
typedef pthread_t gfxThreadHandle;
-typedef int threadpriority_t;
-typedef uint32_t semcount_t;
+typedef int gThreadpriority;
+typedef uint32_t gSemcount;
typedef pthread_mutex_t gfxMutex;
-#define DECLARE_THREAD_FUNCTION(fnName, param) threadreturn_t fnName(void *param)
+#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
@@ -50,8 +50,8 @@ typedef pthread_mutex_t gfxMutex;
#define gfxSemSignalI(psem) gfxSemSignal(psem)
#define TIME_IMMEDIATE 0
-#define TIME_INFINITE ((delaytime_t)-1)
-#define MAX_SEMAPHORE_COUNT ((semcount_t)-1)
+#define TIME_INFINITE ((gDelay)-1)
+#define MAX_SEMAPHORE_COUNT ((gSemcount)-1)
#define LOW_PRIORITY 10
#define NORMAL_PRIORITY 0
#define HIGH_PRIORITY -10
@@ -59,14 +59,14 @@ typedef pthread_mutex_t gfxMutex;
#if GFX_USE_POSIX_SEMAPHORES
typedef struct gfxSem {
sem_t sem;
- semcount_t max;
+ gSemcount max;
} gfxSem;
#else
typedef struct gfxSem {
pthread_mutex_t mtx;
pthread_cond_t cond;
- semcount_t cnt;
- semcount_t max;
+ gSemcount cnt;
+ gSemcount max;
} gfxSem;
#endif
@@ -76,17 +76,17 @@ typedef pthread_mutex_t gfxMutex;
void gfxYield(void);
void gfxHalt(const char *msg);
-void gfxSleepMilliseconds(delaytime_t ms);
-void gfxSleepMicroseconds(delaytime_t ms);
-systemticks_t gfxSystemTicks(void);
+void gfxSleepMilliseconds(gDelay ms);
+void gfxSleepMicroseconds(gDelay ms);
+gTicks gfxSystemTicks(void);
void gfxSystemLock(void);
void gfxSystemUnlock(void);
-void gfxSemInit(gfxSem *psem, semcount_t val, semcount_t limit);
+void gfxSemInit(gfxSem *psem, gSemcount val, gSemcount limit);
void gfxSemDestroy(gfxSem *psem);
-gBool gfxSemWait(gfxSem *psem, delaytime_t ms);
+gBool gfxSemWait(gfxSem *psem, gDelay ms);
void gfxSemSignal(gfxSem *psem);
-gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
-threadreturn_t gfxThreadWait(gfxThreadHandle thread);
+gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
+gThreadreturn gfxThreadWait(gfxThreadHandle thread);
#endif /* GFX_USE_OS_LINUX */
diff --git a/src/gos/gos_nios.c b/src/gos/gos_nios.c
index b7709c8c..90d625fa 100644
--- a/src/gos/gos_nios.c
+++ b/src/gos/gos_nios.c
@@ -52,12 +52,12 @@ void gfxExit(void) {
}
}
-systemticks_t gfxSystemTicks(void)
+gTicks gfxSystemTicks(void)
{
return alt_nticks();
}
-systemticks_t gfxMillisecondsToTicks(delaytime_t ms)
+gTicks gfxMillisecondsToTicks(gDelay ms)
{
return ms;
}
diff --git a/src/gos/gos_nios.h b/src/gos/gos_nios.h
index 3ef7756f..463607b5 100644
--- a/src/gos/gos_nios.h
+++ b/src/gos/gos_nios.h
@@ -12,13 +12,13 @@
#include <sys/alt_alarm.h>
-typedef alt_u32 systemticks_t;
-typedef alt_u32 delaytime_t;
+typedef alt_u32 gTicks;
+typedef alt_u32 gDelay;
void gfxHalt(const char* msg);
void gfxExit(void);
-systemticks_t gfxSystemTicks(void);
-systemticks_t gfxMillisecondsToTicks(delaytime_t ms);
+gTicks gfxSystemTicks(void);
+gTicks gfxMillisecondsToTicks(gDelay ms);
// Use the generic thread handling and heap handling
#define GOS_NEED_X_THREADS GFXON
diff --git a/src/gos/gos_osx.c b/src/gos/gos_osx.c
index a09647ee..5aae802f 100644
--- a/src/gos/gos_osx.c
+++ b/src/gos/gos_osx.c
@@ -53,7 +53,7 @@ void gfxHalt(const char *msg) {
exit(1);
}
-void gfxSleepMilliseconds(delaytime_t ms) {
+void gfxSleepMilliseconds(gDelay ms) {
struct timespec ts;
switch(ms) {
@@ -67,7 +67,7 @@ void gfxSleepMilliseconds(delaytime_t ms) {
}
}
-void gfxSleepMicroseconds(delaytime_t us) {
+void gfxSleepMicroseconds(gDelay us) {
struct timespec ts;
switch(us) {
@@ -81,7 +81,7 @@ void gfxSleepMicroseconds(delaytime_t us) {
}
}
-systemticks_t gfxSystemTicks(void) {
+gTicks gfxSystemTicks(void) {
mach_timespec_t ts;
clock_serv_t cclock;
@@ -92,7 +92,7 @@ systemticks_t gfxSystemTicks(void) {
return ts.tv_sec * 1000UL + ts.tv_nsec / 1000000;
}
-gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param) {
+gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param) {
gfxThreadHandle th;
(void) stackarea;
(void) stacksz;
@@ -110,15 +110,15 @@ gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_
return th;
}
-threadreturn_t gfxThreadWait(gfxThreadHandle thread) {
- threadreturn_t retval;
+gThreadreturn gfxThreadWait(gfxThreadHandle thread) {
+ gThreadreturn retval;
if (pthread_join(thread, &retval))
return 0;
return retval;
}
-void gfxSemInit(gfxSem *pSem, semcount_t val, semcount_t limit) {
+void gfxSemInit(gfxSem *pSem, gSemcount val, gSemcount limit) {
pthread_mutex_init(&pSem->mtx, 0);
pthread_cond_init(&pSem->cond, 0);
pthread_mutex_lock(&pSem->mtx);
@@ -132,7 +132,7 @@ void gfxSemDestroy(gfxSem *pSem) {
pthread_cond_destroy(&pSem->cond);
}
-gBool gfxSemWait(gfxSem *pSem, delaytime_t ms) {
+gBool gfxSemWait(gfxSem *pSem, gDelay ms) {
pthread_mutex_lock(&pSem->mtx);
switch (ms) {
case TIME_INFINITE:
diff --git a/src/gos/gos_osx.h b/src/gos/gos_osx.h
index 6b5a762a..33ead2b4 100644
--- a/src/gos/gos_osx.h
+++ b/src/gos/gos_osx.h
@@ -14,15 +14,15 @@
#include <pthread.h>
#include <stdlib.h>
-typedef unsigned long systemticks_t;
-typedef void * threadreturn_t;
-typedef unsigned long delaytime_t;
+typedef unsigned long gTicks;
+typedef void * gThreadreturn;
+typedef unsigned long gDelay;
typedef pthread_t gfxThreadHandle;
-typedef int threadpriority_t;
-typedef uint32_t semcount_t;
+typedef int gThreadpriority;
+typedef uint32_t gSemcount;
typedef pthread_mutex_t gfxMutex;
-#define DECLARE_THREAD_FUNCTION(fnName, param) threadreturn_t fnName(void *param)
+#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
@@ -42,8 +42,8 @@ typedef pthread_mutex_t gfxMutex;
#define gfxSemSignalI(psem) gfxSemSignal(psem)
#define TIME_IMMEDIATE 0
-#define TIME_INFINITE ((delaytime_t)-1)
-#define MAX_SEMAPHORE_COUNT ((semcount_t)-1)
+#define TIME_INFINITE ((gDelay)-1)
+#define MAX_SEMAPHORE_COUNT ((gSemcount)-1)
#define LOW_PRIORITY 10
#define NORMAL_PRIORITY 0
#define HIGH_PRIORITY -10
@@ -51,8 +51,8 @@ typedef pthread_mutex_t gfxMutex;
typedef struct gfxSem {
pthread_mutex_t mtx;
pthread_cond_t cond;
- semcount_t cnt;
- semcount_t max;
+ gSemcount cnt;
+ gSemcount max;
} gfxSem;
/*===========================================================================*/
@@ -60,17 +60,17 @@ typedef struct gfxSem {
/*===========================================================================*/
void gfxHalt(const char *msg);
-void gfxSleepMilliseconds(delaytime_t ms);
-void gfxSleepMicroseconds(delaytime_t ms);
-systemticks_t gfxSystemTicks(void);
+void gfxSleepMilliseconds(gDelay ms);
+void gfxSleepMicroseconds(gDelay ms);
+gTicks gfxSystemTicks(void);
void gfxSystemLock(void);
void gfxSystemUnlock(void);
-void gfxSemInit(gfxSem *psem, semcount_t val, semcount_t limit);
+void gfxSemInit(gfxSem *psem, gSemcount val, gSemcount limit);
void gfxSemDestroy(gfxSem *psem);
-gBool gfxSemWait(gfxSem *psem, delaytime_t ms);
+gBool gfxSemWait(gfxSem *psem, gDelay ms);
void gfxSemSignal(gfxSem *psem);
-gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
-threadreturn_t gfxThreadWait(gfxThreadHandle thread);
+gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
+gThreadreturn gfxThreadWait(gfxThreadHandle thread);
#endif /* GFX_USE_OS_OSX */
#endif /* _GOS_OSX_H */
diff --git a/src/gos/gos_qt.cpp b/src/gos/gos_qt.cpp
index 4171d4fe..3aa0f7be 100644
--- a/src/gos/gos_qt.cpp
+++ b/src/gos/gos_qt.cpp
@@ -18,7 +18,7 @@ extern "C" void _gosPostInit(void);
class Thread : public QThread
{
public:
- typedef threadreturn_t (*fptr)(void* param);
+ typedef gThreadreturn (*fptr)(void* param);
void setFunction(fptr function, void* param)
{
@@ -26,7 +26,7 @@ public:
_param = param;
}
- threadreturn_t returnValue()
+ gThreadreturn returnValue()
{
return _returnValue;
}
@@ -43,7 +43,7 @@ public:
private:
fptr _function;
void* _param;
- threadreturn_t _returnValue;
+ gThreadreturn _returnValue;
};
static QElapsedTimer _systickTimer;
@@ -103,22 +103,22 @@ void gfxYield(void)
QThread::msleep(0);
}
-void gfxSleepMilliseconds(delaytime_t ms)
+void gfxSleepMilliseconds(gDelay ms)
{
QThread::msleep(ms);
}
-void gfxSleepMicroseconds(delaytime_t us)
+void gfxSleepMicroseconds(gDelay us)
{
QThread::usleep(us);
}
-systemticks_t gfxSystemTicks(void)
+gTicks gfxSystemTicks(void)
{
return _systickTimer.elapsed();
}
-systemticks_t gfxMillisecondsToTicks(delaytime_t ms)
+gTicks gfxMillisecondsToTicks(gDelay ms)
{
return ms;
}
@@ -153,7 +153,7 @@ void gfxMutexExit(gfxMutex *pmutex)
static_cast<QMutex*>(*pmutex)->unlock();
}
-void gfxSemInit(gfxSem *psem, semcount_t val, semcount_t limit)
+void gfxSemInit(gfxSem *psem, gSemcount val, gSemcount limit)
{
*psem = new QSemaphore(limit);
@@ -165,7 +165,7 @@ void gfxSemDestroy(gfxSem *psem)
delete static_cast<QSemaphore*>(*psem);
}
-gBool gfxSemWait(gfxSem *psem, delaytime_t ms)
+gBool gfxSemWait(gfxSem *psem, gDelay ms)
{
return static_cast<QSemaphore*>(*psem)->tryAcquire(1, ms);
}
@@ -185,7 +185,7 @@ void gfxSemSignalI(gfxSem *psem)
static_cast<QSemaphore*>(*psem)->release(1);
}
-gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param)
+gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param)
{
Q_UNUSED(stackarea)
@@ -199,11 +199,11 @@ gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_
return static_cast<gfxThreadHandle>(thread);
}
-threadreturn_t gfxThreadWait(gfxThreadHandle thread)
+gThreadreturn gfxThreadWait(gfxThreadHandle thread)
{
Thread* t = static_cast<Thread*>(thread);
- threadreturn_t returnValue = t->returnValue();
+ gThreadreturn returnValue = t->returnValue();
t->wait();
t->exit();
diff --git a/src/gos/gos_qt.h b/src/gos/gos_qt.h
index 367e2a87..fe9c5e34 100644
--- a/src/gos/gos_qt.h
+++ b/src/gos/gos_qt.h
@@ -10,24 +10,24 @@
#if GFX_USE_OS_QT
-#define DECLARE_THREAD_FUNCTION(fnName, param) threadreturn_t fnName(void *param)
+#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 TIME_IMMEDIATE 0
-#define TIME_INFINITE ((delaytime_t)-1)
-#define MAX_SEMAPHORE_COUNT ((semcount_t)(((unsigned long)((semcount_t)(-1))) >> 1))
+#define TIME_INFINITE ((gDelay)-1)
+#define MAX_SEMAPHORE_COUNT ((gSemcount)(((unsigned long)((gSemcount)(-1))) >> 1))
#define LOW_PRIORITY 2
#define NORMAL_PRIORITY 3
#define HIGH_PRIORITY 4
-typedef int systemticks_t;
-typedef int delaytime_t;
+typedef int gTicks;
+typedef int gDelay;
typedef void* gfxMutex;
typedef void* gfxSem;
-typedef int semcount_t;
-typedef int threadreturn_t;
-typedef int threadpriority_t;
+typedef int gSemcount;
+typedef int gThreadreturn;
+typedef int gThreadpriority;
typedef void* gfxThreadHandle;
void _gosInit();
@@ -39,24 +39,24 @@ void* gfxAlloc(size_t sz);
void* gfxRealloc(void *ptr, size_t oldsz, size_t newsz);
void gfxFree(void* ptr);
void gfxYield(void);
-void gfxSleepMilliseconds(delaytime_t ms);
-void gfxSleepMicroseconds(delaytime_t us);
-systemticks_t gfxSystemTicks(void);
-systemticks_t gfxMillisecondsToTicks(delaytime_t ms);
+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, semcount_t val, semcount_t limit);
+void gfxSemInit(gfxSem *psem, gSemcount val, gSemcount limit);
void gfxSemDestroy(gfxSem *psem);
-gBool gfxSemWait(gfxSem *psem, delaytime_t ms);
+gBool gfxSemWait(gfxSem *psem, gDelay ms);
gBool gfxSemWaitI(gfxSem *psem);
void gfxSemSignal(gfxSem *psem);
void gfxSemSignalI(gfxSem *psem);
-gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
-threadreturn_t gfxThreadWait(gfxThreadHandle thread);
+gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
+gThreadreturn gfxThreadWait(gfxThreadHandle thread);
gfxThreadHandle gfxThreadMe(void);
void gfxThreadClose(gfxThreadHandle thread);
diff --git a/src/gos/gos_raw32.c b/src/gos/gos_raw32.c
index 63769d65..cfaac53f 100644
--- a/src/gos/gos_raw32.c
+++ b/src/gos/gos_raw32.c
@@ -74,8 +74,8 @@ void _gosDeinit(void)
#endif
#include <stdio.h>
- systemticks_t gfxSystemTicks(void) { return GetTickCount(); }
- systemticks_t gfxMillisecondsToTicks(delaytime_t ms) { return ms; }
+ gTicks gfxSystemTicks(void) { return GetTickCount(); }
+ gTicks gfxMillisecondsToTicks(gDelay ms) { return ms; }
#endif
/*********************************************************
diff --git a/src/gos/gos_raw32.h b/src/gos/gos_raw32.h
index 6b6bce93..7a936afe 100644
--- a/src/gos/gos_raw32.h
+++ b/src/gos/gos_raw32.h
@@ -17,8 +17,8 @@
* malloc(), realloc and free() - if GOS_RAW_HEAP_SIZE == 0
*
* You must also define the following routines in your own code so that timing functions will work...
- * systemticks_t gfxSystemTicks(void);
- * systemticks_t gfxMillisecondsToTicks(delaytime_t ms);
+ * gTicks gfxSystemTicks(void);
+ * gTicks gfxMillisecondsToTicks(gDelay ms);
*/
#ifndef _GOS_RAW32_H
#define _GOS_RAW32_H
diff --git a/src/gos/gos_rawrtos.c b/src/gos/gos_rawrtos.c
index fd50a3f7..b39b0701 100644
--- a/src/gos/gos_rawrtos.c
+++ b/src/gos/gos_rawrtos.c
@@ -45,23 +45,23 @@ void _gosDeinit(void)
}
-void gfxSleepMilliseconds(delaytime_t ms)
+void gfxSleepMilliseconds(gDelay ms)
{
- systemticks_t ticks = ms*RAW_TICKS_PER_SECOND/1000;
+ gTicks ticks = ms*RAW_TICKS_PER_SECOND/1000;
if(!ticks)ticks = 1;
raw_sleep(ticks);
}
-void gfxSleepMicroseconds(delaytime_t us)
+void gfxSleepMicroseconds(gDelay us)
{
- systemticks_t ticks = (us/1000)*RAW_TICKS_PER_SECOND/1000;
+ gTicks ticks = (us/1000)*RAW_TICKS_PER_SECOND/1000;
if(!ticks)ticks = 1;
raw_sleep(ticks);
}
-gBool gfxSemWait(gfxSem* psem, delaytime_t ms)
+gBool gfxSemWait(gfxSem* psem, gDelay ms)
{
- systemticks_t ticks = ms*RAW_TICKS_PER_SECOND/1000;
+ gTicks ticks = ms*RAW_TICKS_PER_SECOND/1000;
if(!ticks)ticks=1;
if(raw_semaphore_get((psem), ticks)==RAW_SUCCESS)
return gTrue;
@@ -75,7 +75,7 @@ gBool gfxSemWaitI(gfxSem* psem)
return gFalse;
}
-gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param)
+gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param)
{
RAW_U16 ret;
gfxThreadHandle taskobj;
diff --git a/src/gos/gos_rawrtos.h b/src/gos/gos_rawrtos.h
index 8dc5549e..355c766f 100644
--- a/src/gos/gos_rawrtos.h
+++ b/src/gos/gos_rawrtos.h
@@ -7,11 +7,11 @@
#define TIME_IMMEDIATE (RAW_NO_WAIT)
#define TIME_INFINITE (RAW_WAIT_FOREVER)
-typedef uint32_t delaytime_t;
-typedef RAW_TICK_TYPE systemticks_t;
-typedef int32_t semcount_t;
-typedef uint32_t threadreturn_t;
-typedef RAW_U8 threadpriority_t;
+typedef uint32_t gDelay;
+typedef RAW_TICK_TYPE gTicks;
+typedef int32_t gSemcount;
+typedef uint32_t gThreadreturn;
+typedef RAW_U8 gThreadpriority;
#define MAX_SEMAPHORE_COUNT RAW_SEMAPHORE_COUNT
#define LOW_PRIORITY (CONFIG_RAW_PRIO_MAX-2)
@@ -22,7 +22,7 @@ typedef RAW_SEMAPHORE gfxSem;
typedef RAW_MUTEX gfxMutex;
typedef RAW_TASK_OBJ* gfxThreadHandle;
-#define DECLARE_THREAD_FUNCTION(fnName, param) threadreturn_t fnName(void *param)
+#define DECLARE_THREAD_FUNCTION(fnName, param) gThreadreturn fnName(void *param)
#define DECLARE_THREAD_STACK(name, sz) PORT_STACK name[(sz) & ~3];
#define THREAD_RETURN(retval) return retval
@@ -63,11 +63,11 @@ extern RAW_U16 raw_semaphore_delete(RAW_SEMAPHORE *semaphore_ptr);
extern RAW_U16 raw_semaphore_get(RAW_SEMAPHORE *semaphore_ptr, RAW_TICK_TYPE wait_option);
extern RAW_U16 raw_semaphore_put(RAW_SEMAPHORE *semaphore_ptr);
-void gfxSleepMilliseconds(delaytime_t ms);
-void gfxSleepMicroseconds(delaytime_t us);
-gBool gfxSemWait(gfxSem* psem, delaytime_t ms);
+void gfxSleepMilliseconds(gDelay ms);
+void gfxSleepMicroseconds(gDelay us);
+gBool gfxSemWait(gfxSem* psem, gDelay ms);
gBool gfxSemWaitI(gfxSem* psem);
-gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
+gfxThreadHandle gfxThreadCreate(void *stackarea, size_t 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 11b2e0aa..c2511dfa 100644
--- a/src/gos/gos_win32.c
+++ b/src/gos/gos_win32.c
@@ -37,7 +37,7 @@ void gfxHalt(const char *msg) {
ExitProcess(1);
}
-void gfxSleepMicroseconds(delaytime_t ms) {
+void gfxSleepMicroseconds(gDelay ms) {
static LARGE_INTEGER pcfreq;
static int initflag;
LARGE_INTEGER t1, t2, tdiff;
@@ -74,7 +74,7 @@ void gfxSystemUnlock(void) {
ReleaseMutex(SystemMutex);
}
-gBool gfxSemWait(gfxSem *psem, delaytime_t ms) {
+gBool gfxSemWait(gfxSem *psem, gDelay ms) {
return WaitForSingleObject(*psem, ms) == WAIT_OBJECT_0;
}
@@ -87,7 +87,7 @@ typedef LONG (__stdcall *_NtQuerySemaphore)(
);
/* - Left here simply because of its undocumented cleverness...
-semcount_t gfxSemCounter(gfxSem *pSem) {
+gSemcount gfxSemCounter(gfxSem *pSem) {
static _NtQuerySemaphore NtQuerySemaphore;
struct _SEMAPHORE_BASIC_INFORMATION {
ULONG CurrentCount;
@@ -103,7 +103,7 @@ semcount_t gfxSemCounter(gfxSem *pSem) {
}
*/
-gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION(*fn,p), void *param) {
+gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION(*fn,p), void *param) {
(void) stackarea;
HANDLE thd;
@@ -116,7 +116,7 @@ gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_
return thd;
}
-threadreturn_t gfxThreadWait(gfxThreadHandle thread) {
+gThreadreturn gfxThreadWait(gfxThreadHandle thread) {
DWORD ret;
WaitForSingleObject(thread, INFINITE);
diff --git a/src/gos/gos_win32.h b/src/gos/gos_win32.h
index 3cdd5214..10412119 100644
--- a/src/gos/gos_win32.h
+++ b/src/gos/gos_win32.h
@@ -25,19 +25,19 @@
#include <malloc.h>
-typedef DWORD delaytime_t;
-typedef DWORD systemticks_t;
-typedef LONG semcount_t;
-typedef DWORD threadreturn_t;
-typedef int threadpriority_t;
+typedef DWORD gDelay;
+typedef DWORD gTicks;
+typedef LONG gSemcount;
+typedef DWORD gThreadreturn;
+typedef int gThreadpriority;
-#define DECLARE_THREAD_FUNCTION(fnName, param) threadreturn_t (WINAPI fnName)(void *param)
+#define DECLARE_THREAD_FUNCTION(fnName, param) gThreadreturn (WINAPI fnName)(void *param)
#define DECLARE_THREAD_STACK(name, sz) uint8_t name[1];
#define THREAD_RETURN(retval) return retval
#define TIME_IMMEDIATE 0
#define TIME_INFINITE INFINITE
-#define MAX_SEMAPHORE_COUNT ((semcount_t)(((unsigned long)((semcount_t)(-1))) >> 1))
+#define MAX_SEMAPHORE_COUNT ((gSemcount)(((unsigned long)((gSemcount)(-1))) >> 1))
#define LOW_PRIORITY THREAD_PRIORITY_BELOW_NORMAL
#define NORMAL_PRIORITY THREAD_PRIORITY_NORMAL
#define HIGH_PRIORITY THREAD_PRIORITY_ABOVE_NORMAL
@@ -71,12 +71,12 @@ typedef HANDLE gfxThreadHandle;
/*===========================================================================*/
void gfxHalt(const char *msg);
-void gfxSleepMicroseconds(delaytime_t ms);
-gBool gfxSemWait(gfxSem *psem, delaytime_t ms);
+void gfxSleepMicroseconds(gDelay ms);
+gBool gfxSemWait(gfxSem *psem, gDelay ms);
void gfxSystemLock(void);
void gfxSystemUnlock(void);
-gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION(*fn,p), void *param);
-threadreturn_t gfxThreadWait(gfxThreadHandle thread);
+gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION(*fn,p), void *param);
+gThreadreturn gfxThreadWait(gfxThreadHandle thread);
#endif /* GFX_USE_OS_WIN32 */
#endif /* _GOS_WIN32_H */
diff --git a/src/gos/gos_x_threads.c b/src/gos/gos_x_threads.c
index efff9f20..a4a3eb31 100644
--- a/src/gos/gos_x_threads.c
+++ b/src/gos/gos_x_threads.c
@@ -45,13 +45,13 @@ void gfxMutexExit(gfxMutex *pmutex) {
pmutex[0] = 0;
}
-void gfxSemInit(gfxSem *psem, semcount_t val, semcount_t limit) {
+void gfxSemInit(gfxSem *psem, gSemcount val, gSemcount limit) {
psem->cnt = val;
psem->limit = limit;
}
-gBool gfxSemWait(gfxSem *psem, delaytime_t ms) {
- systemticks_t starttm, delay;
+gBool gfxSemWait(gfxSem *psem, gDelay ms) {
+ gTicks starttm, delay;
// Convert our delay to ticks
starttm = 0;
@@ -112,8 +112,8 @@ void gfxSemSignalI(gfxSem *psem) {
* Sleep functions
*********************************************************/
-void gfxSleepMilliseconds(delaytime_t ms) {
- systemticks_t starttm, delay;
+void gfxSleepMilliseconds(gDelay ms) {
+ gTicks starttm, delay;
// Safety first
switch (ms) {
@@ -134,8 +134,8 @@ void gfxSleepMilliseconds(delaytime_t ms) {
} while (gfxSystemTicks() - starttm < delay);
}
-void gfxSleepMicroseconds(delaytime_t ms) {
- systemticks_t starttm, delay;
+void gfxSleepMicroseconds(gDelay ms) {
+ gTicks starttm, delay;
// Safety first
switch (ms) {
@@ -176,7 +176,7 @@ typedef struct thread {
#define FLG_THD_DEAD 0x0004
#define FLG_THD_WAIT 0x0008
size_t size; // Size of the thread stack (including this structure)
- threadreturn_t (*fn)(void *param); // Thread function
+ gThreadreturn (*fn)(void *param); // Thread function
void * param; // Parameter for the thread function
void * cxt; // The current thread context.
} thread;
@@ -485,7 +485,7 @@ void gfxYield(void) {
}
// This routine is not currently public - but it could be.
-void gfxThreadExit(threadreturn_t ret) {
+void gfxThreadExit(gThreadreturn ret) {
thread *me;
// Save the results in case someone is waiting
@@ -508,7 +508,7 @@ void gfxThreadExit(threadreturn_t ret) {
// We never get back here as we didn't re-queue ourselves
}
-gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param) {
+gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param) {
thread * t;
thread * me;
(void) prio;
@@ -543,7 +543,7 @@ gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_
return t;
}
-threadreturn_t gfxThreadWait(gfxThreadHandle th) {
+gThreadreturn gfxThreadWait(gfxThreadHandle th) {
thread * t;
t = th;
@@ -565,7 +565,7 @@ threadreturn_t gfxThreadWait(gfxThreadHandle th) {
gfxFree(t);
// Return the status left by the dead process
- return (threadreturn_t)t->param;
+ return (gThreadreturn)t->param;
}
#endif /* GFX_USE_OS_RAW32 */
diff --git a/src/gos/gos_x_threads.h b/src/gos/gos_x_threads.h
index 7f7b57e7..69b586c6 100644
--- a/src/gos/gos_x_threads.h
+++ b/src/gos/gos_x_threads.h
@@ -16,46 +16,46 @@
* memcpy() - for heap and threading
*
* You must also define the following routines in your own code so that timing functions will work...
- * systemticks_t gfxSystemTicks(void);
- * systemticks_t gfxMillisecondsToTicks(delaytime_t ms);
+ * gTicks gfxSystemTicks(void);
+ * gTicks gfxMillisecondsToTicks(gDelay ms);
*/
#ifndef _GOS_X_THREADS_H
#define _GOS_X_THREADS_H
#if GOS_NEED_X_THREADS
-typedef uint32_t delaytime_t;
-typedef uint32_t systemticks_t;
-typedef short semcount_t;
-typedef int threadreturn_t;
-typedef int threadpriority_t;
+typedef uint32_t gDelay;
+typedef uint32_t gTicks;
+typedef short gSemcount;
+typedef int gThreadreturn;
+typedef int gThreadpriority;
-#define DECLARE_THREAD_FUNCTION(fnName, param) threadreturn_t fnName(void *param)
+#define DECLARE_THREAD_FUNCTION(fnName, param) gThreadreturn fnName(void *param)
#define DECLARE_THREAD_STACK(name, sz) uint8_t name[(sz) & ~3];
#define THREAD_RETURN(retval) return retval
#define TIME_IMMEDIATE 0
-#define TIME_INFINITE ((delaytime_t)-1)
+#define TIME_INFINITE ((gDelay)-1)
#define MAX_SEMAPHORE_COUNT 0x7FFF
#define LOW_PRIORITY 0
#define NORMAL_PRIORITY 1
#define HIGH_PRIORITY 2
typedef struct {
- semcount_t cnt;
- semcount_t limit;
+ gSemcount cnt;
+ gSemcount limit;
} gfxSem;
typedef uint32_t gfxMutex;
typedef void * gfxThreadHandle;
// Required timing functions - supplied by the user or the operating system
-systemticks_t gfxSystemTicks(void);
-systemticks_t gfxMillisecondsToTicks(delaytime_t ms);
+gTicks gfxSystemTicks(void);
+gTicks gfxMillisecondsToTicks(gDelay ms);
// Sleep Functions
-void gfxSleepMilliseconds(delaytime_t ms);
-void gfxSleepMicroseconds(delaytime_t ms);
+void gfxSleepMilliseconds(gDelay ms);
+void gfxSleepMicroseconds(gDelay ms);
void gfxYield(void);
// System Locking
@@ -69,24 +69,24 @@ void gfxMutexEnter(gfxMutex *pmutex);
void gfxMutexExit(gfxMutex *pmutex);
// Semaphores
-void gfxSemInit(gfxSem *psem, semcount_t val, semcount_t limit);
+void gfxSemInit(gfxSem *psem, gSemcount val, gSemcount limit);
#define gfxSemDestroy(psem)
-gBool gfxSemWait(gfxSem *psem, delaytime_t ms);
+gBool gfxSemWait(gfxSem *psem, gDelay ms);
gBool gfxSemWaitI(gfxSem *psem);
void gfxSemSignal(gfxSem *psem);
void gfxSemSignalI(gfxSem *psem);
// Threads
-gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
+gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, gThreadpriority prio, DECLARE_THREAD_FUNCTION((*fn),p), void *param);
#define gfxThreadClose(thread)
-threadreturn_t gfxThreadWait(gfxThreadHandle thread);
+gThreadreturn gfxThreadWait(gfxThreadHandle thread);
gfxThreadHandle gfxThreadMe(void);
/** The following is not part of the public ugfx API as some operating systems
* simply do not provide this capability.
* For RAW32 we need it anyway so we might as well declare it here.
*/
-void gfxThreadExit(threadreturn_t ret);
+void gfxThreadExit(gThreadreturn ret);
#endif /* GOS_NEED_X_THREADS */
#endif /* _GOS_X_THREADS_H */
diff --git a/src/gos/gos_zephyr.c b/src/gos/gos_zephyr.c
index 401d9f6a..82660c46 100644
--- a/src/gos/gos_zephyr.c
+++ b/src/gos/gos_zephyr.c
@@ -9,7 +9,7 @@
#if GFX_USE_OS_ZEPHYR
-systemticks_t gfxSystemTicks(void)
+gTicks gfxSystemTicks(void)
{
s32_t ms = k_uptime_get_32();
return CONFIG_SYS_CLOCK_TICKS_PER_SEC*ms/1000;
diff --git a/src/gos/gos_zephyr.h b/src/gos/gos_zephyr.h
index 07f9107b..1bfccf8b 100644
--- a/src/gos/gos_zephyr.h
+++ b/src/gos/gos_zephyr.h
@@ -16,14 +16,14 @@
/* Type definitions */
/*===========================================================================*/
-typedef s32_t delaytime_t;
-typedef u32_t systemticks_t;
-typedef u32_t semcount_t;
-typedef void threadreturn_t;
-typedef int threadpriority_t;
+typedef s32_t gDelay;
+typedef u32_t gTicks;
+typedef u32_t gSemcount;
+typedef void gThreadreturn;
+typedef int gThreadpriority;
#define DECLARE_THREAD_FUNCTION(fnName, param)\
- threadreturn_t fnName(void* param, void* p2, void* p3)
+ gThreadreturn fnName(void* param, void* p2, void* p3)
#define DECLARE_THREAD_STACK(name, sz)\
K_THREAD_STACK_DEFINE(name, sz)
@@ -32,7 +32,7 @@ typedef int threadpriority_t;
#define TIME_IMMEDIATE K_NO_WAIT
#define TIME_INFINITE K_FOREVER
-#define MAX_SEMAPHORE_COUNT ((semcount_t)(((unsigned long)((semcount_t)(-1))) >> 1))
+#define MAX_SEMAPHORE_COUNT ((gSemcount)(((unsigned long)((gSemcount)(-1))) >> 1))
#define LOW_PRIORITY CONFIG_NUM_PREEMPT_PRIORITIES-1
#define NORMAL_PRIORITY 1
#define HIGH_PRIORITY 0
@@ -59,7 +59,7 @@ typedef k_tid_t gfxThreadHandle;
#define gfxSleepMilliseconds(ms) k_sleep(ms)
#define gfxSleepMicroseconds(us) do{}while(0)
#define gfxMillisecondsToTicks(ms) CONFIG_SYS_CLOCK_TICKS_PER_SEC*ms/1000
-systemticks_t gfxSystemTicks();
+gTicks gfxSystemTicks();
#define gfxSystemLock() k_sched_lock()
#define gfxSystemUnlock() k_sched_unlock()
diff --git a/src/gqueue/gqueue.c b/src/gqueue/gqueue.c
index 0e4c7020..e761c238 100644
--- a/src/gqueue/gqueue.c
+++ b/src/gqueue/gqueue.c
@@ -163,7 +163,7 @@ void _gqueueDeinit(void)
gfxSemDestroy(&pqueue->sem);
}
- gfxQueueGSyncItem *gfxQueueGSyncGet(gfxQueueGSync *pqueue, delaytime_t ms) {
+ gfxQueueGSyncItem *gfxQueueGSyncGet(gfxQueueGSync *pqueue, gDelay ms) {
gfxQueueGSyncItem *pi;
if (!gfxSemWait(&pqueue->sem, ms))
@@ -302,7 +302,7 @@ void _gqueueDeinit(void)
gfxSemDestroy(&pqueue->sem);
}
- gfxQueueFSyncItem *gfxQueueFSyncGet(gfxQueueFSync *pqueue, delaytime_t ms) {
+ gfxQueueFSyncItem *gfxQueueFSyncGet(gfxQueueFSync *pqueue, gDelay ms) {
gfxQueueFSyncItem *pi;
if (!gfxSemWait(&pqueue->sem, ms))
@@ -320,7 +320,7 @@ void _gqueueDeinit(void)
return pi;
}
- gBool gfxQueueFSyncPut(gfxQueueFSync *pqueue, gfxQueueFSyncItem *pitem, delaytime_t ms) {
+ gBool gfxQueueFSyncPut(gfxQueueFSync *pqueue, gfxQueueFSyncItem *pitem, gDelay ms) {
if (!pitem) return; // Safety
gfxSemInit(&pitem->sem, 0, 1);
pitem->next = 0;
@@ -339,7 +339,7 @@ void _gqueueDeinit(void)
return gfxSemWait(&pitem->sem, ms);
}
- gBool gfxQueueFSyncPush(gfxQueueFSync *pqueue, gfxQueueFSyncItem *pitem, delaytime_t ms) {
+ gBool gfxQueueFSyncPush(gfxQueueFSync *pqueue, gfxQueueFSyncItem *pitem, gDelay ms) {
if (!pitem) return; // Safety
gfxSemInit(&pitem->sem, 0, 1);
@@ -355,7 +355,7 @@ void _gqueueDeinit(void)
return gfxSemWait(&pitem->sem, ms);
}
- gBool gfxQueueFSyncInsert(gfxQueueFSync *pqueue, gfxQueueFSyncItem *pitem, gfxQueueASyncItem *pafter, delaytime_t ms) {
+ gBool gfxQueueFSyncInsert(gfxQueueFSync *pqueue, gfxQueueFSyncItem *pitem, gfxQueueASyncItem *pafter, gDelay ms) {
if (!pitem) return; // Safety
gfxSemInit(&pitem->sem, 0, 1);
@@ -454,7 +454,7 @@ void _gqueueDeinit(void)
void gfxBufferRelease(GDataBuffer *pd) { gfxQueueGSyncPut(&bufferFreeList, (gfxQueueGSyncItem *)pd); }
void gfxBufferReleaseI(GDataBuffer *pd) { gfxQueueGSyncPutI(&bufferFreeList, (gfxQueueGSyncItem *)pd); }
- GDataBuffer *gfxBufferGet(delaytime_t ms) { return (GDataBuffer *)gfxQueueGSyncGet(&bufferFreeList, ms); }
+ GDataBuffer *gfxBufferGet(gDelay ms) { return (GDataBuffer *)gfxQueueGSyncGet(&bufferFreeList, ms); }
GDataBuffer *gfxBufferGetI(void) { return (GDataBuffer *)gfxQueueGSyncGetI(&bufferFreeList); }
gBool gfxBufferIsAvailable(void) { return bufferFreeList.head != 0; }
diff --git a/src/gqueue/gqueue.h b/src/gqueue/gqueue.h
index c0da77d9..fa4a31e5 100644
--- a/src/gqueue/gqueue.h
+++ b/src/gqueue/gqueue.h
@@ -133,9 +133,9 @@ void gfxQueueFSyncDeinit(gfxQueueFSync *pqueue);
*/
gfxQueueASyncItem *gfxQueueASyncGet(gfxQueueASync *pqueue);
gfxQueueASyncItem *gfxQueueASyncGetI(gfxQueueASync *pqueue);
-gfxQueueGSyncItem *gfxQueueGSyncGet(gfxQueueGSync *pqueue, delaytime_t ms);
+gfxQueueGSyncItem *gfxQueueGSyncGet(gfxQueueGSync *pqueue, gDelay ms);
gfxQueueGSyncItem *gfxQueueGSyncGetI(gfxQueueGSync *pqueue);
-gfxQueueFSyncItem *gfxQueueFSyncGet(gfxQueueFSync *pqueue, delaytime_t ms);
+gfxQueueFSyncItem *gfxQueueFSyncGet(gfxQueueFSync *pqueue, gDelay ms);
/** @} */
/**
@@ -159,7 +159,7 @@ void gfxQueueASyncPut(gfxQueueASync *pqueue, gfxQueueASyncItem *pitem);
void gfxQueueASyncPutI(gfxQueueASync *pqueue, gfxQueueASyncItem *pitem);
void gfxQueueGSyncPut(gfxQueueGSync *pqueue, gfxQueueGSyncItem *pitem);
void gfxQueueGSyncPutI(gfxQueueGSync *pqueue, gfxQueueGSyncItem *pitem);
-gBool gfxQueueFSyncPut(gfxQueueFSync *pqueue, gfxQueueFSyncItem *pitem, delaytime_t ms);
+gBool gfxQueueFSyncPut(gfxQueueFSync *pqueue, gfxQueueFSyncItem *pitem, gDelay ms);
/** @} */
/**
@@ -197,7 +197,7 @@ void gfxQueueASyncPush(gfxQueueASync *pqueue, gfxQueueASyncItem *pitem);
void gfxQueueASyncPushI(gfxQueueASync *pqueue, gfxQueueASyncItem *pitem);
void gfxQueueGSyncPush(gfxQueueGSync *pqueue, gfxQueueGSyncItem *pitem);
void gfxQueueGSyncPushI(gfxQueueGSync *pqueue, gfxQueueGSyncItem *pitem);
-gBool gfxQueueFSyncPush(gfxQueueFSync *pqueue, gfxQueueFSyncItem *pitem, delaytime_t ms);
+gBool gfxQueueFSyncPush(gfxQueueFSync *pqueue, gfxQueueFSyncItem *pitem, gDelay ms);
/** @} */
/**
@@ -223,7 +223,7 @@ void gfxQueueASyncInsert(gfxQueueASync *pqueue, gfxQueueASyncItem *pitem, gfxQue
void gfxQueueASyncInsertI(gfxQueueASync *pqueue, gfxQueueASyncItem *pitem, gfxQueueASyncItem *pafter);
void gfxQueueGSyncInsert(gfxQueueGSync *pqueue, gfxQueueGSyncItem *pitem, gfxQueueASyncItem *pafter);
void gfxQueueGSyncInsertI(gfxQueueGSync *pqueue, gfxQueueGSyncItem *pitem, gfxQueueASyncItem *pafter);
-gBool gfxQueueFSyncInsert(gfxQueueFSync *pqueue, gfxQueueFSyncItem *pitem, gfxQueueASyncItem *pafter, delaytime_t ms);
+gBool gfxQueueFSyncInsert(gfxQueueFSync *pqueue, gfxQueueFSyncItem *pitem, gfxQueueASyncItem *pafter, gDelay ms);
/** @} */
/**
@@ -376,7 +376,7 @@ gBool gfxBufferIsAvailable(void);
* @api
* @{
*/
-GDataBuffer *gfxBufferGet(delaytime_t ms);
+GDataBuffer *gfxBufferGet(gDelay ms);
GDataBuffer *gfxBufferGetI(void);
/** @} */
diff --git a/src/gtimer/gtimer.c b/src/gtimer/gtimer.c
index 7ae0b652..93e93b6f 100644
--- a/src/gtimer/gtimer.c
+++ b/src/gtimer/gtimer.c
@@ -22,7 +22,7 @@ static gfxMutex mutex;
static gfxThreadHandle hThread = 0;
static GTimer *pTimerHead = 0;
static gfxSem waitsem;
-static systemticks_t ticks2ms;
+static gTicks ticks2ms;
static DECLARE_THREAD_STACK(waTimerThread, GTIMER_THREAD_WORKAREA_SIZE);
/*===========================================================================*/
@@ -31,9 +31,9 @@ static DECLARE_THREAD_STACK(waTimerThread, GTIMER_THREAD_WORKAREA_SIZE);
static DECLARE_THREAD_FUNCTION(GTimerThreadHandler, arg) {
GTimer *pt;
- systemticks_t tm;
- systemticks_t nxtTimeout;
- systemticks_t lastTime;
+ gTicks tm;
+ gTicks nxtTimeout;
+ gTicks lastTime;
GTimerFunction fn;
void *param;
(void) arg;
@@ -136,7 +136,7 @@ void gtimerDeinit(GTimer* pt)
gtimerStop(pt);
}
-void gtimerStart(GTimer *pt, GTimerFunction fn, void *param, gBool periodic, delaytime_t millisec) {
+void gtimerStart(GTimer *pt, GTimerFunction fn, void *param, gBool periodic, gDelay millisec) {
gfxMutexEnter(&mutex);
// Start our thread if not already going
diff --git a/src/gtimer/gtimer.h b/src/gtimer/gtimer.h
index 402c3f1e..67c7539f 100644
--- a/src/gtimer/gtimer.h
+++ b/src/gtimer/gtimer.h
@@ -52,8 +52,8 @@ typedef void (*GTimerFunction)(void *param);
typedef struct GTimer_t {
GTimerFunction fn;
void *param;
- systemticks_t when;
- systemticks_t period;
+ gTicks when;
+ gTicks period;
uint16_t flags;
struct GTimer_t *next;
struct GTimer_t *prev;
@@ -110,7 +110,7 @@ void gtimerDeinit(GTimer* pt);
*
* @api
*/
-void gtimerStart(GTimer *pt, GTimerFunction fn, void *param, gBool periodic, delaytime_t millisec);
+void gtimerStart(GTimer *pt, GTimerFunction fn, void *param, gBool periodic, gDelay millisec);
/**
* @brief Stop a timer (periodic or otherwise)
diff --git a/src/gwin/gwin_image.c b/src/gwin/gwin_image.c
index 547145ae..d19c4d30 100644
--- a/src/gwin/gwin_image.c
+++ b/src/gwin/gwin_image.c
@@ -37,7 +37,7 @@ static void ImageRedraw(GHandle gh) {
gCoord x, y, w, h, dx, dy;
gColor bg;
#if GWIN_NEED_IMAGE_ANIMATION
- delaytime_t delay;
+ gDelay delay;
#endif
// The default display area
diff --git a/src/gwin/gwin_progressbar.c b/src/gwin/gwin_progressbar.c
index c6adde39..4e87c199 100644
--- a/src/gwin/gwin_progressbar.c
+++ b/src/gwin/gwin_progressbar.c
@@ -195,7 +195,7 @@ void gwinProgressbarDecrement(GHandle gh) {
#undef gsw
}
- void gwinProgressbarStart(GHandle gh, delaytime_t delay) {
+ void gwinProgressbarStart(GHandle gh, gDelay delay) {
#define gsw ((GProgressbarObject *)gh)
if (gh->vmt != (gwinVMT *)&progressbarVMT)
diff --git a/src/gwin/gwin_progressbar.h b/src/gwin/gwin_progressbar.h
index a5af2502..46e46d07 100644
--- a/src/gwin/gwin_progressbar.h
+++ b/src/gwin/gwin_progressbar.h
@@ -159,7 +159,7 @@ void gwinProgressbarDecrement(GHandle gh);
*
* @api
*/
- void gwinProgressbarStart(GHandle gh, delaytime_t delay);
+ void gwinProgressbarStart(GHandle gh, gDelay delay);
/**
* @brief Stop the timer which is started by @p gwinProgressbarStart()