Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed app/Stat/Debug/stat.pch
Binary file not shown.
Binary file removed app/Stat/Release/stat.pch
Binary file not shown.
Binary file removed app/draw/Debug/Draw.pch
Binary file not shown.
Binary file removed app/draw/Release/Draw.pch
Binary file not shown.
Binary file added doc/~$lloX项目github协同开发指南.docx
Binary file not shown.
Binary file removed doc/~WRL1647.tmp
Binary file not shown.
5 changes: 5 additions & 0 deletions kernel/bluetooth/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
tags
.*.swp
*.o
*.d
*.out
Empty file added kernel/bluetooth/ReadMe.txt
Empty file.
26 changes: 26 additions & 0 deletions kernel/bluetooth/arch/cc.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#pragma once

#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <signal.h>

//system types
typedef uint8_t u8_t;
#define U8_F "d"
typedef int8_t s8_t;
#define S8_F "d"
typedef uint16_t u16_t;
#define U16_F "04x"
typedef int16_t s16_t;
#define S16_F "04x"
typedef uint32_t u32_t;
#define U32_F "08x"
typedef int32_t s32_t;
#define S32_F "08x"
typedef int mem_ptr_t;

#define PACK_STRUCT_STRUCT __attribute__((__packed__))

#define LWIP_PLATFORM_DIAG(x) printf x
#define LWIP_PLATFORM_ASSERT(x) printf(x)//; raise(SIGTRAP)
147 changes: 147 additions & 0 deletions kernel/bluetooth/arch/lwbtopts.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
/*
* Copyright (c) 2003 EISLAB, Lulea University of Technology.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*
* This file is part of the lwBT Bluetooth stack.
*
* Author: Conny Ohult <[email protected]>
*
*/

#ifndef __LWBT_LWBTOPTS_H__
#define __LWBT_LWBTOPTS_H__

#define PHYBUSIF_DEBUG LWIP_DBG_ON
#define HCI_DEBUG LWIP_DBG_OFF
#define HCI_EV_DEBUG LWIP_DBG_ON
#define L2CAP_DEBUG LWIP_DBG_OFF
#define SDP_DEBUG LWIP_DBG_ON
#define RFCOMM_DEBUG LWIP_DBG_ON


/* ---------- Memory options ---------- */
#define MAX_NUM_CLIENTS 6 /* Maximum number of connected Bluetooth clients. No more than 6 */

/*NAT - Network Address Translation*/
#define MEMP_NUM_NAT_PCB 8 /* Must be set to 1 or more if NAT is used. Set this to the number of diffrent ports/ids that the application use */

#define MEMP_NUM_HCI_PCB 1 /* Always set to one */
#define MEMP_NUM_HCI_LINK (1 + MAX_NUM_CLIENTS) /* One for DT + One per ACL connection */
#define MEMP_NUM_HCI_INQ 1 /* One per max number of returned results from an inquiry */

/* MEMP_NUM_L2CAP_PCB: the number of simulatenously active L2CAP
connections. */
#define MEMP_NUM_L2CAP_PCB (2 + MAX_NUM_CLIENTS) /* One for a closing connection + one for DT + one per number of connected Bluetooth clients */
/* MEMP_NUM_L2CAP_PCB_LISTEN: the number of listening L2CAP
connections. */
#define MEMP_NUM_L2CAP_PCB_LISTEN 2 /* One per listening PSM */
/* MEMP_NUM_L2CAP_SIG: the number of simultaneously unresponded
L2CAP signals */
#define MEMP_NUM_L2CAP_SIG (2 * MAX_NUM_CLIENTS)/* Two per number of connected Bluetooth clients but min 2 */
#define MEMP_NUM_L2CAP_SEG (2 + 2 * MAX_NUM_CLIENTS) /* One per number of L2CAP connections */

#define MEMP_NUM_SDP_PCB MAX_NUM_CLIENTS /* One per number of connected Bluetooth clients */
#define MEMP_NUM_SDP_RECORD 1 /* One per registered service record */

#define MEMP_NUM_RFCOMM_PCB (2 + 2 * MAX_NUM_CLIENTS) /* Two for DT + Two per number of connected Bluetooth clients */
#define MEMP_NUM_RFCOMM_PCB_LISTEN (2 * MAX_NUM_CLIENTS) /* Two per number of connected Bluetooth clients */

#define MEMP_NUM_PPP_PCB (1 + MAX_NUM_CLIENTS) /* One for DT + One per number of connected Bluetooth clients */
#define MEMP_NUM_PPP_REQ MAX_NUM_CLIENTS /* One per number of connected Bluetooth clients but min 1 */

/* ---------- HCI options ---------- */
/* HCI: Defines if we have lower layers of the Bluetooth stack running on a separate host
controller */
#define HCI 1

#if HCI
/* HCI_HOST_MAX_NUM_ACL: The maximum number of ACL packets that the host can buffer */
#define HCI_HOST_MAX_NUM_ACL 8 //TODO: Should be equal to PBUF_POOL_SIZE/2??? */
/* HCI_HOST_ACL_MAX_LEN: The maximum size of an ACL packet that the host can buffer */
#define HCI_HOST_ACL_MAX_LEN (RFCOMM_N + 14) /* Default: RFCOMM MFS + ACL header size, L2CAP header size,
RFCOMM header size and RFCOMM FCS size */
/* HCI_PACKET_TYPE: The set of packet types which may be used on the connection. In order to
maximize packet throughput, it is recommended that RFCOMM should make use of the 3 and 5
slot baseband packets.*/
#define HCI_PACKET_TYPE 0xCC18 /* Default DM1, DH1, DM3, DH3, DM5, DH5 */
/* HCI_ALLOW_ROLE_SWITCH: Tells the host controller whether to accept a Master/Slave switch
during establishment of a connection */
#define HCI_ALLOW_ROLE_SWITCH 1 /* Default 1 */
/* HCI_FLOW_QUEUEING: Control if a packet should be queued if the host controller is out of
bufferspace for outgoing packets. Only the first packet sent when out of credits will be
queued */
#define HCI_FLOW_QUEUEING 0 /* Default: 0 */

#endif /* HCI */

/* ---------- L2CAP options ---------- */
/* L2CAP_HCI: Option for including HCI to access the Bluetooth baseband capabilities */
#define L2CAP_HCI 1 //TODO: NEEDED?
/* L2CAP_CFG_QOS: Control if a flow specification similar to RFC 1363 should be used */
#define L2CAP_CFG_QOS 0
/* L2CAP_MTU: Maximum transmission unit for L2CAP packet payload (min 48) */
#define L2CAP_MTU (RFCOMM_N + 6)/* Default for this implementation is RFCOMM MFS + RFCOMM header size and
RFCOMM FCS size while the L2CAP default is 672 */
/* L2CAP_OUT_FLUSHTO: For some networking protocols, such as many real-time protocols, guaranteed delivery
is undesirable. The flush time-out value SHALL be set to its default value 0xffff for a reliable L2CAP
channel, and MAY be set to other values if guaranteed delivery is not desired. (min 1) */
#define L2CAP_OUT_FLUSHTO 0xFFFF /* Default: 0xFFFF. Infinite number of retransmissions (reliable channel)
The value of 1 implies no retransmissions at the Baseband level
should be performed since the minimum polling interval is 1.25 ms.*/
/* L2CAP_RTX: The Responsive Timeout eXpired timer is used to terminate
the channel when the remote endpoint is unresponsive to signalling
requests (min 1s, max 60s) */
#define L2CAP_RTX 60
/* L2CAP_ERTX: The Extended Response Timeout eXpired timer is used in
place of the RTC timer when a L2CAP_ConnectRspPnd event is received
(min 60s, max 300s) */
#define L2CAP_ERTX 300
/* L2CAP_MAXRTX: Maximum number of Request retransmissions before
terminating the channel identified by the request. The decision
should be based on the flush timeout of the signalling link. If the
flush timeout is infinite, no retransmissions should be performed */
#define L2CAP_MAXRTX 0
/* L2CAP_CFG_TO: Amount of time spent arbitrating the channel parameters
before terminating the connection (max 120s) */
#define L2CAP_CFG_TO 30

/* ---------- SDP options ---------- */

/* ---------- RFCOMM options ---------- */
/* RFCOMM_N: Maximum frame size for RFCOMM segments (min 23, max 32767)*/
#define RFCOMM_N ((1024) + 8) /* Default: Worst case byte stuffed PPP packet size +
non-compressed PPP header size and FCS size */
/* RFCOMM_K: Initial amount of credits issued to the peer (min 0, max 7) */
#define RFCOMM_K 0
/* RFCOMM_TO: Acknowledgement timer (T1) and response timer for multiplexer control channel (T2).
T1 is the timeout for frames sent with the P/F bit set to 1 (SABM and DISC) and T2 is the timeout
for commands sent in UIH frames on DLCI 0 (min 10s, max 60s) */
#define RFCOMM_TO 20
/* RFCOMM_FLOW_QUEUEING: Control if a packet should be queued if a channel is out of credits for
outgoing packets. Only the first packet sent when out of credits will be queued */
#define RFCOMM_FLOW_QUEUEING 0 /* Default: 0 */


#endif /* __LWBTOPTS_H__ */
26 changes: 26 additions & 0 deletions kernel/bluetooth/arch/lwipopts.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#pragma once

#ifndef LITTLE_ENDIAN
#define LITTLE_ENDIAN 1234
#endif

#ifndef BIG_ENDIAN
#define BIG_ENDIAN 4321
#endif

#define LWIP_DEBUG 1
#define NO_SYS 1
#define MEM_LIBC_MALLOC 1
#define MEM_ALIGNMENT 4
#define LWIP_TCP 0
#define LWIP_UDP 0
#define LWIP_IGMP 0
#define LWIP_RAW 0
#define IP_REASSEMBLY 0
#define LWIP_NETCONN 0
#define ARP_QUEUEING 0
//#define BYTE_ORDER LITTLE_ENDIAN
#define LWIP_PLATFORM_BYTESWAP 0

#define MEM_DEBUG LWIP_DBG_ON
#define MEM_STATS 1
4 changes: 4 additions & 0 deletions kernel/bluetooth/arch/perf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#pragma once

#define PERF_START
#define PERF_STOP(x)
Empty file.
Loading