Browse Source

gThreadpriorityLow/Normal/High to replace LOW_/NORMAL_/HIGH_PRIORITY

remotes/origin_old/release/v2.9
inmarket 4 years ago
parent
commit
1fc4180d41
  1. 2
      changelog.txt
  2. 2
      demos/3rdparty/notepad-2/notepadApp.h
  3. 2
      demos/3rdparty/notepad-2/notepadCore.h
  4. 2
      demos/applications/combo/bounce.c
  5. 2
      demos/applications/combo/mandelbrot.c
  6. 2
      demos/games/justget10/jg10.c
  7. 2
      demos/games/minesweeper/mines.c
  8. 2
      demos/games/tetris/tetris.c
  9. 4
      demos/modules/gos/threads/main.c
  10. 2
      demos/modules/gos/threads_advanced/main.c
  11. 4
      demos/tools/uGFXnetDisplay/main.c
  12. 2
      drivers/multiple/X/gdisp_lld_X.c
  13. 4
      drivers/multiple/uGFXnet/gdisp_lld_uGFXnet.c
  14. 2
      gfxconf.example.h
  15. 21
      src/gos/gos.h
  16. 6
      src/gos/gos_chibios.h
  17. 6
      src/gos/gos_cmsis.h
  18. 4
      src/gos/gos_cmsis2.c
  19. 6
      src/gos/gos_cmsis2.h
  20. 6
      src/gos/gos_ecos.h
  21. 2
      src/gos/gos_freertos.c
  22. 6
      src/gos/gos_freertos.h
  23. 6
      src/gos/gos_linux.h
  24. 6
      src/gos/gos_osx.h
  25. 6
      src/gos/gos_qt.h
  26. 6
      src/gos/gos_rawrtos.h
  27. 6
      src/gos/gos_win32.h
  28. 6
      src/gos/gos_x_threads.h
  29. 6
      src/gos/gos_zephyr.h
  30. 4
      src/gtimer/gtimer_options.h

2
changelog.txt

@ -19,7 +19,7 @@ CHANGE: Added type gBool to replace V2.x bool_t, and values gT
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
CHANGE: Added type gThreadpriority to replace V2.x threadpriority_t and values gThreadpriorityLow/Normal/High to replace LOW_/NORMAL_/HIGH_PRIORITY
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

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

@ -38,7 +38,7 @@
#include "notepadCore.h"
#include "notepadUIDefines.h"
#define NPAD_THD_PRIO NORMAL_PRIORITY
#define NPAD_THD_PRIO gThreadpriorityNormal
#define NPAD_THD_WA_SIZE 512
void nSetColorScheme(NColorScheme sch);

2
demos/3rdparty/notepad-2/notepadCore.h

@ -37,7 +37,7 @@
/* Configuration */
#define NCORE_THD_STACK_SIZE 256
#define NCORE_THD_PRIO NORMAL_PRIORITY
#define NCORE_THD_PRIO gThreadpriorityNormal
#define NCORE_MODE_DRAW 0
#define NCORE_MODE_ERASE 1

2
demos/applications/combo/bounce.c

@ -153,7 +153,7 @@ void doBounce(GHandle parent, gBool start) {
if (start) {
run = gTrue;
gh = parent;
thread = gfxThreadCreate(0, 0x200, LOW_PRIORITY, task, 0);
thread = gfxThreadCreate(0, 0x200, gThreadpriorityLow, task, 0);
} else if (run) {
run = gFalse;
gfxThreadWait(thread);

2
demos/applications/combo/mandelbrot.c

@ -89,7 +89,7 @@ void doMandlebrot(GHandle parent, gBool start) {
if (start) {
run = gTrue;
gh = parent;
thread = gfxThreadCreate(0, 0x400, LOW_PRIORITY, task, 0);
thread = gfxThreadCreate(0, 0x400, gThreadpriorityLow, task, 0);
} else if (run) {
run = gFalse;
gfxThreadWait(thread);

2
demos/games/justget10/jg10.c

@ -460,7 +460,7 @@ void jg10Start(void) {
#endif
initField();
guiCreate();
gfxThreadCreate(0, 1024, NORMAL_PRIORITY, thdJg10, 0);
gfxThreadCreate(0, 1024, gThreadpriorityNormal, thdJg10, 0);
while (!jg10GameOver) {
gfxSleepMilliseconds(100);
}

2
demos/games/minesweeper/mines.c

@ -382,7 +382,7 @@ void minesStart(void)
#endif
initField();
gfxThreadCreate(0, 1024, NORMAL_PRIORITY, thdMines, 0);
gfxThreadCreate(0, 1024, gThreadpriorityNormal, thdMines, 0);
while (!minesGameOver) {
gfxSleepMilliseconds(100);
}

2
demos/games/tetris/tetris.c

@ -498,7 +498,7 @@ void tetrisStart(void) {
tetrisGameOver = gFalse;
printGameOver(); // removes "Game Over!" if tetrisGameOver == gFalse
tetrisPreviousGameTime = gfxSystemTicks();
gfxThreadCreate(0, 1024, NORMAL_PRIORITY, thdTetris, 0);
gfxThreadCreate(0, 1024, gThreadpriorityNormal, thdTetris, 0);
while (!tetrisGameOver) {
gfxSleepMilliseconds(1000);
}

4
demos/modules/gos/threads/main.c

@ -51,8 +51,8 @@ int main(void)
gfxInit();
// Give this plenty of stack. Stack size optimisation should be a production change only
gfxThreadCreate(0, 2048, NORMAL_PRIORITY, heartbeat1, 0);
gfxThreadCreate(0, 2048, NORMAL_PRIORITY, heartbeat2, 0);
gfxThreadCreate(0, 2048, gThreadpriorityNormal, heartbeat1, 0);
gfxThreadCreate(0, 2048, gThreadpriorityNormal, heartbeat2, 0);
while (1) {
DEBUGWRITE("thread main\n");

2
demos/modules/gos/threads_advanced/main.c

@ -107,7 +107,7 @@ int main(void)
/* Create a static thread from the default heap with normal priority.
* We pass a the parameter to the thread which tells the thread whether to return or not
*/
thd = gfxThreadCreate(NULL, 2048, NORMAL_PRIORITY, Thread_function, (void*)&exitThread);
thd = gfxThreadCreate(NULL, 2048, gThreadpriorityNormal, Thread_function, (void*)&exitThread);
/* Start the timer. The callback function will be called once after 2000ms
* We will pass the thread handle as a parameter so the timer can ask the thread to terminate

4
demos/tools/uGFXnetDisplay/main.c

@ -81,7 +81,7 @@
#define StartSockets() Start_LWIP();
#else
#include "lwipthread.h"
#define StartSockets() gfxThreadClose(gfxThreadCreate(wa_lwip_thread, LWIP_THREAD_STACK_SIZE, NORMAL_PRIORITY, lwip_thread, 0))
#define StartSockets() gfxThreadClose(gfxThreadCreate(wa_lwip_thread, LWIP_THREAD_STACK_SIZE, gThreadpriorityNormal, lwip_thread, 0))
#endif
#if !LWIP_SOCKET
@ -358,7 +358,7 @@ int main(proto_args) {
#if GFX_USE_GINPUT && GINPUT_NEED_MOUSE
// Start the mouse thread if needed
if (cmd[3])
gfxThreadClose(gfxThreadCreate(waNetThread, sizeof(waNetThread), HIGH_PRIORITY, NetThread, 0));
gfxThreadClose(gfxThreadCreate(waNetThread, sizeof(waNetThread), gThreadpriorityHigh, NetThread, 0));
#endif
// Process incoming instructions

2
drivers/multiple/X/gdisp_lld_X.c

@ -330,7 +330,7 @@ LLDSPEC gBool gdisp_lld_init(GDisplay *g) {
#endif
fprintf(stderr, "Running GFX Window in %d bit color\n", vis.depth);
if (!(hth = gfxThreadCreate(waXThread, sizeof(waXThread), HIGH_PRIORITY, ThreadX, 0))) {
if (!(hth = gfxThreadCreate(waXThread, sizeof(waXThread), gThreadpriorityHigh, ThreadX, 0))) {
fprintf(stderr, "Cannot start X Thread\n");
XCloseDisplay(dis);
exit(0);

4
drivers/multiple/uGFXnet/gdisp_lld_uGFXnet.c

@ -124,7 +124,7 @@
#define StartSockets() Start_LWIP();
#else
#include "lwipthread.h"
#define StartSockets() gfxThreadClose(gfxThreadCreate(wa_lwip_thread, LWIP_THREAD_STACK_SIZE, NORMAL_PRIORITY, lwip_thread, 0))
#define StartSockets() gfxThreadClose(gfxThreadCreate(wa_lwip_thread, LWIP_THREAD_STACK_SIZE, gThreadpriorityNormal, lwip_thread, 0))
#endif
#if !LWIP_SOCKET
@ -435,7 +435,7 @@ LLDSPEC gBool gdisp_lld_init(GDisplay *g) {
// Initialise the receiver thread (if it hasn't been done already)
if (!hThread) {
MUTEX_INIT;
hThread = gfxThreadCreate(waNetThread, sizeof(waNetThread), HIGH_PRIORITY, NetThread, 0);
hThread = gfxThreadCreate(waNetThread, sizeof(waNetThread), gThreadpriorityHigh, NetThread, 0);
gfxThreadClose(hThread);
}

2
gfxconf.example.h

@ -264,7 +264,7 @@
///////////////////////////////////////////////////////////////////////////
//#define GFX_USE_GTIMER GFXOFF
//#define GTIMER_THREAD_PRIORITY HIGH_PRIORITY
//#define GTIMER_THREAD_PRIORITY gThreadpriorityHigh
//#define GTIMER_THREAD_WORKAREA_SIZE 2048

21
src/gos/gos.h

@ -99,12 +99,12 @@
* @note Your platform may use slightly different definitions to these
* @{
*/
#define gDelayNone 0
#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
#define HIGH_PRIORITY 2
#define gThreadpriorityLow 0
#define gThreadpriorityNormal 1
#define gThreadpriorityHigh 2
/** @} */
/**
@ -495,14 +495,17 @@
#if GFX_COMPAT_V2
typedef gDelay delaytime_t;
#if !GFX_USE_OS_CHIBIOS
// These values are defined by ChibiOS itself
#define TIME_IMMEDIATE gDelayNone
#define TIME_INFINITE gDelayForever
#endif
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
#define LOW_PRIORITY gThreadpriorityLow
#define NORMAL_PRIORITY gThreadpriorityNormal
#define HIGH_PRIORITY gThreadpriorityHigh
#endif
#endif /* _GOS_H */

6
src/gos/gos_chibios.h

@ -39,9 +39,9 @@ typedef msg_t gThreadreturn;
typedef tprio_t gThreadpriority;
#define MAX_SEMAPHORE_COUNT ((gSemcount)(((unsigned long)((gSemcount)(-1))) >> 1))
#define LOW_PRIORITY LOWPRIO
#define NORMAL_PRIORITY NORMALPRIO
#define HIGH_PRIORITY HIGHPRIO
#define gThreadpriorityLow LOWPRIO
#define gThreadpriorityNormal NORMALPRIO
#define gThreadpriorityHigh HIGHPRIO
#define DECLARE_THREAD_STACK(name, sz) WORKING_AREA(name, sz)
#define DECLARE_THREAD_FUNCTION(fnName, param) gThreadreturn fnName(void *param)

6
src/gos/gos_cmsis.h

@ -34,9 +34,9 @@ typedef void gThreadreturn;
typedef osPriority gThreadpriority;
#define MAX_SEMAPHORE_COUNT osFeature_Semaphore
#define LOW_PRIORITY osPriorityLow
#define NORMAL_PRIORITY osPriorityNormal
#define HIGH_PRIORITY osPriorityHigh
#define gThreadpriorityLow osPriorityLow
#define gThreadpriorityNormal osPriorityNormal
#define gThreadpriorityHigh osPriorityHigh
typedef struct gfxSem {
uint32_t semaphore[2];

4
src/gos/gos_cmsis2.c

@ -44,12 +44,12 @@ void _gosPostInit(void)
osKernelInitialize();
/* Fall Through */
case osKernelReady:
gfxThreadCreate(0, GFX_OS_UGFXMAIN_STACKSIZE, NORMAL_PRIORITY, startUGFX_CMSIS2, 0);
gfxThreadCreate(0, GFX_OS_UGFXMAIN_STACKSIZE, gThreadpriorityNormal, startUGFX_CMSIS2, 0);
osKernelStart();
gfxHalt("Unable to start CMSIS V2 scheduler. Out of memory?");
break;
default:
gfxThreadCreate(0, GFX_OS_UGFXMAIN_STACKSIZE, NORMAL_PRIORITY, startUGFX_CMSIS2, 0);
gfxThreadCreate(0, GFX_OS_UGFXMAIN_STACKSIZE, gThreadpriorityNormal, startUGFX_CMSIS2, 0);
break;
}
#endif

6
src/gos/gos_cmsis2.h

@ -34,9 +34,9 @@ typedef void gThreadreturn;
typedef osPriority_t gThreadpriority;
#define MAX_SEMAPHORE_COUNT 65535UL
#define LOW_PRIORITY osPriorityLow
#define NORMAL_PRIORITY osPriorityNormal
#define HIGH_PRIORITY osPriorityHigh
#define gThreadpriorityLow osPriorityLow
#define gThreadpriorityNormal osPriorityNormal
#define gThreadpriorityHigh osPriorityHigh
typedef osSemaphoreId_t gfxSem;

6
src/gos/gos_ecos.h

@ -29,9 +29,9 @@ typedef cyg_addrword_t gThreadpriority;
typedef cyg_handle_t gfxThreadHandle;
#define MAX_SEMAPHORE_COUNT 0x7FFFFFFF
#define LOW_PRIORITY (CYGNUM_KERNEL_SCHED_PRIORITIES-2)
#define NORMAL_PRIORITY (CYGNUM_KERNEL_SCHED_PRIORITIES/2)
#define HIGH_PRIORITY 0
#define gThreadpriorityLow (CYGNUM_KERNEL_SCHED_PRIORITIES-2)
#define gThreadpriorityNormal (CYGNUM_KERNEL_SCHED_PRIORITIES/2)
#define gThreadpriorityHigh 0
#define DECLARE_THREAD_STACK(name, sz) struct { cyg_thread t; unsigned char stk[(sz) & ~3]; } name[1]
#define DECLARE_THREAD_FUNCTION(fnName, param) gThreadreturn fnName(cyg_addrword_t param)

2
src/gos/gos_freertos.c

@ -52,7 +52,7 @@ void _gosPostInit(void)
{
#if !GFX_OS_NO_INIT && GFX_OS_CALL_UGFXMAIN
if (xTaskGetSchedulerState() == taskSCHEDULER_NOT_STARTED) {
gfxThreadCreate(0, GFX_OS_UGFXMAIN_STACKSIZE, NORMAL_PRIORITY, startUGFX_FreeRTOS, 0);
gfxThreadCreate(0, GFX_OS_UGFXMAIN_STACKSIZE, gThreadpriorityNormal, startUGFX_FreeRTOS, 0);
vTaskStartScheduler();
gfxHalt("Unable to start FreeRTOS scheduler. Out of memory?");
}

6
src/gos/gos_freertos.h

@ -33,9 +33,9 @@ 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
#define gThreadpriorityLow 0
#define gThreadpriorityNormal configMAX_PRIORITIES/2
#define gThreadpriorityHigh configMAX_PRIORITIES-1
/* FreeRTOS will allocate the stack when creating the thread */
#define DECLARE_THREAD_STACK(name, sz) uint8_t name[1]

6
src/gos/gos_linux.h

@ -52,9 +52,9 @@ typedef pthread_mutex_t gfxMutex;
#define gDelayNone 0
#define gDelayForever ((gDelay)-1)
#define MAX_SEMAPHORE_COUNT ((gSemcount)-1)
#define LOW_PRIORITY 10
#define NORMAL_PRIORITY 0
#define HIGH_PRIORITY -10
#define gThreadpriorityLow 10
#define gThreadpriorityNormal 0
#define gThreadpriorityHigh -10
#if GFX_USE_POSIX_SEMAPHORES
typedef struct gfxSem {

6
src/gos/gos_osx.h

@ -44,9 +44,9 @@ typedef pthread_mutex_t gfxMutex;
#define gDelayNone 0
#define gDelayForever ((gDelay)-1)
#define MAX_SEMAPHORE_COUNT ((gSemcount)-1)
#define LOW_PRIORITY 10
#define NORMAL_PRIORITY 0
#define HIGH_PRIORITY -10
#define gThreadpriorityLow 10
#define gThreadpriorityNormal 0
#define gThreadpriorityHigh -10
typedef struct gfxSem {
pthread_mutex_t mtx;

6
src/gos/gos_qt.h

@ -17,9 +17,9 @@
#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
#define HIGH_PRIORITY 4
#define gThreadpriorityLow 2
#define gThreadpriorityNormal 3
#define gThreadpriorityHigh 4
typedef int gTicks;
typedef int gDelay;

6
src/gos/gos_rawrtos.h

@ -14,9 +14,9 @@ typedef uint32_t gThreadreturn;
typedef RAW_U8 gThreadpriority;
#define MAX_SEMAPHORE_COUNT RAW_SEMAPHORE_COUNT
#define LOW_PRIORITY (CONFIG_RAW_PRIO_MAX-2)
#define NORMAL_PRIORITY (CONFIG_RAW_PRIO_MAX/2)
#define HIGH_PRIORITY 1
#define gThreadpriorityLow (CONFIG_RAW_PRIO_MAX-2)
#define gThreadpriorityNormal (CONFIG_RAW_PRIO_MAX/2)
#define gThreadpriorityHigh 1
typedef RAW_SEMAPHORE gfxSem;
typedef RAW_MUTEX gfxMutex;

6
src/gos/gos_win32.h

@ -38,9 +38,9 @@ typedef int gThreadpriority;
#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
#define HIGH_PRIORITY THREAD_PRIORITY_ABOVE_NORMAL
#define gThreadpriorityLow THREAD_PRIORITY_BELOW_NORMAL
#define gThreadpriorityNormal THREAD_PRIORITY_NORMAL
#define gThreadpriorityHigh THREAD_PRIORITY_ABOVE_NORMAL
typedef HANDLE gfxSem;
typedef HANDLE gfxMutex;

6
src/gos/gos_x_threads.h

@ -37,9 +37,9 @@ typedef int gThreadpriority;
#define gDelayNone 0
#define gDelayForever ((gDelay)-1)
#define MAX_SEMAPHORE_COUNT 0x7FFF
#define LOW_PRIORITY 0
#define NORMAL_PRIORITY 1
#define HIGH_PRIORITY 2
#define gThreadpriorityLow 0
#define gThreadpriorityNormal 1
#define gThreadpriorityHigh 2
typedef struct {
gSemcount cnt;

6
src/gos/gos_zephyr.h

@ -33,9 +33,9 @@ typedef int gThreadpriority;
#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
#define HIGH_PRIORITY 0
#define gThreadpriorityLow CONFIG_NUM_PREEMPT_PRIORITIES-1
#define gThreadpriorityNormal 1
#define gThreadpriorityHigh 0
typedef struct k_sem gfxSem;

4
src/gtimer/gtimer_options.h

@ -28,10 +28,10 @@
*/
/**
* @brief Defines the GTIMER thread priority
* @details Defaults to HIGH_PRIORITY
* @details Defaults to gThreadpriorityHigh
*/
#ifndef GTIMER_THREAD_PRIORITY
#define GTIMER_THREAD_PRIORITY HIGH_PRIORITY
#define GTIMER_THREAD_PRIORITY gThreadpriorityHigh
#endif
/**
* @brief Defines the size of the timer threads work area (stack+structures).

Loading…
Cancel
Save