TI BLE5-Stack API Documentation  9.14.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 
70 
71 
73 #define B_ADDR_LEN 6
74 
76 #define KEYLEN 16
77 
80 #define LSB_2_BYTES 2
81 
83 #define MSB_4_BYTES 4
84 
86 #define B_CHANNEL_MAP_LEN 5
87 
89 #define B_EVENT_MASK_LEN 8
90 
92 #define B_LOCAL_NAME_LEN 248
93 
95 #define B_MAX_ADV_LEN 31
96 
98 #define B_RANDOM_NUM_SIZE 8
99 
101 #define B_FEATURE_SUPPORT_LENGTH 8
102 
104 #define B_APP_DEFAULT_PASSCODE 123456
105 
107 #define EXTENDED_STACK_SETTINGS_DEFAULT 0x00
108 
110 #define CENTRAL_GUARD_TIME_ENABLE 0x01
111 #define CC2652RB_OVERRIDE_USED 0x02
112 
113 #define bleInvalidTaskID INVALID_TASK
114 #define bleNotReady 0x10
115 #define bleAlreadyInRequestedMode 0x11
116 #define bleIncorrectMode 0x12
117 #define bleMemAllocError 0x13
118 #define bleNotConnected 0x14
119 #define bleNoResources 0x15
120 #define blePending 0x16
121 #define bleTimeout 0x17
122 #define bleInvalidRange 0x18
123 #define bleLinkEncrypted 0x19
124 #define bleProcedureComplete 0x1A
125 #define bleInvalidMtuSize 0x1B
126 #define blePairingTimedOut 0x1C
127 #define bleMemFreeError 0x1D
128 #define bleInternalError 0x1E
129 #define bleDisallowed 0x1F
130 
131 // GAP Status Return Values - returned as bStatus_t
132 #define bleGAPUserCanceled 0x30
133 #define bleGAPConnNotAcceptable 0x31
134 #define bleGAPBondRejected 0x32
135 #define bleGAPBufferInUse 0x33
136 #define bleGAPNotFound 0x34
137 #define bleGAPFilteredOut 0x35
138 #define bleGAPBondItemNotFound 0x36
139 
140 // ATT Status Return Values - returned as bStatus_t
141 #define bleInvalidPDU 0x40
142 #define bleInsufficientAuthen 0x41
143 #define bleInsufficientEncrypt 0x42
144 #define bleInsufficientKeySize 0x43
145 
146 // L2CAP Status Return Values - returned as bStatus_t
147 
148 #define INVALID_TASK_ID 0xFF
149 
150 // Note: Maximum NVID index is 0x03FF (10 bits) - this is a NV driver limitation
151 #define MAX_NUM_NV_RECORDS 50
152 
153 // Device NV Items - Range 0 - 0x1F
154 #define BLE_NVID_IRK 0x02
155 #define BLE_NVID_CSRK 0x03
156 #define BLE_NVID_ADDR_MODE 0x04
157 #define BLE_LRU_BOND_LIST 0x05
158 #define BLE_NVID_RANDOM_ADDR 0x06
159 
160 // Bonding NV Items - Range 0x20 - ( (GAP_BONDINGS_MAX * GAP_BOND_REC_IDS) - 1 )
161 #define BLE_NVID_GAP_BOND_START 0x20
162 #define BLE_NVID_GAP_BOND_END (BLE_NVID_GAP_BOND_START + (MAX_NUM_NV_RECORDS * GAP_BOND_REC_IDS) - 1)
163 
165 // 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
166 #define BLE_NVID_GATT_CFG_START (BLE_NVID_GAP_BOND_END + 1)
167 #define BLE_NVID_GATT_CFG_END (BLE_NVID_GATT_CFG_START + MAX_NUM_NV_RECORDS - 1)
168 
169 // 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
170 #define BLE_NVID_CUST_START (BLE_NVID_GATT_CFG_END + 1)
171 #define BLE_NVID_CUST_END (BLE_NVID_CUST_START + MAX_NUM_NV_RECORDS - 1)
172 
173 // BLE Mesh NV IDs Start
174 #define BLE_NVID_MESH_START BLE_NVID_CUST_END + 1
175 
176 /*********************************************************************
177  * BLE OSAL GAP GLOBAL Events
178  */
179 #define GAP_EVENT_SIGN_COUNTER_CHANGED 0x4000
180 
181 // GAP - Messages IDs (0xD0 - 0xDF)
182 #define GAP_MSG_EVENT 0xD0
183 
184 // SM - Messages IDs (0xC1 - 0xCF)
185 #define SM_NEW_RAND_KEY_EVENT 0xC1
186 #define SM_MSG_EVENT 0xC2
187 
188 // GATT - Messages IDs (0xB0 - 0xBF)
189 #define GATT_MSG_EVENT 0xB0
190 #define GATT_SERV_MSG_EVENT 0xB1
191 
192 // L2CAP - Messages IDs (0xA0 - 0xAF)
193 #define L2CAP_DATA_EVENT 0xA0
194 #define L2CAP_SIGNAL_EVENT 0xA2
195 
196 // HCI - Messages IDs (0x90 - 0x9F)
197 #define HCI_DATA_EVENT 0x90
198 #define HCI_GAP_EVENT_EVENT 0x91
199 #define HCI_SMP_EVENT_EVENT 0x92
200 #define HCI_EXT_CMD_EVENT 0x93
201 #define HCI_SMP_META_EVENT_EVENT 0x94
202 #define HCI_GAP_META_EVENT_EVENT 0x95
203 
204 // ICall and Dispatch - Messages IDs (0x80 - 0x8F)
205 #define ICALL_EVENT_EVENT 0x80
206 #define ICALL_CMD_EVENT 0x81
207 #define DISPATCH_CMD_EVENT 0x82
208 
209 #ifdef __TI_COMPILER_VERSION__
210 #define PRAGMA_OPTIMIZE_NONE
211 #elif defined(__IAR_SYSTEMS_ICC__)
212 #define PRAGMA_OPTIMIZE_NONE _Pragma("optimize=none")
213 #endif
214 
215 /*********************************************************************
216  * TYPEDEFS
217  */
218 
220 typedef uint8_t bStatus_t;
221 
223 typedef struct
224 {
225  uint8 event;
226  uint8 status;
227 } event_hdr_t;
228 
229 /*********************************************************************
230  * System Events
231  */
232 
233 /*********************************************************************
234  * Global System Messages
235  */
236 
237 /*********************************************************************
238  * MACROS
239  */
240 
242 #define TI_BASE_UUID_128( uuid ) 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB0, \
243  0x00, 0x40, 0x51, 0x04, LO_UINT16( uuid ), HI_UINT16( uuid ), 0x00, 0xF0
244 
245 /*********************************************************************
246  * GLOBAL VARIABLES
247  */
248 
249 /*********************************************************************
250  * FUNCTIONS
251  */
252 
253 /*********************************************************************
254 *********************************************************************/
255 
256 #ifdef __cplusplus
257 }
258 #endif
259 
260 #endif /* BCOMDEF_H */
Common Defines.
uint8 event
Event ID.
Definition: bcomdef.h:225
Generic Event Header.
Definition: bcomdef.h:223
uint8 status
Event status.
Definition: bcomdef.h:226
uint8_t bStatus_t
BLE Generic Status return.
Definition: bcomdef.h:220
© Copyright 1995-2025, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale