![]() |
µGFX
2.9
version 2.9
|
Module to build a uniform abstraction layer between uGFX and the underlying system.
Data Structures | |
struct | gSem |
A semaphore. More... | |
struct | gMutex |
A mutex. More... | |
Functions | |
void | gfxHalt (const char *msg) |
Halt the GFX application due to an error. More... | |
void | gfxExit (void) |
Exit the GFX application. More... | |
void * | gfxAlloc (gMemSize sz) |
Allocate memory. More... | |
void * | gfxRealloc (void *ptr, gMemSize oldsz, gMemSize newsz) |
Re-allocate memory. More... | |
void | gfxFree (void *ptr) |
Free memory. More... | |
void | gfxYield (void) |
Yield the current thread. More... | |
void | gfxSleepMilliseconds (gDelay ms) |
Put the current thread to sleep for the specified period in milliseconds. More... | |
void | gfxSleepMicroseconds (gDelay us) |
Put the current thread to sleep for the specified period in microseconds. More... | |
gTicks | gfxSystemTicks (void) |
Get the current operating system tick time. More... | |
gTicks | gfxMillisecondsToTicks (gDelay ms) |
Convert a given number of millseconds to a number of operating system ticks. More... | |
void | gfxSystemLock (void) |
Lock the operating system to protect a sequence of code. More... | |
void | gfxSystemUnlock (void) |
Unlock the operating system previous locked by gfxSystemLock() More... | |
void | gfxMutexInit (gMutex *pmutex) |
Initialise a mutex to protect a region of code from other threads. More... | |
void | gfxMutexDestroy (gMutex *pmutex) |
Destroy a Mutex. More... | |
void | gfxMutexEnter (gMutex *pmutex) |
Enter the critical code region protected by the mutex. More... | |
void | gfxMutexExit (gMutex *pmutex) |
Exit the critical code region protected by the mutex. More... | |
void | gfxSemInit (gSem *psem, gSemcount val, gSemcount limit) |
Initialise a Counted Semaphore. More... | |
void | gfxSemDestroy (gSem *psem) |
Destroy a Counted Semaphore. More... | |
gBool | gfxSemWait (gSem *psem, gDelay ms) |
Wait on a semaphore. More... | |
gBool | gfxSemWaitI (gSem *psem) |
Test if a wait on a semaphore can be satisfied immediately. More... | |
void | gfxSemSignal (gSem *psem) |
Signal a semaphore. More... | |
void | gfxSemSignalI (gSem *psem) |
Signal a semaphore. More... | |
gThread | gfxThreadCreate (void *stackarea, gMemSize stacksz, gThreadpriority prio, GFX_THREAD_FUNCTION((*fn), p), void *param) |
Start a new thread. More... | |
gThreadreturn | gfxThreadWait (gThread thread) |
Wait for a thread to finish. More... | |
gThread | gfxThreadMe (void) |
Get the current thread handle. More... | |
void | gfxThreadClose (gThread thread) |
Close the thread handle. More... | |
The operating system to use. One (and only one) of these must be defined. | |
#define | GFX_USE_OS_CHIBIOS GFXOFF |
Use ChibiOS. More... | |
#define | GFX_USE_OS_FREERTOS GFXOFF |
Use FreeRTOS. More... | |
#define | GFX_USE_OS_WIN32 GFXOFF |
Use Win32. More... | |
#define | GFX_USE_OS_LINUX GFXOFF |
Use a linux based system running X11. More... | |
#define | GFX_USE_OS_OSX GFXOFF |
Use a Mac OS-X based system. More... | |
#define | GFX_USE_OS_RAW32 GFXOFF |
Use a Raw 32-bit CPU based system (Bare Metal) More... | |
#define | GFX_USE_OS_ECOS GFXOFF |
Use a eCos. More... | |
#define | GFX_USE_OS_RAWRTOS GFXOFF |
Use RAWRTOS. More... | |
#define | GFX_USE_OS_ARDUINO GFXOFF |
Use Arduino. More... | |
#define | GFX_USE_OS_CMSIS GFXOFF |
Use CMSIS RTOS compatible OS. More... | |
#define | GFX_USE_OS_CMSIS2 GFXOFF |
Use CMSIS2 RTOS compatible OS. More... | |
#define | GFX_USE_OS_KEIL GFXOFF |
Use Keil CMSIS 1.x (RTOS, RTX4) More... | |
#define | GFX_USE_OS_RTX5 GFXOFF |
Use Keil RTX5. More... | |
#define | GFX_USE_OS_NIOS GFXOFF |
Use NIOS-II. More... | |
#define | GFX_USE_OS_ZEPHYR GFXOFF |
Use Zephyr. More... | |
#define | GFX_USE_OS_QT GFXOFF |
Use Qt. More... | |
GFX_OS_EXTRA_DEINIT_FUNCTION | |
A macro that defines a function that uGFX calls as part of gfxDeInit() just before de-initializing the operating system. Defaults to undefined
| |
#define | GFX_OS_NO_INIT GFXOFF |
Should uGFX avoid initializing the operating system. More... | |
#define | GFX_OS_INIT_NO_WARNING GFXOFF |
Turn off warnings about initializing the operating system. More... | |
#define | GFX_OS_CALL_UGFXMAIN GFXOFF |
Call uGFXMain() after all initialisation. More... | |
#define | GFX_OS_UGFXMAIN_STACKSIZE 0 |
When uGFXMain() is started as a thread, what stack size should be used. More... | |
#define | GFX_FREERTOS_USE_TRACE GFXOFF |
Should uGFX stuff be added to the FreeRTOS+Tracer. More... | |
#define | GFX_OS_HEAP_SIZE 0 |
How much RAM should uGFX use for the heap when using its own internal heap allocator. More... | |
#define | GFX_EMULATE_MALLOC GFXOFF |
Enable wrappers for malloc() and free() More... | |
#define | GFX_MEM_LT64K GFXOFF |
Is the maximum memory allocation less than 64K. More... | |
Macros | |
#define | GFX_THREAD_FUNCTION(fnName, param) gThreadreturn fnName(void *param) |
Declare a thread function. More... | |
#define | GFX_THREAD_STACK(name, sz) gU8 name[sz]; |
Declare a thread stack. More... | |
#define | GFX_EMULATE_MALLOC GFXOFF |
Use gfxAlloc and gfxFree to implement malloc() and free() More... | |
Typedefs | |
typedef void * | gThread |
A thread handle. More... | |
void* gfxAlloc | ( | gMemSize | sz | ) |
Allocate memory.
[in] | sz | The size in bytes of the area to allocate |
Referenced by gdriverRegister().
void gfxExit | ( | void | ) |
Exit the GFX application.
void gfxFree | ( | void * | ptr | ) |
Free memory.
[in] | ptr | The memory to free |
Referenced by gdriverRegister(), and gdriverUnRegister().
void gfxHalt | ( | const char * | msg | ) |
Halt the GFX application due to an error.
[in] | msg | An optional debug message to show (Can be NULL) |
gTicks gfxMillisecondsToTicks | ( | gDelay | ms | ) |
Convert a given number of millseconds to a number of operating system ticks.
[in] | ms | The number of millseconds |
void gfxMutexDestroy | ( | gMutex * | pmutex | ) |
Destroy a Mutex.
[in] | pmutex | A pointer to the mutex |
void gfxMutexEnter | ( | gMutex * | pmutex | ) |
Enter the critical code region protected by the mutex.
Blocks until there is no other thread in the critical region.
[in] | pmutex | A pointer to the mutex |
Referenced by geventDetachSourceListeners(), geventGetEventBuffer(), geventGetSourceListener(), geventSendEvent(), gtimerJab(), and gtimerStop().
void gfxMutexExit | ( | gMutex * | pmutex | ) |
Exit the critical code region protected by the mutex.
May cause another thread waiting on the mutex to now be placed into the run queue.
[in] | pmutex | A pointer to the mutex |
Referenced by geventDetachSourceListeners(), geventGetEventBuffer(), geventGetSourceListener(), geventSendEvent(), gtimerJab(), and gtimerStop().
void gfxMutexInit | ( | gMutex * | pmutex | ) |
Initialise a mutex to protect a region of code from other threads.
[in] | pmutex | A pointer to the mutex |
void* gfxRealloc | ( | void * | ptr, |
gMemSize | oldsz, | ||
gMemSize | newsz | ||
) |
Re-allocate memory.
[in] | ptr | The old memory area to be increased/decreased in size |
[in] | oldsz | The size in bytes of the old memory area |
[in] | newsz | The size in bytes of the new memory area |
void gfxSemDestroy | ( | gSem * | psem | ) |
Destroy a Counted Semaphore.
[in] | psem | A pointer to the semaphore |
void gfxSemInit | ( | gSem * | psem, |
gSemcount | val, | ||
gSemcount | limit | ||
) |
Initialise a Counted Semaphore.
[in] | psem | A pointer to the semaphore |
[in] | val | The initial value of the semaphore |
[in] | limit | The maxmimum value of the semaphore |
void gfxSemSignal | ( | gSem * | psem | ) |
Signal a semaphore.
The semaphore counter is increased and if the result is non-positive then a waiting thread is queued for execution. Note that once the thread reaches "limit", further signals are ignored.
[in] | psem | A pointer to the semaphore |
Referenced by geventSendEvent(), and gtimerJab().
void gfxSemSignalI | ( | gSem * | psem | ) |
Signal a semaphore.
The semaphore counter is increased and if the result is non-positive then a waiting thread is queued for execution. Note that once the thread reaches "limit", further signals are ignored.
[in] | psem | A pointer to the semaphore |
Referenced by gtimerJabI().
gBool gfxSemWait | ( | gSem * | psem, |
gDelay | ms | ||
) |
Wait on a semaphore.
The semaphore counter is decreased and if the result becomes negative the thread waits for it to become non-negative again
[in] | psem | A pointer to the semaphore |
[in] | ms | The maximum time to wait for the semaphore |
gBool gfxSemWaitI | ( | gSem * | psem | ) |
Test if a wait on a semaphore can be satisfied immediately.
Equivalent to gfxSemWait(psem, gDelayNone)
except it can be called at interrupt level
[in] | psem | A pointer to the semaphore |
void gfxSleepMicroseconds | ( | gDelay | us | ) |
Put the current thread to sleep for the specified period in microseconds.
[in] | us | The number microseconds to sleep |
void gfxSleepMilliseconds | ( | gDelay | ms | ) |
Put the current thread to sleep for the specified period in milliseconds.
[in] | ms | The number milliseconds to sleep |
Referenced by ginputGetToggleStatus().
void gfxSystemLock | ( | void | ) |
Lock the operating system to protect a sequence of code.
gTicks gfxSystemTicks | ( | void | ) |
Get the current operating system tick time.
void gfxSystemUnlock | ( | void | ) |
Unlock the operating system previous locked by gfxSystemLock()
void gfxThreadClose | ( | gThread | thread | ) |
Close the thread handle.
[in] | thread | The Thread Handle |
gThread gfxThreadCreate | ( | void * | stackarea, |
gMemSize | stacksz, | ||
gThreadpriority | prio, | ||
GFX_THREAD_FUNCTION((*fn), p) | , | ||
void * | param | ||
) |
Start a new thread.
[in] | stackarea | A pointer to the area for the new threads stack or NULL to dynamically allocate it |
[in] | stacksz | The size of the thread stack. 0 means the default operating system size although this is only valid when stackarea is dynamically allocated. |
[in] | prio | The priority of the new thread |
[in] | fn | The function the new thread will run |
[in] | param | A parameter to pass the thread function. |
gThread gfxThreadMe | ( | void | ) |
Get the current thread handle.
gThreadreturn gfxThreadWait | ( | gThread | thread | ) |
Wait for a thread to finish.
[in] | thread | The Thread Handle |
void gfxYield | ( | void | ) |
Yield the current thread.
Give up the rest of the current time slice for this thread in order to give other threads a chance to run.
#define GFX_EMULATE_MALLOC GFXOFF |
Use gfxAlloc and gfxFree to implement malloc() and free()
#define GFX_EMULATE_MALLOC GFXOFF |
Enable wrappers for malloc() and free()
Defaults to GFXOFF
Definition at line 261 of file gos_options.h.
#define GFX_FREERTOS_USE_TRACE GFXOFF |
Should uGFX stuff be added to the FreeRTOS+Tracer.
Defaults to GFXOFF
Definition at line 234 of file gos_options.h.
#define GFX_MEM_LT64K GFXOFF |
Is the maximum memory allocation less than 64K.
Defaults to GFXOFF
Definition at line 275 of file gos_options.h.
#define GFX_OS_CALL_UGFXMAIN GFXOFF |
Call uGFXMain() after all initialisation.
Defaults to GFXOFF
Definition at line 216 of file gos_options.h.
#define GFX_OS_HEAP_SIZE 0 |
How much RAM should uGFX use for the heap when using its own internal heap allocator.
Defaults to 0.
gfxAddHeapBlock()
is added allowing the user to add extra memory blocks to the heap. Definition at line 249 of file gos_options.h.
#define GFX_OS_INIT_NO_WARNING GFXOFF |
Turn off warnings about initializing the operating system.
Defaults to GFXOFF
Definition at line 202 of file gos_options.h.
#define GFX_OS_NO_INIT GFXOFF |
Should uGFX avoid initializing the operating system.
Defaults to GFXOFF
Definition at line 192 of file gos_options.h.
#define GFX_OS_UGFXMAIN_STACKSIZE 0 |
When uGFXMain() is started as a thread, what stack size should be used.
Defaults to 0
Definition at line 227 of file gos_options.h.
#define GFX_THREAD_FUNCTION | ( | fnName, | |
param | |||
) | gThreadreturn fnName(void *param) |
#define GFX_THREAD_STACK | ( | name, | |
sz | |||
) | gU8 name[sz]; |
Declare a thread stack.
[in] | name | The name of the stack |
[in] | sz | The size of the stack in bytes |
#define GFX_USE_OS_ARDUINO GFXOFF |
#define GFX_USE_OS_CHIBIOS GFXOFF |
#define GFX_USE_OS_CMSIS GFXOFF |
#define GFX_USE_OS_CMSIS2 GFXOFF |
#define GFX_USE_OS_ECOS GFXOFF |
#define GFX_USE_OS_FREERTOS GFXOFF |
#define GFX_USE_OS_KEIL GFXOFF |
#define GFX_USE_OS_LINUX GFXOFF |
Use a linux based system running X11.
Defaults to GFXOFF
Definition at line 49 of file gos_options.h.
#define GFX_USE_OS_NIOS GFXOFF |
#define GFX_USE_OS_OSX GFXOFF |
#define GFX_USE_OS_QT GFXOFF |
#define GFX_USE_OS_RAW32 GFXOFF |
Use a Raw 32-bit CPU based system (Bare Metal)
Defaults to GFXOFF
Definition at line 63 of file gos_options.h.
#define GFX_USE_OS_RAWRTOS GFXOFF |
#define GFX_USE_OS_RTX5 GFXOFF |
#define GFX_USE_OS_WIN32 GFXOFF |
#define GFX_USE_OS_ZEPHYR GFXOFF |