simulator: make sure LCD driver ready to use after rt_hw_sdl_start is invoked
This commit is contained in:
parent
842d129f03
commit
5cb02e1258
|
@ -25,11 +25,11 @@ void rt_init_thread_entry(void *parameter)
|
||||||
pcap_netif_hw_init();
|
pcap_netif_hw_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
rt_platform_init();
|
||||||
|
|
||||||
/* initialization RT-Thread Components */
|
/* initialization RT-Thread Components */
|
||||||
rt_components_init();
|
rt_components_init();
|
||||||
|
|
||||||
rt_platform_init();
|
|
||||||
|
|
||||||
/* File system Initialization */
|
/* File system Initialization */
|
||||||
#ifdef RT_USING_DFS
|
#ifdef RT_USING_DFS
|
||||||
{
|
{
|
||||||
|
|
|
@ -151,6 +151,7 @@ static void sdlfb_hw_init(void)
|
||||||
#include <rtgui/rtgui_system.h>
|
#include <rtgui/rtgui_system.h>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
static HANDLE sdl_ok_event = NULL;
|
||||||
static DWORD WINAPI sdl_loop(LPVOID lpParam)
|
static DWORD WINAPI sdl_loop(LPVOID lpParam)
|
||||||
#else
|
#else
|
||||||
static void *sdl_loop(void *lpParam)
|
static void *sdl_loop(void *lpParam)
|
||||||
|
@ -172,7 +173,9 @@ static void *sdl_loop(void *lpParam)
|
||||||
|
|
||||||
device = rt_device_find("sdl");
|
device = rt_device_find("sdl");
|
||||||
rtgui_graphic_set_device(device);
|
rtgui_graphic_set_device(device);
|
||||||
|
#ifdef _WIN32
|
||||||
|
SetEvent(sdl_ok_event);
|
||||||
|
#endif
|
||||||
/* handle SDL event */
|
/* handle SDL event */
|
||||||
while (!quit)
|
while (!quit)
|
||||||
{
|
{
|
||||||
|
@ -307,7 +310,15 @@ void rt_hw_sdl_start(void)
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
HANDLE thread;
|
HANDLE thread;
|
||||||
DWORD thread_id;
|
DWORD thread_id;
|
||||||
|
sdl_ok_event = CreateEvent(NULL,
|
||||||
|
FALSE,
|
||||||
|
FALSE,
|
||||||
|
NULL);
|
||||||
|
if (sdl_ok_event == NULL)
|
||||||
|
{
|
||||||
|
printf("error, create SDL event failed\n");
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
/* create thread that loop sdl event */
|
/* create thread that loop sdl event */
|
||||||
thread = CreateThread(NULL,
|
thread = CreateThread(NULL,
|
||||||
0,
|
0,
|
||||||
|
@ -322,6 +333,9 @@ void rt_hw_sdl_start(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ResumeThread(thread);
|
ResumeThread(thread);
|
||||||
|
|
||||||
|
/* wait until SDL LCD device is registered and seted */
|
||||||
|
WaitForSingleObject(sdl_ok_event, INFINITE);
|
||||||
#else
|
#else
|
||||||
/* Linux */
|
/* Linux */
|
||||||
pthread_t pid;
|
pthread_t pid;
|
||||||
|
|
Loading…
Reference in New Issue