4 * Portions derived from rfcomm.c, original header as follows:
6 * Copyright (C) 2000, 2001 Axis Communications AB
7 * Copyright (C) 2002, 2004, 2009 Motorola
9 * Author: Mats Friden <mats.friden@axis.com>
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 * Exceptionally, Axis Communications AB grants discretionary and
26 * conditional permissions for additional use of the text contained
27 * in the company's release of the AXIS OpenBT Stack under the
28 * provisions set forth hereunder.
30 * Provided that, if you use the AXIS OpenBT Stack with other files,
31 * that do not implement functionality as specified in the Bluetooth
32 * System specification, to produce an executable, this does not by
33 * itself cause the resulting executable to be covered by the GNU
34 * General Public License. Your use of that executable is in no way
35 * restricted on account of using the AXIS OpenBT Stack code with it.
37 * This exception does not however invalidate any other reasons why
38 * the executable file might be covered by the provisions of the GNU
39 * General Public License.
43 #define TS0710_MAX_CHN 17
45 #define SET_PF(ctr) ((ctr) | (1 << 4))
46 #define CLR_PF(ctr) ((ctr) & 0xef)
47 #define GET_PF(ctr) (((ctr) >> 4) & 0x1)
49 #define SHORT_PAYLOAD_SIZE 127
55 #define TS0710_MAX_HDR_SIZE 5
56 #define DEF_TS0710_MTU 1024
58 #define TS0710_BASIC_FLAG 0xF9
60 /* the control field */
69 /* the type field in a multiplexer command packet */
79 /* V.24 modem control signals */
86 #define CTRL_CHAN 0 /* The control channel is defined as DLCI 0 */
88 #define MCC_CMD 1 /* Multiplexer command cr */
89 #define MCC_RSP 0 /* Multiplexer response cr */
91 static inline int mcc_is_cmd(u8 type)
96 static inline int mcc_is_rsp(u8 type)
98 return !(type & MCC_CR);
102 #ifdef __LITTLE_ENDIAN_BITFIELD
104 struct address_field {
109 } __attribute__ ((packed));
111 static inline int ts0710_dlci(u8 addr)
113 return (addr >> 2) & 0x3f;
117 struct short_length {
120 } __attribute__ ((packed));
126 } __attribute__ ((packed));
128 struct short_frame_head {
129 struct address_field addr;
131 struct short_length length;
132 } __attribute__ ((packed));
135 struct short_frame_head h;
137 } __attribute__ ((packed));
139 struct long_frame_head {
140 struct address_field addr;
142 struct long_length length;
144 } __attribute__ ((packed));
147 struct long_frame_head h;
149 } __attribute__ ((packed));
151 /* Typedefinitions for structures used for the multiplexer commands */
156 } __attribute__ ((packed));
158 struct mcc_short_frame_head {
159 struct mcc_type type;
160 struct short_length length;
162 } __attribute__ ((packed));
164 struct mcc_short_frame {
165 struct mcc_short_frame_head h;
167 } __attribute__ ((packed));
169 struct mcc_long_frame_head {
170 struct mcc_type type;
171 struct long_length length;
173 } __attribute__ ((packed));
175 struct mcc_long_frame {
176 struct mcc_long_frame_head h;
178 } __attribute__ ((packed));
189 } __attribute__ ((packed));
197 } __attribute__ ((packed));
199 struct msc_msg_data {
200 struct address_field dlci;
202 } __attribute__ ((packed));
217 u8 max_nbrof_retrans;
219 } __attribute__ ((packed));
222 #error Only littel-endianess supported now!
225 #define TS0710_FRAME_SIZE(len) \
226 ((len) > SHORT_PAYLOAD_SIZE ? \
227 (len) + FLAG_SIZE + sizeof(struct long_frame) + FCS_SIZE : \
228 (len) + FLAG_SIZE + sizeof(struct short_frame) + FCS_SIZE)
230 #define TS0710_MCC_FRAME_SIZE(len) \
231 TS0710_FRAME_SIZE((len) + sizeof(struct mcc_short_frame))
257 wait_queue_head_t open_wait;
258 wait_queue_head_t close_wait;
262 struct mutex write_lock;
267 /* user space interfaces */
271 struct dlci_struct dlci[TS0710_MAX_CHN];
272 struct chan_struct chan[NR_MUXS];