1
0
Fork 0
forked from len0rd/rockbox

Bootloader USB mode for PP502x. Enable only on GoGear SA9200 for the time being. Add HAVE_BOOTLOADER_USB_MODE to config if BOOTLOADER is defined to enable it. Clean up some kernel stuff a little to support it. Mess up a bunch of other stuff (hopefully not too badly).

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29053 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Michael Sevakis 2011-01-15 08:19:30 +00:00
parent 53db95417d
commit 3a1127785b
26 changed files with 842 additions and 160 deletions

View file

@ -154,6 +154,9 @@ static long last_disk_activity = -1;
/** static, private data **/
static bool initialized = false;
static unsigned int sd_thread_id = 0;
#define Q_CLOSE 1
static long next_yield = 0;
#define MIN_YIELD_PERIOD 1000
@ -1106,7 +1109,9 @@ sd_write_error:
}
}
#ifndef SD_DRIVER_CLOSE
static void sd_thread(void) NORETURN_ATTR;
#endif
static void sd_thread(void)
{
struct queue_event ev;
@ -1175,10 +1180,30 @@ static void sd_thread(void)
case SYS_USB_DISCONNECTED:
usb_acknowledge(SYS_USB_DISCONNECTED_ACK);
break;
#ifdef SD_DRIVER_CLOSE
case Q_CLOSE:
return;
#endif
}
}
}
#ifdef SD_DRIVER_CLOSE
void sd_close(void)
{
unsigned int thread_id = sd_thread_id;
if (thread_id == 0)
return;
sd_thread_id = 0;
queue_post(&sd_queue, Q_CLOSE, 0);
thread_wait(thread_id);
}
#endif /* SD_DRIVER_CLOSE */
void sd_enable(bool on)
{
if(on)
@ -1241,8 +1266,8 @@ int sd_init(void)
ret = currcard->initialized;
queue_init(&sd_queue, true);
create_thread(sd_thread, sd_stack, sizeof(sd_stack), 0,
sd_thread_name IF_PRIO(, PRIORITY_USER_INTERFACE)
sd_thread_id = create_thread(sd_thread, sd_stack, sizeof(sd_stack),
0, sd_thread_name IF_PRIO(, PRIORITY_USER_INTERFACE)
IF_COP(, CPU));
/* enable interupt for the mSD card */