blob: 901ff437e7005def334d8098a0ad0af05d14d39d [file] [log] [blame]
Tilman Schmidt917f5082006-04-10 22:55:00 -07001/*
2 * Siemens Gigaset 307x driver
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -08003 * Common header file for all connection variants
4 *
Tilman Schmidt70440cf2006-04-10 22:55:14 -07005 * Written by Stefan Eilers
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -08006 * and Hansjoerg Lipp <hjlipp@web.de>
7 *
Tilman Schmidt917f5082006-04-10 22:55:00 -07008 * =====================================================================
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of
12 * the License, or (at your option) any later version.
13 * =====================================================================
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -080014 */
15
16#ifndef GIGASET_H
17#define GIGASET_H
18
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -080019#include <linux/kernel.h>
20#include <linux/compiler.h>
21#include <linux/types.h>
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -080022#include <linux/spinlock.h>
23#include <linux/isdnif.h>
24#include <linux/usb.h>
25#include <linux/skbuff.h>
26#include <linux/netdevice.h>
27#include <linux/ppp_defs.h>
28#include <linux/timer.h>
29#include <linux/interrupt.h>
30#include <linux/tty.h>
31#include <linux/tty_driver.h>
32#include <linux/list.h>
Tilman Schmidt917f5082006-04-10 22:55:00 -070033#include <asm/atomic.h>
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -080034
35#define GIG_VERSION {0,5,0,0}
36#define GIG_COMPAT {0,4,0,0}
37
Tilman Schmidt917f5082006-04-10 22:55:00 -070038#define MAX_REC_PARAMS 10 /* Max. number of params in response string */
39#define MAX_RESP_SIZE 512 /* Max. size of a response string */
40#define HW_HDR_LEN 2 /* Header size used to store ack info */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -080041
Tilman Schmidt917f5082006-04-10 22:55:00 -070042#define MAX_EVENTS 64 /* size of event queue */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -080043
44#define RBUFSIZE 8192
Tilman Schmidt917f5082006-04-10 22:55:00 -070045#define SBUFSIZE 4096 /* sk_buff payload size */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -080046
Tilman Schmidt917f5082006-04-10 22:55:00 -070047#define TRANSBUFSIZE 768 /* bytes per skb for transparent receive */
48#define MAX_BUF_SIZE (SBUFSIZE - 2) /* Max. size of a data packet from LL */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -080049
50/* compile time options */
51#define GIG_MAJOR 0
52
53#define GIG_MAYINITONDIAL
54#define GIG_RETRYCID
55#define GIG_X75
56
Tilman Schmidtec81b5e62006-04-10 22:55:03 -070057#define GIG_TICK 100 /* in milliseconds */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -080058
59/* timeout values (unit: 1 sec) */
60#define INIT_TIMEOUT 1
61
62/* timeout values (unit: 0.1 sec) */
63#define RING_TIMEOUT 3 /* for additional parameters to RING */
64#define BAS_TIMEOUT 20 /* for response to Base USB ops */
65#define ATRDY_TIMEOUT 3 /* for HD_READY_SEND_ATDATA */
66
67#define BAS_RETRY 3 /* max. retries for base USB ops */
68
69#define MAXACT 3
70
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -080071extern int gigaset_debuglevel; /* "needs" cast to (enum debuglevel) */
72
Tilman Schmidtc652cbd2008-02-06 01:38:24 -080073/* debug flags, combine by adding/bitwise OR */
Tilman Schmidt73a88812006-04-22 02:35:30 -070074enum debuglevel {
Tilman Schmidtc652cbd2008-02-06 01:38:24 -080075 DEBUG_INTR = 0x00008, /* interrupt processing */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -080076 DEBUG_CMD = 0x00020, /* sent/received LL commands */
77 DEBUG_STREAM = 0x00040, /* application data stream I/O events */
78 DEBUG_STREAM_DUMP = 0x00080, /* application data stream content */
79 DEBUG_LLDATA = 0x00100, /* sent/received LL data */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -080080 DEBUG_DRIVER = 0x00400, /* driver structure */
81 DEBUG_HDLC = 0x00800, /* M10x HDLC processing */
82 DEBUG_WRITE = 0x01000, /* M105 data write */
Tilman Schmidt784d5852006-04-10 22:55:04 -070083 DEBUG_TRANSCMD = 0x02000, /* AT-COMMANDS+RESPONSES */
84 DEBUG_MCMD = 0x04000, /* COMMANDS THAT ARE SENT VERY OFTEN */
Tilman Schmidt917f5082006-04-10 22:55:00 -070085 DEBUG_INIT = 0x08000, /* (de)allocation+initialization of data
86 structures */
Tilman Schmidtc652cbd2008-02-06 01:38:24 -080087 DEBUG_SUSPEND = 0x10000, /* suspend/resume processing */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -080088 DEBUG_OUTPUT = 0x20000, /* output to device */
Tilman Schmidt784d5852006-04-10 22:55:04 -070089 DEBUG_ISO = 0x40000, /* isochronous transfers */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -080090 DEBUG_IF = 0x80000, /* character device operations */
Tilman Schmidt917f5082006-04-10 22:55:00 -070091 DEBUG_USBREQ = 0x100000, /* USB communication (except payload
92 data) */
Tilman Schmidt784d5852006-04-10 22:55:04 -070093 DEBUG_LOCKCMD = 0x200000, /* AT commands and responses when
Tilman Schmidt917f5082006-04-10 22:55:00 -070094 MS_LOCKED */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -080095
Tilman Schmidt917f5082006-04-10 22:55:00 -070096 DEBUG_ANY = 0x3fffff, /* print message if any of the others is
97 activated */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -080098};
99
Tilman Schmidt784d5852006-04-10 22:55:04 -0700100/* Kernel message macros for situations where dev_printk and friends cannot be
101 * used for lack of reliable access to a device structure.
102 * linux/usb.h already contains these but in an obsolete form which clutters
103 * the log needlessly, and according to the USB maintainer those should be
104 * removed rather than fixed anyway.
105 */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800106#undef err
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800107
Tilman Schmidt784d5852006-04-10 22:55:04 -0700108#define err(format, arg...) printk(KERN_ERR KBUILD_MODNAME ": " \
109 format "\n" , ## arg)
Tilman Schmidt784d5852006-04-10 22:55:04 -0700110
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800111#ifdef CONFIG_GIGASET_DEBUG
Tilman Schmidt784d5852006-04-10 22:55:04 -0700112
113#define gig_dbg(level, format, arg...) \
Tilman Schmidt917f5082006-04-10 22:55:00 -0700114 do { \
115 if (unlikely(((enum debuglevel)gigaset_debuglevel) & (level))) \
Tilman Schmidt784d5852006-04-10 22:55:04 -0700116 printk(KERN_DEBUG KBUILD_MODNAME ": " format "\n", \
117 ## arg); \
Tilman Schmidt917f5082006-04-10 22:55:00 -0700118 } while (0)
Tilman Schmidt73a88812006-04-22 02:35:30 -0700119#define DEBUG_DEFAULT (DEBUG_TRANSCMD | DEBUG_CMD | DEBUG_USBREQ)
Tilman Schmidt784d5852006-04-10 22:55:04 -0700120
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800121#else
Tilman Schmidt784d5852006-04-10 22:55:04 -0700122
123#define gig_dbg(level, format, arg...) do {} while (0)
124#define DEBUG_DEFAULT 0
125
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800126#endif
127
128void gigaset_dbg_buffer(enum debuglevel level, const unsigned char *msg,
Tilman Schmidt01371502006-04-10 22:55:11 -0700129 size_t len, const unsigned char *buf);
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800130
131/* connection state */
132#define ZSAU_NONE 0
133#define ZSAU_DISCONNECT_IND 4
134#define ZSAU_OUTGOING_CALL_PROCEEDING 1
135#define ZSAU_PROCEEDING 1
136#define ZSAU_CALL_DELIVERED 2
137#define ZSAU_ACTIVE 3
138#define ZSAU_NULL 5
139#define ZSAU_DISCONNECT_REQ 6
140#define ZSAU_UNKNOWN -1
141
142/* USB control transfer requests */
Tilman Schmidt917f5082006-04-10 22:55:00 -0700143#define OUT_VENDOR_REQ (USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_ENDPOINT)
144#define IN_VENDOR_REQ (USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_ENDPOINT)
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800145
146/* int-in-events 3070 */
147#define HD_B1_FLOW_CONTROL 0x80
148#define HD_B2_FLOW_CONTROL 0x81
Tilman Schmidt917f5082006-04-10 22:55:00 -0700149#define HD_RECEIVEATDATA_ACK (0x35) // 3070
150 // att: HD_RECEIVE>>AT<<DATA_ACK
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800151#define HD_READY_SEND_ATDATA (0x36) // 3070
152#define HD_OPEN_ATCHANNEL_ACK (0x37) // 3070
153#define HD_CLOSE_ATCHANNEL_ACK (0x38) // 3070
154#define HD_DEVICE_INIT_OK (0x11) // ISurf USB + 3070
155#define HD_OPEN_B1CHANNEL_ACK (0x51) // ISurf USB + 3070
156#define HD_OPEN_B2CHANNEL_ACK (0x52) // ISurf USB + 3070
157#define HD_CLOSE_B1CHANNEL_ACK (0x53) // ISurf USB + 3070
158#define HD_CLOSE_B2CHANNEL_ACK (0x54) // ISurf USB + 3070
159// Powermangment
160#define HD_SUSPEND_END (0x61) // ISurf USB
161// Configuration
162#define HD_RESET_INTERRUPT_PIPE_ACK (0xFF) // ISurf USB + 3070
163
164/* control requests 3070 */
165#define HD_OPEN_B1CHANNEL (0x23) // ISurf USB + 3070
166#define HD_CLOSE_B1CHANNEL (0x24) // ISurf USB + 3070
167#define HD_OPEN_B2CHANNEL (0x25) // ISurf USB + 3070
168#define HD_CLOSE_B2CHANNEL (0x26) // ISurf USB + 3070
169#define HD_RESET_INTERRUPT_PIPE (0x27) // ISurf USB + 3070
170#define HD_DEVICE_INIT_ACK (0x34) // ISurf USB + 3070
171#define HD_WRITE_ATMESSAGE (0x12) // 3070
172#define HD_READ_ATMESSAGE (0x13) // 3070
173#define HD_OPEN_ATCHANNEL (0x28) // 3070
174#define HD_CLOSE_ATCHANNEL (0x29) // 3070
175
Tilman Schmidtc652cbd2008-02-06 01:38:24 -0800176/* number of B channels supported by base driver */
177#define BAS_CHANNELS 2
178
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800179/* USB frames for isochronous transfer */
Tilman Schmidt917f5082006-04-10 22:55:00 -0700180#define BAS_FRAMETIME 1 /* number of milliseconds between frames */
181#define BAS_NUMFRAMES 8 /* number of frames per URB */
182#define BAS_MAXFRAME 16 /* allocated bytes per frame */
183#define BAS_NORMFRAME 8 /* send size without flow control */
184#define BAS_HIGHFRAME 10 /* " " with positive flow control */
185#define BAS_LOWFRAME 5 /* " " with negative flow control */
186#define BAS_CORRFRAMES 4 /* flow control multiplicator */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800187
Tilman Schmidt917f5082006-04-10 22:55:00 -0700188#define BAS_INBUFSIZE (BAS_MAXFRAME * BAS_NUMFRAMES)
189 /* size of isoc in buf per URB */
190#define BAS_OUTBUFSIZE 4096 /* size of common isoc out buffer */
191#define BAS_OUTBUFPAD BAS_MAXFRAME /* size of pad area for isoc out buf */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800192
193#define BAS_INURBS 3
194#define BAS_OUTURBS 3
195
196/* variable commands in struct bc_state */
197#define AT_ISO 0
198#define AT_DIAL 1
199#define AT_MSN 2
200#define AT_BC 3
201#define AT_PROTO 4
202#define AT_TYPE 5
203#define AT_HLC 6
204#define AT_NUM 7
205
206/* variables in struct at_state_t */
Tilman Schmidt917f5082006-04-10 22:55:00 -0700207#define VAR_ZSAU 0
208#define VAR_ZDLE 1
209#define VAR_ZVLS 2
210#define VAR_ZCTP 3
211#define VAR_NUM 4
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800212
Tilman Schmidt917f5082006-04-10 22:55:00 -0700213#define STR_NMBR 0
214#define STR_ZCPN 1
215#define STR_ZCON 2
216#define STR_ZBC 3
217#define STR_ZHLC 4
218#define STR_NUM 5
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800219
Tilman Schmidt917f5082006-04-10 22:55:00 -0700220#define EV_TIMEOUT -105
221#define EV_IF_VER -106
222#define EV_PROC_CIDMODE -107
223#define EV_SHUTDOWN -108
224#define EV_START -110
225#define EV_STOP -111
226#define EV_IF_LOCK -112
227#define EV_PROTO_L2 -113
228#define EV_ACCEPT -114
229#define EV_DIAL -115
230#define EV_HUP -116
231#define EV_BC_OPEN -117
232#define EV_BC_CLOSED -118
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800233
234/* input state */
Tilman Schmidt917f5082006-04-10 22:55:00 -0700235#define INS_command 0x0001
236#define INS_DLE_char 0x0002
237#define INS_byte_stuff 0x0004
238#define INS_have_data 0x0008
239#define INS_skip_frame 0x0010
240#define INS_DLE_command 0x0020
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800241#define INS_flag_hunt 0x0040
242
243/* channel state */
244#define CHS_D_UP 0x01
245#define CHS_B_UP 0x02
246#define CHS_NOTIFY_LL 0x04
247
Tilman Schmidt917f5082006-04-10 22:55:00 -0700248#define ICALL_REJECT 0
249#define ICALL_ACCEPT 1
250#define ICALL_IGNORE 2
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800251
252/* device state */
Tilman Schmidt917f5082006-04-10 22:55:00 -0700253#define MS_UNINITIALIZED 0
254#define MS_INIT 1
255#define MS_LOCKED 2
256#define MS_SHUTDOWN 3
257#define MS_RECOVER 4
258#define MS_READY 5
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800259
260/* mode */
Tilman Schmidt917f5082006-04-10 22:55:00 -0700261#define M_UNKNOWN 0
262#define M_CONFIG 1
263#define M_UNIMODEM 2
264#define M_CID 3
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800265
266/* start mode */
Tilman Schmidt917f5082006-04-10 22:55:00 -0700267#define SM_LOCKED 0
268#define SM_ISDN 1 /* default */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800269
270struct gigaset_ops;
271struct gigaset_driver;
272
273struct usb_cardstate;
274struct ser_cardstate;
275struct bas_cardstate;
276
277struct bc_state;
278struct usb_bc_state;
279struct ser_bc_state;
280struct bas_bc_state;
281
282struct reply_t {
Tilman Schmidt917f5082006-04-10 22:55:00 -0700283 int resp_code; /* RSP_XXXX */
284 int min_ConState; /* <0 => ignore */
285 int max_ConState; /* <0 => ignore */
286 int parameter; /* e.g. ZSAU_XXXX <0: ignore*/
287 int new_ConState; /* <0 => ignore */
288 int timeout; /* >0 => *HZ; <=0 => TOUT_XXXX*/
289 int action[MAXACT]; /* ACT_XXXX */
290 char *command; /* NULL==none */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800291};
292
293extern struct reply_t gigaset_tab_cid_m10x[];
294extern struct reply_t gigaset_tab_nocid_m10x[];
295
296struct inbuf_t {
Tilman Schmidt917f5082006-04-10 22:55:00 -0700297 unsigned char *rcvbuf; /* usb-gigaset receive buffer */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800298 struct bc_state *bcs;
Tilman Schmidt917f5082006-04-10 22:55:00 -0700299 struct cardstate *cs;
300 int inputstate;
Tilman Schmidt9d4bee22008-02-06 01:38:28 -0800301 int head, tail;
Tilman Schmidt917f5082006-04-10 22:55:00 -0700302 unsigned char data[RBUFSIZE];
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800303};
304
305/* isochronous write buffer structure
306 * circular buffer with pad area for extraction of complete USB frames
307 * - data[read..nextread-1] is valid data already submitted to the USB subsystem
308 * - data[nextread..write-1] is valid data yet to be sent
309 * - data[write] is the next byte to write to
310 * - in byte-oriented L2 procotols, it is completely free
311 * - in bit-oriented L2 procotols, it may contain a partial byte of valid data
312 * - data[write+1..read-1] is free
313 * - wbits is the number of valid data bits in data[write], starting at the LSB
314 * - writesem is the semaphore for writing to the buffer:
315 * if writesem <= 0, data[write..read-1] is currently being written to
316 * - idle contains the byte value to repeat when the end of valid data is
317 * reached; if nextread==write (buffer contains no data to send), either the
Tilman Schmidt917f5082006-04-10 22:55:00 -0700318 * BAS_OUTBUFPAD bytes immediately before data[write] (if
319 * write>=BAS_OUTBUFPAD) or those of the pad area (if write<BAS_OUTBUFPAD)
320 * are also filled with that value
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800321 */
322struct isowbuf_t {
Tilman Schmidt9d4bee22008-02-06 01:38:28 -0800323 int read;
324 int nextread;
325 int write;
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800326 atomic_t writesem;
327 int wbits;
328 unsigned char data[BAS_OUTBUFSIZE + BAS_OUTBUFPAD];
329 unsigned char idle;
330};
331
332/* isochronous write URB context structure
333 * data to be stored along with the URB and retrieved when it is returned
334 * as completed by the USB subsystem
335 * - urb: pointer to the URB itself
336 * - bcs: pointer to the B Channel control structure
337 * - limit: end of write buffer area covered by this URB
Tilman Schmidtdbd98232008-02-06 01:38:23 -0800338 * - status: URB completion status
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800339 */
340struct isow_urbctx_t {
341 struct urb *urb;
342 struct bc_state *bcs;
343 int limit;
Tilman Schmidtdbd98232008-02-06 01:38:23 -0800344 int status;
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800345};
346
347/* AT state structure
348 * data associated with the state of an ISDN connection, whether or not
349 * it is currently assigned a B channel
350 */
351struct at_state_t {
Tilman Schmidt917f5082006-04-10 22:55:00 -0700352 struct list_head list;
353 int waiting;
354 int getstring;
Tilman Schmidt69049cc2006-04-10 22:55:16 -0700355 unsigned timer_index;
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800356 unsigned long timer_expires;
357 int timer_active;
Tilman Schmidt917f5082006-04-10 22:55:00 -0700358 unsigned int ConState; /* State of connection */
359 struct reply_t *replystruct;
360 int cid;
361 int int_var[VAR_NUM]; /* see VAR_XXXX */
362 char *str_var[STR_NUM]; /* see STR_XXXX */
363 unsigned pending_commands; /* see PC_XXXX */
Tilman Schmidt69049cc2006-04-10 22:55:16 -0700364 unsigned seq_index;
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800365
Tilman Schmidt917f5082006-04-10 22:55:00 -0700366 struct cardstate *cs;
367 struct bc_state *bcs;
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800368};
369
370struct resp_type_t {
371 unsigned char *response;
Tilman Schmidt917f5082006-04-10 22:55:00 -0700372 int resp_code; /* RSP_XXXX */
373 int type; /* RT_XXXX */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800374};
375
376struct event_t {
377 int type;
378 void *ptr, *arg;
379 int parameter;
380 int cid;
381 struct at_state_t *at_state;
382};
383
384/* This buffer holds all information about the used B-Channel */
385struct bc_state {
Tilman Schmidt917f5082006-04-10 22:55:00 -0700386 struct sk_buff *tx_skb; /* Current transfer buffer to modem */
387 struct sk_buff_head squeue; /* B-Channel send Queue */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800388
389 /* Variables for debugging .. */
Tilman Schmidt917f5082006-04-10 22:55:00 -0700390 int corrupted; /* Counter for corrupted packages */
391 int trans_down; /* Counter of packages (downstream) */
392 int trans_up; /* Counter of packages (upstream) */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800393
394 struct at_state_t at_state;
395 unsigned long rcvbytes;
396
397 __u16 fcs;
398 struct sk_buff *skb;
Tilman Schmidt917f5082006-04-10 22:55:00 -0700399 int inputstate; /* see INS_XXXX */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800400
401 int channel;
402
403 struct cardstate *cs;
404
Tilman Schmidt917f5082006-04-10 22:55:00 -0700405 unsigned chstate; /* bitmap (CHS_*) */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800406 int ignore;
Tilman Schmidt917f5082006-04-10 22:55:00 -0700407 unsigned proto2; /* Layer 2 protocol (ISDN_PROTO_L2_*) */
408 char *commands[AT_NUM]; /* see AT_XXXX */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800409
410#ifdef CONFIG_GIGASET_DEBUG
411 int emptycount;
412#endif
413 int busy;
414 int use_count;
415
Tilman Schmidt784d5852006-04-10 22:55:04 -0700416 /* private data of hardware drivers */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800417 union {
Tilman Schmidt917f5082006-04-10 22:55:00 -0700418 struct ser_bc_state *ser; /* serial hardware driver */
419 struct usb_bc_state *usb; /* usb hardware driver (m105) */
420 struct bas_bc_state *bas; /* usb hardware driver (base) */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800421 } hw;
422};
423
424struct cardstate {
425 struct gigaset_driver *driver;
426 unsigned minor_index;
Tilman Schmidt784d5852006-04-10 22:55:04 -0700427 struct device *dev;
Greg Kroah-Hartman01107d32006-08-07 22:19:37 -0700428 struct device *tty_dev;
Tilman Schmidte468c042008-02-06 01:38:29 -0800429 unsigned flags;
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800430
431 const struct gigaset_ops *ops;
432
433 /* Stuff to handle communication */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800434 wait_queue_head_t waitqueue;
435 int waiting;
Tilman Schmidt9d4bee22008-02-06 01:38:28 -0800436 int mode; /* see M_XXXX */
437 int mstate; /* Modem state: see MS_XXXX */
Tilman Schmidt917f5082006-04-10 22:55:00 -0700438 /* only changed by the event layer */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800439 int cmd_result;
440
441 int channels;
Tilman Schmidt917f5082006-04-10 22:55:00 -0700442 struct bc_state *bcs; /* Array of struct bc_state */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800443
Tilman Schmidt917f5082006-04-10 22:55:00 -0700444 int onechannel; /* data and commands transmitted in one
445 stream (M10x) */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800446
447 spinlock_t lock;
Tilman Schmidt917f5082006-04-10 22:55:00 -0700448 struct at_state_t at_state; /* at_state_t for cid == 0 */
449 struct list_head temp_at_states;/* list of temporary "struct
450 at_state_t"s without B channel */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800451
452 struct inbuf_t *inbuf;
453
454 struct cmdbuf_t *cmdbuf, *lastcmdbuf;
455 spinlock_t cmdlock;
456 unsigned curlen, cmdbytes;
457
458 unsigned open_count;
459 struct tty_struct *tty;
460 struct tasklet_struct if_wake_tasklet;
461 unsigned control_state;
462
463 unsigned fwver[4];
464 int gotfwver;
465
Tilman Schmidt69049cc2006-04-10 22:55:16 -0700466 unsigned running; /* !=0 if events are handled */
467 unsigned connected; /* !=0 if hardware is connected */
468 unsigned isdn_up; /* !=0 after ISDN_STAT_RUN */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800469
Tilman Schmidt69049cc2006-04-10 22:55:16 -0700470 unsigned cidmode;
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800471
Tilman Schmidt917f5082006-04-10 22:55:00 -0700472 int myid; /* id for communication with LL */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800473 isdn_if iif;
474
475 struct reply_t *tabnocid;
476 struct reply_t *tabcid;
477 int cs_init;
Tilman Schmidt917f5082006-04-10 22:55:00 -0700478 int ignoreframes; /* frames to ignore after setting up the
479 B channel */
Tilman Schmidtabfd1dc2006-04-10 22:55:12 -0700480 struct mutex mutex; /* locks this structure:
Tilman Schmidt784d5852006-04-10 22:55:04 -0700481 * connected is not changed,
482 * hardware_up is not changed,
483 * MState is not changed to or from
484 * MS_LOCKED */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800485
486 struct timer_list timer;
487 int retry_count;
Tilman Schmidt917f5082006-04-10 22:55:00 -0700488 int dle; /* !=0 if modem commands/responses are
489 dle encoded */
490 int cur_at_seq; /* sequence of AT commands being
491 processed */
Tilman Schmidt784d5852006-04-10 22:55:04 -0700492 int curchannel; /* channel those commands are meant
Tilman Schmidt917f5082006-04-10 22:55:00 -0700493 for */
Tilman Schmidt9d4bee22008-02-06 01:38:28 -0800494 int commands_pending; /* flag(s) in xxx.commands_pending have
Tilman Schmidt917f5082006-04-10 22:55:00 -0700495 been set */
496 struct tasklet_struct event_tasklet;
497 /* tasklet for serializing AT commands.
498 * Scheduled
499 * -> for modem reponses (and
Tilman Schmidt784d5852006-04-10 22:55:04 -0700500 * incoming data for M10x)
Tilman Schmidt917f5082006-04-10 22:55:00 -0700501 * -> on timeout
502 * -> after setting bits in
503 * xxx.at_state.pending_command
504 * (e.g. command from LL) */
505 struct tasklet_struct write_tasklet;
506 /* tasklet for serial output
507 * (not used in base driver) */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800508
509 /* event queue */
510 struct event_t events[MAX_EVENTS];
Tilman Schmidt69049cc2006-04-10 22:55:16 -0700511 unsigned ev_tail, ev_head;
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800512 spinlock_t ev_lock;
513
514 /* current modem response */
515 unsigned char respdata[MAX_RESP_SIZE];
516 unsigned cbytes;
517
Tilman Schmidt784d5852006-04-10 22:55:04 -0700518 /* private data of hardware drivers */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800519 union {
Tilman Schmidt917f5082006-04-10 22:55:00 -0700520 struct usb_cardstate *usb; /* USB hardware driver (m105) */
521 struct ser_cardstate *ser; /* serial hardware driver */
522 struct bas_cardstate *bas; /* USB hardware driver (base) */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800523 } hw;
524};
525
526struct gigaset_driver {
527 struct list_head list;
Tilman Schmidt917f5082006-04-10 22:55:00 -0700528 spinlock_t lock; /* locks minor tables and blocked */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800529 struct tty_driver *tty;
530 unsigned have_tty;
531 unsigned minor;
532 unsigned minors;
533 struct cardstate *cs;
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800534 int blocked;
535
536 const struct gigaset_ops *ops;
537 struct module *owner;
538};
539
540struct cmdbuf_t {
541 struct cmdbuf_t *next, *prev;
542 int len, offset;
543 struct tasklet_struct *wake_tasklet;
544 unsigned char buf[0];
545};
546
547struct bas_bc_state {
548 /* isochronous output state */
Tilman Schmidt9d4bee22008-02-06 01:38:28 -0800549 int running;
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800550 atomic_t corrbytes;
551 spinlock_t isooutlock;
552 struct isow_urbctx_t isoouturbs[BAS_OUTURBS];
553 struct isow_urbctx_t *isooutdone, *isooutfree, *isooutovfl;
554 struct isowbuf_t *isooutbuf;
Tilman Schmidt784d5852006-04-10 22:55:04 -0700555 unsigned numsub; /* submitted URB counter
556 (for diagnostic messages only) */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800557 struct tasklet_struct sent_tasklet;
558
559 /* isochronous input state */
560 spinlock_t isoinlock;
561 struct urb *isoinurbs[BAS_INURBS];
562 unsigned char isoinbuf[BAS_INBUFSIZE * BAS_INURBS];
Tilman Schmidt784d5852006-04-10 22:55:04 -0700563 struct urb *isoindone; /* completed isoc read URB */
Tilman Schmidtdbd98232008-02-06 01:38:23 -0800564 int isoinstatus; /* status of completed URB */
Tilman Schmidt784d5852006-04-10 22:55:04 -0700565 int loststatus; /* status of dropped URB */
566 unsigned isoinlost; /* number of bytes lost */
567 /* state of bit unstuffing algorithm
568 (in addition to BC_state.inputstate) */
569 unsigned seqlen; /* number of '1' bits not yet
570 unstuffed */
571 unsigned inbyte, inbits; /* collected bits for next byte */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800572 /* statistics */
Tilman Schmidt784d5852006-04-10 22:55:04 -0700573 unsigned goodbytes; /* bytes correctly received */
574 unsigned alignerrs; /* frames with incomplete byte at end */
575 unsigned fcserrs; /* FCS errors */
576 unsigned frameerrs; /* framing errors */
577 unsigned giants; /* long frames */
578 unsigned runts; /* short frames */
579 unsigned aborts; /* HDLC aborts */
580 unsigned shared0s; /* '0' bits shared between flags */
581 unsigned stolen0s; /* '0' stuff bits also serving as
582 leading flag bits */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800583 struct tasklet_struct rcvd_tasklet;
584};
585
586struct gigaset_ops {
Tilman Schmidt917f5082006-04-10 22:55:00 -0700587 /* Called from ev-layer.c/interface.c for sending AT commands to the
588 device */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800589 int (*write_cmd)(struct cardstate *cs,
Tilman Schmidt784d5852006-04-10 22:55:04 -0700590 const unsigned char *buf, int len,
591 struct tasklet_struct *wake_tasklet);
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800592
593 /* Called from interface.c for additional device control */
594 int (*write_room)(struct cardstate *cs);
595 int (*chars_in_buffer)(struct cardstate *cs);
596 int (*brkchars)(struct cardstate *cs, const unsigned char buf[6]);
597
598 /* Called from ev-layer.c after setting up connection
599 * Should call gigaset_bchannel_up(), when finished. */
600 int (*init_bchannel)(struct bc_state *bcs);
601
602 /* Called from ev-layer.c after hanging up
603 * Should call gigaset_bchannel_down(), when finished. */
604 int (*close_bchannel)(struct bc_state *bcs);
605
606 /* Called by gigaset_initcs() for setting up bcs->hw.xxx */
607 int (*initbcshw)(struct bc_state *bcs);
608
609 /* Called by gigaset_freecs() for freeing bcs->hw.xxx */
610 int (*freebcshw)(struct bc_state *bcs);
611
Tilman Schmidt73a88812006-04-22 02:35:30 -0700612 /* Called by gigaset_bchannel_down() for resetting bcs->hw.xxx */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800613 void (*reinitbcshw)(struct bc_state *bcs);
614
615 /* Called by gigaset_initcs() for setting up cs->hw.xxx */
616 int (*initcshw)(struct cardstate *cs);
617
618 /* Called by gigaset_freecs() for freeing cs->hw.xxx */
619 void (*freecshw)(struct cardstate *cs);
620
Tilman Schmidt917f5082006-04-10 22:55:00 -0700621 /* Called from common.c/interface.c for additional serial port
622 control */
623 int (*set_modem_ctrl)(struct cardstate *cs, unsigned old_state,
624 unsigned new_state);
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800625 int (*baud_rate)(struct cardstate *cs, unsigned cflag);
626 int (*set_line_ctrl)(struct cardstate *cs, unsigned cflag);
627
628 /* Called from i4l.c to put an skb into the send-queue. */
629 int (*send_skb)(struct bc_state *bcs, struct sk_buff *skb);
630
631 /* Called from ev-layer.c to process a block of data
632 * received through the common/control channel. */
633 void (*handle_input)(struct inbuf_t *inbuf);
634
635};
636
637/* = Common structures and definitions ======================================= */
638
639/* Parser states for DLE-Event:
640 * <DLE-EVENT>: <DLE_FLAG> "X" <EVENT> <DLE_FLAG> "."
641 * <DLE_FLAG>: 0x10
642 * <EVENT>: ((a-z)* | (A-Z)* | (0-10)*)+
643 */
Tilman Schmidt784d5852006-04-10 22:55:04 -0700644#define DLE_FLAG 0x10
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800645
646/* ===========================================================================
647 * Functions implemented in asyncdata.c
648 */
649
650/* Called from i4l.c to put an skb into the send-queue.
651 * After sending gigaset_skb_sent() should be called. */
652int gigaset_m10x_send_skb(struct bc_state *bcs, struct sk_buff *skb);
653
654/* Called from ev-layer.c to process a block of data
655 * received through the common/control channel. */
656void gigaset_m10x_input(struct inbuf_t *inbuf);
657
658/* ===========================================================================
659 * Functions implemented in isocdata.c
660 */
661
662/* Called from i4l.c to put an skb into the send-queue.
663 * After sending gigaset_skb_sent() should be called. */
664int gigaset_isoc_send_skb(struct bc_state *bcs, struct sk_buff *skb);
665
666/* Called from ev-layer.c to process a block of data
667 * received through the common/control channel. */
668void gigaset_isoc_input(struct inbuf_t *inbuf);
669
670/* Called from bas-gigaset.c to process a block of data
671 * received through the isochronous channel */
Tilman Schmidt917f5082006-04-10 22:55:00 -0700672void gigaset_isoc_receive(unsigned char *src, unsigned count,
673 struct bc_state *bcs);
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800674
675/* Called from bas-gigaset.c to put a block of data
676 * into the isochronous output buffer */
677int gigaset_isoc_buildframe(struct bc_state *bcs, unsigned char *in, int len);
678
679/* Called from bas-gigaset.c to initialize the isochronous output buffer */
680void gigaset_isowbuf_init(struct isowbuf_t *iwb, unsigned char idle);
681
682/* Called from bas-gigaset.c to retrieve a block of bytes for sending */
683int gigaset_isowbuf_getbytes(struct isowbuf_t *iwb, int size);
684
685/* ===========================================================================
686 * Functions implemented in i4l.c/gigaset.h
687 */
688
689/* Called by gigaset_initcs() for setting up with the isdn4linux subsystem */
690int gigaset_register_to_LL(struct cardstate *cs, const char *isdnid);
691
692/* Called from xxx-gigaset.c to indicate completion of sending an skb */
693void gigaset_skb_sent(struct bc_state *bcs, struct sk_buff *skb);
694
695/* Called from common.c/ev-layer.c to indicate events relevant to the LL */
696int gigaset_isdn_icall(struct at_state_t *at_state);
697int gigaset_isdn_setup_accept(struct at_state_t *at_state);
698int gigaset_isdn_setup_dial(struct at_state_t *at_state, void *data);
699
700void gigaset_i4l_cmd(struct cardstate *cs, int cmd);
701void gigaset_i4l_channel_cmd(struct bc_state *bcs, int cmd);
702
703
704static inline void gigaset_isdn_rcv_err(struct bc_state *bcs)
705{
706 isdn_ctrl response;
707
708 /* error -> LL */
Tilman Schmidt784d5852006-04-10 22:55:04 -0700709 gig_dbg(DEBUG_CMD, "sending L1ERR");
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800710 response.driver = bcs->cs->myid;
711 response.command = ISDN_STAT_L1ERR;
712 response.arg = bcs->channel;
713 response.parm.errcode = ISDN_STAT_L1ERR_RECV;
714 bcs->cs->iif.statcallb(&response);
715}
716
717/* ===========================================================================
718 * Functions implemented in ev-layer.c
719 */
720
721/* tasklet called from common.c to process queued events */
722void gigaset_handle_event(unsigned long data);
723
724/* called from isocdata.c / asyncdata.c
725 * when a complete modem response line has been received */
726void gigaset_handle_modem_response(struct cardstate *cs);
727
728/* ===========================================================================
729 * Functions implemented in proc.c
730 */
731
732/* initialize sysfs for device */
Tilman Schmidtb1d47462006-04-10 22:55:07 -0700733void gigaset_init_dev_sysfs(struct cardstate *cs);
734void gigaset_free_dev_sysfs(struct cardstate *cs);
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800735
736/* ===========================================================================
737 * Functions implemented in common.c/gigaset.h
738 */
739
740void gigaset_bcs_reinit(struct bc_state *bcs);
741void gigaset_at_init(struct at_state_t *at_state, struct bc_state *bcs,
Tilman Schmidt784d5852006-04-10 22:55:04 -0700742 struct cardstate *cs, int cid);
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800743int gigaset_get_channel(struct bc_state *bcs);
744void gigaset_free_channel(struct bc_state *bcs);
745int gigaset_get_channels(struct cardstate *cs);
746void gigaset_free_channels(struct cardstate *cs);
747void gigaset_block_channels(struct cardstate *cs);
748
749/* Allocate and initialize driver structure. */
750struct gigaset_driver *gigaset_initdriver(unsigned minor, unsigned minors,
Tilman Schmidt784d5852006-04-10 22:55:04 -0700751 const char *procname,
752 const char *devname,
Tilman Schmidt784d5852006-04-10 22:55:04 -0700753 const struct gigaset_ops *ops,
754 struct module *owner);
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800755
756/* Deallocate driver structure. */
757void gigaset_freedriver(struct gigaset_driver *drv);
758void gigaset_debugdrivers(void);
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800759struct cardstate *gigaset_get_cs_by_tty(struct tty_struct *tty);
760struct cardstate *gigaset_get_cs_by_id(int id);
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800761void gigaset_blockdriver(struct gigaset_driver *drv);
762
Tilman Schmidt917f5082006-04-10 22:55:00 -0700763/* Allocate and initialize card state. Calls hardware dependent
764 gigaset_init[b]cs(). */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800765struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
766 int onechannel, int ignoreframes,
767 int cidmode, const char *modulename);
768
769/* Free card state. Calls hardware dependent gigaset_free[b]cs(). */
770void gigaset_freecs(struct cardstate *cs);
771
772/* Tell common.c that hardware and driver are ready. */
773int gigaset_start(struct cardstate *cs);
774
775/* Tell common.c that the device is not present any more. */
776void gigaset_stop(struct cardstate *cs);
777
778/* Tell common.c that the driver is being unloaded. */
Tilman Schmidte468c042008-02-06 01:38:29 -0800779int gigaset_shutdown(struct cardstate *cs);
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800780
781/* Tell common.c that an skb has been sent. */
782void gigaset_skb_sent(struct bc_state *bcs, struct sk_buff *skb);
783
784/* Append event to the queue.
785 * Returns NULL on failure or a pointer to the event on success.
786 * ptr must be kmalloc()ed (and not be freed by the caller).
787 */
788struct event_t *gigaset_add_event(struct cardstate *cs,
Tilman Schmidt784d5852006-04-10 22:55:04 -0700789 struct at_state_t *at_state, int type,
790 void *ptr, int parameter, void *arg);
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800791
792/* Called on CONFIG1 command from frontend. */
793int gigaset_enterconfigmode(struct cardstate *cs); //0: success <0: errorcode
794
795/* cs->lock must not be locked */
796static inline void gigaset_schedule_event(struct cardstate *cs)
797{
798 unsigned long flags;
799 spin_lock_irqsave(&cs->lock, flags);
Tilman Schmidt69049cc2006-04-10 22:55:16 -0700800 if (cs->running)
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800801 tasklet_schedule(&cs->event_tasklet);
802 spin_unlock_irqrestore(&cs->lock, flags);
803}
804
805/* Tell common.c that B channel has been closed. */
806/* cs->lock must not be locked */
807static inline void gigaset_bchannel_down(struct bc_state *bcs)
808{
809 gigaset_add_event(bcs->cs, &bcs->at_state, EV_BC_CLOSED, NULL, 0, NULL);
810
Tilman Schmidt784d5852006-04-10 22:55:04 -0700811 gig_dbg(DEBUG_CMD, "scheduling BC_CLOSED");
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800812 gigaset_schedule_event(bcs->cs);
813}
814
815/* Tell common.c that B channel has been opened. */
816/* cs->lock must not be locked */
817static inline void gigaset_bchannel_up(struct bc_state *bcs)
818{
819 gigaset_add_event(bcs->cs, &bcs->at_state, EV_BC_OPEN, NULL, 0, NULL);
820
Tilman Schmidt784d5852006-04-10 22:55:04 -0700821 gig_dbg(DEBUG_CMD, "scheduling BC_OPEN");
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800822 gigaset_schedule_event(bcs->cs);
823}
824
825/* handling routines for sk_buff */
826/* ============================= */
827
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800828/* pass received skb to LL
829 * Warning: skb must not be accessed anymore!
830 */
831static inline void gigaset_rcv_skb(struct sk_buff *skb,
Tilman Schmidt784d5852006-04-10 22:55:04 -0700832 struct cardstate *cs,
833 struct bc_state *bcs)
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800834{
835 cs->iif.rcvcallb_skb(cs->myid, bcs->channel, skb);
836 bcs->trans_down++;
837}
838
839/* handle reception of corrupted skb
840 * Warning: skb must not be accessed anymore!
841 */
842static inline void gigaset_rcv_error(struct sk_buff *procskb,
Tilman Schmidt784d5852006-04-10 22:55:04 -0700843 struct cardstate *cs,
844 struct bc_state *bcs)
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800845{
846 if (procskb)
847 dev_kfree_skb(procskb);
848
849 if (bcs->ignore)
850 --bcs->ignore;
851 else {
852 ++bcs->corrupted;
853 gigaset_isdn_rcv_err(bcs);
854 }
855}
856
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800857/* append received bytes to inbuf */
Tilman Schmidt714e8232006-04-10 22:55:09 -0700858int gigaset_fill_inbuf(struct inbuf_t *inbuf, const unsigned char *src,
859 unsigned numbytes);
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800860
861/* ===========================================================================
862 * Functions implemented in interface.c
863 */
864
865/* initialize interface */
866void gigaset_if_initdriver(struct gigaset_driver *drv, const char *procname,
Greg Kroah-Hartmanf4eaa372005-06-20 21:15:16 -0700867 const char *devname);
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800868/* release interface */
869void gigaset_if_freedriver(struct gigaset_driver *drv);
870/* add minor */
871void gigaset_if_init(struct cardstate *cs);
872/* remove minor */
873void gigaset_if_free(struct cardstate *cs);
874/* device received data */
875void gigaset_if_receive(struct cardstate *cs,
Tilman Schmidt784d5852006-04-10 22:55:04 -0700876 unsigned char *buffer, size_t len);
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800877
878#endif