blob: 7a44caca8a17d9034b24140defb1c7381a3e3a64 [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 *
5 * Written by Stefan Eilers <Eilers.Stefan@epost.de>
6 * 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
19#include <linux/config.h>
20#include <linux/kernel.h>
21#include <linux/compiler.h>
22#include <linux/types.h>
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -080023#include <linux/spinlock.h>
24#include <linux/isdnif.h>
25#include <linux/usb.h>
26#include <linux/skbuff.h>
27#include <linux/netdevice.h>
28#include <linux/ppp_defs.h>
29#include <linux/timer.h>
30#include <linux/interrupt.h>
31#include <linux/tty.h>
32#include <linux/tty_driver.h>
33#include <linux/list.h>
Tilman Schmidt917f5082006-04-10 22:55:00 -070034#include <asm/atomic.h>
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -080035
36#define GIG_VERSION {0,5,0,0}
37#define GIG_COMPAT {0,4,0,0}
38
Tilman Schmidt917f5082006-04-10 22:55:00 -070039#define MAX_REC_PARAMS 10 /* Max. number of params in response string */
40#define MAX_RESP_SIZE 512 /* Max. size of a response string */
41#define HW_HDR_LEN 2 /* Header size used to store ack info */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -080042
Tilman Schmidt917f5082006-04-10 22:55:00 -070043#define MAX_EVENTS 64 /* size of event queue */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -080044
45#define RBUFSIZE 8192
Tilman Schmidt917f5082006-04-10 22:55:00 -070046#define SBUFSIZE 4096 /* sk_buff payload size */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -080047
Tilman Schmidt917f5082006-04-10 22:55:00 -070048#define TRANSBUFSIZE 768 /* bytes per skb for transparent receive */
49#define MAX_BUF_SIZE (SBUFSIZE - 2) /* Max. size of a data packet from LL */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -080050
51/* compile time options */
52#define GIG_MAJOR 0
53
54#define GIG_MAYINITONDIAL
55#define GIG_RETRYCID
56#define GIG_X75
57
58#define MAX_TIMER_INDEX 1000
59#define MAX_SEQ_INDEX 1000
60
Tilman Schmidtec81b5e2006-04-10 22:55:03 -070061#define GIG_TICK 100 /* in milliseconds */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -080062
63/* timeout values (unit: 1 sec) */
64#define INIT_TIMEOUT 1
65
66/* timeout values (unit: 0.1 sec) */
67#define RING_TIMEOUT 3 /* for additional parameters to RING */
68#define BAS_TIMEOUT 20 /* for response to Base USB ops */
69#define ATRDY_TIMEOUT 3 /* for HD_READY_SEND_ATDATA */
70
71#define BAS_RETRY 3 /* max. retries for base USB ops */
72
73#define MAXACT 3
74
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -080075extern int gigaset_debuglevel; /* "needs" cast to (enum debuglevel) */
76
Tilman Schmidt917f5082006-04-10 22:55:00 -070077/* any combination of these can be given with the 'debug=' parameter to insmod,
78 * e.g. 'insmod usb_gigaset.o debug=0x2c' will set DEBUG_OPEN, DEBUG_CMD and
79 * DEBUG_INTR.
80 */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -080081enum debuglevel { /* up to 24 bits (atomic_t) */
Tilman Schmidt784d5852006-04-10 22:55:04 -070082 DEBUG_REG = 0x0002, /* serial port I/O register operations */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -080083 DEBUG_OPEN = 0x0004, /* open/close serial port */
84 DEBUG_INTR = 0x0008, /* interrupt processing */
Tilman Schmidt784d5852006-04-10 22:55:04 -070085 DEBUG_INTR_DUMP = 0x0010, /* Activating hexdump debug output on
Tilman Schmidt917f5082006-04-10 22:55:00 -070086 interrupt requests, not available as
87 run-time option */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -080088 DEBUG_CMD = 0x00020, /* sent/received LL commands */
89 DEBUG_STREAM = 0x00040, /* application data stream I/O events */
90 DEBUG_STREAM_DUMP = 0x00080, /* application data stream content */
91 DEBUG_LLDATA = 0x00100, /* sent/received LL data */
Tilman Schmidt917f5082006-04-10 22:55:00 -070092 DEBUG_INTR_0 = 0x00200, /* serial port interrupt processing */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -080093 DEBUG_DRIVER = 0x00400, /* driver structure */
94 DEBUG_HDLC = 0x00800, /* M10x HDLC processing */
95 DEBUG_WRITE = 0x01000, /* M105 data write */
Tilman Schmidt784d5852006-04-10 22:55:04 -070096 DEBUG_TRANSCMD = 0x02000, /* AT-COMMANDS+RESPONSES */
97 DEBUG_MCMD = 0x04000, /* COMMANDS THAT ARE SENT VERY OFTEN */
Tilman Schmidt917f5082006-04-10 22:55:00 -070098 DEBUG_INIT = 0x08000, /* (de)allocation+initialization of data
99 structures */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800100 DEBUG_LOCK = 0x10000, /* semaphore operations */
101 DEBUG_OUTPUT = 0x20000, /* output to device */
Tilman Schmidt784d5852006-04-10 22:55:04 -0700102 DEBUG_ISO = 0x40000, /* isochronous transfers */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800103 DEBUG_IF = 0x80000, /* character device operations */
Tilman Schmidt917f5082006-04-10 22:55:00 -0700104 DEBUG_USBREQ = 0x100000, /* USB communication (except payload
105 data) */
Tilman Schmidt784d5852006-04-10 22:55:04 -0700106 DEBUG_LOCKCMD = 0x200000, /* AT commands and responses when
Tilman Schmidt917f5082006-04-10 22:55:00 -0700107 MS_LOCKED */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800108
Tilman Schmidt917f5082006-04-10 22:55:00 -0700109 DEBUG_ANY = 0x3fffff, /* print message if any of the others is
110 activated */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800111};
112
Tilman Schmidt784d5852006-04-10 22:55:04 -0700113/* missing from linux/device.h ... */
114#ifndef dev_notice
115#define dev_notice(dev, format, arg...) \
116 dev_printk(KERN_NOTICE , dev , format , ## arg)
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800117#endif
118
Tilman Schmidt784d5852006-04-10 22:55:04 -0700119/* Kernel message macros for situations where dev_printk and friends cannot be
120 * used for lack of reliable access to a device structure.
121 * linux/usb.h already contains these but in an obsolete form which clutters
122 * the log needlessly, and according to the USB maintainer those should be
123 * removed rather than fixed anyway.
124 */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800125#undef err
Tilman Schmidt784d5852006-04-10 22:55:04 -0700126#undef info
127#undef warn
128#undef notice
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800129
Tilman Schmidt784d5852006-04-10 22:55:04 -0700130#define err(format, arg...) printk(KERN_ERR KBUILD_MODNAME ": " \
131 format "\n" , ## arg)
132#define info(format, arg...) printk(KERN_INFO KBUILD_MODNAME ": " \
133 format "\n" , ## arg)
134#define warn(format, arg...) printk(KERN_WARNING KBUILD_MODNAME ": " \
135 format "\n" , ## arg)
136#define notice(format, arg...) printk(KERN_NOTICE KBUILD_MODNAME ": " \
137 format "\n" , ## arg)
138
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800139#ifdef CONFIG_GIGASET_DEBUG
Tilman Schmidt784d5852006-04-10 22:55:04 -0700140
141#define gig_dbg(level, format, arg...) \
Tilman Schmidt917f5082006-04-10 22:55:00 -0700142 do { \
143 if (unlikely(((enum debuglevel)gigaset_debuglevel) & (level))) \
Tilman Schmidt784d5852006-04-10 22:55:04 -0700144 printk(KERN_DEBUG KBUILD_MODNAME ": " format "\n", \
145 ## arg); \
Tilman Schmidt917f5082006-04-10 22:55:00 -0700146 } while (0)
Tilman Schmidt784d5852006-04-10 22:55:04 -0700147#define DEBUG_DEFAULT (DEBUG_INIT | DEBUG_TRANSCMD | DEBUG_CMD | DEBUG_USBREQ)
148
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800149#else
Tilman Schmidt784d5852006-04-10 22:55:04 -0700150
151#define gig_dbg(level, format, arg...) do {} while (0)
152#define DEBUG_DEFAULT 0
153
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800154#endif
155
156void gigaset_dbg_buffer(enum debuglevel level, const unsigned char *msg,
Tilman Schmidt01371502006-04-10 22:55:11 -0700157 size_t len, const unsigned char *buf);
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800158
159/* connection state */
160#define ZSAU_NONE 0
161#define ZSAU_DISCONNECT_IND 4
162#define ZSAU_OUTGOING_CALL_PROCEEDING 1
163#define ZSAU_PROCEEDING 1
164#define ZSAU_CALL_DELIVERED 2
165#define ZSAU_ACTIVE 3
166#define ZSAU_NULL 5
167#define ZSAU_DISCONNECT_REQ 6
168#define ZSAU_UNKNOWN -1
169
170/* USB control transfer requests */
Tilman Schmidt917f5082006-04-10 22:55:00 -0700171#define OUT_VENDOR_REQ (USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_ENDPOINT)
172#define IN_VENDOR_REQ (USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_ENDPOINT)
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800173
174/* int-in-events 3070 */
175#define HD_B1_FLOW_CONTROL 0x80
176#define HD_B2_FLOW_CONTROL 0x81
Tilman Schmidt917f5082006-04-10 22:55:00 -0700177#define HD_RECEIVEATDATA_ACK (0x35) // 3070
178 // att: HD_RECEIVE>>AT<<DATA_ACK
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800179#define HD_READY_SEND_ATDATA (0x36) // 3070
180#define HD_OPEN_ATCHANNEL_ACK (0x37) // 3070
181#define HD_CLOSE_ATCHANNEL_ACK (0x38) // 3070
182#define HD_DEVICE_INIT_OK (0x11) // ISurf USB + 3070
183#define HD_OPEN_B1CHANNEL_ACK (0x51) // ISurf USB + 3070
184#define HD_OPEN_B2CHANNEL_ACK (0x52) // ISurf USB + 3070
185#define HD_CLOSE_B1CHANNEL_ACK (0x53) // ISurf USB + 3070
186#define HD_CLOSE_B2CHANNEL_ACK (0x54) // ISurf USB + 3070
187// Powermangment
188#define HD_SUSPEND_END (0x61) // ISurf USB
189// Configuration
190#define HD_RESET_INTERRUPT_PIPE_ACK (0xFF) // ISurf USB + 3070
191
192/* control requests 3070 */
193#define HD_OPEN_B1CHANNEL (0x23) // ISurf USB + 3070
194#define HD_CLOSE_B1CHANNEL (0x24) // ISurf USB + 3070
195#define HD_OPEN_B2CHANNEL (0x25) // ISurf USB + 3070
196#define HD_CLOSE_B2CHANNEL (0x26) // ISurf USB + 3070
197#define HD_RESET_INTERRUPT_PIPE (0x27) // ISurf USB + 3070
198#define HD_DEVICE_INIT_ACK (0x34) // ISurf USB + 3070
199#define HD_WRITE_ATMESSAGE (0x12) // 3070
200#define HD_READ_ATMESSAGE (0x13) // 3070
201#define HD_OPEN_ATCHANNEL (0x28) // 3070
202#define HD_CLOSE_ATCHANNEL (0x29) // 3070
203
204/* USB frames for isochronous transfer */
Tilman Schmidt917f5082006-04-10 22:55:00 -0700205#define BAS_FRAMETIME 1 /* number of milliseconds between frames */
206#define BAS_NUMFRAMES 8 /* number of frames per URB */
207#define BAS_MAXFRAME 16 /* allocated bytes per frame */
208#define BAS_NORMFRAME 8 /* send size without flow control */
209#define BAS_HIGHFRAME 10 /* " " with positive flow control */
210#define BAS_LOWFRAME 5 /* " " with negative flow control */
211#define BAS_CORRFRAMES 4 /* flow control multiplicator */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800212
Tilman Schmidt917f5082006-04-10 22:55:00 -0700213#define BAS_INBUFSIZE (BAS_MAXFRAME * BAS_NUMFRAMES)
214 /* size of isoc in buf per URB */
215#define BAS_OUTBUFSIZE 4096 /* size of common isoc out buffer */
216#define BAS_OUTBUFPAD BAS_MAXFRAME /* size of pad area for isoc out buf */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800217
218#define BAS_INURBS 3
219#define BAS_OUTURBS 3
220
221/* variable commands in struct bc_state */
222#define AT_ISO 0
223#define AT_DIAL 1
224#define AT_MSN 2
225#define AT_BC 3
226#define AT_PROTO 4
227#define AT_TYPE 5
228#define AT_HLC 6
229#define AT_NUM 7
230
231/* variables in struct at_state_t */
Tilman Schmidt917f5082006-04-10 22:55:00 -0700232#define VAR_ZSAU 0
233#define VAR_ZDLE 1
234#define VAR_ZVLS 2
235#define VAR_ZCTP 3
236#define VAR_NUM 4
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800237
Tilman Schmidt917f5082006-04-10 22:55:00 -0700238#define STR_NMBR 0
239#define STR_ZCPN 1
240#define STR_ZCON 2
241#define STR_ZBC 3
242#define STR_ZHLC 4
243#define STR_NUM 5
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800244
Tilman Schmidt917f5082006-04-10 22:55:00 -0700245#define EV_TIMEOUT -105
246#define EV_IF_VER -106
247#define EV_PROC_CIDMODE -107
248#define EV_SHUTDOWN -108
249#define EV_START -110
250#define EV_STOP -111
251#define EV_IF_LOCK -112
252#define EV_PROTO_L2 -113
253#define EV_ACCEPT -114
254#define EV_DIAL -115
255#define EV_HUP -116
256#define EV_BC_OPEN -117
257#define EV_BC_CLOSED -118
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800258
259/* input state */
Tilman Schmidt917f5082006-04-10 22:55:00 -0700260#define INS_command 0x0001
261#define INS_DLE_char 0x0002
262#define INS_byte_stuff 0x0004
263#define INS_have_data 0x0008
264#define INS_skip_frame 0x0010
265#define INS_DLE_command 0x0020
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800266#define INS_flag_hunt 0x0040
267
268/* channel state */
269#define CHS_D_UP 0x01
270#define CHS_B_UP 0x02
271#define CHS_NOTIFY_LL 0x04
272
Tilman Schmidt917f5082006-04-10 22:55:00 -0700273#define ICALL_REJECT 0
274#define ICALL_ACCEPT 1
275#define ICALL_IGNORE 2
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800276
277/* device state */
Tilman Schmidt917f5082006-04-10 22:55:00 -0700278#define MS_UNINITIALIZED 0
279#define MS_INIT 1
280#define MS_LOCKED 2
281#define MS_SHUTDOWN 3
282#define MS_RECOVER 4
283#define MS_READY 5
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800284
285/* mode */
Tilman Schmidt917f5082006-04-10 22:55:00 -0700286#define M_UNKNOWN 0
287#define M_CONFIG 1
288#define M_UNIMODEM 2
289#define M_CID 3
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800290
291/* start mode */
Tilman Schmidt917f5082006-04-10 22:55:00 -0700292#define SM_LOCKED 0
293#define SM_ISDN 1 /* default */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800294
295struct gigaset_ops;
296struct gigaset_driver;
297
298struct usb_cardstate;
299struct ser_cardstate;
300struct bas_cardstate;
301
302struct bc_state;
303struct usb_bc_state;
304struct ser_bc_state;
305struct bas_bc_state;
306
307struct reply_t {
Tilman Schmidt917f5082006-04-10 22:55:00 -0700308 int resp_code; /* RSP_XXXX */
309 int min_ConState; /* <0 => ignore */
310 int max_ConState; /* <0 => ignore */
311 int parameter; /* e.g. ZSAU_XXXX <0: ignore*/
312 int new_ConState; /* <0 => ignore */
313 int timeout; /* >0 => *HZ; <=0 => TOUT_XXXX*/
314 int action[MAXACT]; /* ACT_XXXX */
315 char *command; /* NULL==none */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800316};
317
318extern struct reply_t gigaset_tab_cid_m10x[];
319extern struct reply_t gigaset_tab_nocid_m10x[];
320
321struct inbuf_t {
Tilman Schmidt917f5082006-04-10 22:55:00 -0700322 unsigned char *rcvbuf; /* usb-gigaset receive buffer */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800323 struct bc_state *bcs;
Tilman Schmidt917f5082006-04-10 22:55:00 -0700324 struct cardstate *cs;
325 int inputstate;
326 atomic_t head, tail;
327 unsigned char data[RBUFSIZE];
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800328};
329
330/* isochronous write buffer structure
331 * circular buffer with pad area for extraction of complete USB frames
332 * - data[read..nextread-1] is valid data already submitted to the USB subsystem
333 * - data[nextread..write-1] is valid data yet to be sent
334 * - data[write] is the next byte to write to
335 * - in byte-oriented L2 procotols, it is completely free
336 * - in bit-oriented L2 procotols, it may contain a partial byte of valid data
337 * - data[write+1..read-1] is free
338 * - wbits is the number of valid data bits in data[write], starting at the LSB
339 * - writesem is the semaphore for writing to the buffer:
340 * if writesem <= 0, data[write..read-1] is currently being written to
341 * - idle contains the byte value to repeat when the end of valid data is
342 * reached; if nextread==write (buffer contains no data to send), either the
Tilman Schmidt917f5082006-04-10 22:55:00 -0700343 * BAS_OUTBUFPAD bytes immediately before data[write] (if
344 * write>=BAS_OUTBUFPAD) or those of the pad area (if write<BAS_OUTBUFPAD)
345 * are also filled with that value
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800346 */
347struct isowbuf_t {
348 atomic_t read;
349 atomic_t nextread;
350 atomic_t write;
351 atomic_t writesem;
352 int wbits;
353 unsigned char data[BAS_OUTBUFSIZE + BAS_OUTBUFPAD];
354 unsigned char idle;
355};
356
357/* isochronous write URB context structure
358 * data to be stored along with the URB and retrieved when it is returned
359 * as completed by the USB subsystem
360 * - urb: pointer to the URB itself
361 * - bcs: pointer to the B Channel control structure
362 * - limit: end of write buffer area covered by this URB
363 */
364struct isow_urbctx_t {
365 struct urb *urb;
366 struct bc_state *bcs;
367 int limit;
368};
369
370/* AT state structure
371 * data associated with the state of an ISDN connection, whether or not
372 * it is currently assigned a B channel
373 */
374struct at_state_t {
Tilman Schmidt917f5082006-04-10 22:55:00 -0700375 struct list_head list;
376 int waiting;
377 int getstring;
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800378 atomic_t timer_index;
379 unsigned long timer_expires;
380 int timer_active;
Tilman Schmidt917f5082006-04-10 22:55:00 -0700381 unsigned int ConState; /* State of connection */
382 struct reply_t *replystruct;
383 int cid;
384 int int_var[VAR_NUM]; /* see VAR_XXXX */
385 char *str_var[STR_NUM]; /* see STR_XXXX */
386 unsigned pending_commands; /* see PC_XXXX */
387 atomic_t seq_index;
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800388
Tilman Schmidt917f5082006-04-10 22:55:00 -0700389 struct cardstate *cs;
390 struct bc_state *bcs;
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800391};
392
393struct resp_type_t {
394 unsigned char *response;
Tilman Schmidt917f5082006-04-10 22:55:00 -0700395 int resp_code; /* RSP_XXXX */
396 int type; /* RT_XXXX */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800397};
398
399struct event_t {
400 int type;
401 void *ptr, *arg;
402 int parameter;
403 int cid;
404 struct at_state_t *at_state;
405};
406
407/* This buffer holds all information about the used B-Channel */
408struct bc_state {
Tilman Schmidt917f5082006-04-10 22:55:00 -0700409 struct sk_buff *tx_skb; /* Current transfer buffer to modem */
410 struct sk_buff_head squeue; /* B-Channel send Queue */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800411
412 /* Variables for debugging .. */
Tilman Schmidt917f5082006-04-10 22:55:00 -0700413 int corrupted; /* Counter for corrupted packages */
414 int trans_down; /* Counter of packages (downstream) */
415 int trans_up; /* Counter of packages (upstream) */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800416
417 struct at_state_t at_state;
418 unsigned long rcvbytes;
419
420 __u16 fcs;
421 struct sk_buff *skb;
Tilman Schmidt917f5082006-04-10 22:55:00 -0700422 int inputstate; /* see INS_XXXX */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800423
424 int channel;
425
426 struct cardstate *cs;
427
Tilman Schmidt917f5082006-04-10 22:55:00 -0700428 unsigned chstate; /* bitmap (CHS_*) */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800429 int ignore;
Tilman Schmidt917f5082006-04-10 22:55:00 -0700430 unsigned proto2; /* Layer 2 protocol (ISDN_PROTO_L2_*) */
431 char *commands[AT_NUM]; /* see AT_XXXX */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800432
433#ifdef CONFIG_GIGASET_DEBUG
434 int emptycount;
435#endif
436 int busy;
437 int use_count;
438
Tilman Schmidt784d5852006-04-10 22:55:04 -0700439 /* private data of hardware drivers */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800440 union {
Tilman Schmidt917f5082006-04-10 22:55:00 -0700441 struct ser_bc_state *ser; /* serial hardware driver */
442 struct usb_bc_state *usb; /* usb hardware driver (m105) */
443 struct bas_bc_state *bas; /* usb hardware driver (base) */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800444 } hw;
445};
446
447struct cardstate {
448 struct gigaset_driver *driver;
449 unsigned minor_index;
Tilman Schmidt784d5852006-04-10 22:55:04 -0700450 struct device *dev;
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800451
452 const struct gigaset_ops *ops;
453
454 /* Stuff to handle communication */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800455 wait_queue_head_t waitqueue;
456 int waiting;
Tilman Schmidt917f5082006-04-10 22:55:00 -0700457 atomic_t mode; /* see M_XXXX */
458 atomic_t mstate; /* Modem state: see MS_XXXX */
459 /* only changed by the event layer */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800460 int cmd_result;
461
462 int channels;
Tilman Schmidt917f5082006-04-10 22:55:00 -0700463 struct bc_state *bcs; /* Array of struct bc_state */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800464
Tilman Schmidt917f5082006-04-10 22:55:00 -0700465 int onechannel; /* data and commands transmitted in one
466 stream (M10x) */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800467
468 spinlock_t lock;
Tilman Schmidt917f5082006-04-10 22:55:00 -0700469 struct at_state_t at_state; /* at_state_t for cid == 0 */
470 struct list_head temp_at_states;/* list of temporary "struct
471 at_state_t"s without B channel */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800472
473 struct inbuf_t *inbuf;
474
475 struct cmdbuf_t *cmdbuf, *lastcmdbuf;
476 spinlock_t cmdlock;
477 unsigned curlen, cmdbytes;
478
479 unsigned open_count;
480 struct tty_struct *tty;
481 struct tasklet_struct if_wake_tasklet;
482 unsigned control_state;
483
484 unsigned fwver[4];
485 int gotfwver;
486
Tilman Schmidt917f5082006-04-10 22:55:00 -0700487 atomic_t running; /* !=0 if events are handled */
488 atomic_t connected; /* !=0 if hardware is connected */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800489
490 atomic_t cidmode;
491
Tilman Schmidt917f5082006-04-10 22:55:00 -0700492 int myid; /* id for communication with LL */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800493 isdn_if iif;
494
495 struct reply_t *tabnocid;
496 struct reply_t *tabcid;
497 int cs_init;
Tilman Schmidt917f5082006-04-10 22:55:00 -0700498 int ignoreframes; /* frames to ignore after setting up the
499 B channel */
Tilman Schmidt784d5852006-04-10 22:55:04 -0700500 struct semaphore sem; /* locks this structure:
501 * connected is not changed,
502 * hardware_up is not changed,
503 * MState is not changed to or from
504 * MS_LOCKED */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800505
506 struct timer_list timer;
507 int retry_count;
Tilman Schmidt917f5082006-04-10 22:55:00 -0700508 int dle; /* !=0 if modem commands/responses are
509 dle encoded */
510 int cur_at_seq; /* sequence of AT commands being
511 processed */
Tilman Schmidt784d5852006-04-10 22:55:04 -0700512 int curchannel; /* channel those commands are meant
Tilman Schmidt917f5082006-04-10 22:55:00 -0700513 for */
514 atomic_t commands_pending; /* flag(s) in xxx.commands_pending have
515 been set */
516 struct tasklet_struct event_tasklet;
517 /* tasklet for serializing AT commands.
518 * Scheduled
519 * -> for modem reponses (and
Tilman Schmidt784d5852006-04-10 22:55:04 -0700520 * incoming data for M10x)
Tilman Schmidt917f5082006-04-10 22:55:00 -0700521 * -> on timeout
522 * -> after setting bits in
523 * xxx.at_state.pending_command
524 * (e.g. command from LL) */
525 struct tasklet_struct write_tasklet;
526 /* tasklet for serial output
527 * (not used in base driver) */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800528
529 /* event queue */
530 struct event_t events[MAX_EVENTS];
531 atomic_t ev_tail, ev_head;
532 spinlock_t ev_lock;
533
534 /* current modem response */
535 unsigned char respdata[MAX_RESP_SIZE];
536 unsigned cbytes;
537
Tilman Schmidt784d5852006-04-10 22:55:04 -0700538 /* private data of hardware drivers */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800539 union {
Tilman Schmidt917f5082006-04-10 22:55:00 -0700540 struct usb_cardstate *usb; /* USB hardware driver (m105) */
541 struct ser_cardstate *ser; /* serial hardware driver */
542 struct bas_cardstate *bas; /* USB hardware driver (base) */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800543 } hw;
544};
545
546struct gigaset_driver {
547 struct list_head list;
Tilman Schmidt917f5082006-04-10 22:55:00 -0700548 spinlock_t lock; /* locks minor tables and blocked */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800549 struct tty_driver *tty;
550 unsigned have_tty;
551 unsigned minor;
552 unsigned minors;
553 struct cardstate *cs;
554 unsigned *flags;
555 int blocked;
556
557 const struct gigaset_ops *ops;
558 struct module *owner;
559};
560
561struct cmdbuf_t {
562 struct cmdbuf_t *next, *prev;
563 int len, offset;
564 struct tasklet_struct *wake_tasklet;
565 unsigned char buf[0];
566};
567
568struct bas_bc_state {
569 /* isochronous output state */
570 atomic_t running;
571 atomic_t corrbytes;
572 spinlock_t isooutlock;
573 struct isow_urbctx_t isoouturbs[BAS_OUTURBS];
574 struct isow_urbctx_t *isooutdone, *isooutfree, *isooutovfl;
575 struct isowbuf_t *isooutbuf;
Tilman Schmidt784d5852006-04-10 22:55:04 -0700576 unsigned numsub; /* submitted URB counter
577 (for diagnostic messages only) */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800578 struct tasklet_struct sent_tasklet;
579
580 /* isochronous input state */
581 spinlock_t isoinlock;
582 struct urb *isoinurbs[BAS_INURBS];
583 unsigned char isoinbuf[BAS_INBUFSIZE * BAS_INURBS];
Tilman Schmidt784d5852006-04-10 22:55:04 -0700584 struct urb *isoindone; /* completed isoc read URB */
585 int loststatus; /* status of dropped URB */
586 unsigned isoinlost; /* number of bytes lost */
587 /* state of bit unstuffing algorithm
588 (in addition to BC_state.inputstate) */
589 unsigned seqlen; /* number of '1' bits not yet
590 unstuffed */
591 unsigned inbyte, inbits; /* collected bits for next byte */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800592 /* statistics */
Tilman Schmidt784d5852006-04-10 22:55:04 -0700593 unsigned goodbytes; /* bytes correctly received */
594 unsigned alignerrs; /* frames with incomplete byte at end */
595 unsigned fcserrs; /* FCS errors */
596 unsigned frameerrs; /* framing errors */
597 unsigned giants; /* long frames */
598 unsigned runts; /* short frames */
599 unsigned aborts; /* HDLC aborts */
600 unsigned shared0s; /* '0' bits shared between flags */
601 unsigned stolen0s; /* '0' stuff bits also serving as
602 leading flag bits */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800603 struct tasklet_struct rcvd_tasklet;
604};
605
606struct gigaset_ops {
Tilman Schmidt917f5082006-04-10 22:55:00 -0700607 /* Called from ev-layer.c/interface.c for sending AT commands to the
608 device */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800609 int (*write_cmd)(struct cardstate *cs,
Tilman Schmidt784d5852006-04-10 22:55:04 -0700610 const unsigned char *buf, int len,
611 struct tasklet_struct *wake_tasklet);
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800612
613 /* Called from interface.c for additional device control */
614 int (*write_room)(struct cardstate *cs);
615 int (*chars_in_buffer)(struct cardstate *cs);
616 int (*brkchars)(struct cardstate *cs, const unsigned char buf[6]);
617
618 /* Called from ev-layer.c after setting up connection
619 * Should call gigaset_bchannel_up(), when finished. */
620 int (*init_bchannel)(struct bc_state *bcs);
621
622 /* Called from ev-layer.c after hanging up
623 * Should call gigaset_bchannel_down(), when finished. */
624 int (*close_bchannel)(struct bc_state *bcs);
625
626 /* Called by gigaset_initcs() for setting up bcs->hw.xxx */
627 int (*initbcshw)(struct bc_state *bcs);
628
629 /* Called by gigaset_freecs() for freeing bcs->hw.xxx */
630 int (*freebcshw)(struct bc_state *bcs);
631
Tilman Schmidt917f5082006-04-10 22:55:00 -0700632 /* Called by gigaset_stop() or gigaset_bchannel_down() for resetting
633 bcs->hw.xxx */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800634 void (*reinitbcshw)(struct bc_state *bcs);
635
636 /* Called by gigaset_initcs() for setting up cs->hw.xxx */
637 int (*initcshw)(struct cardstate *cs);
638
639 /* Called by gigaset_freecs() for freeing cs->hw.xxx */
640 void (*freecshw)(struct cardstate *cs);
641
Tilman Schmidt917f5082006-04-10 22:55:00 -0700642 /* Called from common.c/interface.c for additional serial port
643 control */
644 int (*set_modem_ctrl)(struct cardstate *cs, unsigned old_state,
645 unsigned new_state);
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800646 int (*baud_rate)(struct cardstate *cs, unsigned cflag);
647 int (*set_line_ctrl)(struct cardstate *cs, unsigned cflag);
648
649 /* Called from i4l.c to put an skb into the send-queue. */
650 int (*send_skb)(struct bc_state *bcs, struct sk_buff *skb);
651
652 /* Called from ev-layer.c to process a block of data
653 * received through the common/control channel. */
654 void (*handle_input)(struct inbuf_t *inbuf);
655
656};
657
658/* = Common structures and definitions ======================================= */
659
660/* Parser states for DLE-Event:
661 * <DLE-EVENT>: <DLE_FLAG> "X" <EVENT> <DLE_FLAG> "."
662 * <DLE_FLAG>: 0x10
663 * <EVENT>: ((a-z)* | (A-Z)* | (0-10)*)+
664 */
Tilman Schmidt784d5852006-04-10 22:55:04 -0700665#define DLE_FLAG 0x10
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800666
667/* ===========================================================================
668 * Functions implemented in asyncdata.c
669 */
670
671/* Called from i4l.c to put an skb into the send-queue.
672 * After sending gigaset_skb_sent() should be called. */
673int gigaset_m10x_send_skb(struct bc_state *bcs, struct sk_buff *skb);
674
675/* Called from ev-layer.c to process a block of data
676 * received through the common/control channel. */
677void gigaset_m10x_input(struct inbuf_t *inbuf);
678
679/* ===========================================================================
680 * Functions implemented in isocdata.c
681 */
682
683/* Called from i4l.c to put an skb into the send-queue.
684 * After sending gigaset_skb_sent() should be called. */
685int gigaset_isoc_send_skb(struct bc_state *bcs, struct sk_buff *skb);
686
687/* Called from ev-layer.c to process a block of data
688 * received through the common/control channel. */
689void gigaset_isoc_input(struct inbuf_t *inbuf);
690
691/* Called from bas-gigaset.c to process a block of data
692 * received through the isochronous channel */
Tilman Schmidt917f5082006-04-10 22:55:00 -0700693void gigaset_isoc_receive(unsigned char *src, unsigned count,
694 struct bc_state *bcs);
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800695
696/* Called from bas-gigaset.c to put a block of data
697 * into the isochronous output buffer */
698int gigaset_isoc_buildframe(struct bc_state *bcs, unsigned char *in, int len);
699
700/* Called from bas-gigaset.c to initialize the isochronous output buffer */
701void gigaset_isowbuf_init(struct isowbuf_t *iwb, unsigned char idle);
702
703/* Called from bas-gigaset.c to retrieve a block of bytes for sending */
704int gigaset_isowbuf_getbytes(struct isowbuf_t *iwb, int size);
705
706/* ===========================================================================
707 * Functions implemented in i4l.c/gigaset.h
708 */
709
710/* Called by gigaset_initcs() for setting up with the isdn4linux subsystem */
711int gigaset_register_to_LL(struct cardstate *cs, const char *isdnid);
712
713/* Called from xxx-gigaset.c to indicate completion of sending an skb */
714void gigaset_skb_sent(struct bc_state *bcs, struct sk_buff *skb);
715
716/* Called from common.c/ev-layer.c to indicate events relevant to the LL */
717int gigaset_isdn_icall(struct at_state_t *at_state);
718int gigaset_isdn_setup_accept(struct at_state_t *at_state);
719int gigaset_isdn_setup_dial(struct at_state_t *at_state, void *data);
720
721void gigaset_i4l_cmd(struct cardstate *cs, int cmd);
722void gigaset_i4l_channel_cmd(struct bc_state *bcs, int cmd);
723
724
725static inline void gigaset_isdn_rcv_err(struct bc_state *bcs)
726{
727 isdn_ctrl response;
728
729 /* error -> LL */
Tilman Schmidt784d5852006-04-10 22:55:04 -0700730 gig_dbg(DEBUG_CMD, "sending L1ERR");
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800731 response.driver = bcs->cs->myid;
732 response.command = ISDN_STAT_L1ERR;
733 response.arg = bcs->channel;
734 response.parm.errcode = ISDN_STAT_L1ERR_RECV;
735 bcs->cs->iif.statcallb(&response);
736}
737
738/* ===========================================================================
739 * Functions implemented in ev-layer.c
740 */
741
742/* tasklet called from common.c to process queued events */
743void gigaset_handle_event(unsigned long data);
744
745/* called from isocdata.c / asyncdata.c
746 * when a complete modem response line has been received */
747void gigaset_handle_modem_response(struct cardstate *cs);
748
749/* ===========================================================================
750 * Functions implemented in proc.c
751 */
752
753/* initialize sysfs for device */
Tilman Schmidtb1d47462006-04-10 22:55:07 -0700754void gigaset_init_dev_sysfs(struct cardstate *cs);
755void gigaset_free_dev_sysfs(struct cardstate *cs);
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800756
757/* ===========================================================================
758 * Functions implemented in common.c/gigaset.h
759 */
760
761void gigaset_bcs_reinit(struct bc_state *bcs);
762void gigaset_at_init(struct at_state_t *at_state, struct bc_state *bcs,
Tilman Schmidt784d5852006-04-10 22:55:04 -0700763 struct cardstate *cs, int cid);
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800764int gigaset_get_channel(struct bc_state *bcs);
765void gigaset_free_channel(struct bc_state *bcs);
766int gigaset_get_channels(struct cardstate *cs);
767void gigaset_free_channels(struct cardstate *cs);
768void gigaset_block_channels(struct cardstate *cs);
769
770/* Allocate and initialize driver structure. */
771struct gigaset_driver *gigaset_initdriver(unsigned minor, unsigned minors,
Tilman Schmidt784d5852006-04-10 22:55:04 -0700772 const char *procname,
773 const char *devname,
774 const char *devfsname,
775 const struct gigaset_ops *ops,
776 struct module *owner);
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800777
778/* Deallocate driver structure. */
779void gigaset_freedriver(struct gigaset_driver *drv);
780void gigaset_debugdrivers(void);
781struct cardstate *gigaset_get_cs_by_minor(unsigned minor);
782struct cardstate *gigaset_get_cs_by_tty(struct tty_struct *tty);
783struct cardstate *gigaset_get_cs_by_id(int id);
784
785/* For drivers without fixed assignment device<->cardstate (usb) */
786struct cardstate *gigaset_getunassignedcs(struct gigaset_driver *drv);
787void gigaset_unassign(struct cardstate *cs);
788void gigaset_blockdriver(struct gigaset_driver *drv);
789
Tilman Schmidt917f5082006-04-10 22:55:00 -0700790/* Allocate and initialize card state. Calls hardware dependent
791 gigaset_init[b]cs(). */
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800792struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
793 int onechannel, int ignoreframes,
794 int cidmode, const char *modulename);
795
796/* Free card state. Calls hardware dependent gigaset_free[b]cs(). */
797void gigaset_freecs(struct cardstate *cs);
798
799/* Tell common.c that hardware and driver are ready. */
800int gigaset_start(struct cardstate *cs);
801
802/* Tell common.c that the device is not present any more. */
803void gigaset_stop(struct cardstate *cs);
804
805/* Tell common.c that the driver is being unloaded. */
806void gigaset_shutdown(struct cardstate *cs);
807
808/* Tell common.c that an skb has been sent. */
809void gigaset_skb_sent(struct bc_state *bcs, struct sk_buff *skb);
810
811/* Append event to the queue.
812 * Returns NULL on failure or a pointer to the event on success.
813 * ptr must be kmalloc()ed (and not be freed by the caller).
814 */
815struct event_t *gigaset_add_event(struct cardstate *cs,
Tilman Schmidt784d5852006-04-10 22:55:04 -0700816 struct at_state_t *at_state, int type,
817 void *ptr, int parameter, void *arg);
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800818
819/* Called on CONFIG1 command from frontend. */
820int gigaset_enterconfigmode(struct cardstate *cs); //0: success <0: errorcode
821
822/* cs->lock must not be locked */
823static inline void gigaset_schedule_event(struct cardstate *cs)
824{
825 unsigned long flags;
826 spin_lock_irqsave(&cs->lock, flags);
827 if (atomic_read(&cs->running))
828 tasklet_schedule(&cs->event_tasklet);
829 spin_unlock_irqrestore(&cs->lock, flags);
830}
831
832/* Tell common.c that B channel has been closed. */
833/* cs->lock must not be locked */
834static inline void gigaset_bchannel_down(struct bc_state *bcs)
835{
836 gigaset_add_event(bcs->cs, &bcs->at_state, EV_BC_CLOSED, NULL, 0, NULL);
837
Tilman Schmidt784d5852006-04-10 22:55:04 -0700838 gig_dbg(DEBUG_CMD, "scheduling BC_CLOSED");
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800839 gigaset_schedule_event(bcs->cs);
840}
841
842/* Tell common.c that B channel has been opened. */
843/* cs->lock must not be locked */
844static inline void gigaset_bchannel_up(struct bc_state *bcs)
845{
846 gigaset_add_event(bcs->cs, &bcs->at_state, EV_BC_OPEN, NULL, 0, NULL);
847
Tilman Schmidt784d5852006-04-10 22:55:04 -0700848 gig_dbg(DEBUG_CMD, "scheduling BC_OPEN");
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800849 gigaset_schedule_event(bcs->cs);
850}
851
852/* handling routines for sk_buff */
853/* ============================= */
854
855/* private version of __skb_put()
856 * append 'len' bytes to the content of 'skb', already knowing that the
857 * existing buffer can accomodate them
858 * returns a pointer to the location where the new bytes should be copied to
859 * This function does not take any locks so it must be called with the
860 * appropriate locks held only.
861 */
862static inline unsigned char *gigaset_skb_put_quick(struct sk_buff *skb,
Tilman Schmidt784d5852006-04-10 22:55:04 -0700863 unsigned int len)
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800864{
865 unsigned char *tmp = skb->tail;
866 /*SKB_LINEAR_ASSERT(skb);*/ /* not needed here */
867 skb->tail += len;
868 skb->len += len;
869 return tmp;
870}
871
872/* pass received skb to LL
873 * Warning: skb must not be accessed anymore!
874 */
875static inline void gigaset_rcv_skb(struct sk_buff *skb,
Tilman Schmidt784d5852006-04-10 22:55:04 -0700876 struct cardstate *cs,
877 struct bc_state *bcs)
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800878{
879 cs->iif.rcvcallb_skb(cs->myid, bcs->channel, skb);
880 bcs->trans_down++;
881}
882
883/* handle reception of corrupted skb
884 * Warning: skb must not be accessed anymore!
885 */
886static inline void gigaset_rcv_error(struct sk_buff *procskb,
Tilman Schmidt784d5852006-04-10 22:55:04 -0700887 struct cardstate *cs,
888 struct bc_state *bcs)
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800889{
890 if (procskb)
891 dev_kfree_skb(procskb);
892
893 if (bcs->ignore)
894 --bcs->ignore;
895 else {
896 ++bcs->corrupted;
897 gigaset_isdn_rcv_err(bcs);
898 }
899}
900
901
902/* bitwise byte inversion table */
903extern __u8 gigaset_invtab[]; /* in common.c */
904
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800905/* append received bytes to inbuf */
Tilman Schmidt714e8232006-04-10 22:55:09 -0700906int gigaset_fill_inbuf(struct inbuf_t *inbuf, const unsigned char *src,
907 unsigned numbytes);
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800908
909/* ===========================================================================
910 * Functions implemented in interface.c
911 */
912
913/* initialize interface */
914void gigaset_if_initdriver(struct gigaset_driver *drv, const char *procname,
Tilman Schmidt784d5852006-04-10 22:55:04 -0700915 const char *devname, const char *devfsname);
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800916/* release interface */
917void gigaset_if_freedriver(struct gigaset_driver *drv);
918/* add minor */
919void gigaset_if_init(struct cardstate *cs);
920/* remove minor */
921void gigaset_if_free(struct cardstate *cs);
922/* device received data */
923void gigaset_if_receive(struct cardstate *cs,
Tilman Schmidt784d5852006-04-10 22:55:04 -0700924 unsigned char *buffer, size_t len);
Hansjoerg Lipp6fd5ea62006-03-26 01:38:29 -0800925
926#endif