diff --git a/bsp/simulator/applications/application.c b/bsp/simulator/applications/application.c index 86db4113aa1eb25a1698f780f2ce245a62758efe..7aab9f2dbbfe456e7cf08340eff132101f40695d 100755 --- a/bsp/simulator/applications/application.c +++ b/bsp/simulator/applications/application.c @@ -25,11 +25,11 @@ void rt_init_thread_entry(void *parameter) pcap_netif_hw_init(); #endif + rt_platform_init(); + /* initialization RT-Thread Components */ rt_components_init(); - rt_platform_init(); - /* File system Initialization */ #ifdef RT_USING_DFS { diff --git a/bsp/simulator/drivers/sdl_fb.c b/bsp/simulator/drivers/sdl_fb.c index 714d263ba029c60f848da926ccfb3f8149fe1ce1..53779808ca91cc80e53cedd2fea7898dab85decc 100755 --- a/bsp/simulator/drivers/sdl_fb.c +++ b/bsp/simulator/drivers/sdl_fb.c @@ -151,6 +151,7 @@ static void sdlfb_hw_init(void) #include #ifdef _WIN32 +static HANDLE sdl_ok_event = NULL; static DWORD WINAPI sdl_loop(LPVOID lpParam) #else static void *sdl_loop(void *lpParam) @@ -172,7 +173,9 @@ static void *sdl_loop(void *lpParam) device = rt_device_find("sdl"); rtgui_graphic_set_device(device); - +#ifdef _WIN32 + SetEvent(sdl_ok_event); +#endif /* handle SDL event */ while (!quit) { @@ -307,7 +310,15 @@ void rt_hw_sdl_start(void) #ifdef _WIN32 HANDLE thread; 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 */ thread = CreateThread(NULL, 0, @@ -322,6 +333,9 @@ void rt_hw_sdl_start(void) return; } ResumeThread(thread); + + /* wait until SDL LCD device is registered and seted */ + WaitForSingleObject(sdl_ok_event, INFINITE); #else /* Linux */ pthread_t pid;