2003-02-07 09:41:57 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2002 by Linus Nielsen Feltzing
|
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* 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.
|
2003-02-07 09:41:57 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
#ifndef _USB_H_
|
|
|
|
#define _USB_H_
|
|
|
|
|
|
|
|
#include "kernel.h"
|
2007-09-04 08:03:07 +00:00
|
|
|
#include "button.h"
|
|
|
|
|
|
|
|
/* Messages from usb_tick and thread states */
|
2008-02-27 19:08:30 +00:00
|
|
|
enum {
|
2008-03-06 21:25:09 +00:00
|
|
|
USB_INSERTED,
|
|
|
|
USB_EXTRACTED,
|
|
|
|
USB_REENABLE,
|
|
|
|
USB_POWERED,
|
|
|
|
USB_TRANSFER_COMPLETION,
|
|
|
|
USB_REQUEST_DISK,
|
2008-03-10 20:55:24 +00:00
|
|
|
USB_RELEASE_DISK,
|
2008-05-10 18:00:11 +00:00
|
|
|
USB_REQUEST_REBOOT,
|
|
|
|
USB_QUIT,
|
2008-02-27 19:08:30 +00:00
|
|
|
};
|
2007-09-04 08:03:07 +00:00
|
|
|
|
|
|
|
|
2008-02-27 19:08:30 +00:00
|
|
|
#ifdef HAVE_USB_POWER
|
2007-09-04 08:03:07 +00:00
|
|
|
#if CONFIG_KEYPAD == RECORDER_PAD
|
|
|
|
#define USBPOWER_BUTTON BUTTON_F1
|
|
|
|
#define USBPOWER_BTN_IGNORE BUTTON_ON
|
|
|
|
#elif CONFIG_KEYPAD == ONDIO_PAD
|
|
|
|
#define USBPOWER_BUTTON BUTTON_MENU
|
|
|
|
#define USBPOWER_BTN_IGNORE BUTTON_OFF
|
|
|
|
#elif (CONFIG_KEYPAD == IPOD_4G_PAD)
|
|
|
|
#define USBPOWER_BUTTON BUTTON_MENU
|
|
|
|
#define USBPOWER_BTN_IGNORE BUTTON_PLAY
|
|
|
|
#elif CONFIG_KEYPAD == IRIVER_H300_PAD
|
2008-07-04 18:12:01 +00:00
|
|
|
#define USBPOWER_BUTTON BUTTON_MODE
|
2007-09-04 08:03:07 +00:00
|
|
|
#define USBPOWER_BTN_IGNORE BUTTON_ON
|
|
|
|
#elif CONFIG_KEYPAD == GIGABEAT_PAD
|
|
|
|
#define USBPOWER_BUTTON BUTTON_MENU
|
|
|
|
#define USBPOWER_BTN_IGNORE BUTTON_POWER
|
2007-09-21 15:51:53 +00:00
|
|
|
#elif CONFIG_KEYPAD == GIGABEAT_S_PAD
|
|
|
|
#define USBPOWER_BUTTON BUTTON_MENU
|
|
|
|
#define USBPOWER_BTN_IGNORE BUTTON_BACK
|
2008-01-09 07:24:43 +00:00
|
|
|
#elif (CONFIG_KEYPAD == IRIVER_H10_PAD) || \
|
|
|
|
(CONFIG_KEYPAD == MROBE100_PAD)
|
2007-11-22 20:51:00 +00:00
|
|
|
#define USBPOWER_BUTTON BUTTON_RIGHT
|
2007-09-04 08:03:07 +00:00
|
|
|
#define USBPOWER_BTN_IGNORE BUTTON_POWER
|
2007-09-06 03:28:58 +00:00
|
|
|
#elif (CONFIG_KEYPAD == SANSA_E200_PAD) || \
|
2008-05-21 03:55:17 +00:00
|
|
|
(CONFIG_KEYPAD == SANSA_C200_PAD) || \
|
2008-11-09 06:17:21 +00:00
|
|
|
(CONFIG_KEYPAD == SANSA_CLIP_PAD) || \
|
2008-11-11 14:46:13 +00:00
|
|
|
(CONFIG_KEYPAD == SANSA_FUZE_PAD) || \
|
2008-05-21 03:55:17 +00:00
|
|
|
(CONFIG_KEYPAD == PHILIPS_SA9200_PAD)
|
2007-09-04 08:03:07 +00:00
|
|
|
#define USBPOWER_BUTTON BUTTON_SELECT
|
|
|
|
#define USBPOWER_BTN_IGNORE BUTTON_POWER
|
2008-06-27 18:40:25 +00:00
|
|
|
#elif CONFIG_KEYPAD == PHILIPS_HDD1630_PAD
|
|
|
|
#define USBPOWER_BUTTON BUTTON_PLAYLIST
|
|
|
|
#define USBPOWER_BTN_IGNORE BUTTON_POWER
|
2007-09-04 08:03:07 +00:00
|
|
|
#endif
|
|
|
|
#endif /* HAVE_USB_POWER */
|
2003-02-07 09:41:57 +00:00
|
|
|
|
2008-02-25 23:43:11 +00:00
|
|
|
#ifdef HAVE_USBSTACK
|
|
|
|
/* USB class drivers */
|
|
|
|
enum {
|
|
|
|
USB_DRIVER_MASS_STORAGE,
|
|
|
|
USB_DRIVER_SERIAL,
|
2008-03-06 21:25:09 +00:00
|
|
|
USB_DRIVER_CHARGING_ONLY,
|
|
|
|
USB_NUM_DRIVERS
|
2008-02-25 23:43:11 +00:00
|
|
|
};
|
|
|
|
#endif
|
2008-02-27 19:08:30 +00:00
|
|
|
#ifdef HAVE_USBSTACK
|
|
|
|
struct usb_transfer_completion_event_data
|
|
|
|
{
|
|
|
|
unsigned char endpoint;
|
2008-10-03 22:43:16 +00:00
|
|
|
int dir;
|
2008-02-27 19:08:30 +00:00
|
|
|
int status;
|
|
|
|
int length;
|
|
|
|
void* data;
|
|
|
|
};
|
|
|
|
#endif
|
2008-02-25 23:43:11 +00:00
|
|
|
|
|
|
|
|
2003-02-07 09:41:57 +00:00
|
|
|
void usb_init(void);
|
2005-12-06 12:12:29 +00:00
|
|
|
void usb_enable(bool on);
|
2003-02-07 09:41:57 +00:00
|
|
|
void usb_start_monitoring(void);
|
2008-05-10 18:00:11 +00:00
|
|
|
void usb_close(void);
|
2005-01-30 15:16:58 +00:00
|
|
|
void usb_acknowledge(long id);
|
2003-02-07 09:41:57 +00:00
|
|
|
void usb_wait_for_disconnect(struct event_queue *q);
|
|
|
|
int usb_wait_for_disconnect_w_tmo(struct event_queue *q, int ticks);
|
2003-07-03 22:11:14 +00:00
|
|
|
bool usb_inserted(void); /* return the official value, what's been reported to the threads */
|
2007-09-04 08:03:07 +00:00
|
|
|
int usb_detect(void); /* return the raw hardware value - nothing/pc/charger */
|
2005-06-23 02:18:29 +00:00
|
|
|
#ifdef HAVE_USB_POWER
|
|
|
|
bool usb_powered(void);
|
2007-02-01 10:47:22 +00:00
|
|
|
#ifdef CONFIG_CHARGING
|
|
|
|
bool usb_charging_enable(bool on);
|
|
|
|
bool usb_charging_enabled(void);
|
|
|
|
#endif
|
2005-06-23 02:18:29 +00:00
|
|
|
#endif
|
2008-02-27 19:08:30 +00:00
|
|
|
#ifdef HAVE_USBSTACK
|
|
|
|
void usb_signal_transfer_completion(struct usb_transfer_completion_event_data* event_data);
|
|
|
|
bool usb_driver_enabled(int driver);
|
2008-03-02 00:15:02 +00:00
|
|
|
bool usb_exclusive_ata(void); /* ata is available for usb */
|
|
|
|
void usb_request_exclusive_ata(void);
|
2008-03-10 20:55:24 +00:00
|
|
|
void usb_release_exclusive_ata(void);
|
2008-02-27 19:08:30 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(IPOD_COLOR) || defined(IPOD_4G) \
|
|
|
|
|| defined(IPOD_MINI) || defined(IPOD_MINI2G)
|
|
|
|
bool firewire_detect(void);
|
|
|
|
#endif
|
2003-02-07 09:41:57 +00:00
|
|
|
|
|
|
|
#endif
|