summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorFrank Gevaerts <frank@gevaerts.be>2008-06-04 18:55:58 +0000
committerFrank Gevaerts <frank@gevaerts.be>2008-06-04 18:55:58 +0000
commit27ad822a447374facc721122bcbe576555c40197 (patch)
tree4b023d4882fae6a8caca758fa9050c3c39a04e81 /firmware
parentea840e203646db7f689a817a02b3b31c108d1b69 (diff)
add usb_allowed_current() function, so powermanagement code can know when it's allowed to charge from usb
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17688 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/export/usb_core.h5
-rw-r--r--firmware/usbstack/usb_core.c13
2 files changed, 18 insertions, 0 deletions
diff --git a/firmware/export/usb_core.h b/firmware/export/usb_core.h
index 3629645d53..a6cf086e18 100644
--- a/firmware/export/usb_core.h
+++ b/firmware/export/usb_core.h
@@ -57,5 +57,10 @@ int usb_core_ack_control(struct usb_ctrlrequest* req);
#ifdef HAVE_HOTSWAP
void usb_core_hotswap_event(int volume,bool inserted);
#endif
+
+#ifdef HAVE_USB_POWER
+unsigned short usb_allowed_current(void);
+#endif
+
#endif
diff --git a/firmware/usbstack/usb_core.c b/firmware/usbstack/usb_core.c
index 759a342dd2..654ed95b4d 100644
--- a/firmware/usbstack/usb_core.c
+++ b/firmware/usbstack/usb_core.c
@@ -726,3 +726,16 @@ int usb_core_ack_control(struct usb_ctrlrequest* req)
return usb_drv_send(EP_CONTROL, NULL, 0);
}
+#ifdef HAVE_USB_POWER
+unsigned short usb_allowed_current()
+{
+ if (usb_state == CONFIGURED)
+ {
+ return 500;
+ }
+ else
+ {
+ return 100;
+ }
+}
+#endif