2013-12-10 14:40:03 +00:00
|
|
|
/*
|
|
|
|
* This file is subject to the terms of the GFX License. If a copy of
|
|
|
|
* the license was not distributed with this file, you can obtain one at:
|
|
|
|
*
|
|
|
|
* http://ugfx.org/license.html
|
|
|
|
*/
|
|
|
|
|
2015-02-20 23:23:33 +00:00
|
|
|
// We need to include stdio.h below for Win32 emulation. Turn off GFILE_NEED_STDIO just for this file to prevent conflicts
|
|
|
|
#define GFILE_NEED_STDIO_MUST_BE_OFF
|
|
|
|
|
2015-11-21 09:27:08 +00:00
|
|
|
#include "../../gfx.h"
|
2013-12-10 14:40:03 +00:00
|
|
|
|
|
|
|
#if GFX_USE_OS_RAW32
|
|
|
|
|
2015-07-16 09:02:59 +00:00
|
|
|
void _gosHeapInit(void);
|
|
|
|
void _gosThreadsInit(void);
|
2013-12-10 14:40:03 +00:00
|
|
|
|
|
|
|
/*********************************************************
|
|
|
|
* Initialise
|
|
|
|
*********************************************************/
|
|
|
|
|
2014-02-02 18:24:43 +00:00
|
|
|
void _gosInit(void)
|
|
|
|
{
|
2014-07-29 02:00:47 +00:00
|
|
|
/* No initialization of the operating system itself is needed as there isn't one.
|
|
|
|
* On the other hand the C runtime should still already be initialized before
|
|
|
|
* getting here!
|
|
|
|
*/
|
2015-07-16 09:02:59 +00:00
|
|
|
#if !GFX_OS_INIT_NO_WARNING
|
|
|
|
#warning "GOS: Raw32 - Make sure you initialize your hardware and the C runtime before calling gfxInit() in your application!"
|
|
|
|
#endif
|
2014-07-29 02:00:47 +00:00
|
|
|
|
2013-12-10 14:40:03 +00:00
|
|
|
// Set up the heap allocator
|
|
|
|
_gosHeapInit();
|
|
|
|
|
|
|
|
// Start the scheduler
|
|
|
|
_gosThreadsInit();
|
|
|
|
}
|
|
|
|
|
2014-02-02 18:24:43 +00:00
|
|
|
void _gosDeinit(void)
|
|
|
|
{
|
|
|
|
/* ToDo */
|
|
|
|
}
|
|
|
|
|
2013-12-10 14:40:03 +00:00
|
|
|
/*********************************************************
|
2015-07-16 09:02:59 +00:00
|
|
|
* For Win32 emulation - automatically add the tick functions
|
2013-12-10 14:40:03 +00:00
|
|
|
* the user would normally have to provide for bare metal.
|
|
|
|
*********************************************************/
|
|
|
|
|
|
|
|
#if defined(WIN32)
|
2015-07-07 23:50:15 +00:00
|
|
|
// Win32 nasty stuff - we have conflicting definitions for Red, Green & Blue
|
|
|
|
#ifndef _WIN32_WINNT
|
|
|
|
#define _WIN32_WINNT 0x0501 // Windows XP and up
|
|
|
|
#endif
|
2013-12-10 14:40:03 +00:00
|
|
|
#undef Red
|
|
|
|
#undef Green
|
|
|
|
#undef Blue
|
|
|
|
#define WIN32_LEAN_AND_MEAN
|
|
|
|
#include <windows.h>
|
2015-07-07 23:50:15 +00:00
|
|
|
#undef WIN32_LEAN_AND_MEAN
|
|
|
|
#define Blue HTML2COLOR(0x0000FF)
|
|
|
|
#define Red HTML2COLOR(0xFF0000)
|
|
|
|
#define Green HTML2COLOR(0x008000)
|
|
|
|
|
|
|
|
#include <stdio.h>
|
2013-12-10 14:40:03 +00:00
|
|
|
systemticks_t gfxSystemTicks(void) { return GetTickCount(); }
|
|
|
|
systemticks_t gfxMillisecondsToTicks(delaytime_t ms) { return ms; }
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*********************************************************
|
|
|
|
* Exit everything functions
|
|
|
|
*********************************************************/
|
|
|
|
|
|
|
|
void gfxHalt(const char *msg) {
|
|
|
|
#if defined(WIN32)
|
|
|
|
fprintf(stderr, "%s\n", msg);
|
|
|
|
ExitProcess(1);
|
|
|
|
#else
|
|
|
|
volatile uint32_t dummy;
|
|
|
|
(void) msg;
|
|
|
|
|
|
|
|
while(1)
|
|
|
|
dummy++;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void gfxExit(void) {
|
|
|
|
#if defined(WIN32)
|
|
|
|
ExitProcess(0);
|
|
|
|
#else
|
|
|
|
volatile uint32_t dummy;
|
|
|
|
|
|
|
|
while(1)
|
|
|
|
dummy++;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* GFX_USE_OS_RAW32 */
|