diff --git a/bootloader/main-pp.c b/bootloader/main-pp.c index 3670a7dc97..c8102dd0cc 100644 --- a/bootloader/main-pp.c +++ b/bootloader/main-pp.c @@ -44,8 +44,8 @@ #include "i2c.h" #include "backlight-target.h" #endif -#if defined(SANSA_E200) || defined(SANSA_C200) || defined(PHILIPS_SA9200) #include "usb.h" +#if defined(SANSA_E200) || defined(SANSA_C200) || defined(PHILIPS_SA9200) #include "usb_drv.h" #endif #include "usb-target.h" @@ -515,17 +515,8 @@ static int handle_usb(int connect_timeout) return usb; } -#else /* !HAVE_BOOTLOADER_USB_MODE */ - -#if defined(SANSA_E200) || defined(SANSA_C200) || defined(PHILIPS_SA9200) \ - || defined (SANSA_VIEW) -/* Ignore cable state */ -static int handle_usb(int connect_timeout) -{ - return USB_EXTRACTED; - (void)connect_timeout; -} -#else +#elif (defined(SANSA_E200) || defined(SANSA_C200) || defined(PHILIPS_SA9200) \ + || defined (SANSA_VIEW)) && !defined(USB_ROCKBOX_USB) /* Return USB_INSERTED if cable present */ static int handle_usb(int connect_timeout) { @@ -546,6 +537,14 @@ static int handle_usb(int connect_timeout) return usb; (void)connect_timeout; } +#else +/* Ignore cable state */ +static int handle_usb(int connect_timeout) +{ + return USB_EXTRACTED; + (void)connect_timeout; +} +#else #endif #endif /* HAVE_BOOTLOADER_USB_MODE */ @@ -692,7 +691,8 @@ void* main(void) pinfo = disk_partinfo(1); if(pinfo->type == PARTITION_TYPE_OS2_HIDDEN_C_DRIVE) { - rc = load_mi4_part(loadbuffer, pinfo, MAX_LOADSIZE, usb); + rc = load_mi4_part(loadbuffer, pinfo, MAX_LOADSIZE, + usb == USB_INSERTED); if (rc < EOK) { printf("Can't load from partition"); printf(strerror(rc)); diff --git a/firmware/target/arm/iriver/usb-target.h b/firmware/target/arm/iriver/usb-target.h index 59e7eb5581..03aa2cbff7 100644 --- a/firmware/target/arm/iriver/usb-target.h +++ b/firmware/target/arm/iriver/usb-target.h @@ -25,5 +25,7 @@ #define USB_TARGET_H bool usb_init_device(void); +void usb_pin_init(void); /* Init the GPIO input only */ +bool usb_plugged(void); /* Returns instantaneous state - always */ #endif diff --git a/firmware/target/arm/tms320dm320/system-target.h b/firmware/target/arm/tms320dm320/system-target.h index 4e0a97f10e..1b94a93126 100644 --- a/firmware/target/arm/tms320dm320/system-target.h +++ b/firmware/target/arm/tms320dm320/system-target.h @@ -35,9 +35,10 @@ void dm320_set_io (char pin_num, bool input, bool invert, bool irq, bool irqany, bool chat, char func_num ); #if defined(CREATIVE_ZVx) && defined(BOOTLOADER) + /* hacky.. */ #define SLEEP_KERNEL_HOOK(ticks) \ - ({ \ /* hacky.. */ - long _sleep_ticks = current_tick + ticks + 1; \ + ({ \ + long _sleep_ticks = current_tick + (ticks) + 1; \ while (TIME_BEFORE(current_tick, _sleep_ticks)) \ switch_thread(); \ true; }) /* handled here */ diff --git a/firmware/target/arm/usb-fw-pp5002.c b/firmware/target/arm/usb-fw-pp5002.c index f9682161c1..d1664c3607 100644 --- a/firmware/target/arm/usb-fw-pp5002.c +++ b/firmware/target/arm/usb-fw-pp5002.c @@ -75,4 +75,4 @@ int usb_detect(void) } /* No different for now */ -void usb_plugged(void) __attribute__((alias("usb_detect"))); +bool usb_plugged(void) __attribute__((alias("usb_detect")));