Fix r29053 red and a leftover use of 'usb' variable as a bool rather than int in main-pp.c.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29054 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Michael Sevakis 2011-01-15 08:52:59 +00:00
parent 3a1127785b
commit 71651cacb6
4 changed files with 19 additions and 16 deletions

View file

@ -44,8 +44,8 @@
#include "i2c.h" #include "i2c.h"
#include "backlight-target.h" #include "backlight-target.h"
#endif #endif
#if defined(SANSA_E200) || defined(SANSA_C200) || defined(PHILIPS_SA9200)
#include "usb.h" #include "usb.h"
#if defined(SANSA_E200) || defined(SANSA_C200) || defined(PHILIPS_SA9200)
#include "usb_drv.h" #include "usb_drv.h"
#endif #endif
#include "usb-target.h" #include "usb-target.h"
@ -515,17 +515,8 @@ static int handle_usb(int connect_timeout)
return usb; return usb;
} }
#else /* !HAVE_BOOTLOADER_USB_MODE */ #elif (defined(SANSA_E200) || defined(SANSA_C200) || defined(PHILIPS_SA9200) \
|| defined (SANSA_VIEW)) && !defined(USB_ROCKBOX_USB)
#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
/* Return USB_INSERTED if cable present */ /* Return USB_INSERTED if cable present */
static int handle_usb(int connect_timeout) static int handle_usb(int connect_timeout)
{ {
@ -546,6 +537,14 @@ static int handle_usb(int connect_timeout)
return usb; return usb;
(void)connect_timeout; (void)connect_timeout;
} }
#else
/* Ignore cable state */
static int handle_usb(int connect_timeout)
{
return USB_EXTRACTED;
(void)connect_timeout;
}
#else
#endif #endif
#endif /* HAVE_BOOTLOADER_USB_MODE */ #endif /* HAVE_BOOTLOADER_USB_MODE */
@ -692,7 +691,8 @@ void* main(void)
pinfo = disk_partinfo(1); pinfo = disk_partinfo(1);
if(pinfo->type == PARTITION_TYPE_OS2_HIDDEN_C_DRIVE) 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) { if (rc < EOK) {
printf("Can't load from partition"); printf("Can't load from partition");
printf(strerror(rc)); printf(strerror(rc));

View file

@ -25,5 +25,7 @@
#define USB_TARGET_H #define USB_TARGET_H
bool usb_init_device(void); bool usb_init_device(void);
void usb_pin_init(void); /* Init the GPIO input only */
bool usb_plugged(void); /* Returns instantaneous state - always */
#endif #endif

View file

@ -35,9 +35,10 @@ void dm320_set_io (char pin_num, bool input, bool invert, bool irq, bool irqany,
bool chat, char func_num ); bool chat, char func_num );
#if defined(CREATIVE_ZVx) && defined(BOOTLOADER) #if defined(CREATIVE_ZVx) && defined(BOOTLOADER)
/* hacky.. */
#define SLEEP_KERNEL_HOOK(ticks) \ #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)) \ while (TIME_BEFORE(current_tick, _sleep_ticks)) \
switch_thread(); \ switch_thread(); \
true; }) /* handled here */ true; }) /* handled here */

View file

@ -75,4 +75,4 @@ int usb_detect(void)
} }
/* No different for now */ /* No different for now */
void usb_plugged(void) __attribute__((alias("usb_detect"))); bool usb_plugged(void) __attribute__((alias("usb_detect")));