2 * \defgroup uipopt Configuration options for uIP
5 * uIP is configured using the per-project configuration file
6 * "uipopt.h". This file contains all compile-time options for uIP and
7 * should be tweaked to match each specific project. The uIP
8 * distribution contains a documented example "uipopt.h" that can be
9 * copied and modified for each project.
14 * Configuration options for uIP.
15 * \author Adam Dunkels <adam@dunkels.com>
17 * This file is used for tweaking various configuration options for
18 * uIP. You should make a copy of this file into one of your project's
19 * directories instead of editing this example "uipopt.h" file that
20 * comes with the uIP distribution.
24 * Copyright (c) 2001-2003, Adam Dunkels.
25 * All rights reserved.
27 * Redistribution and use in source and binary forms, with or without
28 * modification, are permitted provided that the following conditions
30 * 1. Redistributions of source code must retain the above copyright
31 * notice, this list of conditions and the following disclaimer.
32 * 2. Redistributions in binary form must reproduce the above copyright
33 * notice, this list of conditions and the following disclaimer in the
34 * documentation and/or other materials provided with the distribution.
35 * 3. The name of the author may not be used to endorse or promote
36 * products derived from this software without specific prior
39 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
40 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
41 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
42 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
43 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
44 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
45 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
46 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
47 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
48 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
49 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
51 * This file is part of the uIP TCP/IP stack.
63 /*------------------------------------------------------------------------------*/
65 * \defgroup uipopttypedef uIP type definitions
70 * The 8-bit unsigned data type.
72 * This may have to be tweaked for your particular compiler. "unsigned
73 * char" works for most compilers.
78 * The 8-bit signed data type.
80 * This may have to be tweaked for your particular compiler. "unsigned
81 * char" works for most compilers.
86 * The 16-bit unsigned data type.
88 * This may have to be tweaked for your particular compiler. "unsigned
89 * short" works for most compilers.
94 * The 16-bit signed data type.
96 * This may have to be tweaked for your particular compiler. "unsigned
97 * short" works for most compilers.
102 * The 32-bit signed data type.
104 * This may have to be tweaked for your particular compiler. "unsigned
105 * short" works for most compilers.
110 * The 32-bit unsigned data type.
112 * This may have to be tweaked for your particular compiler. "unsigned
113 * short" works for most compilers.
118 * The 64-bit unsigned data type.
120 * This may have to be tweaked for your particular compiler. "unsigned
121 * short" works for most compilers.
126 * The 64-bit signed data type.
128 * This may have to be tweaked for your particular compiler. "unsigned
129 * short" works for most compilers.
134 * The statistics data type.
136 * This datatype determines how high the statistics counters are able
141 /*------------------------------------------------------------------------------*/
144 * \defgroup btopt general configuration options
149 * The size of the uIP packet buffer.
151 * The uIP packet buffer should not be smaller than 60 bytes, and does
152 * not need to be larger than 1500 bytes. Lower size results in lower
153 * TCP throughput, larger size results in higher TCP throughput.
157 #define MEM_SIZE (64*1024)
159 #define PBUF_POOL_NUM (HCI_HOST_MAX_NUM_ACL*MAX_NUM_CLIENTS)
160 #define PBUF_POOL_BUFSIZE HCI_HOST_ACL_MAX_LEN
162 #define PBUF_ROM_NUM 45
166 * Determines if statistics support should be compiled in.
168 * The statistics is useful for debugging and to show the user.
175 * Determines if logging of certain events should be compiled in.
177 * This is useful mostly for debugging. The function uip_log()
178 * must be implemented to suit the architecture of the project, if
179 * logging is turned on.
187 * Print out a uIP log message.
189 * This function must be implemented by the module that uses uIP, and
190 * is called by uIP whenever a log message is generated.
192 void bt_log(const char *filename
,int line_nb
,char *msg
);
195 * The link level header length.
197 * This is the offset into the uip_buf where the IP header can be
198 * found. For Ethernet, this should be set to 14. For SLIP, this
199 * should be set to 0.
205 #define TCPIP_HLEN 40
207 /*------------------------------------------------------------------------------*/
209 * \defgroup uipoptcpu CPU architecture configuration
212 * The CPU architecture configuration is where the endianess of the
213 * CPU on which uIP is to be run is specified. Most CPUs today are
214 * little endian, and the most notable exception are the Motorolas
215 * which are big endian. The BYTE_ORDER macro should be changed to
216 * reflect the CPU architecture on which uIP is to be run.
218 #ifndef LITTLE_ENDIAN
219 #define LITTLE_ENDIAN 3412
220 #endif /* LITTLE_ENDIAN */
222 #define BIG_ENDIAN 1234
223 #endif /* BIGE_ENDIAN */
226 * The byte order of the CPU architecture on which uIP is to be run.
228 * This option can be either BIG_ENDIAN (Motorola byte order) or
229 * LITTLE_ENDIAN (Intel byte order).
234 #define BYTE_ORDER BIG_ENDIAN
235 #endif /* BYTE_ORDER */
238 /*------------------------------------------------------------------------------*/
240 #define LIBC_MEMFUNCREPLACE 0
242 /* ---------- Memory options ---------- */
243 #define MAX_NUM_CLIENTS 6 /* Maximum number of connected Bluetooth clients. No more than 6 */
244 #define MAX_NUM_OPT_CLIENTS 10 /* Maximum number of possible Bluetooth clients we might listen to */
246 #define MEMB_NUM_HCI_PCB 1 /* Always set to one */
247 #define MEMB_NUM_HCI_LINK MAX_NUM_CLIENTS /* One for DT + One per ACL connection */
248 #define MEMB_NUM_HCI_INQ 256 /* One per max number of returned results from an inquiry */
249 #define MEMB_NUM_HCI_LINK_KEY 256 /* One per max number of returned results from an read stored link key */
251 /* MEMP_NUM_L2CAP_PCB: the number of simulatenously active L2CAP
253 #define MEMB_NUM_L2CAP_PCB (2 + 2 * MAX_NUM_CLIENTS) /* One for a closing connection + one for DT + one per number of connected Bluetooth clients */
254 /* MEMP_NUM_L2CAP_PCB_LISTEN: the number of listening L2CAP
256 #define MEMB_NUM_L2CAP_PCB_LISTEN (2 * MAX_NUM_OPT_CLIENTS) /* One per listening PSM */
257 /* MEMP_NUM_L2CAP_SIG: the number of simultaneously unresponded
259 #define MEMB_NUM_L2CAP_SIG (2 * MAX_NUM_CLIENTS)/* Two per number of connected Bluetooth clients but min 2 */
260 #define MEMB_NUM_L2CAP_SEG (2 + 2 * MAX_NUM_CLIENTS) /* One per number of L2CAP connections */
262 #define MEMB_NUM_SDP_PCB MAX_NUM_CLIENTS /* One per number of connected Bluetooth clients */
263 #define MEMB_NUM_SDP_RECORD 1 /* One per registered service record */
265 #define MEMP_NUM_RFCOMM_PCB (2 + 2 * MAX_NUM_CLIENTS) /* Two for DT + Two per number of connected Bluetooth clients */
266 #define MEMP_NUM_RFCOMM_PCB_LISTEN (2 * MAX_NUM_CLIENTS) /* Two per number of connected Bluetooth clients */
268 #define MEMP_NUM_HIDP_PCB (2 + 2 * MAX_NUM_CLIENTS) /* Two for DT + Two per number of connected Bluetooth clients */
269 #define MEMP_NUM_HIDP_PCB_LISTEN (2 * MAX_NUM_CLIENTS) /* Two per number of connected Bluetooth clients */
271 #define MEMP_NUM_PPP_PCB (1 + MAX_NUM_CLIENTS) /* One for DT + One per number of connected Bluetooth clients */
272 #define MEMP_NUM_PPP_REQ MAX_NUM_CLIENTS /* One per number of connected Bluetooth clients but min 1 */
274 #define MEMP_NUM_BTE_PCB (2 + 2 * MAX_NUM_CLIENTS) /* Two for DT + Two per number of connected Bluetooth clients */
275 #define MEMP_NUM_BTE_PCB_LISTEN (2 * MAX_NUM_CLIENTS) /* Two per number of connected Bluetooth clients */
277 #define MEMP_NUM_BTE_CTRLS 256
279 /* ---------- HCI options ---------- */
280 /* HCI: Defines if we have lower layers of the Bluetooth stack running on a separate host
285 /* HCI_HOST_MAX_NUM_ACL: The maximum number of ACL packets that the host can buffer */
286 #define HCI_HOST_MAX_NUM_ACL 20 //TODO: Should be equal to PBUF_POOL_SIZE/2??? */
287 /* HCI_HOST_ACL_MAX_LEN: The maximum size of an ACL packet that the host can buffer */
288 #define HCI_HOST_ACL_MAX_LEN 1691 /* Default: RFCOMM MFS + ACL header size, L2CAP header size,
289 RFCOMM header size and RFCOMM FCS size */
290 /* HCI_PACKET_TYPE: The set of packet types which may be used on the connection. In order to
291 maximize packet throughput, it is recommended that RFCOMM should make use of the 3 and 5
292 slot baseband packets.*/
293 #define HCI_PACKET_TYPE 0xCC18 /* Default DM1, DH1, DM3, DH3, DM5, DH5 */
294 /* HCI_ALLOW_ROLE_SWITCH: Tells the host controller whether to accept a Master/Slave switch
295 during establishment of a connection */
296 #define HCI_ALLOW_ROLE_SWITCH 1 /* Default 1 */
297 /* HCI_FLOW_QUEUEING: Control if a packet should be queued if the host controller is out of
298 bufferspace for outgoing packets. Only the first packet sent when out of credits will be
300 #define HCI_FLOW_QUEUEING 0 /* Default: 0 */
304 /* ---------- L2CAP options ---------- */
305 /* L2CAP_HCI: Option for including HCI to access the Bluetooth baseband capabilities */
306 #define L2CAP_HCI 1 //TODO: NEEDED?
307 /* L2CAP_CFG_QOS: Control if a flow specification similar to RFC 1363 should be used */
308 #define L2CAP_CFG_QOS 0
309 /* L2CAP_MTU: Maximum transmission unit for L2CAP packet payload (min 48) */
310 #define L2CAP_MTU (HIDD_N + 1)/* Default for this implementation is RFCOMM MFS + RFCOMM header size and
311 RFCOMM FCS size while the L2CAP default is 672 */
312 /* L2CAP_OUT_FLUSHTO: For some networking protocols, such as many real-time protocols, guaranteed delivery
313 is undesirable. The flush time-out value SHALL be set to its default value 0xffff for a reliable L2CAP
314 channel, and MAY be set to other values if guaranteed delivery is not desired. (min 1) */
315 #define L2CAP_OUT_FLUSHTO 0xFFFF /* Default: 0xFFFF. Infinite number of retransmissions (reliable channel)
316 The value of 1 implies no retransmissions at the Baseband level
317 should be performed since the minimum polling interval is 1.25 ms.*/
318 /* L2CAP_RTX: The Responsive Timeout eXpired timer is used to terminate
319 the channel when the remote endpoint is unresponsive to signalling
320 requests (min 1s, max 60s) */
322 /* L2CAP_ERTX: The Extended Response Timeout eXpired timer is used in
323 place of the RTC timer when a L2CAP_ConnectRspPnd event is received
324 (min 60s, max 300s) */
325 #define L2CAP_ERTX 300
326 /* L2CAP_MAXRTX: Maximum number of Request retransmissions before
327 terminating the channel identified by the request. The decision
328 should be based on the flush timeout of the signalling link. If the
329 flush timeout is infinite, no retransmissions should be performed */
330 #define L2CAP_MAXRTX 0
331 /* L2CAP_CFG_TO: Amount of time spent arbitrating the channel parameters
332 before terminating the connection (max 120s) */
333 #define L2CAP_CFG_TO 30
335 /* ---------- BTE options ---------- */
337 /* ---------- HIDD options ---------- */
338 /* RFCOMM_N: Maximum frame size for RFCOMM segments (min 23, max 32767)*/
339 #define HIDD_N 672 /* Default: Worst case byte stuffed PPP packet size +
340 non-compressed PPP header size and FCS size */
341 /* RFCOMM_K: Initial amount of credits issued to the peer (min 0, max 7) */
343 /* RFCOMM_TO: Acknowledgement timer (T1) and response timer for multiplexer control channel (T2).
344 T1 is the timeout for frames sent with the P/F bit set to 1 (SABM and DISC) and T2 is the timeout
345 for commands sent in UIH frames on DLCI 0 (min 10s, max 60s) */
347 /* RFCOMM_FLOW_QUEUEING: Control if a packet should be queued if a channel is out of credits for
348 outgoing packets. Only the first packet sent when out of credits will be queued */
349 #define RFCOMM_FLOW_QUEUEING 0 /* Default: 0 */
352 #endif /* __BTOPT_H__ */