1 /** 2 * \defgroup uipopt Configuration options for uIP 3 * @{ 4 * 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. 10 */ 11 12 /** 13 * \file 14 * Configuration options for uIP. 15 * \author Adam Dunkels <adam@dunkels.com> 16 * 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. 21 */ 22 23 /* 24 * Copyright (c) 2001-2003, Adam Dunkels. 25 * All rights reserved. 26 * 27 * Redistribution and use in source and binary forms, with or without 28 * modification, are permitted provided that the following conditions 29 * are met: 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 37 * written permission. 38 * 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. 50 * 51 * This file is part of the uIP TCP/IP stack. 52 * 53 * 54 */ 55 56 #ifndef __BTOPT_H__ 57 #define __BTOPT_H__ 58 59 #include <gctypes.h> 60 #include <stdlib.h> 61 #include <string.h> 62 63 /*------------------------------------------------------------------------------*/ 64 /** 65 * \defgroup uipopttypedef uIP type definitions 66 * @{ 67 */ 68 69 /** 70 * The 8-bit unsigned data type. 71 * 72 * This may have to be tweaked for your particular compiler. "unsigned 73 * char" works for most compilers. 74 */ 75 typedef u8 u8_t; 76 77 /** 78 * The 8-bit signed data type. 79 * 80 * This may have to be tweaked for your particular compiler. "unsigned 81 * char" works for most compilers. 82 */ 83 typedef s8 s8_t; 84 85 /** 86 * The 16-bit unsigned data type. 87 * 88 * This may have to be tweaked for your particular compiler. "unsigned 89 * short" works for most compilers. 90 */ 91 typedef u16 u16_t; 92 93 /** 94 * The 16-bit signed data type. 95 * 96 * This may have to be tweaked for your particular compiler. "unsigned 97 * short" works for most compilers. 98 */ 99 typedef s16 s16_t; 100 101 /** 102 * The 32-bit signed data type. 103 * 104 * This may have to be tweaked for your particular compiler. "unsigned 105 * short" works for most compilers. 106 */ 107 typedef s32 s32_t; 108 109 /** 110 * The 32-bit unsigned data type. 111 * 112 * This may have to be tweaked for your particular compiler. "unsigned 113 * short" works for most compilers. 114 */ 115 typedef u32 u32_t; 116 117 /** 118 * The 64-bit unsigned data type. 119 * 120 * This may have to be tweaked for your particular compiler. "unsigned 121 * short" works for most compilers. 122 */ 123 typedef u64 u64_t; 124 125 /** 126 * The 64-bit signed data type. 127 * 128 * This may have to be tweaked for your particular compiler. "unsigned 129 * short" works for most compilers. 130 */ 131 typedef s64 s64_t; 132 133 /** 134 * The statistics data type. 135 * 136 * This datatype determines how high the statistics counters are able 137 * to count. 138 */ 139 typedef s8 err_t; 140 141 /*------------------------------------------------------------------------------*/ 142 143 /** 144 * \defgroup btopt general configuration options 145 * @{ 146 */ 147 148 /** 149 * The size of the uIP packet buffer. 150 * 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. 154 * 155 * \hideinitializer 156 */ 157 #define MEM_SIZE (64*1024) 158 159 #define PBUF_POOL_NUM (HCI_HOST_MAX_NUM_ACL*MAX_NUM_CLIENTS) 160 #define PBUF_POOL_BUFSIZE HCI_HOST_ACL_MAX_LEN 161 162 #define PBUF_ROM_NUM 45 163 164 /** 165 * Determines if statistics support should be compiled in. 166 * 167 * The statistics is useful for debugging and to show the user. 168 * 169 * \hideinitializer 170 */ 171 #define STATISTICS 0 172 173 /** 174 * Determines if logging of certain events should be compiled in. 175 * 176 * This is useful mostly for debugging. The function uip_log() 177 * must be implemented to suit the architecture of the project, if 178 * logging is turned on. 179 * 180 * \hideinitializer 181 */ 182 #define LOGGING 0 183 #define ERRORING 0 184 185 /** 186 * Print out a uIP log message. 187 * 188 * This function must be implemented by the module that uses uIP, and 189 * is called by uIP whenever a log message is generated. 190 */ 191 void bt_log(const char *filename,int line_nb,char *msg); 192 193 /** 194 * The link level header length. 195 * 196 * This is the offset into the uip_buf where the IP header can be 197 * found. For Ethernet, this should be set to 14. For SLIP, this 198 * should be set to 0. 199 * 200 * \hideinitializer 201 */ 202 #define LL_HLEN 16 203 204 #define TCPIP_HLEN 40 205 /** @} */ 206 /*------------------------------------------------------------------------------*/ 207 /** 208 * \defgroup uipoptcpu CPU architecture configuration 209 * @{ 210 * 211 * The CPU architecture configuration is where the endianess of the 212 * CPU on which uIP is to be run is specified. Most CPUs today are 213 * little endian, and the most notable exception are the Motorolas 214 * which are big endian. The BYTE_ORDER macro should be changed to 215 * reflect the CPU architecture on which uIP is to be run. 216 */ 217 #ifndef LITTLE_ENDIAN 218 #define LITTLE_ENDIAN 3412 219 #endif /* LITTLE_ENDIAN */ 220 #ifndef BIG_ENDIAN 221 #define BIG_ENDIAN 1234 222 #endif /* BIGE_ENDIAN */ 223 224 /** 225 * The byte order of the CPU architecture on which uIP is to be run. 226 * 227 * This option can be either BIG_ENDIAN (Motorola byte order) or 228 * LITTLE_ENDIAN (Intel byte order). 229 * 230 * \hideinitializer 231 */ 232 #ifndef BYTE_ORDER 233 #define BYTE_ORDER BIG_ENDIAN 234 #endif /* BYTE_ORDER */ 235 236 /** @} */ 237 /*------------------------------------------------------------------------------*/ 238 239 #define LIBC_MEMFUNCREPLACE 0 240 241 /* ---------- Memory options ---------- */ 242 #define MAX_NUM_CLIENTS 6 /* Maximum number of connected Bluetooth clients. No more than 6 */ 243 #define MAX_NUM_OPT_CLIENTS 10 /* Maximum number of possible Bluetooth clients we might listen to */ 244 245 #define MEMB_NUM_HCI_PCB 1 /* Always set to one */ 246 #define MEMB_NUM_HCI_LINK MAX_NUM_CLIENTS /* One for DT + One per ACL connection */ 247 #define MEMB_NUM_HCI_INQ 256 /* One per max number of returned results from an inquiry */ 248 #define MEMB_NUM_HCI_LINK_KEY 256 /* One per max number of returned results from an read stored link key */ 249 250 /* MEMP_NUM_L2CAP_PCB: the number of simulatenously active L2CAP 251 connections. */ 252 #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 */ 253 /* MEMP_NUM_L2CAP_PCB_LISTEN: the number of listening L2CAP 254 connections. */ 255 #define MEMB_NUM_L2CAP_PCB_LISTEN (2 * MAX_NUM_OPT_CLIENTS) /* One per listening PSM */ 256 /* MEMP_NUM_L2CAP_SIG: the number of simultaneously unresponded 257 L2CAP signals */ 258 #define MEMB_NUM_L2CAP_SIG (2 * MAX_NUM_CLIENTS)/* Two per number of connected Bluetooth clients but min 2 */ 259 #define MEMB_NUM_L2CAP_SEG (2 + 2 * MAX_NUM_CLIENTS) /* One per number of L2CAP connections */ 260 261 #define MEMB_NUM_SDP_PCB MAX_NUM_CLIENTS /* One per number of connected Bluetooth clients */ 262 #define MEMB_NUM_SDP_RECORD 1 /* One per registered service record */ 263 264 #define MEMP_NUM_RFCOMM_PCB (2 + 2 * MAX_NUM_CLIENTS) /* Two for DT + Two per number of connected Bluetooth clients */ 265 #define MEMP_NUM_RFCOMM_PCB_LISTEN (2 * MAX_NUM_CLIENTS) /* Two per number of connected Bluetooth clients */ 266 267 #define MEMP_NUM_HIDP_PCB (2 + 2 * MAX_NUM_CLIENTS) /* Two for DT + Two per number of connected Bluetooth clients */ 268 #define MEMP_NUM_HIDP_PCB_LISTEN (2 * MAX_NUM_CLIENTS) /* Two per number of connected Bluetooth clients */ 269 270 #define MEMP_NUM_PPP_PCB (1 + MAX_NUM_CLIENTS) /* One for DT + One per number of connected Bluetooth clients */ 271 #define MEMP_NUM_PPP_REQ MAX_NUM_CLIENTS /* One per number of connected Bluetooth clients but min 1 */ 272 273 #define MEMP_NUM_BTE_PCB (2 + 2 * MAX_NUM_CLIENTS) /* Two for DT + Two per number of connected Bluetooth clients */ 274 #define MEMP_NUM_BTE_PCB_LISTEN (2 * MAX_NUM_CLIENTS) /* Two per number of connected Bluetooth clients */ 275 276 #define MEMP_NUM_BTE_CTRLS 256 277 278 /* ---------- HCI options ---------- */ 279 /* HCI: Defines if we have lower layers of the Bluetooth stack running on a separate host 280 controller */ 281 #define HCI 1 282 283 #if HCI 284 /* HCI_HOST_MAX_NUM_ACL: The maximum number of ACL packets that the host can buffer */ 285 #define HCI_HOST_MAX_NUM_ACL 20 //TODO: Should be equal to PBUF_POOL_SIZE/2??? */ 286 /* HCI_HOST_ACL_MAX_LEN: The maximum size of an ACL packet that the host can buffer */ 287 #define HCI_HOST_ACL_MAX_LEN 1691 /* Default: RFCOMM MFS + ACL header size, L2CAP header size, 288 RFCOMM header size and RFCOMM FCS size */ 289 /* HCI_PACKET_TYPE: The set of packet types which may be used on the connection. In order to 290 maximize packet throughput, it is recommended that RFCOMM should make use of the 3 and 5 291 slot baseband packets.*/ 292 #define HCI_PACKET_TYPE 0xCC18 /* Default DM1, DH1, DM3, DH3, DM5, DH5 */ 293 /* HCI_ALLOW_ROLE_SWITCH: Tells the host controller whether to accept a Master/Slave switch 294 during establishment of a connection */ 295 #define HCI_ALLOW_ROLE_SWITCH 1 /* Default 1 */ 296 /* HCI_FLOW_QUEUEING: Control if a packet should be queued if the host controller is out of 297 bufferspace for outgoing packets. Only the first packet sent when out of credits will be 298 queued */ 299 #define HCI_FLOW_QUEUEING 0 /* Default: 0 */ 300 301 #endif /* HCI */ 302 303 /* ---------- L2CAP options ---------- */ 304 /* L2CAP_HCI: Option for including HCI to access the Bluetooth baseband capabilities */ 305 #define L2CAP_HCI 1 //TODO: NEEDED? 306 /* L2CAP_CFG_QOS: Control if a flow specification similar to RFC 1363 should be used */ 307 #define L2CAP_CFG_QOS 0 308 /* L2CAP_MTU: Maximum transmission unit for L2CAP packet payload (min 48) */ 309 #define L2CAP_MTU (HIDD_N + 1)/* Default for this implementation is RFCOMM MFS + RFCOMM header size and 310 RFCOMM FCS size while the L2CAP default is 672 */ 311 /* L2CAP_OUT_FLUSHTO: For some networking protocols, such as many real-time protocols, guaranteed delivery 312 is undesirable. The flush time-out value SHALL be set to its default value 0xffff for a reliable L2CAP 313 channel, and MAY be set to other values if guaranteed delivery is not desired. (min 1) */ 314 #define L2CAP_OUT_FLUSHTO 0xFFFF /* Default: 0xFFFF. Infinite number of retransmissions (reliable channel) 315 The value of 1 implies no retransmissions at the Baseband level 316 should be performed since the minimum polling interval is 1.25 ms.*/ 317 /* L2CAP_RTX: The Responsive Timeout eXpired timer is used to terminate 318 the channel when the remote endpoint is unresponsive to signalling 319 requests (min 1s, max 60s) */ 320 #define L2CAP_RTX 60 321 /* L2CAP_ERTX: The Extended Response Timeout eXpired timer is used in 322 place of the RTC timer when a L2CAP_ConnectRspPnd event is received 323 (min 60s, max 300s) */ 324 #define L2CAP_ERTX 300 325 /* L2CAP_MAXRTX: Maximum number of Request retransmissions before 326 terminating the channel identified by the request. The decision 327 should be based on the flush timeout of the signalling link. If the 328 flush timeout is infinite, no retransmissions should be performed */ 329 #define L2CAP_MAXRTX 0 330 /* L2CAP_CFG_TO: Amount of time spent arbitrating the channel parameters 331 before terminating the connection (max 120s) */ 332 #define L2CAP_CFG_TO 30 333 334 /* ---------- BTE options ---------- */ 335 336 /* ---------- HIDD options ---------- */ 337 /* RFCOMM_N: Maximum frame size for RFCOMM segments (min 23, max 32767)*/ 338 #define HIDD_N 672 /* Default: Worst case byte stuffed PPP packet size + 339 non-compressed PPP header size and FCS size */ 340 /* RFCOMM_K: Initial amount of credits issued to the peer (min 0, max 7) */ 341 #define RFCOMM_K 0 342 /* RFCOMM_TO: Acknowledgement timer (T1) and response timer for multiplexer control channel (T2). 343 T1 is the timeout for frames sent with the P/F bit set to 1 (SABM and DISC) and T2 is the timeout 344 for commands sent in UIH frames on DLCI 0 (min 10s, max 60s) */ 345 #define RFCOMM_TO 20 346 /* RFCOMM_FLOW_QUEUEING: Control if a packet should be queued if a channel is out of credits for 347 outgoing packets. Only the first packet sent when out of credits will be queued */ 348 #define RFCOMM_FLOW_QUEUEING 0 /* Default: 0 */ 349 350 #endif /* __BTOPT_H__ */ 351