mirror of
				https://github.com/0xFEEDC0DE64/arduino-esp32.git
				synced 2025-11-03 23:51:39 +01:00 
			
		
		
		
	
		
			
	
	
		
			245 lines
		
	
	
		
			6.7 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			245 lines
		
	
	
		
			6.7 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| 
								 | 
							
								/******************************************************************************
							 | 
						||
| 
								 | 
							
								 *
							 | 
						||
| 
								 | 
							
								 *  Copyright (C) 1999-2012 Broadcom Corporation
							 | 
						||
| 
								 | 
							
								 *
							 | 
						||
| 
								 | 
							
								 *  Licensed under the Apache License, Version 2.0 (the "License");
							 | 
						||
| 
								 | 
							
								 *  you may not use this file except in compliance with the License.
							 | 
						||
| 
								 | 
							
								 *  You may obtain a copy of the License at:
							 | 
						||
| 
								 | 
							
								 *
							 | 
						||
| 
								 | 
							
								 *  http://www.apache.org/licenses/LICENSE-2.0
							 | 
						||
| 
								 | 
							
								 *
							 | 
						||
| 
								 | 
							
								 *  Unless required by applicable law or agreed to in writing, software
							 | 
						||
| 
								 | 
							
								 *  distributed under the License is distributed on an "AS IS" BASIS,
							 | 
						||
| 
								 | 
							
								 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
							 | 
						||
| 
								 | 
							
								 *  See the License for the specific language governing permissions and
							 | 
						||
| 
								 | 
							
								 *  limitations under the License.
							 | 
						||
| 
								 | 
							
								 *
							 | 
						||
| 
								 | 
							
								 ******************************************************************************/
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#ifndef _GKI_TARGET_H_
							 | 
						||
| 
								 | 
							
								#define _GKI_TARGET_H_
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/******************************************************************************
							 | 
						||
| 
								 | 
							
								**
							 | 
						||
| 
								 | 
							
								** Buffer configuration
							 | 
						||
| 
								 | 
							
								**
							 | 
						||
| 
								 | 
							
								******************************************************************************/
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* The size of the buffers in pool 0. */
							 | 
						||
| 
								 | 
							
								#ifndef GKI_BUF0_SIZE
							 | 
						||
| 
								 | 
							
								#define GKI_BUF0_SIZE               64
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* The number of buffers in buffer pool 0. */
							 | 
						||
| 
								 | 
							
								#ifndef GKI_BUF0_MAX
							 | 
						||
| 
								 | 
							
								#define GKI_BUF0_MAX                96
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* The ID of buffer pool 0. */
							 | 
						||
| 
								 | 
							
								#ifndef GKI_POOL_ID_0
							 | 
						||
| 
								 | 
							
								#define GKI_POOL_ID_0               0
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* The size of the buffers in pool 1. */
							 | 
						||
| 
								 | 
							
								#ifndef GKI_BUF1_SIZE
							 | 
						||
| 
								 | 
							
								#define GKI_BUF1_SIZE               288
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* The number of buffers in buffer pool 1. */
							 | 
						||
| 
								 | 
							
								#ifndef GKI_BUF1_MAX
							 | 
						||
| 
								 | 
							
								#define GKI_BUF1_MAX                52
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* The ID of buffer pool 1. */
							 | 
						||
| 
								 | 
							
								#ifndef GKI_POOL_ID_1
							 | 
						||
| 
								 | 
							
								#define GKI_POOL_ID_1               1
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* The size of the buffers in pool 2. */
							 | 
						||
| 
								 | 
							
								#ifndef GKI_BUF2_SIZE
							 | 
						||
| 
								 | 
							
								#define GKI_BUF2_SIZE               660
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* The number of buffers in buffer pool 2. */
							 | 
						||
| 
								 | 
							
								#ifndef GKI_BUF2_MAX
							 | 
						||
| 
								 | 
							
								#define GKI_BUF2_MAX                90
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* The ID of buffer pool 2. */
							 | 
						||
| 
								 | 
							
								#ifndef GKI_POOL_ID_2
							 | 
						||
| 
								 | 
							
								#define GKI_POOL_ID_2               2
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* The size of the buffers in pool 3. */
							 | 
						||
| 
								 | 
							
								#ifndef GKI_BUF3_SIZE
							 | 
						||
| 
								 | 
							
								#define GKI_BUF3_SIZE               (4096+16)
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* The number of buffers in buffer pool 3. */
							 | 
						||
| 
								 | 
							
								#ifndef GKI_BUF3_MAX
							 | 
						||
| 
								 | 
							
								#define GKI_BUF3_MAX                400
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* The ID of buffer pool 3. */
							 | 
						||
| 
								 | 
							
								#ifndef GKI_POOL_ID_3
							 | 
						||
| 
								 | 
							
								#define GKI_POOL_ID_3               3
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* The size of the largest PUBLIC fixed buffer in system. */
							 | 
						||
| 
								 | 
							
								#ifndef GKI_MAX_BUF_SIZE
							 | 
						||
| 
								 | 
							
								#define GKI_MAX_BUF_SIZE            GKI_BUF3_SIZE
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* The pool ID of the largest PUBLIC fixed buffer in system. */
							 | 
						||
| 
								 | 
							
								#ifndef GKI_MAX_BUF_SIZE_POOL_ID
							 | 
						||
| 
								 | 
							
								#define GKI_MAX_BUF_SIZE_POOL_ID    GKI_POOL_ID_3
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* Pool 4 is used for BluetoothSocket L2CAP connections */
							 | 
						||
| 
								 | 
							
								/* The size of the buffers in pool 4. */
							 | 
						||
| 
								 | 
							
								#ifndef GKI_BUF4_SIZE
							 | 
						||
| 
								 | 
							
								#define GKI_BUF4_SIZE               (8080+26)
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* The number of buffers in buffer pool 4. */
							 | 
						||
| 
								 | 
							
								#ifndef GKI_BUF4_MAX
							 | 
						||
| 
								 | 
							
								#define GKI_BUF4_MAX                (OBX_NUM_SERVERS + OBX_NUM_CLIENTS)
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* The ID of buffer pool 4. */
							 | 
						||
| 
								 | 
							
								#ifndef GKI_POOL_ID_4
							 | 
						||
| 
								 | 
							
								#define GKI_POOL_ID_4               4
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* The number of fixed GKI buffer pools.
							 | 
						||
| 
								 | 
							
								eL2CAP requires Pool ID 5
							 | 
						||
| 
								 | 
							
								If BTM_SCO_HCI_INCLUDED is FALSE, Pool ID 6 is unnecessary, otherwise set to 7
							 | 
						||
| 
								 | 
							
								If BTA_HL_INCLUDED is FALSE then Pool ID 7 is uncessary and set the following to 7, otherwise set to 8
							 | 
						||
| 
								 | 
							
								If BLE_INCLUDED is FALSE then Pool ID 8 is uncessary and set the following to 8, otherwise set to 9
							 | 
						||
| 
								 | 
							
								POOL_ID 9 is a public pool meant for large buffer needs such as SDP_DB
							 | 
						||
| 
								 | 
							
								*/
							 | 
						||
| 
								 | 
							
								#ifndef GKI_NUM_FIXED_BUF_POOLS
							 | 
						||
| 
								 | 
							
								#define GKI_NUM_FIXED_BUF_POOLS     10
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* The buffer pool usage mask. */
							 | 
						||
| 
								 | 
							
								#ifndef GKI_DEF_BUFPOOL_PERM_MASK
							 | 
						||
| 
								 | 
							
								/* Setting POOL_ID 9 as a public pool meant for large buffers such as SDP_DB */
							 | 
						||
| 
								 | 
							
								#define GKI_DEF_BUFPOOL_PERM_MASK   0xfdf0
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* The following is intended to be a reserved pool for L2CAP
							 | 
						||
| 
								 | 
							
								Flow control and retransmissions and intentionally kept out
							 | 
						||
| 
								 | 
							
								of order */
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* The number of buffers in buffer pool 5. */
							 | 
						||
| 
								 | 
							
								#ifndef GKI_BUF5_MAX
							 | 
						||
| 
								 | 
							
								#define GKI_BUF5_MAX                64
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* The ID of buffer pool 5. */
							 | 
						||
| 
								 | 
							
								#ifndef GKI_POOL_ID_5
							 | 
						||
| 
								 | 
							
								#define GKI_POOL_ID_5               5
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* The size of the buffers in pool 5
							 | 
						||
| 
								 | 
							
								** Special pool used by L2CAP retransmissions only.  This size based on segment
							 | 
						||
| 
								 | 
							
								** that will fit into both DH5 and 2-DH3 packet types after accounting for GKI
							 | 
						||
| 
								 | 
							
								** header.  13 bytes of max headers allows us a 339 payload max. (in btui_app.txt)
							 | 
						||
| 
								 | 
							
								** Note: 748 used for insight scriptwrapper with CAT-2 scripts.
							 | 
						||
| 
								 | 
							
								*/
							 | 
						||
| 
								 | 
							
								#ifndef GKI_BUF5_SIZE
							 | 
						||
| 
								 | 
							
								#define GKI_BUF5_SIZE               748
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* The following is intended to be a reserved pool for SCO
							 | 
						||
| 
								 | 
							
								over HCI data and intentionally kept out of order */
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* The ID of buffer pool 6. */
							 | 
						||
| 
								 | 
							
								#ifndef GKI_POOL_ID_6
							 | 
						||
| 
								 | 
							
								#define GKI_POOL_ID_6               6
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* The size of the buffers in pool 6,
							 | 
						||
| 
								 | 
							
								  BUF_SIZE = max SCO data 255 + sizeof(BT_HDR) = 8 + SCO packet header 3 + padding 2 = 268 */
							 | 
						||
| 
								 | 
							
								#ifndef GKI_BUF6_SIZE
							 | 
						||
| 
								 | 
							
								#define GKI_BUF6_SIZE               268
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* The number of buffers in buffer pool 6. */
							 | 
						||
| 
								 | 
							
								#ifndef GKI_BUF6_MAX
							 | 
						||
| 
								 | 
							
								#define GKI_BUF6_MAX                60
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* The following pool is a dedicated pool for HDP
							 | 
						||
| 
								 | 
							
								   If a shared pool is more desirable then
							 | 
						||
| 
								 | 
							
								   1. set BTA_HL_LRG_DATA_POOL_ID to the desired Gki Pool ID
							 | 
						||
| 
								 | 
							
								   2. make sure that the shared pool size is larger than 9472
							 | 
						||
| 
								 | 
							
								   3. adjust GKI_NUM_FIXED_BUF_POOLS accordingly since
							 | 
						||
| 
								 | 
							
								      POOL ID 7 is not needed
							 | 
						||
| 
								 | 
							
								*/
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* The ID of buffer pool 7. */
							 | 
						||
| 
								 | 
							
								#ifndef GKI_POOL_ID_7
							 | 
						||
| 
								 | 
							
								#define GKI_POOL_ID_7               7
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* The size of the buffers in pool 7 */
							 | 
						||
| 
								 | 
							
								#ifndef GKI_BUF7_SIZE
							 | 
						||
| 
								 | 
							
								#define GKI_BUF7_SIZE               (10240 + 24)
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* The number of buffers in buffer pool 7. */
							 | 
						||
| 
								 | 
							
								#ifndef GKI_BUF7_MAX
							 | 
						||
| 
								 | 
							
								#define GKI_BUF7_MAX                2
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* The following pool is a dedicated pool for GATT
							 | 
						||
| 
								 | 
							
								   If a shared pool is more desirable then
							 | 
						||
| 
								 | 
							
								   1. set GATT_DB_POOL_ID to the desired Gki Pool ID
							 | 
						||
| 
								 | 
							
								   2. make sure that the shared pool size fit a common GATT database needs
							 | 
						||
| 
								 | 
							
								   3. adjust GKI_NUM_FIXED_BUF_POOLS accordingly since
							 | 
						||
| 
								 | 
							
								      POOL ID 8 is not needed
							 | 
						||
| 
								 | 
							
								*/
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* The ID of buffer pool 8. */
							 | 
						||
| 
								 | 
							
								#ifndef GKI_POOL_ID_8
							 | 
						||
| 
								 | 
							
								#define GKI_POOL_ID_8               8
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* The size of the buffers in pool 8 */
							 | 
						||
| 
								 | 
							
								#ifndef GKI_BUF8_SIZE
							 | 
						||
| 
								 | 
							
								#define GKI_BUF8_SIZE               128
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* The number of buffers in buffer pool 8. */
							 | 
						||
| 
								 | 
							
								#ifndef GKI_BUF8_MAX
							 | 
						||
| 
								 | 
							
								#define GKI_BUF8_MAX                30
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* The following pool is  meant for large allocations such as SDP_DB */
							 | 
						||
| 
								 | 
							
								#ifndef GKI_POOL_ID_9
							 | 
						||
| 
								 | 
							
								#define GKI_POOL_ID_9              9
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#ifndef GKI_BUF9_SIZE
							 | 
						||
| 
								 | 
							
								#define GKI_BUF9_SIZE            8192
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#ifndef GKI_BUF9_MAX
							 | 
						||
| 
								 | 
							
								#define GKI_BUF9_MAX           5
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								/* The number of fixed and dynamic buffer pools */
							 | 
						||
| 
								 | 
							
								#ifndef GKI_NUM_TOTAL_BUF_POOLS
							 | 
						||
| 
								 | 
							
								#define GKI_NUM_TOTAL_BUF_POOLS     10
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								int gki_init(void);
							 | 
						||
| 
								 | 
							
								void gki_clean_up(void);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								//void LogMsg (UINT32 trace_set_mask, const char *fmt_str, ...);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#endif /*_GKI_TARGET_H_*/
							 |