diff options
Diffstat (limited to 'uisimulator/common/sim_tasks.c')
-rw-r--r-- | uisimulator/common/sim_tasks.c | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/uisimulator/common/sim_tasks.c b/uisimulator/common/sim_tasks.c index 1299a69302..003b993740 100644 --- a/uisimulator/common/sim_tasks.c +++ b/uisimulator/common/sim_tasks.c | |||
@@ -28,6 +28,11 @@ | |||
28 | #include "thread.h" | 28 | #include "thread.h" |
29 | #include "debug.h" | 29 | #include "debug.h" |
30 | #include "usb.h" | 30 | #include "usb.h" |
31 | #include "mv.h" | ||
32 | #include "ata_idle_notify.h" | ||
33 | #ifdef WIN32 | ||
34 | #include <windows.h> | ||
35 | #endif | ||
31 | 36 | ||
32 | static void sim_thread(void); | 37 | static void sim_thread(void); |
33 | static long sim_thread_stack[DEFAULT_STACK_SIZE/sizeof(long)]; | 38 | static long sim_thread_stack[DEFAULT_STACK_SIZE/sizeof(long)]; |
@@ -46,6 +51,10 @@ enum { | |||
46 | #endif | 51 | #endif |
47 | }; | 52 | }; |
48 | 53 | ||
54 | #ifdef HAVE_MULTIDRIVE | ||
55 | extern void sim_ext_extracted(int drive); | ||
56 | #endif | ||
57 | |||
49 | void sim_thread(void) | 58 | void sim_thread(void) |
50 | { | 59 | { |
51 | struct queue_event ev; | 60 | struct queue_event ev; |
@@ -54,9 +63,13 @@ void sim_thread(void) | |||
54 | 63 | ||
55 | while (1) | 64 | while (1) |
56 | { | 65 | { |
57 | queue_wait(&sim_queue, &ev); | 66 | queue_wait_w_tmo(&sim_queue, &ev, 5*HZ); |
58 | switch(ev.id) | 67 | switch(ev.id) |
59 | { | 68 | { |
69 | case SYS_TIMEOUT: | ||
70 | call_storage_idle_notifys(false); | ||
71 | break; | ||
72 | |||
60 | case SIM_SCREENDUMP: | 73 | case SIM_SCREENDUMP: |
61 | screen_dump(); | 74 | screen_dump(); |
62 | #ifdef HAVE_REMOTE_LCD | 75 | #ifdef HAVE_REMOTE_LCD |
@@ -102,6 +115,7 @@ void sim_thread(void) | |||
102 | #ifdef HAVE_MULTIDRIVE | 115 | #ifdef HAVE_MULTIDRIVE |
103 | case SIM_EXT_INSERTED: | 116 | case SIM_EXT_INSERTED: |
104 | case SIM_EXT_EXTRACTED: | 117 | case SIM_EXT_EXTRACTED: |
118 | sim_ext_extracted(ev.data); | ||
105 | queue_broadcast(ev.id == SIM_EXT_INSERTED ? | 119 | queue_broadcast(ev.id == SIM_EXT_INSERTED ? |
106 | SYS_HOTSWAP_INSERTED : SYS_HOTSWAP_EXTRACTED, 0); | 120 | SYS_HOTSWAP_INSERTED : SYS_HOTSWAP_EXTRACTED, 0); |
107 | sleep(HZ/20); | 121 | sleep(HZ/20); |
@@ -174,11 +188,13 @@ static bool is_ext_inserted; | |||
174 | 188 | ||
175 | void sim_trigger_external(bool inserted) | 189 | void sim_trigger_external(bool inserted) |
176 | { | 190 | { |
191 | is_ext_inserted = inserted; | ||
192 | |||
193 | int drive = 1; /* Can do others! */ | ||
177 | if (inserted) | 194 | if (inserted) |
178 | queue_post(&sim_queue, SIM_EXT_INSERTED, 0); | 195 | queue_post(&sim_queue, SIM_EXT_INSERTED, drive); |
179 | else | 196 | else |
180 | queue_post(&sim_queue, SIM_EXT_EXTRACTED, 0); | 197 | queue_post(&sim_queue, SIM_EXT_EXTRACTED, drive); |
181 | is_ext_inserted = inserted; | ||
182 | } | 198 | } |
183 | 199 | ||
184 | bool hostfs_present(int drive) | 200 | bool hostfs_present(int drive) |
@@ -203,7 +219,13 @@ bool volume_present(int volume) | |||
203 | /* volume == drive for now */ | 219 | /* volume == drive for now */ |
204 | return hostfs_present(volume); | 220 | return hostfs_present(volume); |
205 | } | 221 | } |
206 | #endif | 222 | |
223 | int volume_drive(int volume) | ||
224 | { | ||
225 | /* volume == drive for now */ | ||
226 | return volume; | ||
227 | } | ||
228 | #endif /* HAVE_MULTIVOLUME */ | ||
207 | 229 | ||
208 | #if (CONFIG_STORAGE & STORAGE_MMC) | 230 | #if (CONFIG_STORAGE & STORAGE_MMC) |
209 | bool mmc_touched(void) | 231 | bool mmc_touched(void) |
@@ -212,4 +234,4 @@ bool mmc_touched(void) | |||
212 | } | 234 | } |
213 | #endif | 235 | #endif |
214 | 236 | ||
215 | #endif | 237 | #endif /* CONFIG_STORAGE & STORAGE_MMC */ |