4 * Portions derived from rfcomm.c, original header as follows:
6 * Copyright (C) 2000, 2001 Axis Communications AB
8 * Author: Mats Friden <mats.friden@axis.com>
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 * Exceptionally, Axis Communications AB grants discretionary and
25 * conditional permissions for additional use of the text contained
26 * in the company's release of the AXIS OpenBT Stack under the
27 * provisions set forth hereunder.
29 * Provided that, if you use the AXIS OpenBT Stack with other files,
30 * that do not implement functionality as specified in the Bluetooth
31 * System specification, to produce an executable, this does not by
32 * itself cause the resulting executable to be covered by the GNU
33 * General Public License. Your use of that executable is in no way
34 * restricted on account of using the AXIS OpenBT Stack code with it.
36 * This exception does not however invalidate any other reasons why
37 * the executable file might be covered by the provisions of the GNU
38 * General Public License.
42 * Copyright (C) 2002 Motorola
44 * 07/28/2002 Initial version based on rfcomm.c
48 #include <linux/configfs.h>
49 #include <linux/module.h>
51 #include <linux/errno.h>
52 #include <linux/sched.h>
53 #include <linux/interrupt.h>
54 #include <linux/tty.h>
55 #include <linux/tty_flip.h>
56 #include <linux/fcntl.h>
57 #include <linux/string.h>
58 #include <linux/major.h>
60 #include <linux/init.h>
61 //#include <linux/devfs_fs_kernel.h>
63 #include <asm/uaccess.h>
64 #include <asm/system.h>
65 #include <asm/bitops.h>
67 #include <asm/byteorder.h>
68 #include <asm/types.h>
70 #define TS0710_MAX_CHN 33
72 #define SET_PF(ctr) ((ctr) | (1 << 4))
73 #define CLR_PF(ctr) ((ctr) & 0xef)
74 #define GET_PF(ctr) (((ctr) >> 4) & 0x1)
76 #define GET_PN_MSG_FRAME_SIZE(pn) ( ((pn)->frame_sizeh << 8) | ((pn)->frame_sizel))
77 #define SET_PN_MSG_FRAME_SIZE(pn, size) ({ (pn)->frame_sizel = (size) & 0xff; \
78 (pn)->frame_sizeh = (size) >> 8; })
80 #define GET_LONG_LENGTH(a) ( ((a).h_len << 7) | ((a).l_len) )
81 #define SET_LONG_LENGTH(a, length) ({ (a).ea = 0; \
82 (a).l_len = length & 0x7F; \
83 (a).h_len = (length >> 7) & 0xFF; })
85 #define SHORT_CRC_CHECK 3
86 #define LONG_CRC_CHECK 4
88 /* FIXME: Should this one be define here? */
89 #define SHORT_PAYLOAD_SIZE 127
95 #define TS0710_MAX_HDR_SIZE 5
96 #define DEF_TS0710_MTU 1600
98 #define TS0710_BASIC_FLAG 0xF9
99 /* the control field */
108 /* the type field in a multiplexer command packet */
118 /* V.24 modem control signals */
125 #define CTRL_CHAN 0 /* The control channel is defined as DLCI 0 */
126 #define MCC_CMD 1 /* Multiplexer command cr */
127 #define MCC_RSP 0 /* Multiplexer response cr */
129 #ifdef __LITTLE_ENDIAN_BITFIELD
136 } __attribute__ ((packed)) address_field;
141 } __attribute__ ((packed)) short_length;
147 } __attribute__ ((packed)) long_length;
153 } __attribute__ ((packed)) short_frame_head;
158 } __attribute__ ((packed)) short_frame;
165 } __attribute__ ((packed)) long_frame_head;
170 } __attribute__ ((packed)) long_frame;
172 /* Typedefinitions for structures used for the multiplexer commands */
177 } __attribute__ ((packed)) mcc_type;
183 } __attribute__ ((packed)) mcc_short_frame_head;
186 mcc_short_frame_head h;
188 } __attribute__ ((packed)) mcc_short_frame;
194 } __attribute__ ((packed)) mcc_long_frame_head;
197 mcc_long_frame_head h;
199 } __attribute__ ((packed)) mcc_long_frame;
210 } __attribute__ ((packed)) v24_sigs;
218 } __attribute__ ((packed)) brk_sigs;
221 short_frame_head s_head;
222 mcc_short_frame_head mcc_s_head;
225 //brk_sigs break_signals;
227 } __attribute__ ((packed)) msc_msg;
230 /* conflict with termios.h */
260 } __attribute__((packed)) parameter_mask;
279 } __attribute__((packed)) rpn_values;
282 short_frame_head s_head;
283 mcc_short_frame_head mcc_s_head;
287 } __attribute__((packed)) rpn_msg;
293 short_frame_head s_head;
294 mcc_short_frame_head mcc_s_head;
299 } __attribute__((packed)) rls_msg;
304 short_frame_head s_head;
305 mcc_short_frame_head mcc_s_head;
315 __u8 max_nbrof_retrans;
318 } __attribute__ ((packed)) pn_msg;
322 short_frame_head s_head;
323 mcc_short_frame_head mcc_s_head;
324 mcc_type command_type;
326 } __attribute__ ((packed)) nsc_msg;
329 #error Only littel-endianess supported now!
350 volatile __u8 flow_control;
351 volatile __u8 initiated;
352 volatile __u8 initiator;
354 wait_queue_head_t open_wait;
355 wait_queue_head_t close_wait;
358 /* user space interfaces */
360 volatile __u8 initiator;
361 volatile __u8 c_dlci;
363 volatile __u8 be_testing;
364 volatile __u32 test_errs;
366 wait_queue_head_t test_wait;
368 dlci_struct dlci[TS0710_MAX_CHN];