MPEGPlayer quickie: add an option to set the backlight brightness to a plugin-specifi...
[kugel-rb.git] / firmware / export / usb.h
blobff1f55cd357de31ba52246add6360dbfe72458b3
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
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 ****************************************************************************/
19 #ifndef _USB_H_
20 #define _USB_H_
22 #include "kernel.h"
23 #include "button.h"
25 /* Messages from usb_tick and thread states */
26 enum {
27 USB_INSERTED,
28 USB_EXTRACTED,
29 USB_REENABLE,
30 USB_POWERED,
31 USB_TRANSFER_COMPLETION,
32 USB_REQUEST_DISK,
33 USB_RELEASE_DISK,
34 USB_REQUEST_REBOOT,
35 USB_QUIT,
39 #ifdef HAVE_USB_POWER
40 #if CONFIG_KEYPAD == RECORDER_PAD
41 #define USBPOWER_BUTTON BUTTON_F1
42 #define USBPOWER_BTN_IGNORE BUTTON_ON
43 #elif CONFIG_KEYPAD == ONDIO_PAD
44 #define USBPOWER_BUTTON BUTTON_MENU
45 #define USBPOWER_BTN_IGNORE BUTTON_OFF
46 #elif (CONFIG_KEYPAD == IPOD_4G_PAD)
47 #define USBPOWER_BUTTON BUTTON_MENU
48 #define USBPOWER_BTN_IGNORE BUTTON_PLAY
49 #elif CONFIG_KEYPAD == IRIVER_H300_PAD
50 #define USBPOWER_BUTTON BUTTON_REC
51 #define USBPOWER_BTN_IGNORE BUTTON_ON
52 #elif CONFIG_KEYPAD == GIGABEAT_PAD
53 #define USBPOWER_BUTTON BUTTON_MENU
54 #define USBPOWER_BTN_IGNORE BUTTON_POWER
55 #elif CONFIG_KEYPAD == GIGABEAT_S_PAD
56 #define USBPOWER_BUTTON BUTTON_MENU
57 #define USBPOWER_BTN_IGNORE BUTTON_BACK
58 #elif (CONFIG_KEYPAD == IRIVER_H10_PAD) || \
59 (CONFIG_KEYPAD == MROBE100_PAD)
60 #define USBPOWER_BUTTON BUTTON_RIGHT
61 #define USBPOWER_BTN_IGNORE BUTTON_POWER
62 #elif (CONFIG_KEYPAD == SANSA_E200_PAD) || \
63 (CONFIG_KEYPAD == SANSA_C200_PAD)
64 #define USBPOWER_BUTTON BUTTON_SELECT
65 #define USBPOWER_BTN_IGNORE BUTTON_POWER
66 #endif
67 #endif /* HAVE_USB_POWER */
69 #ifdef HAVE_USBSTACK
70 /* USB class drivers */
71 enum {
72 USB_DRIVER_MASS_STORAGE,
73 USB_DRIVER_SERIAL,
74 USB_DRIVER_CHARGING_ONLY,
75 USB_NUM_DRIVERS
77 #endif
78 #ifdef HAVE_USBSTACK
79 struct usb_transfer_completion_event_data
81 unsigned char endpoint;
82 bool in;
83 int status;
84 int length;
85 void* data;
87 #endif
90 void usb_init(void);
91 void usb_enable(bool on);
92 void usb_start_monitoring(void);
93 void usb_close(void);
94 void usb_acknowledge(long id);
95 void usb_wait_for_disconnect(struct event_queue *q);
96 int usb_wait_for_disconnect_w_tmo(struct event_queue *q, int ticks);
97 bool usb_inserted(void); /* return the official value, what's been reported to the threads */
98 int usb_detect(void); /* return the raw hardware value - nothing/pc/charger */
99 #ifdef HAVE_USB_POWER
100 bool usb_powered(void);
101 #ifdef CONFIG_CHARGING
102 bool usb_charging_enable(bool on);
103 bool usb_charging_enabled(void);
104 #endif
105 #endif
106 #ifdef HAVE_USBSTACK
107 void usb_signal_transfer_completion(struct usb_transfer_completion_event_data* event_data);
108 bool usb_driver_enabled(int driver);
109 bool usb_exclusive_ata(void); /* ata is available for usb */
110 void usb_request_exclusive_ata(void);
111 void usb_release_exclusive_ata(void);
112 #endif
114 #if defined(IPOD_COLOR) || defined(IPOD_4G) \
115 || defined(IPOD_MINI) || defined(IPOD_MINI2G)
116 bool firewire_detect(void);
117 #endif
119 #endif