diff options
-rw-r--r-- | firmware/drivers/serial.c | 54 |
1 files changed, 53 insertions, 1 deletions
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 @@ | |||
27 | #include "lcd.h" | 27 | #include "lcd.h" |
28 | #include "serial.h" | 28 | #include "serial.h" |
29 | 29 | ||
30 | /* Recieved byte identifiers */ | 30 | /* Received byte identifiers */ |
31 | #define PLAY 0xC1 | 31 | #define PLAY 0xC1 |
32 | #define STOP 0xC2 | 32 | #define STOP 0xC2 |
33 | #define PREV 0xC4 | 33 | #define PREV 0xC4 |
@@ -35,6 +35,12 @@ | |||
35 | #define VOLUP 0xD0 | 35 | #define VOLUP 0xD0 |
36 | #define VOLDN 0xE0 | 36 | #define VOLDN 0xE0 |
37 | 37 | ||
38 | #ifdef SCREENDUMP | ||
39 | #define SCRDMP 0xF0 | ||
40 | |||
41 | static void screen_dump(void); | ||
42 | #endif | ||
43 | |||
38 | void serial_setup (void) | 44 | void serial_setup (void) |
39 | { | 45 | { |
40 | char dummy; | 46 | char dummy; |
@@ -86,6 +92,12 @@ static void process_byte(int byte) | |||
86 | case NEXT: | 92 | case NEXT: |
87 | btn = BUTTON_RIGHT; | 93 | btn = BUTTON_RIGHT; |
88 | break; | 94 | break; |
95 | |||
96 | #ifdef SCREENDUMP | ||
97 | case SCRDMP: | ||
98 | screen_dump(); | ||
99 | break; | ||
100 | #endif | ||
89 | } | 101 | } |
90 | 102 | ||
91 | if ( btn ) { | 103 | if ( btn ) { |
@@ -110,3 +122,43 @@ void RXI1 (void) | |||
110 | SSR1 = SSR1 & ~0x40; /* Clear RDRF */ | 122 | SSR1 = SSR1 & ~0x40; /* Clear RDRF */ |
111 | process_byte(serial_byte); | 123 | process_byte(serial_byte); |
112 | } | 124 | } |
125 | |||
126 | #ifdef SCREENDUMP | ||
127 | static void serial_enable_tx(void) | ||
128 | { | ||
129 | SCR1 |= 0x20; | ||
130 | } | ||
131 | |||
132 | static void serial_tx(unsigned char ch) | ||
133 | { | ||
134 | while (!(SSR1 & SCI_TDRE)) | ||
135 | { | ||
136 | ; | ||
137 | } | ||
138 | |||
139 | /* | ||
140 | * Write data into TDR and clear TDRE | ||
141 | */ | ||
142 | TDR1 = ch; | ||
143 | SSR1 &= ~SCI_TDRE; | ||
144 | } | ||
145 | |||
146 | static void screen_dump(void) | ||
147 | { | ||
148 | int x, y; | ||
149 | int level; | ||
150 | |||
151 | serial_enable_tx(); | ||
152 | |||
153 | level = set_irq_level(15); | ||
154 | for(y = 0;y < LCD_HEIGHT/8;y++) | ||
155 | { | ||
156 | for(x = 0;x < LCD_WIDTH;x++) | ||
157 | { | ||
158 | serial_tx(lcd_framebuffer[x][y]); | ||
159 | } | ||
160 | } | ||
161 | set_irq_level(level); | ||
162 | } | ||
163 | |||
164 | #endif | ||