summaryrefslogtreecommitdiff
path: root/firmware/usb.c
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2004-06-30 13:31:14 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2004-06-30 13:31:14 +0000
commita8dab4c08af0e1d251ff633a2859c8b9b24efc7c (patch)
treebe8b66535d905e50319788f988f94ab008a48ba3 /firmware/usb.c
parent058302a4807e14d564195de9825e3aa970ea68f9 (diff)
downloadrockbox-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/usb.c')
-rw-r--r--firmware/usb.c67
1 files changed, 45 insertions, 22 deletions
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
36extern void dbg_ports(void); /* NASTY! defined in apps/ */ 36extern void dbg_ports(void); /* NASTY! defined in apps/ */
37 37
38#ifdef HAVE_LCD_BITMAP
39bool do_screendump_instead_of_usb = false;
40void 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