4 * $Id: hfc_usb.h,v 4.2 2005/04/07 15:27:17 martinb1 Exp $
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
22 #define HFC_CTRL_TIMEOUT 20 /* 5ms timeout writing/reading regs */
23 #define HFC_TIMER_T3 8000 /* timeout for l1 activation timer */
24 #define HFC_TIMER_T4 500 /* time for state change interval */
26 #define HFCUSB_L1_STATECHANGE 0 /* L1 state changed */
27 #define HFCUSB_L1_DRX 1 /* D-frame received */
28 #define HFCUSB_L1_ERX 2 /* E-frame received */
29 #define HFCUSB_L1_DTX 4 /* D-frames completed */
31 #define MAX_BCH_SIZE 2048 /* allowed B-channel packet size */
33 #define HFCUSB_RX_THRESHOLD 64 /* threshold for fifo report bit rx */
34 #define HFCUSB_TX_THRESHOLD 64 /* threshold for fifo report bit tx */
36 #define HFCUSB_CHIP_ID 0x16 /* Chip ID register index */
37 #define HFCUSB_CIRM 0x00 /* cirm register index */
38 #define HFCUSB_USB_SIZE 0x07 /* int length register */
39 #define HFCUSB_USB_SIZE_I 0x06 /* iso length register */
40 #define HFCUSB_F_CROSS 0x0b /* bit order register */
41 #define HFCUSB_CLKDEL 0x37 /* bit delay register */
42 #define HFCUSB_CON_HDLC 0xfa /* channel connect register */
43 #define HFCUSB_HDLC_PAR 0xfb
44 #define HFCUSB_SCTRL 0x31 /* S-bus control register (tx) */
45 #define HFCUSB_SCTRL_E 0x32 /* same for E and special funcs */
46 #define HFCUSB_SCTRL_R 0x33 /* S-bus control register (rx) */
47 #define HFCUSB_F_THRES 0x0c /* threshold register */
48 #define HFCUSB_FIFO 0x0f /* fifo select register */
49 #define HFCUSB_F_USAGE 0x1a /* fifo usage register */
50 #define HFCUSB_MST_MODE0 0x14
51 #define HFCUSB_MST_MODE1 0x15
52 #define HFCUSB_P_DATA 0x1f
53 #define HFCUSB_INC_RES_F 0x0e
54 #define HFCUSB_STATES 0x30
56 #define HFCUSB_CHIPID 0x40 /* ID value of HFC-S USB */
61 #define HFCUSB_NUM_FIFOS 8 /* maximum number of fifos */
62 #define HFCUSB_B1_TX 0 /* index for B1 transmit bulk/int */
63 #define HFCUSB_B1_RX 1 /* index for B1 receive bulk/int */
64 #define HFCUSB_B2_TX 2
65 #define HFCUSB_B2_RX 3
68 #define HFCUSB_PCM_TX 6
69 #define HFCUSB_PCM_RX 7
72 * used to switch snd_transfer_mode for different TA modes e.g. the Billion USB TA just
73 * supports ISO out, while the Cologne Chip EVAL TA just supports BULK out
79 #define ISOC_PACKETS_D 8
80 #define ISOC_PACKETS_B 8
81 #define ISO_BUFFER_SIZE 128
83 // ISO send definitions
88 #define BITLINE_INF (-64*8)
94 #define write_usb(a,b,c)usb_control_msg((a)->dev,(a)->ctrl_out_pipe,0,0x40,(c),(b),NULL,0,HFC_CTRL_TIMEOUT)
95 #define read_usb(a,b,c) usb_control_msg((a)->dev,(a)->ctrl_in_pipe,1,0xC0,0,(b),(c),1,HFC_CTRL_TIMEOUT)
100 /*******************/
105 /* *********************/
106 /* USB related defines */
107 /***********************/
108 #define HFC_CTRL_BUFSIZE 32
112 /*************************************************/
113 /* entry and size of output/input control buffer */
114 /*************************************************/
116 __u8 hfc_reg; /* register number */
117 __u8 reg_val; /* value to be written (or read) */
118 int action; /* data for action handler */
122 /********************/
123 /* URB error codes: */
124 /********************/
125 /* Used to represent a list of values and their respective symbolic names */
126 struct hfcusb_symbolic_list {
131 static struct hfcusb_symbolic_list urb_errlist[] = {
132 {-ENOMEM, "No memory for allocation of internal structures"},
133 {-ENOSPC, "The host controller's bandwidth is already consumed"},
134 {-ENOENT, "URB was canceled by unlink_urb"},
135 {-EXDEV, "ISO transfer only partially completed"},
136 {-EAGAIN, "Too match scheduled for the future"},
137 {-ENXIO, "URB already queued"},
138 {-EFBIG, "Too much ISO frames requested"},
139 {-ENOSR, "Buffer error (overrun)"},
140 {-EPIPE, "Specified endpoint is stalled (device not responding)"},
141 {-EOVERFLOW, "Babble (bad cable?)"},
142 {-EPROTO, "Bit-stuff error (bad cable?)"},
143 {-EILSEQ, "CRC/Timeout"},
144 {-ETIMEDOUT, "NAK (device does not respond)"},
145 {-ESHUTDOWN, "Device unplugged"},
150 /*****************************************************/
151 /* device dependant information to support different */
152 /* ISDN Ta's using the HFC-S USB chip */
153 /*****************************************************/
155 /* USB descriptor need to contain one of the following EndPoint combination: */
156 #define CNF_4INT3ISO 1 // 4 INT IN, 3 ISO OUT
157 #define CNF_3INT3ISO 2 // 3 INT IN, 3 ISO OUT
158 #define CNF_4ISO3ISO 3 // 4 ISO IN, 3 ISO OUT
159 #define CNF_3ISO3ISO 4 // 3 ISO IN, 3 ISO OUT
161 #define EP_NUL 1 // Endpoint at this position not allowed
162 #define EP_NOP 2 // all type of endpoints allowed at this position
163 #define EP_ISO 3 // Isochron endpoint mandatory at this position
164 #define EP_BLK 4 // Bulk endpoint mandatory at this position
165 #define EP_INT 5 // Interrupt endpoint mandatory at this position
167 /* this array represents all endpoints possible in the HCF-USB the last
168 * 3 entries are the configuration number, the minimum interval for
169 * Interrupt endpoints & boolean if E-channel logging possible
171 static int validconf[][19] = {
172 // INT in, ISO out config
173 {EP_NUL, EP_INT, EP_NUL, EP_INT, EP_NUL, EP_INT, EP_NOP, EP_INT,
174 EP_ISO, EP_NUL, EP_ISO, EP_NUL, EP_ISO, EP_NUL, EP_NUL, EP_NUL,
176 {EP_NUL, EP_INT, EP_NUL, EP_INT, EP_NUL, EP_INT, EP_NUL, EP_NUL,
177 EP_ISO, EP_NUL, EP_ISO, EP_NUL, EP_ISO, EP_NUL, EP_NUL, EP_NUL,
179 // ISO in, ISO out config
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_NOP, EP_ISO,
183 {EP_NUL, EP_NUL, EP_NUL, EP_NUL, EP_NUL, EP_NUL, EP_NUL, EP_NUL,
184 EP_ISO, EP_ISO, EP_ISO, EP_ISO, EP_ISO, EP_ISO, EP_NUL, EP_NUL,
186 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} // EOL element
189 #ifdef CONFIG_HISAX_DEBUG
190 // string description of chosen config
191 static char *conf_str[] = {
192 "4 Interrupt IN + 3 Isochron OUT",
193 "3 Interrupt IN + 3 Isochron OUT",
194 "4 Isochron IN + 3 Isochron OUT",
195 "3 Isochron IN + 3 Isochron OUT"
201 int vendor; // vendor id
202 int prod_id; // product id
203 char *vend_name; // vendor string
204 __u8 led_scheme; // led display scheme
205 signed short led_bits[8]; // array of 8 possible LED bitmask settings
208 #define LED_OFF 0 // no LED support
209 #define LED_SCHEME1 1 // LED standard scheme
210 #define LED_SCHEME2 2 // not used yet...
212 #define LED_POWER_ON 1
213 #define LED_POWER_OFF 2
218 #define LED_B1_DATA 7
221 #define LED_B2_DATA 10
223 #define LED_NORMAL 0 // LEDs are normal
224 #define LED_INVERTED 1 // LEDs are inverted
226 /* time in ms to perform a Flashing LED when B-Channel has traffic */
230 #endif // __HFC_USB_H__