RetroArch
btopt.h
Go to the documentation of this file.
1 
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 /*------------------------------------------------------------------------------*/
75 typedef u8 u8_t;
76 
83 typedef s8 s8_t;
84 
91 typedef u16 u16_t;
92 
99 typedef s16 s16_t;
100 
107 typedef s32 s32_t;
108 
115 typedef u32 u32_t;
116 
123 typedef u64 u64_t;
124 
131 typedef s64 s64_t;
132 
139 typedef s8 err_t;
140 
141 /*------------------------------------------------------------------------------*/
142 
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 
172 #define STATISTICS 0
173 
183 #define LOGGING 0
184 #define ERRORING 0
185 
192 void bt_log(const char *filename,int line_nb,char *msg);
193 
203 #define LL_HLEN 16
204 
205 #define TCPIP_HLEN 40
206 
207 /*------------------------------------------------------------------------------*/
218 #ifndef LITTLE_ENDIAN
219 #define LITTLE_ENDIAN 3412
220 #endif /* LITTLE_ENDIAN */
221 #ifndef BIG_ENDIAN
222 #define BIG_ENDIAN 1234
223 #endif /* BIGE_ENDIAN */
224 
233 #ifndef BYTE_ORDER
234 #define BYTE_ORDER BIG_ENDIAN
235 #endif /* BYTE_ORDER */
236 
238 /*------------------------------------------------------------------------------*/
239 
240 #define LIBC_MEMFUNCREPLACE 0
241 
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 */
245 
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 */
250 
251 /* MEMP_NUM_L2CAP_PCB: the number of simulatenously active L2CAP
252  connections. */
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
255  connections. */
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
258  L2CAP signals */
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 */
261 
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 */
264 
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 */
267 
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 */
270 
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 */
273 
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 */
276 
277 #define MEMP_NUM_BTE_CTRLS 256
278 
279 /* ---------- HCI options ---------- */
280 /* HCI: Defines if we have lower layers of the Bluetooth stack running on a separate host
281  controller */
282 #define HCI 1
283 
284 #if HCI
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
299  queued */
300 #define HCI_FLOW_QUEUEING 0 /* Default: 0 */
301 
302 #endif /* HCI */
303 
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) */
321 #define L2CAP_RTX 60
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
334 
335 /* ---------- BTE options ---------- */
336 
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) */
342 #define RFCOMM_K 0
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) */
346 #define RFCOMM_TO 20
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 */
350 
351 
352 #endif /* __BTOPT_H__ */
int32_t s32
32bit signed integer
Definition: gctypes.h:24
s64 s64_t
Definition: btopt.h:131
Data type definitions.
int8_t s8
8bit signed integer
Definition: gctypes.h:22
u32 u32_t
Definition: btopt.h:115
void bt_log(const char *filename, int line_nb, char *msg)
s8 err_t
Definition: btopt.h:139
s32 s32_t
Definition: btopt.h:107
uint16_t u16
16bit unsigned integer
Definition: gctypes.h:18
s16 s16_t
Definition: btopt.h:99
u16 u16_t
Definition: btopt.h:91
u64 u64_t
Definition: btopt.h:123
static const unsigned char msg[]
Definition: ccm.c:375
u8 u8_t
Definition: btopt.h:75
int16_t s16
16bit signed integer
Definition: gctypes.h:23
uint64_t u64
64bit unsigned integer
Definition: gctypes.h:20
s8 s8_t
Definition: btopt.h:83
uint8_t u8
8bit unsigned integer
Definition: gctypes.h:17
uint32_t u32
32bit unsigned integer
Definition: gctypes.h:19
int64_t s64
64bit signed integer
Definition: gctypes.h:25