From 0f387e913abb2cb53578088246eff81eca7beaf2 Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Wed, 4 Sep 2002 12:34:13 +0000 Subject: Added (disabled) screendump feature git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2172 a1c6a512-1295-4272-9138-f99709370657 --- firmware/drivers/serial.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) (limited to 'firmware') diff --git a/firmware/drivers/serial.c b/firmware/drivers/serial.c index 112e45c1e4..91e2a6911f 100644 --- a/firmware/drivers/serial.c +++ b/firmware/drivers/serial.c @@ -27,7 +27,7 @@ #include "lcd.h" #include "serial.h" -/* Recieved byte identifiers */ +/* Received byte identifiers */ #define PLAY 0xC1 #define STOP 0xC2 #define PREV 0xC4 @@ -35,6 +35,12 @@ #define VOLUP 0xD0 #define VOLDN 0xE0 +#ifdef SCREENDUMP +#define SCRDMP 0xF0 + +static void screen_dump(void); +#endif + void serial_setup (void) { char dummy; @@ -86,6 +92,12 @@ static void process_byte(int byte) case NEXT: btn = BUTTON_RIGHT; break; + +#ifdef SCREENDUMP + case SCRDMP: + screen_dump(); + break; +#endif } if ( btn ) { @@ -110,3 +122,43 @@ void RXI1 (void) SSR1 = SSR1 & ~0x40; /* Clear RDRF */ process_byte(serial_byte); } + +#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(15); + for(y = 0;y < LCD_HEIGHT/8;y++) + { + for(x = 0;x < LCD_WIDTH;x++) + { + serial_tx(lcd_framebuffer[x][y]); + } + } + set_irq_level(level); +} + +#endif -- cgit v1.2.3