FS #7691 - improved USB detection on PP devices. This patch modifies the target-tree function usb_detect() on all targets from bool to int, returning USB_INSERTED or USB_EXTRACTED instead of true or false. This was done to enable the PP usb_detect() to check for USB_POWER (either a connection to a USB wall charger, or the user holding "charge mode" button) and return that as a third value.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14600 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Dave Chapman 2007-09-04 08:03:07 +00:00
parent 946a815cd4
commit 1672350378
19 changed files with 163 additions and 102 deletions

View file

@ -21,6 +21,7 @@
#include "system.h"
#include "kernel.h"
#include "ata.h"
#include "usb.h"
#define USB_RST_ASSERT GPBDAT &= ~(1 << 4)
#define USB_RST_DEASSERT GPBDAT |= (1 << 4)
@ -35,9 +36,12 @@
#define USB_CRADLE_BUS_DISABLE GPHDAT &= ~(1 << 8)
/* The usb detect is one pin to the cpu active low */
inline bool usb_detect(void)
int usb_detect(void)
{
return USB_UNIT_IS_PRESENT | USB_CRADLE_IS_PRESENT;
if (USB_UNIT_IS_PRESENT | USB_CRADLE_IS_PRESENT)
return USB_INSERTED;
else
return USB_EXTRACTED;
}
void usb_init_device(void)

View file

@ -20,7 +20,6 @@
#define USB_TARGET_H
bool usb_init_device(void);
bool usb_detect(void);
void usb_enable(bool on);
#endif