ohci.h revision 677833bc953b6cb418c701facbdcf4aa18d6c44e
#ifdef USB_DISK
#ifndef _OHCI_H
#define _OHCI_H
/*******************************************************************************
*
*
* Copyright 2003 Steven James <pyro@linuxlabs.com> and
* LinuxLabs http://www.linuxlabs.com
*
* 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
******************************************************************************/
// for OHCI
/* ED States */
#define ED_NEW 0x00
#define ED_UNLINK 0x01
#define ED_OPER 0x02
#define ED_DEL 0x04
#define ED_URB_DEL 0x08
/* usb_ohci_ed */
struct ed {
void * dma;
};
// __attribute((aligned(16)));
/* TD info field */
#define TD_CC 0xf0000000
#define TD_EC 0x0C000000
#define TD_T 0x03000000
#define TD_T_DATA0 0x02000000
#define TD_T_DATA1 0x03000000
#define TD_T_TOGGLE 0x00000000
#define TD_R 0x00040000
#define TD_DI 0x00E00000
#define TD_DP 0x00180000
#define TD_DP_SETUP 0x00000000
#define TD_DP_IN 0x00100000
#define TD_DP_OUT 0x00080000
#define TD_ISO 0x00010000
#define TD_DEL 0x00020000
/* CC Codes */
#define TD_CC_NOERROR 0x00
#define TD_CC_CRC 0x01
#define TD_CC_BITSTUFFING 0x02
#define TD_CC_DATATOGGLEM 0x03
#define TD_CC_STALL 0x04
#define TD_DEVNOTRESP 0x05
#define TD_PIDCHECKFAIL 0x06
#define TD_UNEXPECTEDPID 0x07
#define TD_DATAOVERRUN 0x08
#define TD_DATAUNDERRUN 0x09
#define TD_BUFFEROVERRUN 0x0C
#define TD_BUFFERUNDERRUN 0x0D
#define TD_NOTACCESSED 0x0F
#define MAXPSW 1
struct ohci_td {
struct ohci_td * next_dl_td;
void * td_dma;
void * data_dma;
};
//__attribute((aligned(32))); /* normally 16, iso needs 32 */
/*
* The HCCA (Host Controller Communications Area) is a 256 byte
* structure defined in the OHCI spec. that the host controller is
* told the base address of. It must be 256-byte aligned.
*/
struct ohci_hcca {
#define MAX_ROOT_PORTS 15
struct ohci_regs {
/* control and status registers */
/* memory pointers */
/* frame counters */
/* Root hub ports */
struct ohci_roothub_regs {
u32 a;
u32 b;
} roothub;
typedef struct ohci_regs ohci_regs_t;
/* OHCI CONTROL AND STATUS REGISTER MASKS */
/*
* HcControl (control) register masks
*/
/* pre-shifted values for HCFS */
# define OHCI_USB_RESET (0 << 6)
/*
* HcCommandStatus (cmdstatus) register masks
*/
/*
* masks used with interrupt registers:
* HcInterruptStatus (intrstatus)
* HcInterruptEnable (intrenable)
* HcInterruptDisable (intrdisable)
*/
/* For initializing controller (mask in an HCFS mode too) */
#define OHCI_CONTROL_INIT \
(OHCI_CTRL_CBSR & 0x3)
//| OHCI_CTRL_IE | OHCI_CTRL_PLE
/* OHCI ROOT HUB REGISTER MASKS */
/* roothub.portstatus [i] bits */
/* roothub.status bits */
/* roothub.b masks */
/* roothub.a masks */
typedef struct
{
int state;
#if 0
#endif
} urb_priv_t;
typedef struct ohci {
void * hcca_dma;
int intrstatus;
struct usb_ctrlrequest *dr;
} ohci_t;
extern ohci_regs_t *ohci_regs;
int ohci_control_msg( uchar devnum, uchar request_type, uchar request, unsigned short wValue, unsigned short wIndex, unsigned short
void ohci_init(void);
#endif
#endif