GFILE was not being initialised properly.

Added GFX_OS_EXTRA_INIT_FUNCTION and GFX_OS_EXTRA_DEINIT_FUNCTION macro's to enable special initialisation to occur being anything else happens.
This commit is contained in:
inmarket 2015-02-28 13:06:15 +10:00
parent 73ba2778ab
commit dc4f706132
3 changed files with 32 additions and 0 deletions

8
gfx.h
View File

@ -221,6 +221,14 @@ extern "C" {
* @note This will initialise each sub-system that has been turned on.
* For example, if GFX_USE_GDISP is defined then display will be initialised
* and cleared to black.
* @note If you define GFX_NO_OS_INIT as TRUE in your gfxconf.h file then ugfx doesn't try to
* initialise the operating system for you when you call @p gfxInit().
* @note If you define GFX_OS_EXTRA_INIT_FUNCTION in your gfxconf.h file the macro is the
* name of a void function with no parameters that is called immediately after
* operating system initialisation (whether or not GFX_NO_OS_INIT is set).
* @note If you define GFX_OS_EXTRA_DEINIT_FUNCTION in your gfxconf.h file the macro is the
* name of a void function with no parameters that is called immediately before
* operating system de-initialisation (as ugfx is exiting).
*
* @api
*/

View File

@ -41,6 +41,8 @@
// Options that (should where relevant) apply to all operating systems
// #define GFX_NO_OS_INIT FALSE
// #define GFX_OS_EXTRA_INIT_FUNCTION myOSInitRoutine
// #define GFX_OS_EXTRA_DEINIT_FUNCTION myOSDeInitRoutine
///////////////////////////////////////////////////////////////////////////

View File

@ -20,10 +20,20 @@ static bool_t initDone = FALSE;
/* These init functions are defined by each module but not published */
extern void _gosInit(void);
extern void _gosDeinit(void);
#ifdef GFX_OS_EXTRA_INIT_FUNCTION
extern void GFX_OS_EXTRA_INIT_FUNCTION(void);
#endif
#ifdef GFX_OS_EXTRA_DEINIT_FUNCTION
extern void GFX_OS_EXTRA_DEINIT_FUNCTION(void);
#endif
#if GFX_USE_GDRIVER
extern void _gdriverInit(void);
extern void _gdriverDeinit(void);
#endif
#if GFX_USE_GFILE
extern void _gfileInit(void);
extern void _gfileDeinit(void);
#endif
#if GFX_USE_GDISP
extern void _gdispInit(void);
extern void _gdispDeinit(void);
@ -71,6 +81,9 @@ void gfxInit(void)
// These must be initialised in the order of their dependancies
_gosInit();
#ifdef GFX_OS_EXTRA_INIT_FUNCTION
GFX_OS_EXTRA_INIT_FUNCTION();
#endif
#if GFX_USE_GQUEUE
_gqueueInit();
#endif
@ -86,6 +99,9 @@ void gfxInit(void)
#if GFX_USE_GDRIVER
_gdriverInit();
#endif
#if GFX_USE_GFILE
_gfileInit();
#endif
#if GFX_USE_GDISP
_gdispInit();
#endif
@ -125,6 +141,9 @@ void gfxDeinit(void)
#if GFX_USE_GDISP
_gdispDeinit();
#endif
#if GFX_USE_GFILE
_gfileDeinit();
#endif
#if GFX_USE_GDRIVER
_gdriverDeinit();
#endif
@ -140,5 +159,8 @@ void gfxDeinit(void)
#if GFX_USE_GQUEUE
_gqueueDeinit();
#endif
#ifdef GFX_OS_EXTRA_DEINIT_FUNCTION
GFX_OS_EXTRA_DEINIT_FUNCTION();
#endif
_gosDeinit();
}