uhci.h revision 677833bc953b6cb418c701facbdcf4aa18d6c44e
#ifndef _UHCI_H
#define _UHCI_H
/*
* The link pointer is multi use. Some fields are valid only for some uses.
* In other cases, they must be 0
*
*/
#define MAX_POLLDEV 10
#define MAX_TRANSACTIONS 10
#define MAX_QUEUEHEAD 255
#define MAX_TD 1024
typedef struct link_pointer {
unsigned long terminate:1;
unsigned long queue:1;
unsigned long depth:1;
unsigned long reserved:1;
unsigned long link:28;
extern link_pointer_t *frame_list[];
#define SETUP_TOKEN 0x2d
#define IN_TOKEN 0x69
#define OUT_TOKEN 0xe1
#define CTRL_RETRIES 3
#define CONTROL_STS_RETRIES 0
// some port features
#define PORT_CONNECTION 0
#define PORT_ENABLE 1
#define PORT_SUSPEND 2
#define PORT_OVER_CURRENT 3
#define PORT_RESET 4
#define PORT_POWER 8
#define PORT_LOW_SPEED 9
#define C_PORT_CONNECTION 16
#define C_PORT_ENABLE 17
#define C_PORT_SUSPEND 18
#define C_PORT_OVER_CURRENT 19
#define C_PORT_RESET 20
// features
#define FEATURE_HALT 0
typedef struct td {
unsigned long reserved2:5;
unsigned long res1:1;
unsigned long bitstuff:1;
unsigned long crc:1;
unsigned long nak:1;
unsigned long babble:1;
unsigned long buffer_error:1;
unsigned long stall:1;
unsigned long active:1;
unsigned long isochronous:1;
unsigned long lowspeed:1;
unsigned long retrys:2;
unsigned long detect_short:1;
unsigned long reserved3:2;
unsigned long device_addr:7;
unsigned long endpoint:4;
unsigned long data_toggle:1;
unsigned long reserved:1;
void *buffer;
typedef struct queue_head {
unsigned long int udata[2];
typedef struct transaction {
struct transaction *next;
//#####################################################
extern queue_head_t *free_qh;
extern queue_head_t *queue_heads;
queue_head_t *new_queue_head(void);
void init_qh(void);
extern td_t *free_td_list;
void init_td(void);
extern transaction_t *free_transactions;
void init_transactions(void);
#define USBCMDRUN 0x01
#define USBCMD_DEBUG 0x20
#define USBSTSHALTED 0x20
int hc_stop(void);
extern queue_head_t *sched_queue[];
extern int num_polls;
transaction_t *ctrl_msg(uchar devnum, uchar request_type, uchar request, unsigned short wValue, unsigned short wIndex, unsigned short wLength, uchar *data);
int uhci_control_msg( uchar devnum, uchar request_type, uchar request, unsigned short wValue, unsigned short wIndex, unsigned short wLength, void *data);
// defined in uhci.c
void uhci_init(void);
void clear_uport_stat(unsigned short port);
#endif