2007-08-27 16:04:32 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
2008-04-18 17:24:19 +00:00
|
|
|
* $Id$
|
2007-08-27 16:04:32 +00:00
|
|
|
*
|
2009-03-23 17:08:46 +00:00
|
|
|
* Copyright (C) 2007 by Björn Stenberg
|
2007-08-27 16:04:32 +00:00
|
|
|
*
|
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.
|
2007-08-27 16:04:32 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
2007-11-22 20:51:00 +00:00
|
|
|
#include "usb_ch9.h"
|
2008-02-27 19:08:30 +00:00
|
|
|
#include "usb.h"
|
2007-08-27 16:04:32 +00:00
|
|
|
|
2007-11-22 20:51:00 +00:00
|
|
|
/* endpoints */
|
2008-03-06 21:25:09 +00:00
|
|
|
#define EP_CONTROL 0
|
2009-05-16 15:30:09 +00:00
|
|
|
|
|
|
|
#define DIR_OUT 0
|
|
|
|
#define DIR_IN 1
|
|
|
|
|
|
|
|
/* The USB core is a device, and OUT is RX from that P.O.V */
|
|
|
|
#define DIR_RX DIR_OUT
|
|
|
|
#define DIR_TX DIR_IN
|
|
|
|
|
|
|
|
#define EP_DIR(ep) (((ep) & USB_ENDPOINT_DIR_MASK) ? DIR_IN : DIR_OUT)
|
|
|
|
#define EP_NUM(ep) ((ep) & USB_ENDPOINT_NUMBER_MASK)
|
|
|
|
|
2007-11-22 20:51:00 +00:00
|
|
|
extern int usb_max_pkt_size;
|
|
|
|
|
2008-10-03 22:43:16 +00:00
|
|
|
struct usb_class_driver;
|
|
|
|
|
2007-11-22 20:51:00 +00:00
|
|
|
void usb_core_init(void);
|
|
|
|
void usb_core_exit(void);
|
|
|
|
void usb_core_control_request(struct usb_ctrlrequest* req);
|
2009-04-19 19:53:32 +00:00
|
|
|
void usb_core_transfer_complete(int endpoint,int dir,int status,int length);
|
2007-11-22 20:51:00 +00:00
|
|
|
void usb_core_bus_reset(void);
|
2009-01-13 16:27:35 +00:00
|
|
|
bool usb_core_any_exclusive_storage(void);
|
2008-03-06 21:25:09 +00:00
|
|
|
void usb_core_enable_driver(int driver,bool enabled);
|
2009-04-19 19:53:32 +00:00
|
|
|
bool usb_core_driver_enabled(int driver);
|
2008-03-06 21:25:09 +00:00
|
|
|
void usb_core_handle_transfer_completion(
|
2009-04-19 19:53:32 +00:00
|
|
|
struct usb_transfer_completion_event_data* event);
|
2012-12-07 12:37:26 +00:00
|
|
|
void usb_core_handle_notify(long id, intptr_t data);
|
|
|
|
/* For controllers which handle SET ADDR and/or SET CONFIG in hardware */
|
|
|
|
void usb_core_notify_set_address(uint8_t addr);
|
|
|
|
void usb_core_notify_set_config(uint8_t config);
|
2008-10-03 22:43:16 +00:00
|
|
|
|
2009-05-16 15:30:09 +00:00
|
|
|
int usb_core_request_endpoint(int type, int dir,struct usb_class_driver* drv);
|
2008-10-03 22:43:16 +00:00
|
|
|
void usb_core_release_endpoint(int dir);
|
|
|
|
|
2008-03-10 20:55:24 +00:00
|
|
|
#ifdef HAVE_HOTSWAP
|
|
|
|
void usb_core_hotswap_event(int volume,bool inserted);
|
|
|
|
#endif
|
2008-06-04 18:55:58 +00:00
|
|
|
|
2007-11-22 20:51:00 +00:00
|
|
|
#endif
|
|
|
|
|