forked from len0rd/rockbox
		
	1) "Charge during USB connection" option is now tristate: off/on/force. Currently "force" behaves just like "on", but in future it will allow charging even when it was not possible to positively identify a charger. 2) The H300 code has been adjusted to use the new system but there should be no functional differences, it already had the USB charging option and its USB/charging support is hardware controlled. 3) The Gigabeat S code has been adjusted to use the new system: the player now has the USB charging option, which wasn't previously available. The player will only charge at full speed when allowed to do so by a working USB host, so USB AC adapters won't work very well; however, they didn't work before either, so this is not a change in functionality. 4) The iPod Nano 2G code has been adjusted to use the new system: it already had the USB charging option. Using a USB AC adapter won't charge at full speed any more (it did before) - the old implementation was equivalent to the not-yet-implemented "force" option in the new system. No other target should be affected. Support for the "force" mode and support for at least some other iPod models will come in a future commit :) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26570 a1c6a512-1295-4272-9138-f99709370657
		
			
				
	
	
		
			73 lines
		
	
	
	
		
			2.4 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			73 lines
		
	
	
	
		
			2.4 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| /***************************************************************************
 | |
|  *             __________               __   ___.
 | |
|  *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
 | |
|  *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
 | |
|  *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
 | |
|  *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
 | |
|  *                     \/            \/     \/    \/            \/
 | |
|  * $Id$
 | |
|  *
 | |
|  * Copyright (C) 2007 by Björn Stenberg
 | |
|  *
 | |
|  * This program is free software; you can redistribute it and/or
 | |
|  * modify it under the terms of the GNU General Public License
 | |
|  * as published by the Free Software Foundation; either version 2
 | |
|  * of the License, or (at your option) any later version.
 | |
|  *
 | |
|  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
 | |
|  * KIND, either express or implied.
 | |
|  *
 | |
|  ****************************************************************************/
 | |
| #ifndef USB_CORE_H
 | |
| #define USB_CORE_H
 | |
| 
 | |
| #include "usb_ch9.h"
 | |
| #include "usb.h"
 | |
| 
 | |
| /* endpoints */
 | |
| #define EP_CONTROL 0
 | |
| 
 | |
| #define DIR_OUT 0
 | |
| #define DIR_IN 1
 | |
| 
 | |
| /* The USB core is a device, and OUT is RX from that P.O.V */
 | |
| #define DIR_RX DIR_OUT
 | |
| #define DIR_TX DIR_IN
 | |
| 
 | |
| #define EP_DIR(ep) (((ep) & USB_ENDPOINT_DIR_MASK) ? DIR_IN : DIR_OUT)
 | |
| #define EP_NUM(ep) ((ep) & USB_ENDPOINT_NUMBER_MASK)
 | |
| 
 | |
| extern int usb_max_pkt_size;
 | |
| 
 | |
| struct usb_class_driver;
 | |
| 
 | |
| void usb_core_init(void);
 | |
| void usb_core_exit(void);
 | |
| void usb_core_control_request(struct usb_ctrlrequest* req);
 | |
| void usb_core_transfer_complete(int endpoint,int dir,int status,int length);
 | |
| void usb_core_bus_reset(void);
 | |
| bool usb_core_any_exclusive_storage(void);
 | |
| void usb_core_enable_driver(int driver,bool enabled);
 | |
| bool usb_core_driver_enabled(int driver);
 | |
| void usb_core_handle_transfer_completion(
 | |
|         struct usb_transfer_completion_event_data* event);
 | |
| 
 | |
| int usb_core_request_endpoint(int type, int dir,struct usb_class_driver* drv);
 | |
| void usb_core_release_endpoint(int dir);
 | |
| 
 | |
| #ifdef HAVE_HOTSWAP
 | |
| void usb_core_hotswap_event(int volume,bool inserted);
 | |
| #endif
 | |
| 
 | |
| #ifdef HAVE_USB_CHARGING_ENABLE
 | |
| /* hardware which knows how to control usb current should use one
 | |
|  * of the following to find out from the usb stack how much is ok
 | |
|  */
 | |
| /* implemented by target, called by usb when value changes */
 | |
| void usb_charging_maxcurrent_change(int maxcurrent);
 | |
| /* implemented by usb, called by target to get value */
 | |
| int usb_charging_maxcurrent(void);
 | |
| #endif
 | |
| 
 | |
| #endif
 | |
| 
 |