Difference between revisions of "GOS"

From uGFX Wiki
Jump to: navigation, search
(Porting)
(Functions)
Line 15: Line 15:
  
 
=== Functions ===
 
=== Functions ===
Below you can find a complete overview of all the functions that need to be implemented. Most of those can just be <code>#define</code> wrappers around the matching ones of your underlying system.
+
ToDo
 
<syntaxhighlight lang=c>
 
<syntaxhighlight lang=c>
 
void            gfxHalt(const char *msg);
 
void            gfxHalt(const char *msg);
Line 46: Line 46:
 
void            gfxThreadClose(gfxThreadHandle thread);
 
void            gfxThreadClose(gfxThreadHandle thread);
 
</syntaxhighlight>
 
</syntaxhighlight>
 
  
 
=== Data types ===
 
=== Data types ===

Revision as of 20:22, 1 July 2014

GOS is the module which builds the abstraction layer between µGFX and the underlying system. The underlying system can be an RTOS such as ChibiOS or FreeRTOS, or also just a stand-alone library like the STDperiph library from STmicroelectronics. The GOS module allows to write completely platform independent application code.

Existing ports

The following ports already exist and are part of the official repository:

  • ChibiOS/RT
  • FreeRTOS
  • BareMetal (no OS at all)
  • Linux
  • Mac OS X
  • Window

Porting

Porting uGFX to a new underlying system is fairly easy. Only a couple of functions and data types have to be implemented and declared.

Functions

ToDo

void            gfxHalt(const char *msg);
void            gfxExit(void);
void*           gfxAlloc(size_t sz);
void*           gfxRealloc(void *p, size_t oldsz, size_t newsz);
void            gfxFree(void *ptr);
void            gfxYield(void);
void            gfxSleepMilliseconds(delaytime_t ms);
void            gfxSleepMicroseconds(delaytime_t ms);
systemticks_t   gfxSystemTicks(void);
systemticks_t   gfxMillisecondsToTicks(delaytime_t ms);
void            gfxSystemLock(void);
void            gfxSystemUnlock(void);
void            gfxMutexInit(gfxMutex *pmutex);
void            gfxMutexDestroy(gfxMutex *pmutex);
void            gfxMutexEnter(gfxMutex *pmutex);
void            gfxMutexExit(gfxMutex *pmutex);
void            gfxSemInit(gfxSem *psem, semcount_t val, semcount_t limit);
void            gfxSemDestroy(gfxSem *psem);
bool_t          gfxSemWait(gfxSem *psem, delaytime_t ms);
void            gfxSemSignal(gfxSem *psem);
void            gfxSemSignalI(gfxSem *psem);
semcount_t      gfxSemCounter(gfxSem *pSem);
semcount_t      gfxSemCounterI(gfxSem *pSem);
gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_t prio,
                                DECLARE_THREAD_FUNCTION((*fn),p), void *param);
threadreturn_t  gfxThreadWait(gfxThreadHandle thread);
gfxThreadHandle gfxThreadMe(void)
void            gfxThreadClose(gfxThreadHandle thread);

Data types

ToDo


Examples

When creating a new port, taking a look at existing ones can help a lot. The existing ports can be found under /src/gos/'