2007-08-27 16:04:32 +00:00
|
|
|
|
/***************************************************************************
|
|
|
|
|
* __________ __ ___.
|
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
|
* \/ \/ \/ \/ \/
|
2007-11-22 20:51:00 +00:00
|
|
|
|
* $Id: $
|
2007-08-27 16:04:32 +00:00
|
|
|
|
*
|
2007-11-22 20:51:00 +00:00
|
|
|
|
* Copyright (C) 2007 by Bj<EFBFBD>rn Stenberg
|
2007-08-27 16:04:32 +00:00
|
|
|
|
*
|
|
|
|
|
* All files in this archive are subject to the GNU General Public License.
|
|
|
|
|
* See the file COPYING in the source tree root for full license agreement.
|
|
|
|
|
*
|
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
|
* KIND, either express or implied.
|
|
|
|
|
*
|
|
|
|
|
****************************************************************************/
|
2007-11-22 20:51:00 +00:00
|
|
|
|
#ifndef USB_CORE_H
|
|
|
|
|
#define USB_CORE_H
|
2007-08-27 16:04:32 +00:00
|
|
|
|
|
2008-02-20 22:54:26 +00:00
|
|
|
|
#ifndef BOOTLOADER
|
|
|
|
|
#define USB_THREAD
|
|
|
|
|
|
|
|
|
|
#ifdef USE_ROCKBOX_USB
|
|
|
|
|
//#define USB_SERIAL
|
|
|
|
|
//#define USB_BENCHMARK
|
|
|
|
|
#define USB_STORAGE
|
|
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
#define USB_CHARGING_ONLY
|
|
|
|
|
|
|
|
|
|
#endif /* USE_ROCKBOX_USB */
|
|
|
|
|
#else
|
|
|
|
|
#define USB_CHARGING_ONLY
|
|
|
|
|
#endif /* BOOTLOADER */
|
|
|
|
|
|
2007-11-22 20:51:00 +00:00
|
|
|
|
#include "usb_ch9.h"
|
2007-08-27 16:04:32 +00:00
|
|
|
|
|
2007-11-22 20:51:00 +00:00
|
|
|
|
#if defined(CPU_PP)
|
|
|
|
|
#define USB_IRAM_ORIGIN ((unsigned char *)0x4000c000)
|
|
|
|
|
#define USB_IRAM_SIZE ((size_t)0xc000)
|
|
|
|
|
#endif
|
|
|
|
|
|
2008-02-20 22:54:26 +00:00
|
|
|
|
|
|
|
|
|
enum {
|
|
|
|
|
USB_CORE_QUIT,
|
|
|
|
|
USB_CORE_TRANSFER_COMPLETION
|
|
|
|
|
};
|
|
|
|
|
|
2007-11-22 20:51:00 +00:00
|
|
|
|
/* endpoints */
|
|
|
|
|
enum {
|
2008-02-20 22:54:26 +00:00
|
|
|
|
EP_CONTROL = 0,
|
|
|
|
|
#ifdef USB_STORAGE
|
|
|
|
|
EP_MASS_STORAGE,
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef USB_SERIAL
|
|
|
|
|
EP_SERIAL,
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef USB_CHARGING_ONLY
|
|
|
|
|
EP_CHARGING_ONLY,
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef USB_BENCHMARK
|
|
|
|
|
EP_BENCHMARK,
|
|
|
|
|
#endif
|
|
|
|
|
NUM_ENDPOINTS
|
2007-11-22 20:51:00 +00:00
|
|
|
|
};
|
|
|
|
|
|
2008-02-20 22:54:26 +00:00
|
|
|
|
|
2007-11-22 20:51:00 +00:00
|
|
|
|
/* queue events */
|
|
|
|
|
#define USB_TRANSFER_COMPLETE 1
|
|
|
|
|
|
|
|
|
|
struct queue_msg {
|
|
|
|
|
int endpoint;
|
|
|
|
|
int length;
|
|
|
|
|
void* data;
|
2007-08-27 16:04:32 +00:00
|
|
|
|
};
|
|
|
|
|
|
2007-11-22 20:51:00 +00:00
|
|
|
|
extern int usb_max_pkt_size;
|
|
|
|
|
|
|
|
|
|
void usb_core_init(void);
|
|
|
|
|
void usb_core_exit(void);
|
|
|
|
|
void usb_core_control_request(struct usb_ctrlrequest* req);
|
2008-02-20 22:54:26 +00:00
|
|
|
|
void usb_core_transfer_complete(int endpoint, bool in, int status, int length);
|
2007-11-22 20:51:00 +00:00
|
|
|
|
void usb_core_bus_reset(void);
|
2007-11-23 15:02:26 +00:00
|
|
|
|
bool usb_core_data_connection(void);
|
2007-11-22 20:51:00 +00:00
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|