gDelayNone/gDelayForever to replace TIME_IMMEDIATE/TIME_INFINITE
This commit is contained in:
parent
215f31ee3d
commit
93da5a0578
@ -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"
|
||||
|
@ -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
vendored
2
demos/3rdparty/notepad-2/notepadApp.c
vendored
@ -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) {
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -72,7 +72,7 @@ int main(void) {
|
||||
|
||||
while(1) {
|
||||
// Get an Event
|
||||
pe = geventEventWait(&gl, TIME_INFINITE);
|
||||
pe = geventEventWait(&gl, gDelayForever);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -124,7 +124,7 @@ int main(void) {
|
||||
|
||||
while(1) {
|
||||
// Get an Event
|
||||
pe = geventEventWait(&gl, TIME_INFINITE);
|
||||
pe = geventEventWait(&gl, gDelayForever);
|
||||
|
||||
}
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -87,7 +87,7 @@ int main(void) {
|
||||
|
||||
while(1) {
|
||||
// Get an Event
|
||||
pe = geventEventWait(&gl, TIME_INFINITE);
|
||||
pe = geventEventWait(&gl, gDelayForever);
|
||||
|
||||
(void)pe;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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:
|
||||
|
@ -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)
|
||||
|
@ -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.
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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).
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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))))
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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) {
|
||||
|
@ -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 */
|
||||
|
@ -202,7 +202,7 @@ gDelay gdispImageNext_JPG(gdispImage *img) {
|
||||
(void) img;
|
||||
|
||||
/* No more frames/pages */
|
||||
return TIME_INFINITE;
|
||||
return gDelayForever;
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------/
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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 */
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -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()
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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.
|
||||
|
@ -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);
|
||||
@ -61,7 +61,7 @@ static DECLARE_THREAD_FUNCTION(GTimerThreadHandler, arg) {
|
||||
if ((pt->flags & GTIMER_FLG_JABBED) || (!(pt->flags & GTIMER_FLG_INFINITE) && TimeIsWithin(pt->when, lastTime, tm))) {
|
||||
|
||||
// Is this timer periodic?
|
||||
if ((pt->flags & GTIMER_FLG_PERIODIC) && pt->period != TIME_IMMEDIATE) {
|
||||
if ((pt->flags & GTIMER_FLG_PERIODIC) && pt->period != gDelayNone) {
|
||||
// Yes - Update ready for the next period
|
||||
if (!(pt->flags & GTIMER_FLG_INFINITE)) {
|
||||
// We may have skipped a period.
|
||||
@ -164,9 +164,9 @@ void gtimerStart(GTimer *pt, GTimerFunction fn, void *param, gBool periodic, gDe
|
||||
pt->flags = GTIMER_FLG_SCHEDULED;
|
||||
if (periodic)
|
||||
pt->flags |= GTIMER_FLG_PERIODIC;
|
||||
if (millisec == TIME_INFINITE) {
|
||||
if (millisec == gDelayForever) {
|
||||
pt->flags |= GTIMER_FLG_INFINITE;
|
||||
pt->period = TIME_INFINITE;
|
||||
pt->period = gDelayForever;
|
||||
} else {
|
||||
pt->period = gfxMillisecondsToTicks(millisec);
|
||||
pt->when = gfxSystemTicks() + pt->period;
|
||||
|
@ -89,9 +89,9 @@ void gtimerDeinit(GTimer* pt);
|
||||
* @param[in] param The parameter to pass to the callback function
|
||||
* @param[in] periodic Is the timer a periodic timer? gFalse is a once-only timer.
|
||||
* @param[in] millisec The timer period. The following special values are allowed:
|
||||
* TIME_IMMEDIATE causes the callback function to be called asap.
|
||||
* gDelayNone causes the callback function to be called asap.
|
||||
* A periodic timer with this value will fire once only.
|
||||
* TIME_INFINITE never timeout (unless triggered by gtimerJab or gtimerJabI)
|
||||
* gDelayForever never timeout (unless triggered by gtimerJab or gtimerJabI)
|
||||
*
|
||||
* @note If the timer is already active its properties are updated with the new parameters.
|
||||
* The current period will be immediately canceled (without the callback function being
|
||||
|
@ -99,10 +99,10 @@ static void ImageRedraw(GHandle gh) {
|
||||
|
||||
// Wait for that delay if required
|
||||
switch(delay) {
|
||||
case TIME_INFINITE:
|
||||
case gDelayForever:
|
||||
// Everything is done
|
||||
break;
|
||||
case TIME_IMMEDIATE:
|
||||
case gDelayNone:
|
||||
// We can't allow a continuous loop here as it would lock the system up so we delay for the minimum period
|
||||
delay = 1;
|
||||
// Fall through
|
||||
|
@ -190,7 +190,7 @@ void _gwmInit(void)
|
||||
#endif
|
||||
#if !GWIN_REDRAW_IMMEDIATE
|
||||
gtimerInit(&RedrawTimer);
|
||||
gtimerStart(&RedrawTimer, RedrawTimerFn, 0, gTrue, TIME_INFINITE);
|
||||
gtimerStart(&RedrawTimer, RedrawTimerFn, 0, gTrue, gDelayForever);
|
||||
#endif
|
||||
_GWINwm = (GWindowManager *)&GNullWindowManager;
|
||||
_GWINwm->vmt->Init();
|
||||
@ -231,8 +231,8 @@ void _gwinFlushRedraws(GRedrawMethod how) {
|
||||
|
||||
// Obtain the drawing lock
|
||||
if (how == REDRAW_WAIT)
|
||||
gfxSemWait(&gwinsem, TIME_INFINITE);
|
||||
else if (how == REDRAW_NOWAIT && !gfxSemWait(&gwinsem, TIME_IMMEDIATE))
|
||||
gfxSemWait(&gwinsem, gDelayForever);
|
||||
else if (how == REDRAW_NOWAIT && !gfxSemWait(&gwinsem, gDelayNone))
|
||||
// Someone is drawing - They will do the redraw when they are finished
|
||||
return;
|
||||
|
||||
@ -373,7 +373,7 @@ gBool _gwinDrawStart(GHandle gh) {
|
||||
return gFalse;
|
||||
|
||||
// Obtain the drawing lock
|
||||
gfxSemWait(&gwinsem, TIME_INFINITE);
|
||||
gfxSemWait(&gwinsem, gDelayForever);
|
||||
|
||||
// Re-test visibility as we may have waited a while
|
||||
if (!(gh->flags & GWIN_FLG_SYSVISIBLE)) {
|
||||
@ -742,7 +742,7 @@ static gBool WM_Add(GHandle gh, const GWindowInit *pInit) {
|
||||
|
||||
static void WM_Delete(GHandle gh) {
|
||||
// Remove it from the window list
|
||||
gfxSemWait(&gwinsem, TIME_INFINITE);
|
||||
gfxSemWait(&gwinsem, gDelayForever);
|
||||
gfxQueueASyncRemove(&_GWINList, &gh->wmq);
|
||||
gfxSemSignal(&gwinsem);
|
||||
}
|
||||
@ -986,7 +986,7 @@ static void WM_Raise(GHandle gh) {
|
||||
// Take it off the list and then put it back on top
|
||||
// The order of the list then reflects the z-order.
|
||||
|
||||
gfxSemWait(&gwinsem, TIME_INFINITE);
|
||||
gfxSemWait(&gwinsem, gDelayForever);
|
||||
|
||||
gfxQueueASyncRemove(&_GWINList, &gh->wmq);
|
||||
gfxQueueASyncPut(&_GWINList, &gh->wmq);
|
||||
|
Loading…
Reference in New Issue
Block a user