15 #error "GOS: Operating System initialization for eCos is not yet implemented in uGFX. Please set GFX_OS_NO_INIT to GFXON in your gfxconf.h"
17 #if !GFX_OS_INIT_NO_WARNING
18 #if GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_DIRECT
19 #warning "GOS: Operating System initialization has been turned off. Make sure you call cyg_scheduler_start() before gfxInit() in your application!"
20 #elif GFX_COMPILER_WARNING_TYPE == GFX_COMPILER_WARNING_MACRO
21 COMPILER_WARNING(
"GOS: Operating System initialization has been turned off. Make sure you call cyg_scheduler_start() before gfxInit() in your application!")
26 void _gosPostInit(
void)
38 case gDelayNone: cyg_thread_yield();
return;
39 case gDelayForever: cyg_thread_suspend(cyg_thread_self());
return;
47 case gDelayNone:
return;
48 case gDelayForever: cyg_thread_suspend(cyg_thread_self());
return;
59 cyg_semaphore_init(&psem->sem, val);
64 cyg_semaphore_destroy(&psem->sem);
70 case gDelayNone:
return cyg_semaphore_trywait(&psem->sem);
71 case gDelayForever:
return cyg_semaphore_wait(&psem->sem);
78 return cyg_semaphore_trywait(&psem->sem);
83 if (psem->limit == gSemMaxCount)
84 cyg_semaphore_post(&psem->sem);
87 if (cyg_semaphore_peek(&psem->sem, &cnt) < psem->limit)
88 cyg_semaphore_post(&psem->sem);
89 cyg_scheduler_unlock();
95 if (psem->limit == gSemMaxCount || cyg_semaphore_peek(&psem->sem, &cnt) < psem->limit)
96 cyg_semaphore_post(&psem->sem);
104 if (!stacksz) stacksz = CYGNUM_HAL_STACK_SIZE_TYPICAL;
105 if (!(stackarea =
gfxAlloc(stacksz+
sizeof(cyg_thread))))
112 cyg_thread_create(prio, fn, param,
"uGFX", (((cyg_thread *)stackarea)+1), stacksz, &th, (cyg_thread *)stackarea);
113 cyg_thread_resume(th);
void gfxSemSignal(gSem *psem)
Signal a semaphore.
void * gThread
A thread handle.
#define GFX_THREAD_FUNCTION(fnName, param)
Declare a thread function.
gTicks gfxMillisecondsToTicks(gDelay ms)
Convert a given number of millseconds to a number of operating system ticks.
gBool gfxSemWait(gSem *psem, gDelay ms)
Wait on a semaphore.
void gfxSleepMicroseconds(gDelay us)
Put the current thread to sleep for the specified period in microseconds.
void * gfxAlloc(gMemSize sz)
Allocate memory.
gThread gfxThreadCreate(void *stackarea, gMemSize stacksz, gThreadpriority prio, GFX_THREAD_FUNCTION((*fn), p), void *param)
Start a new thread.
gBool gfxSemWaitI(gSem *psem)
Test if a wait on a semaphore can be satisfied immediately.
void gfxSemDestroy(gSem *psem)
Destroy a Counted Semaphore.
void gfxSemInit(gSem *psem, gSemcount val, gSemcount limit)
Initialise a Counted Semaphore.
void gfxSemSignalI(gSem *psem)
Signal a semaphore.
void gfxSleepMilliseconds(gDelay ms)
Put the current thread to sleep for the specified period in milliseconds.