Browse Source

gDelayNone/gDelayForever to replace TIME_IMMEDIATE/TIME_INFINITE

remotes/origin_old/release/v2.9
inmarket 3 years ago
parent
commit
93da5a0578
  1. 4
      boards/base/Olimex-SAM7EX256-GE8/board_SSD1306_i2c.h
  2. 2
      changelog.txt
  3. 2
      demos/3rdparty/notepad-2/notepadApp.c
  4. 2
      demos/applications/combo/main.c
  5. 2
      demos/modules/gadc/gwinosc.c
  6. 2
      demos/modules/gaudio/oscilloscope/gwinosc.c
  7. 4
      demos/modules/gaudio/play-vs1053/main.c
  8. 4
      demos/modules/gaudio/play-wave/main.c
  9. 4
      demos/modules/gdisp/images_animated/main.c
  10. 2
      demos/modules/ginput/keyboard/main.c
  11. 2
      demos/modules/gwin/button/main.c
  12. 2
      demos/modules/gwin/checkbox/main.c
  13. 2
      demos/modules/gwin/container_nested/main.c
  14. 2
      demos/modules/gwin/frame/main.c
  15. 2
      demos/modules/gwin/keyboard/main.c
  16. 2
      demos/modules/gwin/label/main.c
  17. 2
      demos/modules/gwin/list/main.c
  18. 2
      demos/modules/gwin/radio/main.c
  19. 2
      demos/modules/gwin/slider/main.c
  20. 2
      demos/modules/gwin/tabset/main.c
  21. 2
      demos/modules/gwin/textedit/main.c
  22. 2
      demos/modules/gwin/widgets/main.c
  23. 14
      demos/tools/touch_driver_test/main.c
  24. 2
      demos/tools/touch_raw_readings/main.c
  25. 2
      demos/tools/uGFXnetDisplay/main.c
  26. 4
      drivers/multiple/Win32/gdisp_lld_Win32.c
  27. 2
      drivers/multiple/Win32/ginput_lld_toggle_config.h
  28. 4
      drivers/multiple/uGFXnet/ginput_lld_mouse_config.h
  29. 4
      drivers/multiple/uGFXnetESP8266/ginput_lld_mouse_config.h
  30. 8
      src/gadc/gadc.c
  31. 6
      src/gaudio/gaudio.c
  32. 14
      src/gdisp/gdisp_image.h
  33. 2
      src/gdisp/gdisp_image_bmp.c
  34. 6
      src/gdisp/gdisp_image_gif.c
  35. 2
      src/gdisp/gdisp_image_jpg.c
  36. 2
      src/gdisp/gdisp_image_native.c
  37. 2
      src/gdisp/gdisp_image_png.c
  38. 4
      src/gevent/gevent.h
  39. 4
      src/ginput/ginput_driver_toggle.h
  40. 19
      src/gos/gos.h
  41. 16
      src/gos/gos_chibios.c
  42. 6
      src/gos/gos_chibios.h
  43. 6
      src/gos/gos_cmsis.h
  44. 6
      src/gos/gos_cmsis2.h
  45. 12
      src/gos/gos_ecos.c
  46. 4
      src/gos/gos_ecos.h
  47. 4
      src/gos/gos_freertos.h
  48. 16
      src/gos/gos_linux.c
  49. 6
      src/gos/gos_linux.h
  50. 12
      src/gos/gos_osx.c
  51. 6
      src/gos/gos_osx.h
  52. 4
      src/gos/gos_qt.h
  53. 2
      src/gos/gos_rawrtos.c
  54. 6
      src/gos/gos_rawrtos.h
  55. 4
      src/gos/gos_win32.c
  56. 6
      src/gos/gos_win32.h
  57. 20
      src/gos/gos_x_threads.c
  58. 4
      src/gos/gos_x_threads.h
  59. 4
      src/gos/gos_zephyr.h
  60. 2
      src/gqueue/gqueue.c
  61. 8
      src/gqueue/gqueue.h
  62. 10
      src/gtimer/gtimer.c
  63. 4
      src/gtimer/gtimer.h
  64. 4
      src/gwin/gwin_image.c
  65. 12
      src/gwin/gwin_wm.c

4
boards/base/Olimex-SAM7EX256-GE8/board_SSD1306_i2c.h

@ -84,9 +84,9 @@
uint8_t data[2]; \
data[0] = 0; \
data[1] = cmd; \
i2cMasterTransmitTimeout (UEXT_I2C, I2C_ADDRESS, data, 2, 0, 0, TIME_INFINITE); \
i2cMasterTransmitTimeout (UEXT_I2C, I2C_ADDRESS, data, 2, 0, 0, gDelayForever); \
}
#define I2C_WRITEBYTES(pdata, len) i2cMasterTransmitTimeout (UEXT_I2C, I2C_ADDRESS, pdata, length, 0, 0, TIME_INFINITE)
#define I2C_WRITEBYTES(pdata, len) i2cMasterTransmitTimeout (UEXT_I2C, I2C_ADDRESS, pdata, length, 0, 0, gDelayForever)
#else
#error "SSD1306 board file: Unsupported I2C method"

2
changelog.txt

@ -16,7 +16,7 @@ CHANGE: Added GFX_RED, GFX_BLUE, GFX_GREEN etc to replace V2.x Red, Gree, Blue
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 gDelay to replace V2.x delaytime_t
CHANGE: Added type gDelay to replace V2.x delaytime_t and values gDelayNone/gDelayForever to replace TIME_IMMEDIATE/TIME_INFINITE
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

2
demos/3rdparty/notepad-2/notepadApp.c

@ -402,7 +402,7 @@ static DECLARE_THREAD_FUNCTION(notepadThread, param) {
ncoreSpawnDrawThread(nDrawingArea, gstatusConsole);
while(1) {
pem = (GEventMouse *) geventEventWait(&gl, TIME_INFINITE);
pem = (GEventMouse *) geventEventWait(&gl, gDelayForever);
/* button pressed... */
if (pem->type == GEVENT_GWIN_BUTTON) {

2
demos/applications/combo/main.c

@ -436,7 +436,7 @@ int main(void) {
while(1) {
// Get an Event
pe = geventEventWait(&gl, TIME_INFINITE);
pe = geventEventWait(&gl, gDelayForever);
switch(pe->type) {
case GEVENT_GWIN_BUTTON:

2
demos/modules/gadc/gwinosc.c

@ -101,7 +101,7 @@ void gwinScopeWaitForTrace(GHandle gh) {
return;
/* Wait for a set of conversions */
pd = gadcHighSpeedGetData(TIME_INFINITE);
pd = gadcHighSpeedGetData(gDelayForever);
/* Ensure we are drawing in the right area */
#if GDISP_NEED_CLIP

2
demos/modules/gaudio/oscilloscope/gwinosc.c

@ -118,7 +118,7 @@ void gwinScopeWaitForTrace(GHandle gh) {
return;
/* Wait for a set of audio conversions */
paud = gaudioRecordGetData(TIME_INFINITE);
paud = gaudioRecordGetData(gDelayForever);
/* Ensure we are drawing in the right area */
#if GDISP_NEED_CLIP

4
demos/modules/gaudio/play-vs1053/main.c

@ -83,7 +83,7 @@ repeatplay:
toplay = gfileGetSize(f);
while(toplay) {
// Get a buffer to put the data into
pd = gfxBufferGet(TIME_INFINITE); // This should never fail as we are waiting forever
pd = gfxBufferGet(gDelayForever); // This should never fail as we are waiting forever
// How much data can we put in
len = toplay > pd->size ? pd->size : toplay;
@ -101,7 +101,7 @@ repeatplay:
gfileClose(f);
// Wait for the play to finish
gaudioPlayWait(TIME_INFINITE);
gaudioPlayWait(gDelayForever);
gdispDrawString(0, gdispGetHeight()/2+10, "Done", font, GFX_GREEN);
// Repeat the whole thing

4
demos/modules/gaudio/play-wave/main.c

@ -165,7 +165,7 @@ repeatplay:
gdispDrawString(0, gdispGetHeight()/2, "Playing...", font, GFX_YELLOW);
while(toplay) {
// Get a buffer to put the data into
pd = gfxBufferGet(TIME_INFINITE); // This should never fail as we are waiting forever
pd = gfxBufferGet(gDelayForever); // This should never fail as we are waiting forever
// How much data can we put in
len = toplay > pd->size ? pd->size : toplay;
@ -183,7 +183,7 @@ repeatplay:
gfileClose(f);
// Wait for the play to finish
gaudioPlayWait(TIME_INFINITE);
gaudioPlayWait(gDelayForever);
gdispDrawString(0, gdispGetHeight()/2+10, "Done", font, GFX_GREEN);
// Repeat the whole thing

4
demos/modules/gdisp/images_animated/main.c

@ -89,12 +89,12 @@ int main(void) {
break;
}
delay = gdispImageNext(&myImage);
if (delay == TIME_INFINITE) {
if (delay == gDelayForever) {
SHOW_ERROR(GFX_GREEN);
break;
}
SHOW_ERROR(GFX_YELLOW);
if (delay != TIME_IMMEDIATE)
if (delay != gDelayNone)
gfxSleepMilliseconds(delay);
}
gdispImageClose(&myImage);

2
demos/modules/ginput/keyboard/main.c

@ -70,7 +70,7 @@ int main(void) {
while(1) {
// Get an Event
pk = (GEventKeyboard *)geventEventWait(&gl, TIME_INFINITE);
pk = (GEventKeyboard *)geventEventWait(&gl, gDelayForever);
if (pk->type != GEVENT_KEYBOARD)
continue;

2
demos/modules/gwin/button/main.c

@ -76,7 +76,7 @@ int main(void) {
while(1) {
// Get an Event
pe = geventEventWait(&gl, TIME_INFINITE);
pe = geventEventWait(&gl, gDelayForever);
switch(pe->type) {
case GEVENT_GWIN_BUTTON:

2
demos/modules/gwin/checkbox/main.c

@ -70,7 +70,7 @@ int main(void) {
while(1) {
// Get an Event
pe = geventEventWait(&gl, TIME_INFINITE);
pe = geventEventWait(&gl, gDelayForever);
switch(pe->type) {
case GEVENT_GWIN_CHECKBOX:

2
demos/modules/gwin/container_nested/main.c

@ -134,7 +134,7 @@ int main(void) {
while(1) {
// Get an Event
pe = geventEventWait(&gl, TIME_INFINITE);
pe = geventEventWait(&gl, gDelayForever);
switch(pe->type) {
case GEVENT_GWIN_CHECKBOX:

2
demos/modules/gwin/frame/main.c

@ -131,7 +131,7 @@ int main(void) {
while(1) {
// Get an Event
pe = geventEventWait(&gl, TIME_INFINITE);
pe = geventEventWait(&gl, gDelayForever);
switch(pe->type) {
case GEVENT_GWIN_SLIDER:

2
demos/modules/gwin/keyboard/main.c

@ -85,7 +85,7 @@ int main(void) {
while(1) {
// Get an Event
pe = geventEventWait(&gl, TIME_INFINITE);
pe = geventEventWait(&gl, gDelayForever);
switch(pe->type) {
case GEVENT_GWIN_KEYBOARD:

2
demos/modules/gwin/label/main.c

@ -72,7 +72,7 @@ int main(void) {
while(1) {
// Get an Event
pe = geventEventWait(&gl, TIME_INFINITE);
pe = geventEventWait(&gl, gDelayForever);
}
return 0;

2
demos/modules/gwin/list/main.c

@ -124,7 +124,7 @@ int main(void) {
while(1) {
// Get an Event
pe = geventEventWait(&gl, TIME_INFINITE);
pe = geventEventWait(&gl, gDelayForever);
}

2
demos/modules/gwin/radio/main.c

@ -92,7 +92,7 @@ int main(void) {
while(1) {
// Get an Event
pe = geventEventWait(&gl, TIME_INFINITE);
pe = geventEventWait(&gl, gDelayForever);
switch(pe->type) {
case GEVENT_GWIN_RADIO:

2
demos/modules/gwin/slider/main.c

@ -84,7 +84,7 @@ int main(void) {
while(1) {
// Get an Event (assume it is a slider event)
pe = (GEventGWinSlider *)geventEventWait(&gl, TIME_INFINITE);
pe = (GEventGWinSlider *)geventEventWait(&gl, gDelayForever);
switch(pe->type) {
case GEVENT_GWIN_SLIDER:

2
demos/modules/gwin/tabset/main.c

@ -87,7 +87,7 @@ int main(void) {
while(1) {
// Get an Event
pe = geventEventWait(&gl, TIME_INFINITE);
pe = geventEventWait(&gl, gDelayForever);
(void)pe;
}

2
demos/modules/gwin/textedit/main.c

@ -117,7 +117,7 @@ int main(void) {
while(1) {
// Get an Event
pk = (GEventKeyboard *)geventEventWait(&gl, TIME_INFINITE);
pk = (GEventKeyboard *)geventEventWait(&gl, gDelayForever);
if (pk->type != GEVENT_KEYBOARD)
continue;

2
demos/modules/gwin/widgets/main.c

@ -535,7 +535,7 @@ int main(void) {
while(1) {
// Get an Event
pe = geventEventWait(&gl, TIME_INFINITE);
pe = geventEventWait(&gl, gDelayForever);
switch(pe->type) {
case GEVENT_GWIN_BUTTON:

14
demos/tools/touch_driver_test/main.c

@ -176,7 +176,7 @@ StepDeviceType:
}
while(1) {
pem = (GEventMouse *)geventEventWait(&gl, TIME_INFINITE);
pem = (GEventMouse *)geventEventWait(&gl, gDelayForever);
if (isCalibrated) {
switch (CheckButtons(pem)) {
case BTN_NEXT:
@ -225,7 +225,7 @@ StepRawReading:
// Always sleep a bit first to enable other events. We actually don't
// mind missing events for this test.
gfxSleepMilliseconds(100);
pem = (GEventMouse *)geventEventWait(&gl, TIME_INFINITE);
pem = (GEventMouse *)geventEventWait(&gl, gDelayForever);
gwinPrintf(ghc, "%u, %u z=%u b=0x%04x\n", pem->x, pem->y, pem->z, pem->buttons & ~GINPUT_MISSED_MOUSE_EVENT);
if ((pem->buttons & GMETA_MOUSE_UP))
break;
@ -265,7 +265,7 @@ StepCalibrate:
gwinPrintf(ghc, "Press and release your %s to move on to start calibration.\n", deviceText);
while(1) {
pem = (GEventMouse *)geventEventWait(&gl, TIME_INFINITE);
pem = (GEventMouse *)geventEventWait(&gl, gDelayForever);
if (isCalibrated) {
switch (CheckButtons(pem)) {
case BTN_NEXT:
@ -317,7 +317,7 @@ StepMouseCoords:
// Always sleep a bit first to enable other events. We actually don't
// mind missing events for this test.
gfxSleepMilliseconds(100);
pem = (GEventMouse *)geventEventWait(&gl, TIME_INFINITE);
pem = (GEventMouse *)geventEventWait(&gl, gDelayForever);
switch (CheckButtons(pem)) {
case BTN_NEXT:
@ -359,7 +359,7 @@ StepMovementJitter:
gwinPrintf(ghc, "Press Next or Back to continue.\n\n");
while(1) {
pem = (GEventMouse *)geventEventWait(&gl, TIME_INFINITE);
pem = (GEventMouse *)geventEventWait(&gl, gDelayForever);
switch (CheckButtons(pem)) {
case BTN_NEXT:
break;
@ -402,7 +402,7 @@ StepClickJitter:
gwinPrintf(ghc, "Press Next or Back to continue.\n\n");
while(1) {
pem = (GEventMouse *)geventEventWait(&gl, TIME_INFINITE);
pem = (GEventMouse *)geventEventWait(&gl, gDelayForever);
switch (CheckButtons(pem)) {
case BTN_NEXT:
break;
@ -444,7 +444,7 @@ StepDrawing:
gwinPrintf(ghc, "Press Next or Back to continue.\n\n");
while(1) {
pem = (GEventMouse *)geventEventWait(&gl, TIME_INFINITE);
pem = (GEventMouse *)geventEventWait(&gl, gDelayForever);
if (pem->y < bHeight && pem->x >= swidth-2*bWidth) {
if ((pem->buttons & GMETA_MOUSE_UP)) {
if (pem->x >= swidth-bWidth)

2
demos/tools/touch_raw_readings/main.c

@ -101,7 +101,7 @@ int main(void) {
geventAttachSource(&gl, gs, GLISTEN_MOUSEDOWNMOVES|GLISTEN_MOUSEUPMOVES|GLISTEN_MOUSEMETA|GLISTEN_MOUSENOFILTER);
while(1) {
pem = (GEventMouse *)geventEventWait(&gl, TIME_INFINITE);
pem = (GEventMouse *)geventEventWait(&gl, gDelayForever);
gwinPrintf(ghc, "%u, %u z=%u b=0x%04x\n", pem->x, pem->y, pem->z, pem->buttons & ~GINPUT_MISSED_MOUSE_EVENT);
// Always sleep a bit first to enable other events. We actually don't mind missing events.

2
demos/tools/uGFXnetDisplay/main.c

@ -198,7 +198,7 @@ static gBool sendpkt(uint16_t *pkt, int len) {
while(1) {
// Get a (mouse) event
pem = (GEventMouse *)geventEventWait(&gl, TIME_INFINITE);
pem = (GEventMouse *)geventEventWait(&gl, gDelayForever);
if (pem->type != GEVENT_MOUSE && pem->type != GEVENT_TOUCH)
continue;

4
drivers/multiple/Win32/gdisp_lld_Win32.c

@ -544,7 +544,7 @@ static LRESULT myWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
rect.bottom = GDISP_SCREEN_HEIGHT + WIN32_BUTTON_AREA;
InvalidateRect(hWnd, &rect, FALSE);
UpdateWindow(hWnd);
#if GINPUT_TOGGLE_POLL_PERIOD == TIME_INFINITE
#if GINPUT_TOGGLE_POLL_PERIOD == gDelayForever
ginputToggleWakeup();
#endif
}
@ -567,7 +567,7 @@ static LRESULT myWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
rect.bottom = GDISP_SCREEN_HEIGHT + WIN32_BUTTON_AREA;
InvalidateRect(hWnd, &rect, FALSE);
UpdateWindow(hWnd);
#if GINPUT_TOGGLE_POLL_PERIOD == TIME_INFINITE
#if GINPUT_TOGGLE_POLL_PERIOD == gDelayForever
ginputToggleWakeup();
#endif
}

2
drivers/multiple/Win32/ginput_lld_toggle_config.h

@ -10,7 +10,7 @@
#if GFX_USE_GINPUT && GINPUT_NEED_TOGGLE
#define GINPUT_TOGGLE_POLL_PERIOD TIME_INFINITE // We are interrupt driven (or polled - either works here)
#define GINPUT_TOGGLE_POLL_PERIOD gDelayForever // We are interrupt driven (or polled - either works here)
// This driver is unique in that it can support 8 buttons per window across multiple windows.
// GINPUT_TOGGLE_CONFIG_ENTRIES just must be less than the number of GDISP windows (GDISP_DRIVER_COUNT_WIN32).

4
drivers/multiple/uGFXnet/ginput_lld_mouse_config.h

@ -13,7 +13,7 @@
// When operating in touch mode we allow sloppier clicks etc
#if 1
#define GINPUT_MOUSE_EVENT_TYPE GEVENT_MOUSE
#define GINPUT_MOUSE_CLICK_TIME TIME_INFINITE // Long click != Context Click
#define GINPUT_MOUSE_CLICK_TIME gDelayForever // Long click != Context Click
#define GINPUT_MOUSE_NEED_CALIBRATION GFXOFF
#define GINPUT_MOUSE_LLD_CALIBRATION_LOADSAVE GFXOFF
#define GINPUT_MOUSE_READ_CYCLES 1
@ -32,7 +32,7 @@
#endif
// This driver supports both an "interrupt" mode, and a polled mode
#define GINPUT_MOUSE_POLL_PERIOD TIME_INFINITE // Interrupt driven by the Window thread
#define GINPUT_MOUSE_POLL_PERIOD gDelayForever // Interrupt driven by the Window thread
//#define GINPUT_MOUSE_POLL_PERIOD 25 // Poll driven
// This driver does not require rotation of co-ordinates for orientations other than 0.

4
drivers/multiple/uGFXnetESP8266/ginput_lld_mouse_config.h

@ -13,7 +13,7 @@
// When operating in touch mode we allow sloppier clicks etc
#if 1
#define GINPUT_MOUSE_EVENT_TYPE GEVENT_MOUSE
#define GINPUT_MOUSE_CLICK_TIME TIME_INFINITE // Long click != Context Click
#define GINPUT_MOUSE_CLICK_TIME gDelayForever // Long click != Context Click
#define GINPUT_MOUSE_NEED_CALIBRATION GFXOFF
#define GINPUT_MOUSE_LLD_CALIBRATION_LOADSAVE GFXOFF
#define GINPUT_MOUSE_READ_CYCLES 1
@ -32,7 +32,7 @@
#endif
// This driver supports both an "interrupt" mode, and a polled mode
#define GINPUT_MOUSE_POLL_PERIOD TIME_INFINITE // Interrupt driven by the Window thread
#define GINPUT_MOUSE_POLL_PERIOD gDelayForever // Interrupt driven by the Window thread
//#define GINPUT_MOUSE_POLL_PERIOD 25 // Poll driven
// This driver does not require rotation of co-ordinates for orientations other than 0.

8
src/gadc/gadc.c

@ -214,7 +214,7 @@ void gadcHighSpeedInit(uint32_t physdev, uint32_t frequency)
#if GFX_USE_GEVENT
GSourceHandle gadcHighSpeedGetSource(void) {
if (!gtimerIsActive(&hsGTimer))
gtimerStart(&hsGTimer, HighSpeedGTimerCallback, 0, gTrue, TIME_INFINITE);
gtimerStart(&hsGTimer, HighSpeedGTimerCallback, 0, gTrue, gDelayForever);
hsFlags |= GADC_HSADC_GTIMER;
return (GSourceHandle)&hsGTimer;
}
@ -285,7 +285,7 @@ static void LowSpeedGTimerCallback(void *param) {
NonTimerData *pdata;
// Look for completed non-timer jobs and call the call-backs for each
while ((pdata = (NonTimerData *)gfxQueueGSyncGet(&lsListDone, TIME_IMMEDIATE))) {
while ((pdata = (NonTimerData *)gfxQueueGSyncGet(&lsListDone, gDelayNone))) {
pdata->callback(pdata->job.buffer, pdata->param);
gfxFree(pdata);
}
@ -315,7 +315,7 @@ void gadcLowSpeedGet(uint32_t physdev, adcsample_t *buffer) {
gfxSystemUnlock();
// Wait for it to complete
gfxSemWait(&ndata.sigdone, TIME_INFINITE);
gfxSemWait(&ndata.sigdone, gDelayForever);
gfxSemDestroy(&ndata.sigdone);
}
@ -324,7 +324,7 @@ gBool gadcLowSpeedStart(uint32_t physdev, adcsample_t *buffer, GADCCallbackFunct
/* Start the Low Speed Timer */
if (!gtimerIsActive(&lsGTimer))
gtimerStart(&lsGTimer, LowSpeedGTimerCallback, 0, gTrue, TIME_INFINITE);
gtimerStart(&lsGTimer, LowSpeedGTimerCallback, 0, gTrue, gDelayForever);
// Prepare the job
if (!(pdata = gfxAlloc(sizeof(NonTimerData))))

6
src/gaudio/gaudio.c

@ -152,7 +152,7 @@ void _gaudioDeinit(void)
GSourceHandle gaudioPlayGetSource(void) {
if (!gtimerIsActive(&playTimer))
gtimerStart(&playTimer, PlayTimerCallback, 0, gTrue, TIME_INFINITE);
gtimerStart(&playTimer, PlayTimerCallback, 0, gTrue, gDelayForever);
playFlags |= PLAYFLG_USEEVENTS;
return (GSourceHandle)&playTimer;
}
@ -209,7 +209,7 @@ void _gaudioDeinit(void)
if ((recordFlags & (RECORDFLG_RECORDING|RECORDFLG_STALLED)) == RECORDFLG_RECORDING)
gaudio_record_lld_stop();
recordFlags &= ~(RECORDFLG_RECORDING|RECORDFLG_STALLED);
while((pd = (GDataBuffer *)gfxQueueGSyncGet(&recordList, TIME_IMMEDIATE)))
while((pd = (GDataBuffer *)gfxQueueGSyncGet(&recordList, gDelayNone)))
gfxBufferRelease(pd);
}
@ -245,7 +245,7 @@ void _gaudioDeinit(void)
GSourceHandle gaudioRecordGetSource(void) {
if (!gtimerIsActive(&recordTimer))
gtimerStart(&recordTimer, RecordTimerCallback, 0, gTrue, TIME_INFINITE);
gtimerStart(&recordTimer, RecordTimerCallback, 0, gTrue, gDelayForever);
recordFlags |= RECORDFLG_USEEVENTS;
return (GSourceHandle)&recordTimer;
}

14
src/gdisp/gdisp_image.h

@ -227,20 +227,20 @@ gdispImageError gdispGImageDraw(GDisplay *g, gdispImage *img, gCoord x, gCoord y
/**
* @brief Prepare for the next frame/page in the image file.
* @return A time in milliseconds to keep displaying the current frame before trying to draw
* the next frame. Watch out for the special values TIME_IMMEDIATE and TIME_INFINITE.
* the next frame. Watch out for the special values gDelayNone and gDelayForever.
*
* @param[in] img The image structure
*
* @pre gdispImageOpen() must have returned successfully.
*
* @note It will return TIME_IMMEDIATE if the first frame/page hasn't been drawn or if the next frame
* @note It will return gDelayNone if the first frame/page hasn't been drawn or if the next frame
* should be drawn immediately.
* @note It will return TIME_INFINITE if another image frame doesn't exist or an error has occurred.
* @note Images that support multiple pages (eg TIFF files) will return TIME_IMMEDIATE between pages
* and then TIME_INFINITE when there are no more pages.
* @note An image that displays a looped animation will never return TIME_INFINITE unless it
* @note It will return gDelayForever if another image frame doesn't exist or an error has occurred.
* @note Images that support multiple pages (eg TIFF files) will return gDelayNone between pages
* and then gDelayForever when there are no more pages.
* @note An image that displays a looped animation will never return gDelayForever unless it
* gets an error.
* @note Calling gdispImageDraw() after getting a TIME_INFINITE will go back to drawing the first
* @note Calling gdispImageDraw() after getting a gDelayForever will go back to drawing the first
* frame/page.
*/
gDelay gdispImageNext(gdispImage *img);

2
src/gdisp/gdisp_image_bmp.c

@ -819,7 +819,7 @@ gDelay gdispImageNext_BMP(gdispImage *img) {
(void) img;
/* No more frames/pages */
return TIME_INFINITE;
return gDelayForever;
}
uint16_t gdispImageGetPaletteSize_BMP(gdispImage *img) {

6
src/gdisp/gdisp_image_gif.c

@ -1122,7 +1122,7 @@ gDelay gdispImageNext_GIF(gdispImage *img) {
gfileSetPos(img->f, priv->frame.posimg+1); // Skip the code size byte too
while(1) {
if (gfileRead(img->f, &blocksz, 1) != 1)
return TIME_INFINITE;
return gDelayForever;
if (!blocksz)
break;
gfileSetPos(img->f, gfileGetPos(img->f) + blocksz);
@ -1145,10 +1145,10 @@ gDelay gdispImageNext_GIF(gdispImage *img) {
case GDISP_IMAGE_ERR_NOMEMORY: // Out of Memory
case GDISP_IMAGE_ERR_UNSUPPORTED: // Unsupported
default:
return TIME_INFINITE;
return gDelayForever;
}
}
return TIME_INFINITE;
return gDelayForever;
}
#endif /* GFX_USE_GDISP && GDISP_NEED_IMAGE && GDISP_NEED_IMAGE_GIF */

2
src/gdisp/gdisp_image_jpg.c

@ -202,7 +202,7 @@ gDelay gdispImageNext_JPG(gdispImage *img) {
(void) img;
/* No more frames/pages */
return TIME_INFINITE;
return gDelayForever;
}
/*----------------------------------------------------------------------------/

2
src/gdisp/gdisp_image_native.c

@ -144,7 +144,7 @@ gDelay gdispImageNext_NATIVE(gdispImage *img) {
(void) img;
/* No more frames/pages */
return TIME_INFINITE;
return gDelayForever;
}
#endif /* GFX_USE_GDISP && GDISP_NEED_IMAGE && GDISP_NEED_IMAGE_NATIVE */

2
src/gdisp/gdisp_image_png.c

@ -1625,7 +1625,7 @@ gDelay gdispImageNext_PNG(gdispImage *img) {
(void) img;
/* No more frames/pages */
return TIME_INFINITE;
return gDelayForever;
}
#endif /* GFX_USE_GDISP && GDISP_NEED_IMAGE && GDISP_NEED_IMAGE_PNG */

4
src/gevent/gevent.h

@ -142,8 +142,8 @@ void geventDetachSource(GListener *pl, GSourceHandle gsh);
* @brief Wait for an event on a listener from an assigned source.
* @details The type of the event should be checked (pevent->type) and then pevent should
* be typecast to the actual event type if it needs to be processed.
* TIME_INFINITE means no timeout - wait forever for an event.
* TIME_IMMEDIATE means return immediately
* gDelayForever means no timeout - wait forever for an event.
* gDelayNone means return immediately
* @note The returned GEvent is released when this routine is called again
* or when optionally @p geventEventComplete() is called. Calling @p geventEventComplete()
* allows the GEvent object to be reused earlier which can reduce missed events. The GEvent

4
src/ginput/ginput_driver_toggle.h

@ -41,12 +41,12 @@ extern "C" {
unsigned ginput_lld_toggle_getbits(const GToggleConfig *ptc);
/* This routine is provided to low level drivers to wakeup a value read from a thread context.
* Particularly useful if GINPUT_TOGGLE_POLL_PERIOD = TIME_INFINITE
* Particularly useful if GINPUT_TOGGLE_POLL_PERIOD = gDelayForever
*/
void ginputToggleWakeup(void);
/* This routine is provided to low level drivers to wakeup a value read from an ISR
* Particularly useful if GINPUT_TOGGLE_POLL_PERIOD = TIME_INFINITE
* Particularly useful if GINPUT_TOGGLE_POLL_PERIOD = gDelayForever
*/
void ginputToggleWakeupI(void);

19
src/gos/gos.h

@ -99,8 +99,8 @@
* @note Your platform may use slightly different definitions to these
* @{
*/
#define TIME_IMMEDIATE 0
#define TIME_INFINITE ((gDelay)-1)
#define gDelayNone 0
#define gDelayForever ((gDelay)-1)
#define MAX_SEMAPHORE_COUNT ((gSemcount)(((unsigned long)((gSemcount)(-1))) >> 1))
#define LOW_PRIORITY 0
#define NORMAL_PRIORITY 1
@ -215,9 +215,9 @@
*
* @param[in] ms The number milliseconds to sleep
*
* @note Specifying TIME_IMMEDIATE will yield the current thread but return
* @note Specifying gDelayNone will yield the current thread but return
* on the next time slice.
* @note Specifying TIME_INFINITE will sleep forever.
* @note Specifying gDelayForever will sleep forever.
*
* @api
*/
@ -228,8 +228,8 @@
*
* @param[in] us The number microseconds to sleep
*
* @note Specifying TIME_IMMEDIATE will return immediately (no sleeping)
* @note Specifying TIME_INFINITE will sleep forever.
* @note Specifying gDelayNone will return immediately (no sleeping)
* @note Specifying gDelayForever will sleep forever.
*
* @api
*/
@ -372,7 +372,7 @@
/**
* @brief Test if a wait on a semaphore can be satisfied immediately
* @details Equivalent to @p gfxSemWait(psem, TIME_IMMEDIATE) except it can be called at interrupt level
* @details Equivalent to @p gfxSemWait(psem, gDelayNone) except it can be called at interrupt level
* @return gFalse if the wait would occur occurred otherwise gTrue
*
* @param[in] psem A pointer to the semaphore
@ -498,6 +498,11 @@
typedef gTicks systemticks_t;
typedef gThreadreturn threadreturn_t;
typedef gThreadpriority threadpriority_t;
#if !GFX_USE_OS_CHIBIOS
// These are defined by ChibiOS itself
#define TIME_IMMEDIATE gDelayNone
#define TIME_INFINITE gDelayForever
#endif
#endif
#endif /* _GOS_H */

16
src/gos/gos_chibios.c

@ -84,8 +84,8 @@ void *gfxRealloc(void *ptr, size_t oldsz, size_t newsz)
void gfxSleepMilliseconds(gDelay ms)
{
switch(ms) {
case TIME_IMMEDIATE: chThdYield(); return;
case TIME_INFINITE: chThdSleep(TIME_INFINITE); return;
case gDelayNone: chThdYield(); return;
case gDelayForever: chThdSleep(TIME_INFINITE); return;
default: chThdSleepMilliseconds(ms); return;
}
}
@ -93,8 +93,8 @@ void gfxSleepMilliseconds(gDelay ms)
void gfxSleepMicroseconds(gDelay ms)
{
switch(ms) {
case TIME_IMMEDIATE: return;
case TIME_INFINITE: chThdSleep(TIME_INFINITE); return;
case gDelayNone: return;
case gDelayForever: chThdSleep(TIME_INFINITE); return;
default: chThdSleepMicroseconds(ms); return;
}
}
@ -122,14 +122,14 @@ gBool gfxSemWait(gfxSem *psem, gDelay ms)
{
#if CH_KERNEL_MAJOR <= 2
switch(ms) {
case TIME_IMMEDIATE: return chSemWaitTimeout(&psem->sem, TIME_IMMEDIATE) != RDY_TIMEOUT;
case TIME_INFINITE: chSemWait(&psem->sem); return gTrue;
case gDelayNone: return chSemWaitTimeout(&psem->sem, TIME_IMMEDIATE) != RDY_TIMEOUT;
case gDelayForever: chSemWait(&psem->sem); return gTrue;
default: return chSemWaitTimeout(&psem->sem, gfxMillisecondsToTicks(ms)) != RDY_TIMEOUT;
}
#else
switch(ms) {
case TIME_IMMEDIATE: return chSemWaitTimeout(&psem->sem, TIME_IMMEDIATE) != MSG_TIMEOUT;
case TIME_INFINITE: chSemWait(&psem->sem); return gTrue;
case gDelayNone: return chSemWaitTimeout(&psem->sem, TIME_IMMEDIATE) != MSG_TIMEOUT;
case gDelayForever: chSemWait(&psem->sem); return gTrue;
default: return chSemWaitTimeout(&psem->sem, gfxMillisecondsToTicks(ms)) != MSG_TIMEOUT;
}
#endif

6
src/gos/gos_chibios.h

@ -25,10 +25,8 @@
/* Type definitions */
/*===========================================================================*/
/**
* TIME_IMMEDIATE, TIME_INFINITE
* are already defined by ChibiOS
*/
#define gDelayNone TIME_IMMEDIATE
#define gDelayForever TIME_INFINITE
#if CH_KERNEL_MAJOR <= 4
typedef systime_t gDelay;

6
src/gos/gos_cmsis.h

@ -25,8 +25,8 @@
/* Type definitions */
/*===========================================================================*/
#define TIME_IMMEDIATE 0
#define TIME_INFINITE osWaitForever
#define gDelayNone 0
#define gDelayForever osWaitForever
typedef uint32_t gDelay;
typedef uint32_t gTicks;
typedef uint16_t gSemcount;
@ -69,7 +69,7 @@ typedef osThreadId gfxThreadHandle;
void gfxMutexInit(gfxMutex* pmutex);
#define gfxMutexDestroy(pmutex) osMutexDelete((pmutex)->id)
#define gfxMutexEnter(pmutex) osMutexWait((pmutex)->id, TIME_INFINITE)
#define gfxMutexEnter(pmutex) osMutexWait((pmutex)->id, gDelayForever)
#define gfxMutexExit(pmutex) osMutexRelease((pmutex)->id)
void gfxSemInit(gfxSem* psem, gSemcount val, gSemcount limit);

6
src/gos/gos_cmsis2.h

@ -25,8 +25,8 @@
/* Type definitions */
/*===========================================================================*/
#define TIME_IMMEDIATE 0
#define TIME_INFINITE osWaitForever
#define gDelayNone 0
#define gDelayForever osWaitForever
typedef uint32_t gDelay;
typedef uint32_t gTicks;
typedef uint16_t gSemcount;
@ -62,7 +62,7 @@ typedef osThreadId_t gfxThreadHandle;
void gfxMutexInit(gfxMutex* pmutex);
#define gfxMutexDestroy(pmutex) osMutexDelete(*(pmutex))
#define gfxMutexEnter(pmutex) osMutexAcquire(*(pmutex), TIME_INFINITE)
#define gfxMutexEnter(pmutex) osMutexAcquire(*(pmutex), gDelayForever)
#define gfxMutexExit(pmutex) osMutexRelease(*(pmutex))
void gfxSemInit(gfxSem* psem, gSemcount val, gSemcount limit);

12
src/gos/gos_ecos.c

@ -35,8 +35,8 @@ void _gosDeinit(void)
void gfxSleepMilliseconds(gDelay ms)
{
switch(ms) {
case TIME_IMMEDIATE: cyg_thread_yield(); return;
case TIME_INFINITE: cyg_thread_suspend(cyg_thread_self()); return;
case gDelayNone: cyg_thread_yield(); return;
case gDelayForever: cyg_thread_suspend(cyg_thread_self()); return;
default: cyg_thread_delay(gfxMillisecondsToTicks(ms)); return;
}
}
@ -44,8 +44,8 @@ void gfxSleepMilliseconds(gDelay ms)
void gfxSleepMicroseconds(gDelay ms)
{
switch(ms) {
case TIME_IMMEDIATE: return;
case TIME_INFINITE: cyg_thread_suspend(cyg_thread_self()); return;
case gDelayNone: return;
case gDelayForever: cyg_thread_suspend(cyg_thread_self()); return;
default: cyg_thread_delay(gfxMillisecondsToTicks(ms/1000)); return;
}
}
@ -67,8 +67,8 @@ void gfxSemDestroy(gfxSem *psem)
gBool gfxSemWait(gfxSem *psem, gDelay ms)
{
switch(ms) {
case TIME_IMMEDIATE: return cyg_semaphore_trywait(&psem->sem);
case TIME_INFINITE: return cyg_semaphore_wait(&psem->sem);
case gDelayNone: return cyg_semaphore_trywait(&psem->sem);
case gDelayForever: return cyg_semaphore_wait(&psem->sem);
default: return cyg_semaphore_timed_wait(&psem->sem, gfxMillisecondsToTicks(ms)+cyg_current_time());
}
}

4
src/gos/gos_ecos.h

@ -18,8 +18,8 @@
/* Type definitions */
/*===========================================================================*/
#define TIME_IMMEDIATE 0
#define TIME_INFINITE 0xFFFFFFFF
#define gDelayNone 0
#define gDelayForever 0xFFFFFFFF
typedef cyg_ucount32 gDelay;
typedef cyg_tick_count_t gTicks;

4
src/gos/gos_freertos.h

@ -24,8 +24,8 @@
/* Type definitions */
/*===========================================================================*/
#define TIME_IMMEDIATE 0
#define TIME_INFINITE ((gDelay)-1)
#define gDelayNone 0
#define gDelayForever ((gDelay)-1)
typedef uint32_t gDelay;
typedef portTickType gTicks;
typedef int32_t gSemcount;

16
src/gos/gos_linux.c

@ -64,11 +64,11 @@ void gfxSleepMilliseconds(gDelay ms) {
struct timespec ts;
switch(ms) {
case TIME_IMMEDIATE:
case gDelayNone:
linuxyield();
return;
case TIME_INFINITE:
case gDelayForever:
while(1)
sleep(60);
return;
@ -85,11 +85,11 @@ void gfxSleepMicroseconds(gDelay us) {
struct timespec ts;
switch(us) {
case TIME_IMMEDIATE:
case gDelayNone:
linuxyield();
return;
case TIME_INFINITE:
case gDelayForever:
while(1)
sleep(60);
return;
@ -147,10 +147,10 @@ gThreadreturn gfxThreadWait(gfxThreadHandle thread) {
}
gBool gfxSemWait(gfxSem *pSem, gDelay ms) {
switch (ms) {
case TIME_INFINITE:
case gDelayForever:
return sem_wait(&pSem->sem) ? gFalse : gTrue;
case TIME_IMMEDIATE:
case gDelayNone:
return sem_trywait(&pSem->sem) ? gFalse : gTrue;
default:
@ -189,12 +189,12 @@ gThreadreturn gfxThreadWait(gfxThreadHandle thread) {
pthread_mutex_lock(&pSem->mtx);
switch (ms) {
case TIME_INFINITE:
case gDelayForever:
while (!pSem->cnt)
pthread_cond_wait(&pSem->cond, &pSem->mtx);
break;
case TIME_IMMEDIATE:
case gDelayNone:
if (!pSem->cnt) {
pthread_mutex_unlock(&pSem->mtx);
return gFalse;

6
src/gos/gos_linux.h

@ -46,11 +46,11 @@ typedef pthread_mutex_t gfxMutex;
#define gfxMutexDestroy(pmtx) pthread_mutex_destroy(pmtx)
#define gfxMutexEnter(pmtx) pthread_mutex_lock(pmtx)
#define gfxMutexExit(pmtx) pthread_mutex_unlock(pmtx)
#define gfxSemWaitI(psem) gfxSemWait(psem, TIME_IMMEDIATE)
#define gfxSemWaitI(psem) gfxSemWait(psem, gDelayNone)
#define gfxSemSignalI(psem) gfxSemSignal(psem)
#define TIME_IMMEDIATE 0
#define TIME_INFINITE ((gDelay)-1)
#define gDelayNone 0
#define gDelayForever ((gDelay)-1)
#define MAX_SEMAPHORE_COUNT ((gSemcount)-1)
#define LOW_PRIORITY 10
#define NORMAL_PRIORITY 0

12
src/gos/gos_osx.c

@ -57,8 +57,8 @@ void gfxSleepMilliseconds(gDelay ms) {
struct timespec ts;
switch(ms) {
case TIME_IMMEDIATE: gfxYield(); return;
case TIME_INFINITE: while(1) sleep(60); return;
case gDelayNone: gfxYield(); return;
case gDelayForever: while(1) sleep(60); return;
default:
ts.tv_sec = ms / 1000;
ts.tv_nsec = (ms % 1000) * 1000000;
@ -71,8 +71,8 @@ void gfxSleepMicroseconds(gDelay us) {
struct timespec ts;
switch(us) {
case TIME_IMMEDIATE: gfxYield(); return;
case TIME_INFINITE: while(1) sleep(60); return;
case gDelayNone: gfxYield(); return;
case gDelayForever: while(1) sleep(60); return;
default:
ts.tv_sec = us / 1000000;
ts.tv_nsec = (us % 1000000) * 1000;
@ -135,11 +135,11 @@ void gfxSemDestroy(gfxSem *pSem) {
gBool gfxSemWait(gfxSem *pSem, gDelay ms) {
pthread_mutex_lock(&pSem->mtx);
switch (ms) {
case TIME_INFINITE:
case gDelayForever:
while (!pSem->cnt)
pthread_cond_wait(&pSem->cond, &pSem->mtx);
break;
case TIME_IMMEDIATE:
case gDelayNone:
if (!pSem->cnt) {
pthread_mutex_unlock(&pSem->mtx);
return gFalse;

6
src/gos/gos_osx.h

@ -38,11 +38,11 @@ typedef pthread_mutex_t gfxMutex;
#define gfxMutexDestroy(pmtx) pthread_mutex_destroy(pmtx)
#define gfxMutexEnter(pmtx) pthread_mutex_lock(pmtx)
#define gfxMutexExit(pmtx) pthread_mutex_unlock(pmtx)
#define gfxSemWaitI(psem) gfxSemWait(psem, TIME_IMMEDIATE)
#define gfxSemWaitI(psem) gfxSemWait(psem, gDelayNone)
#define gfxSemSignalI(psem) gfxSemSignal(psem)
#define TIME_IMMEDIATE 0
#define TIME_INFINITE ((gDelay)-1)
#define gDelayNone 0
#define gDelayForever ((gDelay)-1)
#define MAX_SEMAPHORE_COUNT ((gSemcount)-1)
#define LOW_PRIORITY 10
#define NORMAL_PRIORITY 0

4
src/gos/gos_qt.h

@ -14,8 +14,8 @@
#define DECLARE_THREAD_STACK(name, sz) uint8_t name[0]
#define THREAD_RETURN(retval) return retval
#define TIME_IMMEDIATE 0
#define TIME_INFINITE ((gDelay)-1)
#define gDelayNone 0
#define gDelayForever ((gDelay)-1)
#define MAX_SEMAPHORE_COUNT ((gSemcount)(((unsigned long)((gSemcount)(-1))) >> 1))
#define LOW_PRIORITY 2
#define NORMAL_PRIORITY 3

2
src/gos/gos_rawrtos.c

@ -70,7 +70,7 @@ gBool gfxSemWait(gfxSem* psem, gDelay ms)
gBool gfxSemWaitI(gfxSem* psem)
{
if(raw_semaphore_get((psem), TIME_IMMEDIATE)==RAW_SUCCESS)
if(raw_semaphore_get((psem), RAW_NO_WAIT)==RAW_SUCCESS)
return gTrue;
return gFalse;
}

6
src/gos/gos_rawrtos.h

@ -5,8 +5,8 @@
#include "raw_api.h"
#define TIME_IMMEDIATE (RAW_NO_WAIT)
#define TIME_INFINITE (RAW_WAIT_FOREVER)
#define gDelayNone (RAW_NO_WAIT)
#define gDelayForever (RAW_WAIT_FOREVER)
typedef uint32_t gDelay;
typedef RAW_TICK_TYPE gTicks;
typedef int32_t gSemcount;
@ -38,7 +38,7 @@ typedef RAW_TASK_OBJ* gfxThreadHandle;
#define gfxSystemUnlock() {}
#define gfxMutexInit(pmutex) raw_mutex_create(pmutex, (RAW_U8 *)"", RAW_MUTEX_INHERIT_POLICY, 3)
#define gfxMutexDestroy(pmutex) raw_mutex_delete(pmutex)
#define gfxMutexEnter(pmutex) raw_mutex_get(pmutex, TIME_INFINITE)
#define gfxMutexEnter(pmutex) raw_mutex_get(pmutex, gDelayForever)
#define gfxMutexExit(pmutex) raw_mutex_put(pmutex)
#define gfxSemInit(psem, val, limit) raw_semaphore_create(psem, "", val)
#define gfxSemDestroy(psem) raw_semaphore_delete(psem)

4
src/gos/gos_win32.c

@ -43,10 +43,10 @@ void gfxSleepMicroseconds(gDelay ms) {
LARGE_INTEGER t1, t2, tdiff;
switch(ms) {
case TIME_IMMEDIATE:
case gDelayNone:
return;
case TIME_INFINITE:
case gDelayForever:
while(1)
Sleep(1000);
return;

6
src/gos/gos_win32.h

@ -35,8 +35,8 @@ typedef int gThreadpriority;
#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 gDelayNone 0
#define gDelayForever INFINITE
#define MAX_SEMAPHORE_COUNT ((gSemcount)(((unsigned long)((gSemcount)(-1))) >> 1))
#define LOW_PRIORITY THREAD_PRIORITY_BELOW_NORMAL
#define NORMAL_PRIORITY THREAD_PRIORITY_NORMAL
@ -60,7 +60,7 @@ typedef HANDLE gfxThreadHandle;
#define gfxMutexExit(pmutex) ReleaseMutex(*(pmutex))
#define gfxSemInit(psem, val, limit) *(psem) = CreateSemaphore(0, val, limit, 0)
#define gfxSemDestroy(psem) CloseHandle(*(psem))
#define gfxSemWaitI(psem) gfxSemWait((psem), TIME_IMMEDIATE)
#define gfxSemWaitI(psem) gfxSemWait((psem), gDelayNone)
#define gfxSemSignal(psem) ReleaseSemaphore(*(psem), 1, 0)
#define gfxSemSignalI(psem) ReleaseSemaphore(*(psem), 1, 0)
#define gfxThreadMe() GetCurrentThread()

20
src/gos/gos_x_threads.c

@ -56,11 +56,11 @@ gBool gfxSemWait(gfxSem *psem, gDelay ms) {
// Convert our delay to ticks
starttm = 0;
switch (ms) {
case TIME_IMMEDIATE:
delay = TIME_IMMEDIATE;
case gDelayNone:
delay = gDelayNone;
break;
case TIME_INFINITE:
delay = TIME_INFINITE;
case gDelayForever:
delay = gDelayForever;
break;
default:
delay = gfxMillisecondsToTicks(ms);
@ -73,9 +73,9 @@ gBool gfxSemWait(gfxSem *psem, gDelay ms) {
INTERRUPTS_ON();
// Check if we have exceeded the defined delay
switch (delay) {
case TIME_IMMEDIATE:
case gDelayNone:
return gFalse;
case TIME_INFINITE:
case gDelayForever:
break;
default:
if (gfxSystemTicks() - starttm >= delay)
@ -117,9 +117,9 @@ void gfxSleepMilliseconds(gDelay ms) {
// Safety first
switch (ms) {
case TIME_IMMEDIATE:
case gDelayNone:
return;
case TIME_INFINITE:
case gDelayForever:
while(1)
gfxYield();
return;
@ -139,9 +139,9 @@ void gfxSleepMicroseconds(gDelay ms) {
// Safety first
switch (ms) {
case TIME_IMMEDIATE:
case gDelayNone:
return;
case TIME_INFINITE:
case gDelayForever:
while(1)
gfxYield();
return;

4
src/gos/gos_x_threads.h

@ -34,8 +34,8 @@ typedef int gThreadpriority;
#define DECLARE_THREAD_STACK(name, sz) uint8_t name[(sz) & ~3];
#define THREAD_RETURN(retval) return retval
#define TIME_IMMEDIATE 0
#define TIME_INFINITE ((gDelay)-1)
#define gDelayNone 0
#define gDelayForever ((gDelay)-1)
#define MAX_SEMAPHORE_COUNT 0x7FFF
#define LOW_PRIORITY 0
#define NORMAL_PRIORITY 1

4
src/gos/gos_zephyr.h

@ -30,8 +30,8 @@ typedef int gThreadpriority;
#define THREAD_RETURN(retval) return
#define TIME_IMMEDIATE K_NO_WAIT
#define TIME_INFINITE K_FOREVER
#define gDelayNone K_NO_WAIT
#define gDelayForever K_FOREVER
#define MAX_SEMAPHORE_COUNT ((gSemcount)(((unsigned long)((gSemcount)(-1))) >> 1))
#define LOW_PRIORITY CONFIG_NUM_PREEMPT_PRIORITIES-1
#define NORMAL_PRIORITY 1

2
src/gqueue/gqueue.c

@ -297,7 +297,7 @@ void _gqueueDeinit(void)
gfxSemInit(&pqueue->sem, 0, MAX_SEMAPHORE_COUNT);
}
void gfxQueueFSyncDeinit(gfxQueueGSync *pqueue) {
while(gfxQueueFSyncGet(pqueue, TIME_IMMEDIATE));
while(gfxQueueFSyncGet(pqueue, gDelayNone));
pqueue->head = pqueue->tail = 0;
gfxSemDestroy(&pqueue->sem);
}

8
src/gqueue/gqueue.h

@ -124,7 +124,7 @@ void gfxQueueFSyncDeinit(gfxQueueFSync *pqueue);
*
* @param[in] pqueue A pointer to the queue
* @param[in] ms The maxmimum time to wait for an item. For ASync queues this parameter is
* not specified as TIME_IMMEDIATE is assumed.
* not specified as gDelayNone is assumed.
*
* @note The routines ending in "I" are interrupt/system/iclass level routines.
*
@ -147,7 +147,7 @@ gfxQueueFSyncItem *gfxQueueFSyncGet(gfxQueueFSync *pqueue, gDelay ms);
* @param[in] pitem A pointer to the queue item
* @param[in] ms The maxmimum time to wait for an item to be removed from the queue (only for FSync queues)
*
* @note FSync: Use a delay time of TIME_IMMEDIATE if you don't want to wait until the
* @note FSync: Use a delay time of gDelayNone if you don't want to wait until the
* item is removed from the queue. Note that even if the timeout occurs - the item
* remains in the queue.
* @note The routines ending in "I" are interrupt/system/iclass level routines.
@ -185,7 +185,7 @@ gBool gfxQueueFSyncPut(gfxQueueFSync *pqueue, gfxQueueFSyncItem *pitem, gDelay m
* @param[in] pitem A pointer to the queue item
* @param[in] ms The maxmimum time to wait for an item to be popped (only for FSync queues)
*
* @note FSync: Use a delay time of TIME_IMMEDIATE if you don't want to wait until the
* @note FSync: Use a delay time of gDelayNone if you don't want to wait until the
* item is removed from the queue. Note that even if the timeout occurs - the item
* remains in the queue.
* @note The routines ending in "I" are interrupt/system/iclass level routines.
@ -211,7 +211,7 @@ gBool gfxQueueFSyncPush(gfxQueueFSync *pqueue, gfxQueueFSyncItem *pitem, gDelay
* pafter can't be found in the queue, it puts the new item at the end of the queue.
* @param[in] ms The maxmimum time to wait for an item to be removed from the queue (only for FSync queues)
*
* @note FSync: Use a delay time of TIME_IMMEDIATE if you don't want to wait until the
* @note FSync: Use a delay time of gDelayNone if you don't want to wait until the
* item is removed from the queue. Note that even if the timeout occurs - the item
* remains in the queue.
* @note The routines ending in "I" are interrupt/system/iclass level routines.

10
src/gtimer/gtimer.c

@ -38,7 +38,7 @@ static DECLARE_THREAD_FUNCTION(GTimerThreadHandler, arg) {
void *param;
(void) arg;
nxtTimeout = TIME_INFINITE;
nxtTimeout = gDelayForever;
lastTime = 0;
while(1) {
/* Wait for work to do. */
@ -49,7 +49,7 @@ static DECLARE_THREAD_FUNCTION(GTimerThreadHandler, arg) {
// Our reference time
tm = gfxSystemTicks();
nxtTimeout = TIME_INFINITE;
nxtTimeout = gDelayForever;
/* We need to obtain the mutex */
gfxMutexEnter(&mutex);