BLE-Stack APIs
3.00.00
Main Page
Modules
Data Structures
Files
Related Pages
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
dox_dir
ble_core
src
inc
bcomdef.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2015-2016, Texas Instruments Incorporated
3
* All rights reserved.
4
*
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions
7
* are met:
8
*
9
* * Redistributions of source code must retain the above copyright
10
* notice, this list of conditions and the following disclaimer.
11
*
12
* * Redistributions in binary form must reproduce the above copyright
13
* notice, this list of conditions and the following disclaimer in the
14
* documentation and/or other materials provided with the distribution.
15
*
16
* * Neither the name of Texas Instruments Incorporated nor the names of
17
* its contributors may be used to endorse or promote products derived
18
* from this software without specific prior written permission.
19
*
20
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
*/
32
/*!*****************************************************************************
33
* @file bcomdef.h
34
* @brief Type definitions and macros for BLE stack.
35
*/
36
37
#ifndef BCOMDEF_H
38
#define BCOMDEF_H
39
40
#ifdef __cplusplus
41
extern
"C"
42
{
43
#endif
44
45
46
/*********************************************************************
47
* INCLUDES
48
*/
49
50
#include "
comdef.h
"
51
52
/*********************************************************************
53
* CONSTANTS
54
*/
55
56
#if defined ( HOST_CONFIG )
57
// Set the Controller Configuration
58
#if ( HOST_CONFIG == ( CENTRAL_CFG | PERIPHERAL_CFG ) )
59
#define CTRL_CONFIG ( ADV_NCONN_CFG | ADV_CONN_CFG | SCAN_CFG | INIT_CFG )
60
#elif ( HOST_CONFIG == ( CENTRAL_CFG | BROADCASTER_CFG ) )
61
#define CTRL_CONFIG ( ADV_NCONN_CFG | SCAN_CFG | INIT_CFG )
62
#elif ( HOST_CONFIG == ( PERIPHERAL_CFG | OBSERVER_CFG ) )
63
#define CTRL_CONFIG ( ADV_NCONN_CFG | ADV_CONN_CFG | SCAN_CFG )
64
#elif ( HOST_CONFIG == ( BROADCASTER_CFG | OBSERVER_CFG ) )
65
#define CTRL_CONFIG ( ADV_NCONN_CFG | SCAN_CFG )
66
#elif ( HOST_CONFIG == CENTRAL_CFG )
67
#define CTRL_CONFIG ( SCAN_CFG | INIT_CFG )
68
#elif ( HOST_CONFIG == PERIPHERAL_CFG )
69
#define CTRL_CONFIG ( ADV_NCONN_CFG | ADV_CONN_CFG )
70
#elif ( HOST_CONFIG == OBSERVER_CFG )
71
#define CTRL_CONFIG SCAN_CFG
72
#elif ( HOST_CONFIG == BROADCASTER_CFG )
73
#define CTRL_CONFIG ADV_NCONN_CFG
74
#else
75
#if defined ( FLASH_ONLY_BUILD ) || defined ( FLASH_ROM_BUILD )
76
#error "Build Configuration Error: Invalid Host Role!"
77
#endif
78
#endif
79
#else
80
// Controller Sanity Check: Stop build when no configuration is defined.
81
#if !defined( CTRL_CONFIG ) || !( CTRL_CONFIG & ( ADV_NCONN_CFG | \
82
ADV_CONN_CFG | \
83
SCAN_CFG | \
84
INIT_CFG ) )
85
#if defined ( FLASH_ONLY_BUILD ) || defined ( FLASH_ROM_BUILD )
86
#error "Build Configuration Error: At least one Controller build component required!"
87
#endif
88
#endif // no Controller build components defined
89
#endif
90
91
// If BLE_V41_FEATURES is defined, map it to CTRL_V41_CONFIG
92
#if defined ( BLE_V41_FEATURES ) && !defined ( CTRL_V41_CONFIG )
93
#define CTRL_V41_CONFIG ( ( BLE_V41_FEATURES ) & CTRL_V41_MASK )
94
#elif defined ( BLE_V41_FEATURES ) && defined ( CTRL_V41_CONFIG )
95
#error "Build Configuration Error: Cannot define both BLE_V41_FEATURES and CTRL_V41_CONFIG!"
96
#endif // BLE_V41_FEATURES
97
98
// If BLE_V42_FEATURES is defined, map it to CTRL_V42_CONFIG
99
#if defined ( BLE_V42_FEATURES ) && !defined ( CTRL_V42_CONFIG )
100
#define CTRL_V42_CONFIG BLE_V42_FEATURES
101
#elif defined ( BLE_V42_FEATURES ) && defined ( CTRL_V42_CONFIG )
102
#error "Build Configuration Error: Cannot define both BLE_V42_FEATURES and CTRL_V42_CONFIG!"
103
#endif // BLE_V41_FEATURES
104
105
// If BLE_V50_FEATURES is defined, map it to CTRL_V50_CONFIG
106
#if defined ( BLE_V50_FEATURES ) && !defined ( CTRL_V50_CONFIG )
107
#define CTRL_V50_CONFIG BLE_V50_FEATURES
108
#elif defined ( BLE_V50_FEATURES ) && defined ( CTRL_V50_CONFIG )
109
#error "Build Configuration Error: Cannot define both BLE_V50_FEATURES and CTRL_V50_CONFIG!"
110
#endif // BLE_V41_FEATURES
111
112
// If L2CAP Connection Oriented Channels are not configured then do not
113
// configure GATT Service Changed characteristic
114
#if !defined ( BLE_V41_FEATURES ) || !( BLE_V41_FEATURES & L2CAP_COC_CFG )
115
#define GATT_NO_SERVICE_CHANGED
116
#endif // ! BLE_41_FEATURES || ! L2CAP_COC_CFG
117
118
#if defined(CC2540) || defined(CC2541) || defined(CC2541S)
119
#if !defined ( MAX_NUM_BLE_CONNS )
120
#if ( CTRL_CONFIG & INIT_CFG )
121
#define MAX_NUM_BLE_CONNS 3
122
#elif ( !( CTRL_CONFIG & INIT_CFG ) && ( CTRL_CONFIG & ADV_CONN_CFG ) )
123
#define MAX_NUM_BLE_CONNS 1
124
#else // no connection needed
125
#define MAX_NUM_BLE_CONNS 0
126
#endif // CTRL_CONFIG=INIT_CFG
127
#endif // !MAX_NUM_BLE_CONNS
128
#endif // CC2540 | CC2541 | CC2541S
129
131
#define B_ADDR_LEN 6
132
134
#define KEYLEN 16
135
137
#define B_CHANNEL_MAP_LEN 5
138
140
#define B_EVENT_MASK_LEN 8
141
143
#define B_LOCAL_NAME_LEN 248
144
146
#define B_MAX_ADV_LEN 31
147
149
#define B_RANDOM_NUM_SIZE 8
150
152
#define B_FEATURE_SUPPORT_LENGTH 8
153
155
#define B_RESOLVING_LIST_SIZE 10
156
157
#define bleInvalidTaskID INVALID_TASK
158
#define bleNotReady 0x10
159
#define bleAlreadyInRequestedMode 0x11
160
#define bleIncorrectMode 0x12
161
#define bleMemAllocError 0x13
162
#define bleNotConnected 0x14
163
#define bleNoResources 0x15
164
#define blePending 0x16
165
#define bleTimeout 0x17
166
#define bleInvalidRange 0x18
167
#define bleLinkEncrypted 0x19
168
#define bleProcedureComplete 0x1A
169
#define bleInvalidMtuSize 0x1B
170
171
// GAP Status Return Values - returned as bStatus_t
172
#define bleGAPUserCanceled 0x30
173
#define bleGAPConnNotAcceptable 0x31
174
#define bleGAPBondRejected 0x32
175
176
// ATT Status Return Values - returned as bStatus_t
177
#define bleInvalidPDU 0x40
178
#define bleInsufficientAuthen 0x41
179
#define bleInsufficientEncrypt 0x42
180
#define bleInsufficientKeySize 0x43
181
182
// L2CAP Status Return Values - returned as bStatus_t
183
184
#define INVALID_TASK_ID 0xFF
185
186
// Device NV Items - Range 0 - 0x1F
187
#define BLE_NVID_IRK 0x02
188
#define BLE_NVID_CSRK 0x03
189
#define BLE_NVID_SIGNCOUNTER 0x04
190
#define BLE_LRU_BOND_LIST 0x05
191
192
// Bonding NV Items - Range 0x20 - 0x5F - This allows for 10 bondings
193
#define BLE_NVID_GAP_BOND_START 0x20
194
#define BLE_NVID_GAP_BOND_END 0x5f
195
196
// GATT Configuration NV Items - Range 0x70 - 0x79 - This must match the number of Bonding entries
197
#define BLE_NVID_GATT_CFG_START 0x70
198
#define BLE_NVID_GATT_CFG_END 0x79
199
200
// Customer NV Items - Range 0x80 - 0x8F - This must match the number of Bonding entries
201
#define BLE_NVID_CUST_START 0x80
202
#define BLE_NVID_CUST_END 0x8F
203
204
/*********************************************************************
205
* BLE OSAL GAP GLOBAL Events
206
*/
207
#define GAP_EVENT_SIGN_COUNTER_CHANGED 0x4000
208
209
// GAP - Messages IDs (0xD0 - 0xDF)
210
#define GAP_MSG_EVENT 0xD0
211
212
// SM - Messages IDs (0xC1 - 0xCF)
213
#define SM_NEW_RAND_KEY_EVENT 0xC1
214
#define SM_MSG_EVENT 0xC2
215
216
// GATT - Messages IDs (0xB0 - 0xBF)
217
#define GATT_MSG_EVENT 0xB0
218
#define GATT_SERV_MSG_EVENT 0xB1
219
220
// L2CAP - Messages IDs (0xA0 - 0xAF)
221
#define L2CAP_DATA_EVENT 0xA0
222
#define L2CAP_SIGNAL_EVENT 0xA2
223
224
// HCI - Messages IDs (0x90 - 0x9F)
225
#define HCI_DATA_EVENT 0x90
226
#define HCI_GAP_EVENT_EVENT 0x91
227
#define HCI_SMP_EVENT_EVENT 0x92
228
#define HCI_EXT_CMD_EVENT 0x93
229
#define HCI_SMP_META_EVENT_EVENT 0x94
230
#define HCI_GAP_META_EVENT_EVENT 0x95
231
232
// ICall and Dispatch - Messages IDs (0x80 - 0x8F)
233
#define ICALL_EVENT_EVENT 0x80
234
#define ICALL_CMD_EVENT 0x81
235
#define DISPATCH_CMD_EVENT 0x82
236
237
238
/*********************************************************************
239
* TYPEDEFS
240
*/
241
243
typedef
Status_t
bStatus_t
;
244
245
246
/*********************************************************************
247
* System Events
248
*/
249
250
/*********************************************************************
251
* Global System Messages
252
*/
253
254
/*********************************************************************
255
* MACROS
256
*/
257
258
// TI Base 128-bit UUID: F000XXXX-0451-4000-B000-000000000000
259
#define TI_BASE_UUID_128( uuid ) 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB0, \
260
0x00, 0x40, 0x51, 0x04, LO_UINT16( uuid ), HI_UINT16( uuid ), 0x00, 0xF0
261
262
/*********************************************************************
263
* GLOBAL VARIABLES
264
*/
265
266
/*********************************************************************
267
* FUNCTIONS
268
*/
269
270
/*********************************************************************
271
*********************************************************************/
272
273
#ifdef __cplusplus
274
}
275
#endif
276
277
#endif
/* BCOMDEF_H */
comdef.h
Common Defines.
bStatus_t
Status_t bStatus_t
BLE Generic Status return.
Definition:
bcomdef.h:243
Copyright 2016, Texas Instruments Incorporated