diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2004-06-30 13:31:14 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2004-06-30 13:31:14 +0000 |
commit | a8dab4c08af0e1d251ff633a2859c8b9b24efc7c (patch) | |
tree | be8b66535d905e50319788f988f94ab008a48ba3 /firmware | |
parent | 058302a4807e14d564195de9825e3aa970ea68f9 (diff) | |
download | rockbox-a8dab4c08af0e1d251ff633a2859c8b9b24efc7c.tar.gz rockbox-a8dab4c08af0e1d251ff633a2859c8b9b24efc7c.zip |
New screen dump feature for recorders
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4817 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/drivers/serial.c | 51 | ||||
-rw-r--r-- | firmware/usb.c | 67 |
2 files changed, 45 insertions, 73 deletions
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 @@ | |||
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 | |||
44 | void serial_setup (void) | 38 | void serial_setup (void) |
45 | { | 39 | { |
46 | /* Set PB10 function to serial Rx */ | 40 | /* Set PB10 function to serial Rx */ |
@@ -118,11 +112,6 @@ int remote_control_rx(void) | |||
118 | last_valid_button = BUTTON_RC_RIGHT; | 112 | last_valid_button = BUTTON_RC_RIGHT; |
119 | break; | 113 | break; |
120 | 114 | ||
121 | #ifdef SCREENDUMP | ||
122 | case SCRDMP: | ||
123 | screen_dump(); | ||
124 | break; | ||
125 | #endif | ||
126 | default: | 115 | default: |
127 | last_valid_button = BUTTON_NONE; | 116 | last_valid_button = BUTTON_NONE; |
128 | break; | 117 | break; |
@@ -144,43 +133,3 @@ int remote_control_rx(void) | |||
144 | 133 | ||
145 | return ret; | 134 | return ret; |
146 | } | 135 | } |
147 | |||
148 | #ifdef SCREENDUMP | ||
149 | static void serial_enable_tx(void) | ||
150 | { | ||
151 | SCR1 |= 0x20; | ||
152 | } | ||
153 | |||
154 | static void serial_tx(unsigned char ch) | ||
155 | { | ||
156 | while (!(SSR1 & SCI_TDRE)) | ||
157 | { | ||
158 | ; | ||
159 | } | ||
160 | |||
161 | /* | ||
162 | * Write data into TDR and clear TDRE | ||
163 | */ | ||
164 | TDR1 = ch; | ||
165 | SSR1 &= ~SCI_TDRE; | ||
166 | } | ||
167 | |||
168 | static void screen_dump(void) | ||
169 | { | ||
170 | int x, y; | ||
171 | int level; | ||
172 | |||
173 | serial_enable_tx(); | ||
174 | |||
175 | level = set_irq_level(HIGHEST_IRQ_LEVEL); | ||
176 | for(y = 0;y < LCD_HEIGHT/8;y++) | ||
177 | { | ||
178 | for(x = 0;x < LCD_WIDTH;x++) | ||
179 | { | ||
180 | serial_tx(lcd_framebuffer[y][x]); | ||
181 | } | ||
182 | } | ||
183 | set_irq_level(level); | ||
184 | } | ||
185 | |||
186 | #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 @@ | |||
35 | 35 | ||
36 | extern void dbg_ports(void); /* NASTY! defined in apps/ */ | 36 | extern void dbg_ports(void); /* NASTY! defined in apps/ */ |
37 | 37 | ||
38 | #ifdef HAVE_LCD_BITMAP | ||
39 | bool do_screendump_instead_of_usb = false; | ||
40 | void screen_dump(void); /* Nasty again. Defined in apps/ too */ | ||
41 | #endif | ||
42 | |||
38 | #define USB_REALLY_BRAVE | 43 | #define USB_REALLY_BRAVE |
39 | 44 | ||
40 | #if !defined(SIMULATOR) && !defined(USB_NONE) | 45 | #if !defined(SIMULATOR) && !defined(USB_NONE) |
@@ -149,13 +154,24 @@ static void usb_thread(void) | |||
149 | switch(ev.id) | 154 | switch(ev.id) |
150 | { | 155 | { |
151 | case USB_INSERTED: | 156 | case USB_INSERTED: |
152 | /* Tell all threads that they have to back off the ATA. | 157 | #ifdef HAVE_LCD_BITMAP |
153 | We subtract one for our own thread. */ | 158 | if(do_screendump_instead_of_usb) |
154 | num_acks_to_expect = | 159 | { |
155 | queue_broadcast(SYS_USB_CONNECTED, NULL) - 1; | 160 | screen_dump(); |
156 | waiting_for_ack = true; | 161 | } |
157 | DEBUGF("USB inserted. Waiting for ack from %d threads...\n", | 162 | else |
158 | num_acks_to_expect); | 163 | { |
164 | #endif | ||
165 | /* Tell all threads that they have to back off the ATA. | ||
166 | We subtract one for our own thread. */ | ||
167 | num_acks_to_expect = | ||
168 | queue_broadcast(SYS_USB_CONNECTED, NULL) - 1; | ||
169 | waiting_for_ack = true; | ||
170 | DEBUGF("USB inserted. Waiting for ack from %d threads...\n", | ||
171 | num_acks_to_expect); | ||
172 | #ifdef HAVE_LCD_BITMAP | ||
173 | } | ||
174 | #endif | ||
159 | break; | 175 | break; |
160 | 176 | ||
161 | case SYS_USB_CONNECTED_ACK: | 177 | case SYS_USB_CONNECTED_ACK: |
@@ -181,24 +197,31 @@ static void usb_thread(void) | |||
181 | break; | 197 | break; |
182 | 198 | ||
183 | case USB_EXTRACTED: | 199 | case USB_EXTRACTED: |
184 | if(usb_state == USB_INSERTED) | 200 | #ifdef HAVE_LCD_BITMAP |
201 | if(!do_screendump_instead_of_usb) | ||
185 | { | 202 | { |
186 | /* Only disable the USB mode if we really have enabled it | 203 | #endif |
187 | some threads might not have acknowledged the | 204 | if(usb_state == USB_INSERTED) |
188 | insertion */ | 205 | { |
189 | usb_slave_mode(false); | 206 | /* Only disable the USB mode if we really have enabled it |
190 | } | 207 | some threads might not have acknowledged the |
208 | insertion */ | ||
209 | usb_slave_mode(false); | ||
210 | } | ||
191 | 211 | ||
192 | usb_state = USB_EXTRACTED; | 212 | usb_state = USB_EXTRACTED; |
193 | 213 | ||
194 | /* Tell all threads that we are back in business */ | 214 | /* Tell all threads that we are back in business */ |
195 | num_acks_to_expect = | 215 | num_acks_to_expect = |
196 | queue_broadcast(SYS_USB_DISCONNECTED, NULL) - 1; | 216 | queue_broadcast(SYS_USB_DISCONNECTED, NULL) - 1; |
197 | waiting_for_ack = true; | 217 | waiting_for_ack = true; |
198 | DEBUGF("USB extracted. Waiting for ack from %d threads...\n", | 218 | DEBUGF("USB extracted. Waiting for ack from %d threads...\n", |
199 | num_acks_to_expect); | 219 | num_acks_to_expect); |
200 | #ifdef HAVE_LCD_CHARCELLS | 220 | #ifdef HAVE_LCD_CHARCELLS |
201 | lcd_icon(ICON_USB, false); | 221 | lcd_icon(ICON_USB, false); |
222 | #endif | ||
223 | #ifdef HAVE_LCD_BITMAP | ||
224 | } | ||
202 | #endif | 225 | #endif |
203 | break; | 226 | break; |
204 | 227 | ||