summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2005-12-06 12:12:29 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2005-12-06 12:12:29 +0000
commit01917ec9809f1abff87cb372b700fc09476d343e (patch)
tree7e22b7368af35ecaf7d13c7abde4a350f792ac70 /firmware
parent55e9670c702cbb13895c74a3b0ac32122e5b518f (diff)
downloadrockbox-01917ec9809f1abff87cb372b700fc09476d343e.tar.gz
rockbox-01917ec9809f1abff87cb372b700fc09476d343e.zip
H300 bootloader USB mode
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8168 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/export/usb.h1
-rw-r--r--firmware/usb.c12
2 files changed, 10 insertions, 3 deletions
diff --git a/firmware/export/usb.h b/firmware/export/usb.h
index e8602e7358..b16c11a9b8 100644
--- a/firmware/export/usb.h
+++ b/firmware/export/usb.h
@@ -22,6 +22,7 @@
22#include "kernel.h" 22#include "kernel.h"
23 23
24void usb_init(void); 24void usb_init(void);
25void usb_enable(bool on);
25void usb_start_monitoring(void); 26void usb_start_monitoring(void);
26void usb_acknowledge(long id); 27void usb_acknowledge(long id);
27void usb_wait_for_disconnect(struct event_queue *q); 28void usb_wait_for_disconnect(struct event_queue *q);
diff --git a/firmware/usb.c b/firmware/usb.c
index 8f9de111e4..c453cb7a2b 100644
--- a/firmware/usb.c
+++ b/firmware/usb.c
@@ -79,14 +79,15 @@ static int usb_mmc_countdown = 0;
79 79
80/* FIXME: The extra 0x800 is consumed by fat_mount() when the fsinfo 80/* FIXME: The extra 0x800 is consumed by fat_mount() when the fsinfo
81 needs updating */ 81 needs updating */
82#ifndef BOOTLOADER
82static long usb_stack[(DEFAULT_STACK_SIZE + 0x800)/sizeof(long)]; 83static long usb_stack[(DEFAULT_STACK_SIZE + 0x800)/sizeof(long)];
83static const char usb_thread_name[] = "usb"; 84static const char usb_thread_name[] = "usb";
85#endif
84static struct event_queue usb_queue; 86static struct event_queue usb_queue;
85static bool last_usb_status; 87static bool last_usb_status;
86static bool usb_monitor_enabled; 88static bool usb_monitor_enabled;
87 89
88 90void usb_enable(bool on)
89static void usb_enable(bool on)
90{ 91{
91#ifdef USB_ENABLE_ONDIOSTYLE 92#ifdef USB_ENABLE_ONDIOSTYLE
92 PACR2 &= ~0x04C0; /* use PA3, PA5 as GPIO */ 93 PACR2 &= ~0x04C0; /* use PA3, PA5 as GPIO */
@@ -173,6 +174,7 @@ static void usb_enable(bool on)
173#endif 174#endif
174} 175}
175 176
177#ifndef BOOTLOADER
176static void usb_slave_mode(bool on) 178static void usb_slave_mode(bool on)
177{ 179{
178 int rc; 180 int rc;
@@ -347,6 +349,7 @@ static void usb_thread(void)
347 } 349 }
348 } 350 }
349} 351}
352#endif
350 353
351bool usb_detect(void) 354bool usb_detect(void)
352{ 355{
@@ -378,7 +381,7 @@ bool usb_detect(void)
378 return current_status; 381 return current_status;
379} 382}
380 383
381 384#ifndef BOOTLOADER
382static void usb_tick(void) 385static void usb_tick(void)
383{ 386{
384 bool current_status; 387 bool current_status;
@@ -431,6 +434,7 @@ static void usb_tick(void)
431 } 434 }
432#endif 435#endif
433} 436}
437#endif
434 438
435void usb_acknowledge(long id) 439void usb_acknowledge(long id)
436{ 440{
@@ -468,10 +472,12 @@ void usb_init(void)
468 /* We assume that the USB cable is extracted */ 472 /* We assume that the USB cable is extracted */
469 last_usb_status = false; 473 last_usb_status = false;
470 474
475#ifndef BOOTLOADER
471 queue_init(&usb_queue); 476 queue_init(&usb_queue);
472 create_thread(usb_thread, usb_stack, sizeof(usb_stack), usb_thread_name); 477 create_thread(usb_thread, usb_stack, sizeof(usb_stack), usb_thread_name);
473 478
474 tick_add_task(usb_tick); 479 tick_add_task(usb_tick);
480#endif
475} 481}
476 482
477void usb_wait_for_disconnect(struct event_queue *q) 483void usb_wait_for_disconnect(struct event_queue *q)