Revert "[PATCH] paravirt: Add startup infrastructure for paravirtualization"
[pv_ops_mirror.git] / drivers / isdn / hisax / hfc_usb.h
blob471f2354dfdedf62b652d445b1bbebea0a270a83
1 /*
2 * hfc_usb.h
4 * $Id: hfc_usb.h,v 4.2 2005/04/07 15:27:17 martinb1 Exp $
5 */
7 #ifndef __HFC_USB_H__
8 #define __HFC_USB_H__
10 #define DRIVER_AUTHOR "Peter Sprenger (sprenger@moving-byters.de)"
11 #define DRIVER_DESC "HFC-S USB based HiSAX ISDN driver"
13 #define VERBOSE_USB_DEBUG
16 /***********/
17 /* defines */
18 /***********/
19 #define HFC_CTRL_TIMEOUT 20 /* 5ms timeout writing/reading regs */
20 #define HFC_TIMER_T3 8000 /* timeout for l1 activation timer */
21 #define HFC_TIMER_T4 500 /* time for state change interval */
23 #define HFCUSB_L1_STATECHANGE 0 /* L1 state changed */
24 #define HFCUSB_L1_DRX 1 /* D-frame received */
25 #define HFCUSB_L1_ERX 2 /* E-frame received */
26 #define HFCUSB_L1_DTX 4 /* D-frames completed */
28 #define MAX_BCH_SIZE 2048 /* allowed B-channel packet size */
30 #define HFCUSB_RX_THRESHOLD 64 /* threshold for fifo report bit rx */
31 #define HFCUSB_TX_THRESHOLD 64 /* threshold for fifo report bit tx */
33 #define HFCUSB_CHIP_ID 0x16 /* Chip ID register index */
34 #define HFCUSB_CIRM 0x00 /* cirm register index */
35 #define HFCUSB_USB_SIZE 0x07 /* int length register */
36 #define HFCUSB_USB_SIZE_I 0x06 /* iso length register */
37 #define HFCUSB_F_CROSS 0x0b /* bit order register */
38 #define HFCUSB_CLKDEL 0x37 /* bit delay register */
39 #define HFCUSB_CON_HDLC 0xfa /* channel connect register */
40 #define HFCUSB_HDLC_PAR 0xfb
41 #define HFCUSB_SCTRL 0x31 /* S-bus control register (tx) */
42 #define HFCUSB_SCTRL_E 0x32 /* same for E and special funcs */
43 #define HFCUSB_SCTRL_R 0x33 /* S-bus control register (rx) */
44 #define HFCUSB_F_THRES 0x0c /* threshold register */
45 #define HFCUSB_FIFO 0x0f /* fifo select register */
46 #define HFCUSB_F_USAGE 0x1a /* fifo usage register */
47 #define HFCUSB_MST_MODE0 0x14
48 #define HFCUSB_MST_MODE1 0x15
49 #define HFCUSB_P_DATA 0x1f
50 #define HFCUSB_INC_RES_F 0x0e
51 #define HFCUSB_STATES 0x30
53 #define HFCUSB_CHIPID 0x40 /* ID value of HFC-S USB */
55 /******************/
56 /* fifo registers */
57 /******************/
58 #define HFCUSB_NUM_FIFOS 8 /* maximum number of fifos */
59 #define HFCUSB_B1_TX 0 /* index for B1 transmit bulk/int */
60 #define HFCUSB_B1_RX 1 /* index for B1 receive bulk/int */
61 #define HFCUSB_B2_TX 2
62 #define HFCUSB_B2_RX 3
63 #define HFCUSB_D_TX 4
64 #define HFCUSB_D_RX 5
65 #define HFCUSB_PCM_TX 6
66 #define HFCUSB_PCM_RX 7
69 * used to switch snd_transfer_mode for different TA modes e.g. the Billion USB TA just
70 * supports ISO out, while the Cologne Chip EVAL TA just supports BULK out
72 #define USB_INT 0
73 #define USB_BULK 1
74 #define USB_ISOC 2
76 #define ISOC_PACKETS_D 8
77 #define ISOC_PACKETS_B 8
78 #define ISO_BUFFER_SIZE 128
80 // ISO send definitions
81 #define SINK_MAX 68
82 #define SINK_MIN 48
83 #define SINK_DMIN 12
84 #define SINK_DMAX 18
85 #define BITLINE_INF (-64*8)
88 /**********/
89 /* macros */
90 /**********/
91 #define write_usb(a,b,c)usb_control_msg((a)->dev,(a)->ctrl_out_pipe,0,0x40,(c),(b),NULL,0,HFC_CTRL_TIMEOUT)
92 #define read_usb(a,b,c) usb_control_msg((a)->dev,(a)->ctrl_in_pipe,1,0xC0,0,(b),(c),1,HFC_CTRL_TIMEOUT)
95 /*******************/
96 /* Debugging Flags */
97 /*******************/
98 #define USB_DBG 1
99 #define ISDN_DBG 2
102 /* *********************/
103 /* USB related defines */
104 /***********************/
105 #define HFC_CTRL_BUFSIZE 32
109 /*************************************************/
110 /* entry and size of output/input control buffer */
111 /*************************************************/
112 typedef struct {
113 __u8 hfc_reg; /* register number */
114 __u8 reg_val; /* value to be written (or read) */
115 int action; /* data for action handler */
116 } ctrl_buft;
119 /********************/
120 /* URB error codes: */
121 /********************/
122 /* Used to represent a list of values and their respective symbolic names */
123 struct hfcusb_symbolic_list {
124 const int num;
125 const char *name;
128 static struct hfcusb_symbolic_list urb_errlist[] = {
129 {-ENOMEM, "No memory for allocation of internal structures"},
130 {-ENOSPC, "The host controller's bandwidth is already consumed"},
131 {-ENOENT, "URB was canceled by unlink_urb"},
132 {-EXDEV, "ISO transfer only partially completed"},
133 {-EAGAIN, "Too match scheduled for the future"},
134 {-ENXIO, "URB already queued"},
135 {-EFBIG, "Too much ISO frames requested"},
136 {-ENOSR, "Buffer error (overrun)"},
137 {-EPIPE, "Specified endpoint is stalled"},
138 {-EOVERFLOW, "Babble (bad cable?)"},
139 {-EPROTO, "Bit-stuff error (bad cable?)"},
140 {-EILSEQ, "CRC or missing token"},
141 {-ETIME, "Device did not respond"},
142 {-ESHUTDOWN, "Device unplugged"},
143 {-1, NULL}
147 /*****************************************************/
148 /* device dependant information to support different */
149 /* ISDN Ta's using the HFC-S USB chip */
150 /*****************************************************/
152 /* USB descriptor need to contain one of the following EndPoint combination: */
153 #define CNF_4INT3ISO 1 // 4 INT IN, 3 ISO OUT
154 #define CNF_3INT3ISO 2 // 3 INT IN, 3 ISO OUT
155 #define CNF_4ISO3ISO 3 // 4 ISO IN, 3 ISO OUT
156 #define CNF_3ISO3ISO 4 // 3 ISO IN, 3 ISO OUT
158 #define EP_NUL 1 // Endpoint at this position not allowed
159 #define EP_NOP 2 // all type of endpoints allowed at this position
160 #define EP_ISO 3 // Isochron endpoint mandatory at this position
161 #define EP_BLK 4 // Bulk endpoint mandatory at this position
162 #define EP_INT 5 // Interrupt endpoint mandatory at this position
164 /* this array represents all endpoints possible in the HCF-USB the last
165 * 3 entries are the configuration number, the minimum interval for
166 * Interrupt endpoints & boolean if E-channel logging possible
168 static int validconf[][19] = {
169 // INT in, ISO out config
170 {EP_NUL, EP_INT, EP_NUL, EP_INT, EP_NUL, EP_INT, EP_NOP, EP_INT,
171 EP_ISO, EP_NUL, EP_ISO, EP_NUL, EP_ISO, EP_NUL, EP_NUL, EP_NUL,
172 CNF_4INT3ISO, 2, 1},
173 {EP_NUL, EP_INT, EP_NUL, EP_INT, EP_NUL, EP_INT, EP_NUL, EP_NUL,
174 EP_ISO, EP_NUL, EP_ISO, EP_NUL, EP_ISO, EP_NUL, EP_NUL, EP_NUL,
175 CNF_3INT3ISO, 2, 0},
176 // ISO in, ISO out config
177 {EP_NUL, EP_NUL, EP_NUL, EP_NUL, EP_NUL, EP_NUL, EP_NUL, EP_NUL,
178 EP_ISO, EP_ISO, EP_ISO, EP_ISO, EP_ISO, EP_ISO, EP_NOP, EP_ISO,
179 CNF_4ISO3ISO, 2, 1},
180 {EP_NUL, EP_NUL, EP_NUL, EP_NUL, EP_NUL, EP_NUL, EP_NUL, EP_NUL,
181 EP_ISO, EP_ISO, EP_ISO, EP_ISO, EP_ISO, EP_ISO, EP_NUL, EP_NUL,
182 CNF_3ISO3ISO, 2, 0},
183 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} // EOL element
186 #ifdef CONFIG_HISAX_DEBUG
187 // string description of chosen config
188 static char *conf_str[] = {
189 "4 Interrupt IN + 3 Isochron OUT",
190 "3 Interrupt IN + 3 Isochron OUT",
191 "4 Isochron IN + 3 Isochron OUT",
192 "3 Isochron IN + 3 Isochron OUT"
194 #endif
197 typedef struct {
198 int vendor; // vendor id
199 int prod_id; // product id
200 char *vend_name; // vendor string
201 __u8 led_scheme; // led display scheme
202 signed short led_bits[8]; // array of 8 possible LED bitmask settings
203 } vendor_data;
205 #define LED_OFF 0 // no LED support
206 #define LED_SCHEME1 1 // LED standard scheme
207 #define LED_SCHEME2 2 // not used yet...
209 #define LED_POWER_ON 1
210 #define LED_POWER_OFF 2
211 #define LED_S0_ON 3
212 #define LED_S0_OFF 4
213 #define LED_B1_ON 5
214 #define LED_B1_OFF 6
215 #define LED_B1_DATA 7
216 #define LED_B2_ON 8
217 #define LED_B2_OFF 9
218 #define LED_B2_DATA 10
220 #define LED_NORMAL 0 // LEDs are normal
221 #define LED_INVERTED 1 // LEDs are inverted
223 /* time in ms to perform a Flashing LED when B-Channel has traffic */
224 #define LED_TIME 250
227 #endif // __HFC_USB_H__