aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/hisax/hfc_usb.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/isdn/hisax/hfc_usb.h')
-rw-r--r--drivers/isdn/hisax/hfc_usb.h130
1 files changed, 55 insertions, 75 deletions
diff --git a/drivers/isdn/hisax/hfc_usb.h b/drivers/isdn/hisax/hfc_usb.h
index 471f2354dfde..e79f56568d30 100644
--- a/drivers/isdn/hisax/hfc_usb.h
+++ b/drivers/isdn/hisax/hfc_usb.h
@@ -1,8 +1,8 @@
1/* 1/*
2* hfc_usb.h 2 * hfc_usb.h
3* 3 *
4* $Id: hfc_usb.h,v 4.2 2005/04/07 15:27:17 martinb1 Exp $ 4 * $Id: hfc_usb.h,v 1.1.2.5 2007/08/20 14:36:03 mbachem Exp $
5*/ 5 */
6 6
7#ifndef __HFC_USB_H__ 7#ifndef __HFC_USB_H__
8#define __HFC_USB_H__ 8#define __HFC_USB_H__
@@ -10,25 +10,20 @@
10#define DRIVER_AUTHOR "Peter Sprenger (sprenger@moving-byters.de)" 10#define DRIVER_AUTHOR "Peter Sprenger (sprenger@moving-byters.de)"
11#define DRIVER_DESC "HFC-S USB based HiSAX ISDN driver" 11#define DRIVER_DESC "HFC-S USB based HiSAX ISDN driver"
12 12
13#define VERBOSE_USB_DEBUG
14 13
14#define HFC_CTRL_TIMEOUT 20 /* 5ms timeout writing/reading regs */
15#define HFC_TIMER_T3 8000 /* timeout for l1 activation timer */
16#define HFC_TIMER_T4 500 /* time for state change interval */
15 17
16/***********/ 18#define HFCUSB_L1_STATECHANGE 0 /* L1 state changed */
17/* defines */ 19#define HFCUSB_L1_DRX 1 /* D-frame received */
18/***********/ 20#define HFCUSB_L1_ERX 2 /* E-frame received */
19#define HFC_CTRL_TIMEOUT 20 /* 5ms timeout writing/reading regs */ 21#define HFCUSB_L1_DTX 4 /* D-frames completed */
20#define HFC_TIMER_T3 8000 /* timeout for l1 activation timer */
21#define HFC_TIMER_T4 500 /* time for state change interval */
22 22
23#define HFCUSB_L1_STATECHANGE 0 /* L1 state changed */ 23#define MAX_BCH_SIZE 2048 /* allowed B-channel packet size */
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 */
27 24
28#define MAX_BCH_SIZE 2048 /* allowed B-channel packet size */ 25#define HFCUSB_RX_THRESHOLD 64 /* threshold for fifo report bit rx */
29 26#define HFCUSB_TX_THRESHOLD 64 /* threshold for fifo report bit tx */
30#define HFCUSB_RX_THRESHOLD 64 /* threshold for fifo report bit rx */
31#define HFCUSB_TX_THRESHOLD 64 /* threshold for fifo report bit tx */
32 27
33#define HFCUSB_CHIP_ID 0x16 /* Chip ID register index */ 28#define HFCUSB_CHIP_ID 0x16 /* Chip ID register index */
34#define HFCUSB_CIRM 0x00 /* cirm register index */ 29#define HFCUSB_CIRM 0x00 /* cirm register index */
@@ -52,9 +47,8 @@
52 47
53#define HFCUSB_CHIPID 0x40 /* ID value of HFC-S USB */ 48#define HFCUSB_CHIPID 0x40 /* ID value of HFC-S USB */
54 49
55/******************/ 50
56/* fifo registers */ 51/* fifo registers */
57/******************/
58#define HFCUSB_NUM_FIFOS 8 /* maximum number of fifos */ 52#define HFCUSB_NUM_FIFOS 8 /* maximum number of fifos */
59#define HFCUSB_B1_TX 0 /* index for B1 transmit bulk/int */ 53#define HFCUSB_B1_TX 0 /* index for B1 transmit bulk/int */
60#define HFCUSB_B1_RX 1 /* index for B1 receive bulk/int */ 54#define HFCUSB_B1_RX 1 /* index for B1 receive bulk/int */
@@ -66,9 +60,9 @@
66#define HFCUSB_PCM_RX 7 60#define HFCUSB_PCM_RX 7
67 61
68/* 62/*
69* used to switch snd_transfer_mode for different TA modes e.g. the Billion USB TA just 63 * 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 64 * supports ISO out, while the Cologne Chip EVAL TA just supports BULK out
71*/ 65 */
72#define USB_INT 0 66#define USB_INT 0
73#define USB_BULK 1 67#define USB_BULK 1
74#define USB_ISOC 2 68#define USB_ISOC 2
@@ -77,49 +71,36 @@
77#define ISOC_PACKETS_B 8 71#define ISOC_PACKETS_B 8
78#define ISO_BUFFER_SIZE 128 72#define ISO_BUFFER_SIZE 128
79 73
80// ISO send definitions 74/* Fifo flow Control for TX ISO */
81#define SINK_MAX 68 75#define SINK_MAX 68
82#define SINK_MIN 48 76#define SINK_MIN 48
83#define SINK_DMIN 12 77#define SINK_DMIN 12
84#define SINK_DMAX 18 78#define SINK_DMAX 18
85#define BITLINE_INF (-64*8) 79#define BITLINE_INF (-64*8)
86 80
87 81/* HFC-S USB register access by Control-URSs */
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) 82#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) 83#define read_usb(a,b,c) usb_control_msg((a)->dev,(a)->ctrl_in_pipe,1,0xC0,0,(b),(c),1,HFC_CTRL_TIMEOUT)
93
94
95/*******************/
96/* Debugging Flags */
97/*******************/
98#define USB_DBG 1
99#define ISDN_DBG 2
100
101
102/* *********************/
103/* USB related defines */
104/***********************/
105#define HFC_CTRL_BUFSIZE 32 84#define HFC_CTRL_BUFSIZE 32
106 85
107
108
109/*************************************************/
110/* entry and size of output/input control buffer */ 86/* entry and size of output/input control buffer */
111/*************************************************/
112typedef struct { 87typedef struct {
113 __u8 hfc_reg; /* register number */ 88 __u8 hfc_reg; /* register number */
114 __u8 reg_val; /* value to be written (or read) */ 89 __u8 reg_val; /* value to be written (or read) */
115 int action; /* data for action handler */ 90 int action; /* data for action handler */
116} ctrl_buft; 91} ctrl_buft;
117 92
93/* Debugging Flags */
94#define HFCUSB_DBG_INIT 0x0001
95#define HFCUSB_DBG_STATES 0x0002
96#define HFCUSB_DBG_DCHANNEL 0x0080
97#define HFCUSB_DBG_FIFO_ERR 0x4000
98#define HFCUSB_DBG_VERBOSE_USB 0x8000
118 99
119/********************/ 100/*
120/* URB error codes: */ 101 * URB error codes:
121/********************/ 102 * Used to represent a list of values and their respective symbolic names
122/* Used to represent a list of values and their respective symbolic names */ 103 */
123struct hfcusb_symbolic_list { 104struct hfcusb_symbolic_list {
124 const int num; 105 const int num;
125 const char *name; 106 const char *name;
@@ -134,20 +115,20 @@ static struct hfcusb_symbolic_list urb_errlist[] = {
134 {-ENXIO, "URB already queued"}, 115 {-ENXIO, "URB already queued"},
135 {-EFBIG, "Too much ISO frames requested"}, 116 {-EFBIG, "Too much ISO frames requested"},
136 {-ENOSR, "Buffer error (overrun)"}, 117 {-ENOSR, "Buffer error (overrun)"},
137 {-EPIPE, "Specified endpoint is stalled"}, 118 {-EPIPE, "Specified endpoint is stalled (device not responding)"},
138 {-EOVERFLOW, "Babble (bad cable?)"}, 119 {-EOVERFLOW, "Babble (bad cable?)"},
139 {-EPROTO, "Bit-stuff error (bad cable?)"}, 120 {-EPROTO, "Bit-stuff error (bad cable?)"},
140 {-EILSEQ, "CRC or missing token"}, 121 {-EILSEQ, "CRC/Timeout"},
141 {-ETIME, "Device did not respond"}, 122 {-ETIMEDOUT, "NAK (device does not respond)"},
142 {-ESHUTDOWN, "Device unplugged"}, 123 {-ESHUTDOWN, "Device unplugged"},
143 {-1, NULL} 124 {-1, NULL}
144}; 125};
145 126
146 127
147/*****************************************************/ 128/*
148/* device dependant information to support different */ 129 * device dependant information to support different
149/* ISDN Ta's using the HFC-S USB chip */ 130 * ISDN Ta's using the HFC-S USB chip
150/*****************************************************/ 131 */
151 132
152/* USB descriptor need to contain one of the following EndPoint combination: */ 133/* USB descriptor need to contain one of the following EndPoint combination: */
153#define CNF_4INT3ISO 1 // 4 INT IN, 3 ISO OUT 134#define CNF_4INT3ISO 1 // 4 INT IN, 3 ISO OUT
@@ -155,16 +136,19 @@ static struct hfcusb_symbolic_list urb_errlist[] = {
155#define CNF_4ISO3ISO 3 // 4 ISO IN, 3 ISO OUT 136#define CNF_4ISO3ISO 3 // 4 ISO IN, 3 ISO OUT
156#define CNF_3ISO3ISO 4 // 3 ISO IN, 3 ISO OUT 137#define CNF_3ISO3ISO 4 // 3 ISO IN, 3 ISO OUT
157 138
158#define EP_NUL 1 // Endpoint at this position not allowed 139#define EP_NUL 1 // Endpoint at this position not allowed
159#define EP_NOP 2 // all type of endpoints allowed at this position 140#define EP_NOP 2 // all type of endpoints allowed at this position
160#define EP_ISO 3 // Isochron endpoint mandatory at this position 141#define EP_ISO 3 // Isochron endpoint mandatory at this position
161#define EP_BLK 4 // Bulk endpoint mandatory at this position 142#define EP_BLK 4 // Bulk endpoint mandatory at this position
162#define EP_INT 5 // Interrupt endpoint mandatory at this position 143#define EP_INT 5 // Interrupt endpoint mandatory at this position
163 144
164/* this array represents all endpoints possible in the HCF-USB the last 145/*
165* 3 entries are the configuration number, the minimum interval for 146 * List of all supported endpoint configuration sets, used to find the
166* Interrupt endpoints & boolean if E-channel logging possible 147 * best matching endpoint configuration within a devices' USB descriptor.
167*/ 148 * We need at least 3 RX endpoints, and 3 TX endpoints, either
149 * INT-in and ISO-out, or ISO-in and ISO-out)
150 * with 4 RX endpoints even E-Channel logging is possible
151 */
168static int validconf[][19] = { 152static int validconf[][19] = {
169 // INT in, ISO out config 153 // INT in, ISO out config
170 {EP_NUL, EP_INT, EP_NUL, EP_INT, EP_NUL, EP_INT, EP_NOP, EP_INT, 154 {EP_NUL, EP_INT, EP_NUL, EP_INT, EP_NUL, EP_INT, EP_NOP, EP_INT,
@@ -193,7 +177,6 @@ static char *conf_str[] = {
193}; 177};
194#endif 178#endif
195 179
196
197typedef struct { 180typedef struct {
198 int vendor; // vendor id 181 int vendor; // vendor id
199 int prod_id; // product id 182 int prod_id; // product id
@@ -202,9 +185,9 @@ typedef struct {
202 signed short led_bits[8]; // array of 8 possible LED bitmask settings 185 signed short led_bits[8]; // array of 8 possible LED bitmask settings
203} vendor_data; 186} vendor_data;
204 187
205#define LED_OFF 0 // no LED support 188#define LED_OFF 0 // no LED support
206#define LED_SCHEME1 1 // LED standard scheme 189#define LED_SCHEME1 1 // LED standard scheme
207#define LED_SCHEME2 2 // not used yet... 190#define LED_SCHEME2 2 // not used yet...
208 191
209#define LED_POWER_ON 1 192#define LED_POWER_ON 1
210#define LED_POWER_OFF 2 193#define LED_POWER_OFF 2
@@ -217,11 +200,8 @@ typedef struct {
217#define LED_B2_OFF 9 200#define LED_B2_OFF 9
218#define LED_B2_DATA 10 201#define LED_B2_DATA 10
219 202
220#define LED_NORMAL 0 // LEDs are normal 203#define LED_NORMAL 0 // LEDs are normal
221#define LED_INVERTED 1 // LEDs are inverted 204#define LED_INVERTED 1 // LEDs are inverted
222
223/* time in ms to perform a Flashing LED when B-Channel has traffic */
224#define LED_TIME 250
225 205
226 206
227#endif // __HFC_USB_H__ 207#endif // __HFC_USB_H__