diff options
| author | prife <[email protected]> | 2013-03-02 14:32:26 +0800 |
|---|---|---|
| committer | prife <[email protected]> | 2013-03-02 14:32:26 +0800 |
| commit | 5cb02e1258158f87c233103d0a10cb93120593ce (patch) | |
| tree | 8322ce0e88b79b55a1f35c6bea004630b084b8e4 /bsp/simulator | |
| parent | 842d129f035515728915893085f2ee9fc2c22665 (diff) | |
simulator: make sure LCD driver ready to use after rt_hw_sdl_start is invoked
Diffstat (limited to 'bsp/simulator')
| -rwxr-xr-x | bsp/simulator/applications/application.c | 4 | ||||
| -rwxr-xr-x | bsp/simulator/drivers/sdl_fb.c | 18 |
2 files changed, 18 insertions, 4 deletions
diff --git a/bsp/simulator/applications/application.c b/bsp/simulator/applications/application.c index 86db4113aa..7aab9f2dbb 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 714d263ba0..53779808ca 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 <rtgui/rtgui_system.h> #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; |
