BLE-Stack APIs  1.00.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 
37 #if defined ( HOST_CONFIG )
38  // Set the Controller Configuration
39  #if ( HOST_CONFIG == ( CENTRAL_CFG | PERIPHERAL_CFG ) )
40  #define CTRL_CONFIG ( ADV_NCONN_CFG | ADV_CONN_CFG | SCAN_CFG | INIT_CFG )
41  #elif ( HOST_CONFIG == ( CENTRAL_CFG | BROADCASTER_CFG ) )
42  #define CTRL_CONFIG ( ADV_NCONN_CFG | SCAN_CFG | INIT_CFG )
43  #elif ( HOST_CONFIG == ( PERIPHERAL_CFG | OBSERVER_CFG ) )
44  #define CTRL_CONFIG ( ADV_NCONN_CFG | ADV_CONN_CFG | SCAN_CFG )
45  #elif ( HOST_CONFIG == ( BROADCASTER_CFG | OBSERVER_CFG ) )
46  #define CTRL_CONFIG ( ADV_NCONN_CFG | SCAN_CFG )
47  #elif ( HOST_CONFIG == CENTRAL_CFG )
48  #define CTRL_CONFIG ( SCAN_CFG | INIT_CFG )
49  #elif ( HOST_CONFIG == PERIPHERAL_CFG )
50  #define CTRL_CONFIG ( ADV_NCONN_CFG | ADV_CONN_CFG )
51  #elif ( HOST_CONFIG == OBSERVER_CFG )
52  #define CTRL_CONFIG SCAN_CFG
53  #elif ( HOST_CONFIG == BROADCASTER_CFG )
54  #define CTRL_CONFIG ADV_NCONN_CFG
55  #else
56  #if defined ( FLASH_ONLY_BUILD ) || defined ( FLASH_ROM_BUILD )
57  #error "Build Configuration Error: Invalid Host Role!"
58  #endif
59  #endif
60 #else
61  // Controller Sanity Check: Stop build when no configuration is defined.
62  #if !defined( CTRL_CONFIG ) || !( CTRL_CONFIG & ( ADV_NCONN_CFG | \
63  ADV_CONN_CFG | \
64  SCAN_CFG | \
65  INIT_CFG ) )
66  #if defined ( FLASH_ONLY_BUILD ) || defined ( FLASH_ROM_BUILD )
67  #error "Build Configuration Error: At least one Controller build component required!"
68  #endif
69  #endif // no Controller build components defined
70 #endif
71 
72 // If BLE_V41_FEATURES is defined, map it to CTRL_V41_CONFIG
73 #if defined ( BLE_V41_FEATURES ) && !defined ( CTRL_V41_CONFIG )
74  #define CTRL_V41_CONFIG ( ( BLE_V41_FEATURES ) & CTRL_V41_MASK )
75 #elif defined ( BLE_V41_FEATURES ) && defined ( CTRL_V41_CONFIG )
76  #error "Build Configuration Error: Cannot define both BLE_V41_FEATURES and CTRL_V41_CONFIG!"
77 #endif // BLE_V41_FEATURES
78 
79 // If BLE_V42_FEATURES is defined, map it to CTRL_V42_CONFIG
80 #if defined ( BLE_V42_FEATURES ) && !defined ( CTRL_V42_CONFIG )
81  #define CTRL_V42_CONFIG BLE_V42_FEATURES
82 #elif defined ( BLE_V42_FEATURES ) && defined ( CTRL_V42_CONFIG )
83  #error "Build Configuration Error: Cannot define both BLE_V42_FEATURES and CTRL_V42_CONFIG!"
84 #endif // BLE_V41_FEATURES
85 
86 // If BLE_V50_FEATURES is defined, map it to CTRL_V50_CONFIG
87 #if defined ( BLE_V50_FEATURES ) && !defined ( CTRL_V50_CONFIG )
88  #define CTRL_V50_CONFIG BLE_V50_FEATURES
89 #elif defined ( BLE_V50_FEATURES ) && defined ( CTRL_V50_CONFIG )
90  #error "Build Configuration Error: Cannot define both BLE_V50_FEATURES and CTRL_V50_CONFIG!"
91 #endif // BLE_V41_FEATURES
92 
93 // If L2CAP Connection Oriented Channels are not configured then do not
94 // configure GATT Service Changed characteristic
95 #if !defined ( BLE_V41_FEATURES ) || !( BLE_V41_FEATURES & L2CAP_COC_CFG )
96  #define GATT_NO_SERVICE_CHANGED
97 #endif // ! BLE_41_FEATURES || ! L2CAP_COC_CFG
98 
99 #if defined(CC2540) || defined(CC2541) || defined(CC2541S)
100  #if !defined ( MAX_NUM_BLE_CONNS )
101  #if ( CTRL_CONFIG & INIT_CFG )
102  #define MAX_NUM_BLE_CONNS 3
103  #elif ( !( CTRL_CONFIG & INIT_CFG ) && ( CTRL_CONFIG & ADV_CONN_CFG ) )
104  #define MAX_NUM_BLE_CONNS 1
105  #else // no connection needed
106  #define MAX_NUM_BLE_CONNS 0
107  #endif // CTRL_CONFIG=INIT_CFG
108  #endif // !MAX_NUM_BLE_CONNS
109 #endif // CC2540 | CC2541 | CC2541S
110 
112 #define B_ADDR_LEN 6
113 
115 #define KEYLEN 16
116 
118 #define B_CHANNEL_MAP_LEN 5
119 
121 #define B_EVENT_MASK_LEN 8
122 
124 #define B_LOCAL_NAME_LEN 248
125 
127 #define B_MAX_ADV_LEN 31
128 
130 #define B_RANDOM_NUM_SIZE 8
131 
133 #define B_FEATURE_SUPPORT_LENGTH 8
134 
136 #define B_RESOLVING_LIST_SIZE 10
137 
138 #define bleInvalidTaskID INVALID_TASK
139 #define bleNotReady 0x10
140 #define bleAlreadyInRequestedMode 0x11
141 #define bleIncorrectMode 0x12
142 #define bleMemAllocError 0x13
143 #define bleNotConnected 0x14
144 #define bleNoResources 0x15
145 #define blePending 0x16
146 #define bleTimeout 0x17
147 #define bleInvalidRange 0x18
148 #define bleLinkEncrypted 0x19
149 #define bleProcedureComplete 0x1A
150 #define bleInvalidMtuSize 0x1B
151 #define blePairingTimedOut 0x1C
152 
153 // GAP Status Return Values - returned as bStatus_t
154 #define bleGAPUserCanceled 0x30
155 #define bleGAPConnNotAcceptable 0x31
156 #define bleGAPBondRejected 0x32
157 
158 // ATT Status Return Values - returned as bStatus_t
159 #define bleInvalidPDU 0x40
160 #define bleInsufficientAuthen 0x41
161 #define bleInsufficientEncrypt 0x42
162 #define bleInsufficientKeySize 0x43
163 
164 // L2CAP Status Return Values - returned as bStatus_t
165 
166 #define INVALID_TASK_ID 0xFF
167 
168 // Device NV Items - Range 0 - 0x1F
169 #define BLE_NVID_IRK 0x02
170 #define BLE_NVID_CSRK 0x03
171 #define BLE_NVID_SIGNCOUNTER 0x04
172 #define BLE_LRU_BOND_LIST 0x05
173 
174 // Bonding NV Items - Range 0x20 - 0x5F - This allows for 10 bondings
175 #define BLE_NVID_GAP_BOND_START 0x20
176 #define BLE_NVID_GAP_BOND_END 0x5f
177 
178 // GATT Configuration NV Items - Range 0x70 - 0x79 - This must match the number of Bonding entries
179 #define BLE_NVID_GATT_CFG_START 0x70
180 #define BLE_NVID_GATT_CFG_END 0x79
181 
182 // Customer NV Items - Range 0x80 - 0x8F - This must match the number of Bonding entries
183 #define BLE_NVID_CUST_START 0x80
184 #define BLE_NVID_CUST_END 0x8F
185 
186 /*********************************************************************
187  * BLE OSAL GAP GLOBAL Events
188  */
189 #define GAP_EVENT_SIGN_COUNTER_CHANGED 0x4000
190 
191 // GAP - Messages IDs (0xD0 - 0xDF)
192 #define GAP_MSG_EVENT 0xD0
193 
194 // SM - Messages IDs (0xC1 - 0xCF)
195 #define SM_NEW_RAND_KEY_EVENT 0xC1
196 #define SM_MSG_EVENT 0xC2
197 
198 // GATT - Messages IDs (0xB0 - 0xBF)
199 #define GATT_MSG_EVENT 0xB0
200 #define GATT_SERV_MSG_EVENT 0xB1
201 
202 // L2CAP - Messages IDs (0xA0 - 0xAF)
203 #define L2CAP_DATA_EVENT 0xA0
204 #define L2CAP_SIGNAL_EVENT 0xA2
205 
206 // HCI - Messages IDs (0x90 - 0x9F)
207 #define HCI_DATA_EVENT 0x90
208 #define HCI_GAP_EVENT_EVENT 0x91
209 #define HCI_SMP_EVENT_EVENT 0x92
210 #define HCI_EXT_CMD_EVENT 0x93
211 #define HCI_SMP_META_EVENT_EVENT 0x94
212 #define HCI_GAP_META_EVENT_EVENT 0x95
213 
214 // ICall and Dispatch - Messages IDs (0x80 - 0x8F)
215 #define ICALL_EVENT_EVENT 0x80
216 #define ICALL_CMD_EVENT 0x81
217 #define DISPATCH_CMD_EVENT 0x82
218 
219 
220 /*********************************************************************
221  * TYPEDEFS
222  */
223 
225 typedef Status_t bStatus_t;
226 
227 
228 /*********************************************************************
229  * System Events
230  */
231 
232 /*********************************************************************
233  * Global System Messages
234  */
235 
236 /*********************************************************************
237  * MACROS
238  */
239 
241 #define TI_BASE_UUID_128( uuid ) 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB0, \
242  0x00, 0x40, 0x51, 0x04, LO_UINT16( uuid ), HI_UINT16( uuid ), 0x00, 0xF0
243 
244 /*********************************************************************
245  * GLOBAL VARIABLES
246  */
247 
248 /*********************************************************************
249  * FUNCTIONS
250  */
251 
252 /*********************************************************************
253 *********************************************************************/
254 
255 #ifdef __cplusplus
256 }
257 #endif
258 
259 #endif /* BCOMDEF_H */
Common Defines.
Status_t bStatus_t
BLE Generic Status return.
Definition: bcomdef.h:225
Copyright 2017, Texas Instruments Incorporated