TI BLE5-Stack API Documentation  9.12.00
bcomdef.h
Go to the documentation of this file.
1 /******************************************************************************
2 
3  Group: WCS, BTS
4  $Target Device: DEVICES $
5 
6  ******************************************************************************
7  $License: BSD3 2009 $
8  ******************************************************************************
9  $Release Name: PACKAGE NAME $
10  $Release Date: PACKAGE RELEASE DATE $
11  *****************************************************************************/
12 
18 #ifndef BCOMDEF_H
19 #define BCOMDEF_H
20 
21 #ifdef __cplusplus
22 extern "C"
23 {
24 #endif
25 
26 
27 /*********************************************************************
28  * INCLUDES
29  */
30 
32 
33 /*********************************************************************
34  * CONSTANTS
35  */
36 
38 #if defined ( HOST_CONFIG )
39  // Set the Controller Configuration
40  #if ( HOST_CONFIG == ( CENTRAL_CFG | PERIPHERAL_CFG ) )
41  #define CTRL_CONFIG ( ADV_NCONN_CFG | ADV_CONN_CFG | SCAN_CFG | INIT_CFG )
42  #elif ( HOST_CONFIG == ( CENTRAL_CFG | BROADCASTER_CFG ) )
43  #define CTRL_CONFIG ( ADV_NCONN_CFG | SCAN_CFG | INIT_CFG )
44  #elif ( HOST_CONFIG == ( PERIPHERAL_CFG | OBSERVER_CFG ) )
45  #define CTRL_CONFIG ( ADV_NCONN_CFG | ADV_CONN_CFG | SCAN_CFG )
46  #elif ( HOST_CONFIG == ( BROADCASTER_CFG | OBSERVER_CFG ) )
47  #define CTRL_CONFIG ( ADV_NCONN_CFG | SCAN_CFG )
48  #elif ( HOST_CONFIG == CENTRAL_CFG )
49  #define CTRL_CONFIG ( SCAN_CFG | INIT_CFG )
50  #elif ( HOST_CONFIG == PERIPHERAL_CFG )
51  #define CTRL_CONFIG ( ADV_NCONN_CFG | ADV_CONN_CFG )
52  #elif ( HOST_CONFIG == OBSERVER_CFG )
53  #define CTRL_CONFIG SCAN_CFG
54  #elif ( HOST_CONFIG == BROADCASTER_CFG )
55  #define CTRL_CONFIG ADV_NCONN_CFG
56  #else
57  #error "Build Configuration Error: Invalid Host Role!"
58  #endif
59 #else
60  // Controller Sanity Check: Stop build when no configuration is defined.
61  #if !defined( CTRL_CONFIG ) || !( CTRL_CONFIG & ( ADV_NCONN_CFG | \
62  ADV_CONN_CFG | \
63  SCAN_CFG | \
64  INIT_CFG ) )
65  #error "Build Configuration Error: At least one Controller build component required!"
66  #endif // no Controller build components defined
67 #endif
68 
69 // If BLE_V41_FEATURES is defined, map it to CTRL_V41_CONFIG
70 #if defined ( BLE_V41_FEATURES ) && !defined ( CTRL_V41_CONFIG )
71  #define CTRL_V41_CONFIG ( ( BLE_V41_FEATURES ) & CTRL_V41_MASK )
72 #elif defined ( BLE_V41_FEATURES ) && defined ( CTRL_V41_CONFIG )
73  #error "Build Configuration Error: Cannot define both BLE_V41_FEATURES and CTRL_V41_CONFIG!"
74 #endif // BLE_V41_FEATURES
75 
76 // If BLE_V50_FEATURES is defined, map it to CTRL_V50_CONFIG
77 #if defined ( BLE_V50_FEATURES ) && !defined ( CTRL_V50_CONFIG )
78  #define CTRL_V50_CONFIG BLE_V50_FEATURES
79 #elif defined ( BLE_V50_FEATURES ) && defined ( CTRL_V50_CONFIG )
80  #error "Build Configuration Error: Cannot define both BLE_V50_FEATURES and CTRL_V50_CONFIG!"
81 #endif // BLE_V41_FEATURES
82 
83 #if defined(CC2540) || defined(CC2541) || defined(CC2541S)
84  #if !defined ( MAX_NUM_BLE_CONNS )
85  #if ( CTRL_CONFIG & INIT_CFG )
86  #define MAX_NUM_BLE_CONNS 3
87  #elif ( !( CTRL_CONFIG & INIT_CFG ) && ( CTRL_CONFIG & ADV_CONN_CFG ) )
88  #define MAX_NUM_BLE_CONNS 1
89  #else // no connection needed
90  #define MAX_NUM_BLE_CONNS 0
91  #endif // CTRL_CONFIG=INIT_CFG
92  #endif // !MAX_NUM_BLE_CONNS
93 #endif // CC2540 | CC2541 | CC2541S
94 
96 
97 
99 #define B_ADDR_LEN 6
100 
102 #define KEYLEN 16
103 
106 #define LSB_2_BYTES 2
107 
109 #define MSB_4_BYTES 4
110 
112 #define B_CHANNEL_MAP_LEN 5
113 
115 #define B_EVENT_MASK_LEN 8
116 
118 #define B_LOCAL_NAME_LEN 248
119 
121 #define B_MAX_ADV_LEN 31
122 
124 #define B_RANDOM_NUM_SIZE 8
125 
127 #define B_FEATURE_SUPPORT_LENGTH 8
128 
130 #define B_APP_DEFAULT_PASSCODE 123456
131 
133 #define EXTENDED_STACK_SETTINGS_DEFAULT 0x00
134 
136 #define CENTRAL_GUARD_TIME_ENABLE 0x01
137 #define CC2652RB_OVERRIDE_USED 0x02
138 
139 #define bleInvalidTaskID INVALID_TASK
140 #define bleNotReady 0x10
141 #define bleAlreadyInRequestedMode 0x11
142 #define bleIncorrectMode 0x12
143 #define bleMemAllocError 0x13
144 #define bleNotConnected 0x14
145 #define bleNoResources 0x15
146 #define blePending 0x16
147 #define bleTimeout 0x17
148 #define bleInvalidRange 0x18
149 #define bleLinkEncrypted 0x19
150 #define bleProcedureComplete 0x1A
151 #define bleInvalidMtuSize 0x1B
152 #define blePairingTimedOut 0x1C
153 #define bleMemFreeError 0x1D
154 #define bleInternalError 0x1E
155 #define bleDisallowed 0x1F
156 
157 // GAP Status Return Values - returned as bStatus_t
158 #define bleGAPUserCanceled 0x30
159 #define bleGAPConnNotAcceptable 0x31
160 #define bleGAPBondRejected 0x32
161 #define bleGAPBufferInUse 0x33
162 #define bleGAPNotFound 0x34
163 #define bleGAPFilteredOut 0x35
164 #define bleGAPBondItemNotFound 0x36
165 
166 // ATT Status Return Values - returned as bStatus_t
167 #define bleInvalidPDU 0x40
168 #define bleInsufficientAuthen 0x41
169 #define bleInsufficientEncrypt 0x42
170 #define bleInsufficientKeySize 0x43
171 
172 // L2CAP Status Return Values - returned as bStatus_t
173 
174 #define INVALID_TASK_ID 0xFF
175 
176 // Note: Maximum NVID index is 0x03FF (10 bits) - this is a NV driver limitation
177 #define MAX_NUM_NV_RECORDS 50
178 
179 // Device NV Items - Range 0 - 0x1F
180 #define BLE_NVID_IRK 0x02
181 #define BLE_NVID_CSRK 0x03
182 #define BLE_NVID_ADDR_MODE 0x04
183 #define BLE_LRU_BOND_LIST 0x05
184 #define BLE_NVID_RANDOM_ADDR 0x06
185 
186 // Bonding NV Items - Range 0x20 - ( (GAP_BONDINGS_MAX * GAP_BOND_REC_IDS) - 1 )
187 #define BLE_NVID_GAP_BOND_START 0x20
188 #define BLE_NVID_GAP_BOND_END (BLE_NVID_GAP_BOND_START + (MAX_NUM_NV_RECORDS * GAP_BOND_REC_IDS) - 1)
189 
191 // GATT Configuration NV Items - Range (BLE_NVID_GAP_BOND_END + 1) - (BLE_NVID_GATT_CFG_START + GAP_BONDINGS_MAX - 1) - This must match the number of Bonding entries
192 #define BLE_NVID_GATT_CFG_START (BLE_NVID_GAP_BOND_END + 1)
193 #define BLE_NVID_GATT_CFG_END (BLE_NVID_GATT_CFG_START + MAX_NUM_NV_RECORDS - 1)
194 
195 // Customer NV Items - Range (BLE_NVID_GATT_CFG_END + 1) - (BLE_NVID_CUST_START + GAP_BONDINGS_MAX - 1) - This must match the number of Bonding entries
196 #define BLE_NVID_CUST_START (BLE_NVID_GATT_CFG_END + 1)
197 #define BLE_NVID_CUST_END (BLE_NVID_CUST_START + MAX_NUM_NV_RECORDS - 1)
198 
199 // BLE Mesh NV IDs Start
200 #define BLE_NVID_MESH_START BLE_NVID_CUST_END + 1
201 
202 /*********************************************************************
203  * BLE OSAL GAP GLOBAL Events
204  */
205 #define GAP_EVENT_SIGN_COUNTER_CHANGED 0x4000
206 
207 // GAP - Messages IDs (0xD0 - 0xDF)
208 #define GAP_MSG_EVENT 0xD0
209 
210 // SM - Messages IDs (0xC1 - 0xCF)
211 #define SM_NEW_RAND_KEY_EVENT 0xC1
212 #define SM_MSG_EVENT 0xC2
213 
214 // GATT - Messages IDs (0xB0 - 0xBF)
215 #define GATT_MSG_EVENT 0xB0
216 #define GATT_SERV_MSG_EVENT 0xB1
217 
218 // L2CAP - Messages IDs (0xA0 - 0xAF)
219 #define L2CAP_DATA_EVENT 0xA0
220 #define L2CAP_SIGNAL_EVENT 0xA2
221 
222 // HCI - Messages IDs (0x90 - 0x9F)
223 #define HCI_DATA_EVENT 0x90
224 #define HCI_GAP_EVENT_EVENT 0x91
225 #define HCI_SMP_EVENT_EVENT 0x92
226 #define HCI_EXT_CMD_EVENT 0x93
227 #define HCI_SMP_META_EVENT_EVENT 0x94
228 #define HCI_GAP_META_EVENT_EVENT 0x95
229 
230 // ICall and Dispatch - Messages IDs (0x80 - 0x8F)
231 #define ICALL_EVENT_EVENT 0x80
232 #define ICALL_CMD_EVENT 0x81
233 #define DISPATCH_CMD_EVENT 0x82
234 
235 #ifdef __TI_COMPILER_VERSION__
236 #define PRAGMA_OPTIMIZE_NONE
237 #elif defined(__IAR_SYSTEMS_ICC__)
238 #define PRAGMA_OPTIMIZE_NONE _Pragma("optimize=none")
239 #endif
240 
241 /*********************************************************************
242  * TYPEDEFS
243  */
244 
246 typedef uint8_t bStatus_t;
247 
248 
249 /*********************************************************************
250  * System Events
251  */
252 
253 /*********************************************************************
254  * Global System Messages
255  */
256 
257 /*********************************************************************
258  * MACROS
259  */
260 
262 #define TI_BASE_UUID_128( uuid ) 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB0, \
263  0x00, 0x40, 0x51, 0x04, LO_UINT16( uuid ), HI_UINT16( uuid ), 0x00, 0xF0
264 
265 /*********************************************************************
266  * GLOBAL VARIABLES
267  */
268 
269 /*********************************************************************
270  * FUNCTIONS
271  */
272 
273 /*********************************************************************
274 *********************************************************************/
275 
276 #ifdef __cplusplus
277 }
278 #endif
279 
280 #endif /* BCOMDEF_H */
Common Defines.
uint8_t bStatus_t
BLE Generic Status return.
Definition: bcomdef.h:246
© Copyright 1995-2025, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale