diff options
Diffstat (limited to 'firmware/usb.c')
-rw-r--r-- | firmware/usb.c | 85 |
1 files changed, 21 insertions, 64 deletions
diff --git a/firmware/usb.c b/firmware/usb.c index 962e373a67..64474c7b66 100644 --- a/firmware/usb.c +++ b/firmware/usb.c | |||
@@ -155,7 +155,6 @@ static void usb_thread(void) | |||
155 | #ifdef USB_REALLY_BRAVE | 155 | #ifdef USB_REALLY_BRAVE |
156 | usb_slave_mode(true); | 156 | usb_slave_mode(true); |
157 | usb_state = USB_INSERTED; | 157 | usb_state = USB_INSERTED; |
158 | usb_display_info(); | ||
159 | #else | 158 | #else |
160 | system_reboot(); | 159 | system_reboot(); |
161 | #endif | 160 | #endif |
@@ -292,6 +291,27 @@ void usb_wait_for_disconnect(struct event_queue *q) | |||
292 | } | 291 | } |
293 | } | 292 | } |
294 | 293 | ||
294 | int usb_wait_for_disconnect_w_tmo(struct event_queue *q, int ticks) | ||
295 | { | ||
296 | struct event ev; | ||
297 | |||
298 | /* Don't return until we get SYS_USB_DISCONNECTED or SYS_TIMEOUT */ | ||
299 | while(1) | ||
300 | { | ||
301 | queue_wait_w_tmo(q, &ev, ticks); | ||
302 | switch(ev.id) | ||
303 | { | ||
304 | case SYS_USB_DISCONNECTED: | ||
305 | usb_acknowledge(SYS_USB_DISCONNECTED_ACK); | ||
306 | return 0; | ||
307 | break; | ||
308 | case SYS_TIMEOUT: | ||
309 | return 1; | ||
310 | break; | ||
311 | } | ||
312 | } | ||
313 | } | ||
314 | |||
295 | void usb_start_monitoring(void) | 315 | void usb_start_monitoring(void) |
296 | { | 316 | { |
297 | usb_monitor_enabled = true; | 317 | usb_monitor_enabled = true; |
@@ -319,66 +339,3 @@ void usb_start_monitoring(void) | |||
319 | } | 339 | } |
320 | 340 | ||
321 | #endif | 341 | #endif |
322 | |||
323 | #ifdef HAVE_LCD_BITMAP | ||
324 | #define BMPHEIGHT_usb_logo 32 | ||
325 | #define BMPWIDTH_usb_logo 100 | ||
326 | static unsigned char usb_logo[] = { | ||
327 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
328 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
329 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x20, 0x10, 0x08, | ||
330 | 0x04, 0x04, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, | ||
331 | 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x81, 0x81, 0x81, 0x81, | ||
332 | 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, | ||
333 | 0x01, 0x01, 0x01, 0x01, 0xf1, 0x4f, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, | ||
334 | 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0xc0, | ||
335 | 0x00, 0x00, 0xe0, 0x1c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, | ||
336 | 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, | ||
337 | 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x06, 0x81, 0xc0, 0xe0, 0xe0, 0xe0, 0xe0, | ||
338 | 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0x70, 0x38, 0x1c, 0x1c, | ||
339 | 0x0c, 0x0e, 0x0e, 0x06, 0x06, 0x06, 0x06, 0x06, 0x0f, 0x1f, 0x1f, 0x1f, 0x1f, | ||
340 | 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xc0, 0xc0, 0x80, 0x80, 0x00, 0x00, | ||
341 | 0x00, 0x00, 0xe0, 0x1f, 0x00, 0xf8, 0x06, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, | ||
342 | 0x02, 0x02, 0x02, 0x82, 0x7e, 0x00, 0xc0, 0x3e, 0x01, | ||
343 | 0x70, 0x4f, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, | ||
344 | 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, | ||
345 | 0x40, 0x40, 0x40, 0x40, 0x40, 0x80, 0x00, 0x07, 0x0f, 0x1f, 0x1f, 0x1f, 0x1f, | ||
346 | 0x0f, 0x07, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x07, 0x0f, | ||
347 | 0x1f, 0x3f, 0x7b, 0xf3, 0xe3, 0xc3, 0x83, 0x83, 0x83, 0x83, 0xe3, 0xe3, 0xe3, | ||
348 | 0xe3, 0xe3, 0xe3, 0x03, 0x03, 0x03, 0x3f, 0x1f, 0x1f, 0x0f, 0x0f, 0x07, 0x02, | ||
349 | 0xc0, 0x3e, 0x01, 0xe0, 0x9f, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, | ||
350 | 0x80, 0x80, 0xf0, 0x0f, 0x80, 0x78, 0x07, 0x00, 0x00, | ||
351 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
352 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
353 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0c, 0x10, 0x20, 0x40, 0x40, 0x80, 0x80, | ||
354 | 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, | ||
355 | 0x80, 0x80, 0x80, 0x80, 0x80, 0x81, 0x81, 0x81, 0x81, 0x81, 0x87, 0x87, 0x87, | ||
356 | 0x87, 0x87, 0x87, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xf0, | ||
357 | 0x0f, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, | ||
358 | 0x04, 0x04, 0x04, 0x04, 0x07, 0x00, 0x00, 0x00, 0x00, | ||
359 | }; | ||
360 | |||
361 | #endif | ||
362 | void usb_display_info(void) | ||
363 | { | ||
364 | lcd_stop_scroll(); | ||
365 | lcd_clear_display(); | ||
366 | |||
367 | #ifdef HAVE_LCD_BITMAP | ||
368 | /* lcd_bitmap() only supports 16 pixels height! */ | ||
369 | lcd_bitmap(usb_logo, 6, 16, | ||
370 | BMPWIDTH_usb_logo, 8, false); | ||
371 | lcd_bitmap(usb_logo+BMPWIDTH_usb_logo, 6, 24, | ||
372 | BMPWIDTH_usb_logo, 8, false); | ||
373 | lcd_bitmap(usb_logo+BMPWIDTH_usb_logo*2, 6, 32, | ||
374 | BMPWIDTH_usb_logo, 8, false); | ||
375 | lcd_bitmap(usb_logo+BMPWIDTH_usb_logo*3, 6, 40, | ||
376 | BMPWIDTH_usb_logo, 8, false); | ||
377 | lcd_update(); | ||
378 | #else | ||
379 | lcd_puts(0, 0, "[USB Mode]"); | ||
380 | lcd_icon(ICON_PARAM, false); | ||
381 | lcd_icon(ICON_AUDIO, false); | ||
382 | lcd_icon(ICON_USB, true); | ||
383 | #endif | ||
384 | } | ||