TI BLE-Stack for Bluetooth 4.2 API Documentation  3.01.00.07
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 
139 #define B_APP_DEFAULT_PASSCODE 123456
140 
141 #define bleInvalidTaskID INVALID_TASK
142 #define bleNotReady 0x10
143 #define bleAlreadyInRequestedMode 0x11
144 #define bleIncorrectMode 0x12
145 #define bleMemAllocError 0x13
146 #define bleNotConnected 0x14
147 #define bleNoResources 0x15
148 #define blePending 0x16
149 #define bleTimeout 0x17
150 #define bleInvalidRange 0x18
151 #define bleLinkEncrypted 0x19
152 #define bleProcedureComplete 0x1A
153 #define bleInvalidMtuSize 0x1B
154 
155 // GAP Status Return Values - returned as bStatus_t
156 #define bleGAPUserCanceled 0x30
157 #define bleGAPConnNotAcceptable 0x31
158 #define bleGAPBondRejected 0x32
159 
160 // ATT Status Return Values - returned as bStatus_t
161 #define bleInvalidPDU 0x40
162 #define bleInsufficientAuthen 0x41
163 #define bleInsufficientEncrypt 0x42
164 #define bleInsufficientKeySize 0x43
165 
166 // L2CAP Status Return Values - returned as bStatus_t
167 
168 #define INVALID_TASK_ID 0xFF
169 
170 // Device NV Items - Range 0 - 0x1F
171 #define BLE_NVID_IRK 0x02
172 #define BLE_NVID_CSRK 0x03
173 #define BLE_NVID_SIGNCOUNTER 0x04
174 #define BLE_LRU_BOND_LIST 0x05
175 
176 // Bonding NV Items - Range 0x20 - 0x5F - This allows for 10 bondings
177 #define BLE_NVID_GAP_BOND_START 0x20
178 #define BLE_NVID_GAP_BOND_END 0x5f
179 
180 // GATT Configuration NV Items - Range 0x70 - 0x79 - This must match the number of Bonding entries
181 #define BLE_NVID_GATT_CFG_START 0x70
182 #define BLE_NVID_GATT_CFG_END 0x79
183 
184 // Customer NV Items - Range 0x80 - 0x8F - This must match the number of Bonding entries
185 #define BLE_NVID_CUST_START 0x80
186 #define BLE_NVID_CUST_END 0x8F
187 
188 /*********************************************************************
189  * BLE OSAL GAP GLOBAL Events
190  */
191 #define GAP_EVENT_SIGN_COUNTER_CHANGED 0x4000
192 
193 // GAP - Messages IDs (0xD0 - 0xDF)
194 #define GAP_MSG_EVENT 0xD0
195 
196 // SM - Messages IDs (0xC1 - 0xCF)
197 #define SM_NEW_RAND_KEY_EVENT 0xC1
198 #define SM_MSG_EVENT 0xC2
199 
200 // GATT - Messages IDs (0xB0 - 0xBF)
201 #define GATT_MSG_EVENT 0xB0
202 #define GATT_SERV_MSG_EVENT 0xB1
203 
204 // L2CAP - Messages IDs (0xA0 - 0xAF)
205 #define L2CAP_DATA_EVENT 0xA0
206 #define L2CAP_SIGNAL_EVENT 0xA2
207 
208 // HCI - Messages IDs (0x90 - 0x9F)
209 #define HCI_DATA_EVENT 0x90
210 #define HCI_GAP_EVENT_EVENT 0x91
211 #define HCI_SMP_EVENT_EVENT 0x92
212 #define HCI_EXT_CMD_EVENT 0x93
213 #define HCI_SMP_META_EVENT_EVENT 0x94
214 #define HCI_GAP_META_EVENT_EVENT 0x95
215 
216 // ICall and Dispatch - Messages IDs (0x80 - 0x8F)
217 #define ICALL_EVENT_EVENT 0x80
218 #define ICALL_CMD_EVENT 0x81
219 #define DISPATCH_CMD_EVENT 0x82
220 
221 
222 /*********************************************************************
223  * TYPEDEFS
224  */
225 
227 typedef Status_t bStatus_t;
228 
229 
230 /*********************************************************************
231  * System Events
232  */
233 
234 /*********************************************************************
235  * Global System Messages
236  */
237 
238 /*********************************************************************
239  * MACROS
240  */
241 
243 #define TI_BASE_UUID_128( uuid ) 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB0, \
244  0x00, 0x40, 0x51, 0x04, LO_UINT16( uuid ), HI_UINT16( uuid ), 0x00, 0xF0
245 
246 /*********************************************************************
247  * GLOBAL VARIABLES
248  */
249 
250 /*********************************************************************
251  * FUNCTIONS
252  */
253 
254 /*********************************************************************
255 *********************************************************************/
256 
257 #ifdef __cplusplus
258 }
259 #endif
260 
261 #endif /* BCOMDEF_H */
Common Defines.
Status_t bStatus_t
BLE Generic Status return.
Definition: bcomdef.h:227
Copyright 2017, Texas Instruments Incorporated