TI BLE5-Stack API Documentation  1.01.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: TISD 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 
31 #include "comdef.h"
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  #if defined ( FLASH_ONLY_BUILD ) || defined ( FLASH_ROM_BUILD )
58  #error "Build Configuration Error: Invalid Host Role!"
59  #endif
60  #endif
61 #else
62  // Controller Sanity Check: Stop build when no configuration is defined.
63  #if !defined( CTRL_CONFIG ) || !( CTRL_CONFIG & ( ADV_NCONN_CFG | \
64  ADV_CONN_CFG | \
65  SCAN_CFG | \
66  INIT_CFG ) )
67  #if defined ( FLASH_ONLY_BUILD ) || defined ( FLASH_ROM_BUILD )
68  #error "Build Configuration Error: At least one Controller build component required!"
69  #endif
70  #endif // no Controller build components defined
71 #endif
72 
73 // If BLE_V41_FEATURES is defined, map it to CTRL_V41_CONFIG
74 #if defined ( BLE_V41_FEATURES ) && !defined ( CTRL_V41_CONFIG )
75  #define CTRL_V41_CONFIG ( ( BLE_V41_FEATURES ) & CTRL_V41_MASK )
76 #elif defined ( BLE_V41_FEATURES ) && defined ( CTRL_V41_CONFIG )
77  #error "Build Configuration Error: Cannot define both BLE_V41_FEATURES and CTRL_V41_CONFIG!"
78 #endif // BLE_V41_FEATURES
79 
80 // If BLE_V42_FEATURES is defined, map it to CTRL_V42_CONFIG
81 #if defined ( BLE_V42_FEATURES ) && !defined ( CTRL_V42_CONFIG )
82  #define CTRL_V42_CONFIG BLE_V42_FEATURES
83 #elif defined ( BLE_V42_FEATURES ) && defined ( CTRL_V42_CONFIG )
84  #error "Build Configuration Error: Cannot define both BLE_V42_FEATURES and CTRL_V42_CONFIG!"
85 #endif // BLE_V41_FEATURES
86 
87 // If BLE_V50_FEATURES is defined, map it to CTRL_V50_CONFIG
88 #if defined ( BLE_V50_FEATURES ) && !defined ( CTRL_V50_CONFIG )
89  #define CTRL_V50_CONFIG BLE_V50_FEATURES
90 #elif defined ( BLE_V50_FEATURES ) && defined ( CTRL_V50_CONFIG )
91  #error "Build Configuration Error: Cannot define both BLE_V50_FEATURES and CTRL_V50_CONFIG!"
92 #endif // BLE_V41_FEATURES
93 
94 // If L2CAP Connection Oriented Channels are not configured and GATT_QUAL is not defined
95 // then do not configure GATT Service Changed characteristic
96 #if (!defined ( BLE_V41_FEATURES ) || !( BLE_V41_FEATURES & L2CAP_COC_CFG )) && !defined(GATT_QUAL)
97  #define GATT_NO_SERVICE_CHANGED
98 #endif // ! BLE_41_FEATURES || ! L2CAP_COC_CFG
99 
100 #if defined(CC2540) || defined(CC2541) || defined(CC2541S)
101  #if !defined ( MAX_NUM_BLE_CONNS )
102  #if ( CTRL_CONFIG & INIT_CFG )
103  #define MAX_NUM_BLE_CONNS 3
104  #elif ( !( CTRL_CONFIG & INIT_CFG ) && ( CTRL_CONFIG & ADV_CONN_CFG ) )
105  #define MAX_NUM_BLE_CONNS 1
106  #else // no connection needed
107  #define MAX_NUM_BLE_CONNS 0
108  #endif // CTRL_CONFIG=INIT_CFG
109  #endif // !MAX_NUM_BLE_CONNS
110 #endif // CC2540 | CC2541 | CC2541S
111 
113 
115 #define B_ADDR_LEN 6
116 
118 #define KEYLEN 16
119 
122 #define LSB_2_BYTES 2
123 
125 #define MSB_4_BYTES 4
126 
128 #define B_CHANNEL_MAP_LEN 5
129 
131 #define B_EVENT_MASK_LEN 8
132 
134 #define B_LOCAL_NAME_LEN 248
135 
137 #define B_MAX_ADV_LEN 31
138 
140 #define B_RANDOM_NUM_SIZE 8
141 
143 #define B_FEATURE_SUPPORT_LENGTH 8
144 
146 #define B_RESOLVING_LIST_SIZE 3
147 
149 #define B_APP_DEFAULT_PASSCODE 123456
150 
151 #define bleInvalidTaskID INVALID_TASK
152 #define bleNotReady 0x10
153 #define bleAlreadyInRequestedMode 0x11
154 #define bleIncorrectMode 0x12
155 #define bleMemAllocError 0x13
156 #define bleNotConnected 0x14
157 #define bleNoResources 0x15
158 #define blePending 0x16
159 #define bleTimeout 0x17
160 #define bleInvalidRange 0x18
161 #define bleLinkEncrypted 0x19
162 #define bleProcedureComplete 0x1A
163 #define bleInvalidMtuSize 0x1B
164 #define blePairingTimedOut 0x1C
165 #define bleMemFreeError 0x1D
166 #define bleInternalError 0x1E
167 
168 // GAP Status Return Values - returned as bStatus_t
169 #define bleGAPUserCanceled 0x30
170 #define bleGAPConnNotAcceptable 0x31
171 #define bleGAPBondRejected 0x32
172 #define bleGAPBufferInUse 0x33
173 #define bleGAPNotFound 0x34
174 #define bleGAPFilteredOut 0x35
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_ADDR_MODE 0x04
190 #define BLE_LRU_BOND_LIST 0x05
191 #define BLE_NVID_RANDOM_ADDR 0x06
192 
193 // Bonding NV Items - Range 0x20 - 0x5F - This allows for 10 bondings
194 #define BLE_NVID_GAP_BOND_START 0x20
195 #define BLE_NVID_GAP_BOND_END 0x5f
196 
197 // GATT Configuration NV Items - Range 0x70 - 0x79 - This must match the number of Bonding entries
198 #define BLE_NVID_GATT_CFG_START 0x70
199 #define BLE_NVID_GATT_CFG_END 0x79
200 
201 // Customer NV Items - Range 0x80 - 0x8F - This must match the number of Bonding entries
202 #define BLE_NVID_CUST_START 0x80
203 #define BLE_NVID_CUST_END 0x8F
204 
205 /*********************************************************************
206  * BLE OSAL GAP GLOBAL Events
207  */
208 #define GAP_EVENT_SIGN_COUNTER_CHANGED 0x4000
209 
210 // GAP - Messages IDs (0xD0 - 0xDF)
211 #define GAP_MSG_EVENT 0xD0
212 
213 // SM - Messages IDs (0xC1 - 0xCF)
214 #define SM_NEW_RAND_KEY_EVENT 0xC1
215 #define SM_MSG_EVENT 0xC2
216 
217 // GATT - Messages IDs (0xB0 - 0xBF)
218 #define GATT_MSG_EVENT 0xB0
219 #define GATT_SERV_MSG_EVENT 0xB1
220 
221 // L2CAP - Messages IDs (0xA0 - 0xAF)
222 #define L2CAP_DATA_EVENT 0xA0
223 #define L2CAP_SIGNAL_EVENT 0xA2
224 
225 // HCI - Messages IDs (0x90 - 0x9F)
226 #define HCI_DATA_EVENT 0x90
227 #define HCI_GAP_EVENT_EVENT 0x91
228 #define HCI_SMP_EVENT_EVENT 0x92
229 #define HCI_EXT_CMD_EVENT 0x93
230 #define HCI_SMP_META_EVENT_EVENT 0x94
231 #define HCI_GAP_META_EVENT_EVENT 0x95
232 
233 // ICall and Dispatch - Messages IDs (0x80 - 0x8F)
234 #define ICALL_EVENT_EVENT 0x80
235 #define ICALL_CMD_EVENT 0x81
236 #define DISPATCH_CMD_EVENT 0x82
237 
238 #ifdef __TI_COMPILER_VERSION__
239 #define PRAGMA_OPTIMIZE_NONE
240 #elif defined(__IAR_SYSTEMS_ICC__)
241 #define PRAGMA_OPTIMIZE_NONE _Pragma("optimize=none")
242 #endif
243 
244 /*********************************************************************
245  * TYPEDEFS
246  */
247 
249 typedef Status_t bStatus_t;
250 
251 
252 /*********************************************************************
253  * System Events
254  */
255 
256 /*********************************************************************
257  * Global System Messages
258  */
259 
260 /*********************************************************************
261  * MACROS
262  */
263 
265 #define TI_BASE_UUID_128( uuid ) 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB0, \
266  0x00, 0x40, 0x51, 0x04, LO_UINT16( uuid ), HI_UINT16( uuid ), 0x00, 0xF0
267 
268 /*********************************************************************
269  * GLOBAL VARIABLES
270  */
271 
272 /*********************************************************************
273  * FUNCTIONS
274  */
275 
276 /*********************************************************************
277 *********************************************************************/
278 
279 #ifdef __cplusplus
280 }
281 #endif
282 
283 #endif /* BCOMDEF_H */
Common Defines.
Status_t bStatus_t
BLE Generic Status return.
Definition: bcomdef.h:249
© Copyright 1995-2021, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale