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 */
26 #define USB_INSERTED 1
27 #define USB_EXTRACTED 2
29 #define USB_REENABLE 3
35 #if CONFIG_KEYPAD == RECORDER_PAD
36 #define USBPOWER_BUTTON BUTTON_F1
37 #define USBPOWER_BTN_IGNORE BUTTON_ON
38 #elif CONFIG_KEYPAD == ONDIO_PAD
39 #define USBPOWER_BUTTON BUTTON_MENU
40 #define USBPOWER_BTN_IGNORE BUTTON_OFF
41 #elif (CONFIG_KEYPAD == IPOD_4G_PAD)
42 #define USBPOWER_BUTTON BUTTON_MENU
43 #define USBPOWER_BTN_IGNORE BUTTON_PLAY
44 #elif CONFIG_KEYPAD == IRIVER_H300_PAD
45 #define USBPOWER_BUTTON BUTTON_REC
46 #define USBPOWER_BTN_IGNORE BUTTON_ON
47 #elif CONFIG_KEYPAD == GIGABEAT_PAD
48 #define USBPOWER_BUTTON BUTTON_MENU
49 #define USBPOWER_BTN_IGNORE BUTTON_POWER
50 #elif CONFIG_KEYPAD == GIGABEAT_S_PAD
51 #define USBPOWER_BUTTON BUTTON_MENU
52 #define USBPOWER_BTN_IGNORE BUTTON_BACK
53 #elif (CONFIG_KEYPAD == IRIVER_H10_PAD) || \
54 (CONFIG_KEYPAD == MROBE100_PAD)
55 #define USBPOWER_BUTTON BUTTON_RIGHT
56 #define USBPOWER_BTN_IGNORE BUTTON_POWER
57 #elif (CONFIG_KEYPAD == SANSA_E200_PAD) || \
58 (CONFIG_KEYPAD == SANSA_C200_PAD)
59 #define USBPOWER_BUTTON BUTTON_SELECT
60 #define USBPOWER_BTN_IGNORE BUTTON_POWER
62 #endif /* HAVE_USB_POWER */
65 void usb_enable(bool on
);
66 void usb_start_monitoring(void);
67 void usb_acknowledge(long id
);
68 void usb_wait_for_disconnect(struct event_queue
*q
);
69 int usb_wait_for_disconnect_w_tmo(struct event_queue
*q
, int ticks
);
70 bool usb_inserted(void); /* return the official value, what's been reported to the threads */
71 int usb_detect(void); /* return the raw hardware value - nothing/pc/charger */
73 bool usb_powered(void);
74 #ifdef CONFIG_CHARGING
75 bool usb_charging_enable(bool on
);
76 bool usb_charging_enabled(void);