From a8dab4c08af0e1d251ff633a2859c8b9b24efc7c Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Wed, 30 Jun 2004 13:31:14 +0000 Subject: New screen dump feature for recorders git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4817 a1c6a512-1295-4272-9138-f99709370657 --- firmware/drivers/serial.c | 51 ------------------------------------ firmware/usb.c | 67 +++++++++++++++++++++++++++++++---------------- 2 files changed, 45 insertions(+), 73 deletions(-) (limited to 'firmware') diff --git a/firmware/drivers/serial.c b/firmware/drivers/serial.c index 2badf2e39f..11dadc6f19 100644 --- a/firmware/drivers/serial.c +++ b/firmware/drivers/serial.c @@ -35,12 +35,6 @@ #define VOLUP 0xD0 #define VOLDN 0xE0 -#ifdef SCREENDUMP -#define SCRDMP 0xF0 - -static void screen_dump(void); -#endif - void serial_setup (void) { /* Set PB10 function to serial Rx */ @@ -118,11 +112,6 @@ int remote_control_rx(void) last_valid_button = BUTTON_RC_RIGHT; break; -#ifdef SCREENDUMP - case SCRDMP: - screen_dump(); - break; -#endif default: last_valid_button = BUTTON_NONE; break; @@ -144,43 +133,3 @@ int remote_control_rx(void) return ret; } - -#ifdef SCREENDUMP -static void serial_enable_tx(void) -{ - SCR1 |= 0x20; -} - -static void serial_tx(unsigned char ch) -{ - while (!(SSR1 & SCI_TDRE)) - { - ; - } - - /* - * Write data into TDR and clear TDRE - */ - TDR1 = ch; - SSR1 &= ~SCI_TDRE; -} - -static void screen_dump(void) -{ - int x, y; - int level; - - serial_enable_tx(); - - level = set_irq_level(HIGHEST_IRQ_LEVEL); - for(y = 0;y < LCD_HEIGHT/8;y++) - { - for(x = 0;x < LCD_WIDTH;x++) - { - serial_tx(lcd_framebuffer[y][x]); - } - } - set_irq_level(level); -} - -#endif diff --git a/firmware/usb.c b/firmware/usb.c index 280ff22f02..5350a8575e 100644 --- a/firmware/usb.c +++ b/firmware/usb.c @@ -35,6 +35,11 @@ extern void dbg_ports(void); /* NASTY! defined in apps/ */ +#ifdef HAVE_LCD_BITMAP +bool do_screendump_instead_of_usb = false; +void screen_dump(void); /* Nasty again. Defined in apps/ too */ +#endif + #define USB_REALLY_BRAVE #if !defined(SIMULATOR) && !defined(USB_NONE) @@ -149,13 +154,24 @@ static void usb_thread(void) switch(ev.id) { case USB_INSERTED: - /* Tell all threads that they have to back off the ATA. - We subtract one for our own thread. */ - num_acks_to_expect = - queue_broadcast(SYS_USB_CONNECTED, NULL) - 1; - waiting_for_ack = true; - DEBUGF("USB inserted. Waiting for ack from %d threads...\n", - num_acks_to_expect); +#ifdef HAVE_LCD_BITMAP + if(do_screendump_instead_of_usb) + { + screen_dump(); + } + else + { +#endif + /* Tell all threads that they have to back off the ATA. + We subtract one for our own thread. */ + num_acks_to_expect = + queue_broadcast(SYS_USB_CONNECTED, NULL) - 1; + waiting_for_ack = true; + DEBUGF("USB inserted. Waiting for ack from %d threads...\n", + num_acks_to_expect); +#ifdef HAVE_LCD_BITMAP + } +#endif break; case SYS_USB_CONNECTED_ACK: @@ -181,24 +197,31 @@ static void usb_thread(void) break; case USB_EXTRACTED: - if(usb_state == USB_INSERTED) +#ifdef HAVE_LCD_BITMAP + if(!do_screendump_instead_of_usb) { - /* Only disable the USB mode if we really have enabled it - some threads might not have acknowledged the - insertion */ - usb_slave_mode(false); - } +#endif + if(usb_state == USB_INSERTED) + { + /* Only disable the USB mode if we really have enabled it + some threads might not have acknowledged the + insertion */ + usb_slave_mode(false); + } - usb_state = USB_EXTRACTED; - - /* Tell all threads that we are back in business */ - num_acks_to_expect = - queue_broadcast(SYS_USB_DISCONNECTED, NULL) - 1; - waiting_for_ack = true; - DEBUGF("USB extracted. Waiting for ack from %d threads...\n", - num_acks_to_expect); + usb_state = USB_EXTRACTED; + + /* Tell all threads that we are back in business */ + num_acks_to_expect = + queue_broadcast(SYS_USB_DISCONNECTED, NULL) - 1; + waiting_for_ack = true; + DEBUGF("USB extracted. Waiting for ack from %d threads...\n", + num_acks_to_expect); #ifdef HAVE_LCD_CHARCELLS - lcd_icon(ICON_USB, false); + lcd_icon(ICON_USB, false); +#endif +#ifdef HAVE_LCD_BITMAP + } #endif break; -- cgit v1.2.3