1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2002 by Linus Nielsen Feltzing
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
25 /* Messages from usb_tick and thread states */
31 USB_TRANSFER_COMPLETION
,
39 #if CONFIG_KEYPAD == RECORDER_PAD
40 #define USBPOWER_BUTTON BUTTON_F1
41 #define USBPOWER_BTN_IGNORE BUTTON_ON
42 #elif CONFIG_KEYPAD == ONDIO_PAD
43 #define USBPOWER_BUTTON BUTTON_MENU
44 #define USBPOWER_BTN_IGNORE BUTTON_OFF
45 #elif (CONFIG_KEYPAD == IPOD_4G_PAD)
46 #define USBPOWER_BUTTON BUTTON_MENU
47 #define USBPOWER_BTN_IGNORE BUTTON_PLAY
48 #elif CONFIG_KEYPAD == IRIVER_H300_PAD
49 #define USBPOWER_BUTTON BUTTON_REC
50 #define USBPOWER_BTN_IGNORE BUTTON_ON
51 #elif CONFIG_KEYPAD == GIGABEAT_PAD
52 #define USBPOWER_BUTTON BUTTON_MENU
53 #define USBPOWER_BTN_IGNORE BUTTON_POWER
54 #elif CONFIG_KEYPAD == GIGABEAT_S_PAD
55 #define USBPOWER_BUTTON BUTTON_MENU
56 #define USBPOWER_BTN_IGNORE BUTTON_BACK
57 #elif (CONFIG_KEYPAD == IRIVER_H10_PAD) || \
58 (CONFIG_KEYPAD == MROBE100_PAD)
59 #define USBPOWER_BUTTON BUTTON_RIGHT
60 #define USBPOWER_BTN_IGNORE BUTTON_POWER
61 #elif (CONFIG_KEYPAD == SANSA_E200_PAD) || \
62 (CONFIG_KEYPAD == SANSA_C200_PAD)
63 #define USBPOWER_BUTTON BUTTON_SELECT
64 #define USBPOWER_BTN_IGNORE BUTTON_POWER
66 #endif /* HAVE_USB_POWER */
69 /* USB class drivers */
71 USB_DRIVER_MASS_STORAGE
,
73 USB_DRIVER_CHARGING_ONLY
,
78 struct usb_transfer_completion_event_data
80 unsigned char endpoint
;
90 void usb_enable(bool on
);
91 void usb_start_monitoring(void);
92 void usb_acknowledge(long id
);
93 void usb_wait_for_disconnect(struct event_queue
*q
);
94 int usb_wait_for_disconnect_w_tmo(struct event_queue
*q
, int ticks
);
95 bool usb_inserted(void); /* return the official value, what's been reported to the threads */
96 int usb_detect(void); /* return the raw hardware value - nothing/pc/charger */
98 bool usb_powered(void);
99 #ifdef CONFIG_CHARGING
100 bool usb_charging_enable(bool on
);
101 bool usb_charging_enabled(void);
105 void usb_signal_transfer_completion(struct usb_transfer_completion_event_data
* event_data
);
106 bool usb_driver_enabled(int driver
);
107 bool usb_exclusive_ata(void); /* ata is available for usb */
108 void usb_request_exclusive_ata(void);
109 void usb_release_exclusive_ata(void);
112 #if defined(IPOD_COLOR) || defined(IPOD_4G) \
113 || defined(IPOD_MINI) || defined(IPOD_MINI2G)
114 bool firewire_detect(void);