HW layer for the Nucleo board, it only work with old BLE_API

Dependents:   Hello_BLE F446RE-BLE

Fork of X_NUCLEO_IDB0XA1 by ST

Committer:
Silvio Lucio Oliva
Date:
Mon Jun 08 17:08:01 2015 +0200
Revision:
70:d20d30f59b1c
Child:
126:32039585a969
Initial commit for mbed support

Signed-off-by: Silvio Lucio Oliva <silvio.oliva@st.com>

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Silvio Lucio Oliva 70:d20d30f59b1c 1 /******************** (C) COPYRIGHT 2012 STMicroelectronics ********************
Silvio Lucio Oliva 70:d20d30f59b1c 2 * File Name : bluenrg_gap.h
Silvio Lucio Oliva 70:d20d30f59b1c 3 * Author : AMS - HEA&RF BU
Silvio Lucio Oliva 70:d20d30f59b1c 4 * Version : V1.0.0
Silvio Lucio Oliva 70:d20d30f59b1c 5 * Date : 19-July-2012
Silvio Lucio Oliva 70:d20d30f59b1c 6 * Description : Header file for BlueNRG's GAP layer.
Silvio Lucio Oliva 70:d20d30f59b1c 7 ********************************************************************************
Silvio Lucio Oliva 70:d20d30f59b1c 8 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
Silvio Lucio Oliva 70:d20d30f59b1c 9 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
Silvio Lucio Oliva 70:d20d30f59b1c 10 * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
Silvio Lucio Oliva 70:d20d30f59b1c 11 * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
Silvio Lucio Oliva 70:d20d30f59b1c 12 * CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
Silvio Lucio Oliva 70:d20d30f59b1c 13 * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
Silvio Lucio Oliva 70:d20d30f59b1c 14 *******************************************************************************/
Silvio Lucio Oliva 70:d20d30f59b1c 15 #ifndef __BNRG_GAP_H__
Silvio Lucio Oliva 70:d20d30f59b1c 16 #define __BNRG_GAP_H__
Silvio Lucio Oliva 70:d20d30f59b1c 17
Silvio Lucio Oliva 70:d20d30f59b1c 18 #include <link_layer.h>
Silvio Lucio Oliva 70:d20d30f59b1c 19
Silvio Lucio Oliva 70:d20d30f59b1c 20 /**
Silvio Lucio Oliva 70:d20d30f59b1c 21 *@addtogroup GAP GAP
Silvio Lucio Oliva 70:d20d30f59b1c 22 *@brief API for GAP layer.
Silvio Lucio Oliva 70:d20d30f59b1c 23 *@{
Silvio Lucio Oliva 70:d20d30f59b1c 24 */
Silvio Lucio Oliva 70:d20d30f59b1c 25
Silvio Lucio Oliva 70:d20d30f59b1c 26 /**
Silvio Lucio Oliva 70:d20d30f59b1c 27 * @name GAP UUIDs
Silvio Lucio Oliva 70:d20d30f59b1c 28 * @{
Silvio Lucio Oliva 70:d20d30f59b1c 29 */
Silvio Lucio Oliva 70:d20d30f59b1c 30 #define GAP_SERVICE_UUID (0x1800)
Silvio Lucio Oliva 70:d20d30f59b1c 31 #define DEVICE_NAME_UUID (0x2A00)
Silvio Lucio Oliva 70:d20d30f59b1c 32 #define APPEARANCE_UUID (0x2A01)
Silvio Lucio Oliva 70:d20d30f59b1c 33 #define PERIPHERAL_PRIVACY_FLAG_UUID (0x2A02)
Silvio Lucio Oliva 70:d20d30f59b1c 34 #define RECONNECTION_ADDR_UUID (0x2A03)
Silvio Lucio Oliva 70:d20d30f59b1c 35 #define PERIPHERAL_PREFERRED_CONN_PARAMS_UUID (0x2A04)
Silvio Lucio Oliva 70:d20d30f59b1c 36 /**
Silvio Lucio Oliva 70:d20d30f59b1c 37 * @}
Silvio Lucio Oliva 70:d20d30f59b1c 38 */
Silvio Lucio Oliva 70:d20d30f59b1c 39
Silvio Lucio Oliva 70:d20d30f59b1c 40 /**
Silvio Lucio Oliva 70:d20d30f59b1c 41 * @name Characteristic value lengths
Silvio Lucio Oliva 70:d20d30f59b1c 42 * @{
Silvio Lucio Oliva 70:d20d30f59b1c 43 */
Silvio Lucio Oliva 70:d20d30f59b1c 44 #define DEVICE_NAME_CHARACTERISTIC_LEN (8)
Silvio Lucio Oliva 70:d20d30f59b1c 45 #define APPEARANCE_CHARACTERISTIC_LEN (2)
Silvio Lucio Oliva 70:d20d30f59b1c 46 #define PERIPHERAL_PRIVACY_CHARACTERISTIC_LEN (1)
Silvio Lucio Oliva 70:d20d30f59b1c 47 #define RECONNECTION_ADDR_CHARACTERISTIC_LEN (6)
Silvio Lucio Oliva 70:d20d30f59b1c 48 #define PERIPHERAL_PREF_CONN_PARAMS_CHARACTERISTIC_LEN (8)
Silvio Lucio Oliva 70:d20d30f59b1c 49 /**
Silvio Lucio Oliva 70:d20d30f59b1c 50 * @}
Silvio Lucio Oliva 70:d20d30f59b1c 51 */
Silvio Lucio Oliva 70:d20d30f59b1c 52
Silvio Lucio Oliva 70:d20d30f59b1c 53 /*------------- AD types for adv data and scan response data ----------------*/
Silvio Lucio Oliva 70:d20d30f59b1c 54
Silvio Lucio Oliva 70:d20d30f59b1c 55 /**
Silvio Lucio Oliva 70:d20d30f59b1c 56 * @defgroup AD_Types AD Types
Silvio Lucio Oliva 70:d20d30f59b1c 57 * @brief AD Types
Silvio Lucio Oliva 70:d20d30f59b1c 58 * @{
Silvio Lucio Oliva 70:d20d30f59b1c 59 */
Silvio Lucio Oliva 70:d20d30f59b1c 60
Silvio Lucio Oliva 70:d20d30f59b1c 61 /* FLAGS AD type */
Silvio Lucio Oliva 70:d20d30f59b1c 62 #define AD_TYPE_FLAGS (0x01)
Silvio Lucio Oliva 70:d20d30f59b1c 63 /* flag bits */
Silvio Lucio Oliva 70:d20d30f59b1c 64 /**
Silvio Lucio Oliva 70:d20d30f59b1c 65 * @anchor Flags_AD_Type_bits
Silvio Lucio Oliva 70:d20d30f59b1c 66 * @name Flags AD Type bits
Silvio Lucio Oliva 70:d20d30f59b1c 67 * @brief Bits in Flags AD Type
Silvio Lucio Oliva 70:d20d30f59b1c 68 * @{
Silvio Lucio Oliva 70:d20d30f59b1c 69 */
Silvio Lucio Oliva 70:d20d30f59b1c 70 #define FLAG_BIT_LE_LIMITED_DISCOVERABLE_MODE (0x01)
Silvio Lucio Oliva 70:d20d30f59b1c 71 #define FLAG_BIT_LE_GENERAL_DISCOVERABLE_MODE (0x02)
Silvio Lucio Oliva 70:d20d30f59b1c 72 #define FLAG_BIT_BR_EDR_NOT_SUPPORTED (0x04)
Silvio Lucio Oliva 70:d20d30f59b1c 73 #define FLAG_BIT_LE_BR_EDR_CONTROLLER (0x08)
Silvio Lucio Oliva 70:d20d30f59b1c 74 #define FLAG_BIT_LE_BR_EDR_HOST (0x10)
Silvio Lucio Oliva 70:d20d30f59b1c 75 /**
Silvio Lucio Oliva 70:d20d30f59b1c 76 * @}
Silvio Lucio Oliva 70:d20d30f59b1c 77 */
Silvio Lucio Oliva 70:d20d30f59b1c 78
Silvio Lucio Oliva 70:d20d30f59b1c 79 /**
Silvio Lucio Oliva 70:d20d30f59b1c 80 * @name Service UUID AD types
Silvio Lucio Oliva 70:d20d30f59b1c 81 * @{
Silvio Lucio Oliva 70:d20d30f59b1c 82 */
Silvio Lucio Oliva 70:d20d30f59b1c 83 #define AD_TYPE_16_BIT_SERV_UUID (0x02)
Silvio Lucio Oliva 70:d20d30f59b1c 84 #define AD_TYPE_16_BIT_SERV_UUID_CMPLT_LIST (0x03)
Silvio Lucio Oliva 70:d20d30f59b1c 85 #define AD_TYPE_32_BIT_SERV_UUID (0x04)
Silvio Lucio Oliva 70:d20d30f59b1c 86 #define AD_TYPE_32_BIT_SERV_UUID_CMPLT_LIST (0x05)
Silvio Lucio Oliva 70:d20d30f59b1c 87 #define AD_TYPE_128_BIT_SERV_UUID (0x06)
Silvio Lucio Oliva 70:d20d30f59b1c 88 #define AD_TYPE_128_BIT_SERV_UUID_CMPLT_LIST (0x07)
Silvio Lucio Oliva 70:d20d30f59b1c 89 /**
Silvio Lucio Oliva 70:d20d30f59b1c 90 * @}
Silvio Lucio Oliva 70:d20d30f59b1c 91 */
Silvio Lucio Oliva 70:d20d30f59b1c 92
Silvio Lucio Oliva 70:d20d30f59b1c 93 /* LOCAL NAME AD types */
Silvio Lucio Oliva 70:d20d30f59b1c 94 /**
Silvio Lucio Oliva 70:d20d30f59b1c 95 * @name Local name AD types
Silvio Lucio Oliva 70:d20d30f59b1c 96 * @{
Silvio Lucio Oliva 70:d20d30f59b1c 97 */
Silvio Lucio Oliva 70:d20d30f59b1c 98 #define AD_TYPE_SHORTENED_LOCAL_NAME (0x08)
Silvio Lucio Oliva 70:d20d30f59b1c 99 #define AD_TYPE_COMPLETE_LOCAL_NAME (0x09)
Silvio Lucio Oliva 70:d20d30f59b1c 100 /**
Silvio Lucio Oliva 70:d20d30f59b1c 101 * @}
Silvio Lucio Oliva 70:d20d30f59b1c 102 */
Silvio Lucio Oliva 70:d20d30f59b1c 103
Silvio Lucio Oliva 70:d20d30f59b1c 104 /* TX power level AD type*/
Silvio Lucio Oliva 70:d20d30f59b1c 105 #define AD_TYPE_TX_POWER_LEVEL (0x0A)
Silvio Lucio Oliva 70:d20d30f59b1c 106
Silvio Lucio Oliva 70:d20d30f59b1c 107 /* Class of device */
Silvio Lucio Oliva 70:d20d30f59b1c 108 #define AD_TYPE_CLASS_OF_DEVICE (0x0D)
Silvio Lucio Oliva 70:d20d30f59b1c 109
Silvio Lucio Oliva 70:d20d30f59b1c 110 /* security manager TK value AD type */
Silvio Lucio Oliva 70:d20d30f59b1c 111 #define AD_TYPE_SEC_MGR_TK_VALUE (0x10)
Silvio Lucio Oliva 70:d20d30f59b1c 112
Silvio Lucio Oliva 70:d20d30f59b1c 113 /* security manager OOB flags */
Silvio Lucio Oliva 70:d20d30f59b1c 114 #define AD_TYPE_SEC_MGR_OOB_FLAGS (0x11)
Silvio Lucio Oliva 70:d20d30f59b1c 115
Silvio Lucio Oliva 70:d20d30f59b1c 116 /* slave connection interval AD type */
Silvio Lucio Oliva 70:d20d30f59b1c 117 #define AD_TYPE_SLAVE_CONN_INTERVAL (0x12)
Silvio Lucio Oliva 70:d20d30f59b1c 118
Silvio Lucio Oliva 70:d20d30f59b1c 119 /* service solicitation UUID list Ad types*/
Silvio Lucio Oliva 70:d20d30f59b1c 120 /**
Silvio Lucio Oliva 70:d20d30f59b1c 121 * @name Service solicitation UUID list AD types
Silvio Lucio Oliva 70:d20d30f59b1c 122 * @{
Silvio Lucio Oliva 70:d20d30f59b1c 123 */
Silvio Lucio Oliva 70:d20d30f59b1c 124 #define AD_TYPE_SERV_SOLICIT_16_BIT_UUID_LIST (0x14)
Silvio Lucio Oliva 70:d20d30f59b1c 125 #define AD_TYPE_SERV_SOLICIT_32_BIT_UUID_LIST (0x1F)
Silvio Lucio Oliva 70:d20d30f59b1c 126 #define AD_TYPE_SERV_SOLICIT_128_BIT_UUID_LIST (0x15)
Silvio Lucio Oliva 70:d20d30f59b1c 127 /**
Silvio Lucio Oliva 70:d20d30f59b1c 128 * @}
Silvio Lucio Oliva 70:d20d30f59b1c 129 */
Silvio Lucio Oliva 70:d20d30f59b1c 130
Silvio Lucio Oliva 70:d20d30f59b1c 131 /* service data AD type */
Silvio Lucio Oliva 70:d20d30f59b1c 132 #define AD_TYPE_SERVICE_DATA (0x16)
Silvio Lucio Oliva 70:d20d30f59b1c 133
Silvio Lucio Oliva 70:d20d30f59b1c 134 /* manufaturer specific data AD type */
Silvio Lucio Oliva 70:d20d30f59b1c 135 #define AD_TYPE_MANUFACTURER_SPECIFIC_DATA (0xFF)
Silvio Lucio Oliva 70:d20d30f59b1c 136
Silvio Lucio Oliva 70:d20d30f59b1c 137 /**
Silvio Lucio Oliva 70:d20d30f59b1c 138 * @}
Silvio Lucio Oliva 70:d20d30f59b1c 139 */
Silvio Lucio Oliva 70:d20d30f59b1c 140
Silvio Lucio Oliva 70:d20d30f59b1c 141 #define MAX_ADV_DATA_LEN (31)
Silvio Lucio Oliva 70:d20d30f59b1c 142
Silvio Lucio Oliva 70:d20d30f59b1c 143 #define DEVICE_NAME_LEN (7)
Silvio Lucio Oliva 70:d20d30f59b1c 144 #define BD_ADDR_SIZE (6)
Silvio Lucio Oliva 70:d20d30f59b1c 145
Silvio Lucio Oliva 70:d20d30f59b1c 146 /**
Silvio Lucio Oliva 70:d20d30f59b1c 147 * @name Privacy flag values
Silvio Lucio Oliva 70:d20d30f59b1c 148 * @{
Silvio Lucio Oliva 70:d20d30f59b1c 149 */
Silvio Lucio Oliva 70:d20d30f59b1c 150 #define PRIVACY_ENABLED (0x01)
Silvio Lucio Oliva 70:d20d30f59b1c 151 #define PRIVACY_DISABLED (0x00)
Silvio Lucio Oliva 70:d20d30f59b1c 152 /**
Silvio Lucio Oliva 70:d20d30f59b1c 153 * @}
Silvio Lucio Oliva 70:d20d30f59b1c 154 */
Silvio Lucio Oliva 70:d20d30f59b1c 155
Silvio Lucio Oliva 70:d20d30f59b1c 156 /**
Silvio Lucio Oliva 70:d20d30f59b1c 157 * @name Intervals
Silvio Lucio Oliva 70:d20d30f59b1c 158 * Intervals in terms of 625 micro sec
Silvio Lucio Oliva 70:d20d30f59b1c 159 * @{
Silvio Lucio Oliva 70:d20d30f59b1c 160 */
Silvio Lucio Oliva 70:d20d30f59b1c 161 #define DIR_CONN_ADV_INT_MIN (0x190)/*250ms*/
Silvio Lucio Oliva 70:d20d30f59b1c 162 #define DIR_CONN_ADV_INT_MAX (0x320)/*500ms*/
Silvio Lucio Oliva 70:d20d30f59b1c 163 #define UNDIR_CONN_ADV_INT_MIN (0x800)/*1.28s*/
Silvio Lucio Oliva 70:d20d30f59b1c 164 #define UNDIR_CONN_ADV_INT_MAX (0x1000)/*2.56s*/
Silvio Lucio Oliva 70:d20d30f59b1c 165 #define LIM_DISC_ADV_INT_MIN (0x190)/*250ms*/
Silvio Lucio Oliva 70:d20d30f59b1c 166 #define LIM_DISC_ADV_INT_MAX (0x320)/*500ms*/
Silvio Lucio Oliva 70:d20d30f59b1c 167 #define GEN_DISC_ADV_INT_MIN (0x800)/*1.28s*/
Silvio Lucio Oliva 70:d20d30f59b1c 168 #define GEN_DISC_ADV_INT_MAX (0x1000)/*2.56s*/
Silvio Lucio Oliva 70:d20d30f59b1c 169 /**
Silvio Lucio Oliva 70:d20d30f59b1c 170 * @}
Silvio Lucio Oliva 70:d20d30f59b1c 171 */
Silvio Lucio Oliva 70:d20d30f59b1c 172
Silvio Lucio Oliva 70:d20d30f59b1c 173 /**
Silvio Lucio Oliva 70:d20d30f59b1c 174 * @name Timeout values
Silvio Lucio Oliva 70:d20d30f59b1c 175 * @{
Silvio Lucio Oliva 70:d20d30f59b1c 176 */
Silvio Lucio Oliva 70:d20d30f59b1c 177 #define LIM_DISC_MODE_TIMEOUT (180000)/* 180 seconds. according to the errata published */
Silvio Lucio Oliva 70:d20d30f59b1c 178 #define PRIVATE_ADDR_INT_TIMEOUT (900000)/* 15 minutes */
Silvio Lucio Oliva 70:d20d30f59b1c 179 /**
Silvio Lucio Oliva 70:d20d30f59b1c 180 * @}
Silvio Lucio Oliva 70:d20d30f59b1c 181 */
Silvio Lucio Oliva 70:d20d30f59b1c 182
Silvio Lucio Oliva 70:d20d30f59b1c 183 /**
Silvio Lucio Oliva 70:d20d30f59b1c 184 * @anchor gap_roles
Silvio Lucio Oliva 70:d20d30f59b1c 185 * @name GAP Roles
Silvio Lucio Oliva 70:d20d30f59b1c 186 * @{
Silvio Lucio Oliva 70:d20d30f59b1c 187 */
Silvio Lucio Oliva 70:d20d30f59b1c 188 #ifdef BLUENRG_MS
Silvio Lucio Oliva 70:d20d30f59b1c 189 ///@cond BLUENRG_MS
Silvio Lucio Oliva 70:d20d30f59b1c 190 #define GAP_PERIPHERAL_ROLE (0x01)
Silvio Lucio Oliva 70:d20d30f59b1c 191 #define GAP_BROADCASTER_ROLE (0x02)
Silvio Lucio Oliva 70:d20d30f59b1c 192 #define GAP_CENTRAL_ROLE (0x04)
Silvio Lucio Oliva 70:d20d30f59b1c 193 #define GAP_OBSERVER_ROLE (0x08)
Silvio Lucio Oliva 70:d20d30f59b1c 194 ///@endcond
Silvio Lucio Oliva 70:d20d30f59b1c 195 #else
Silvio Lucio Oliva 70:d20d30f59b1c 196 ///@cond BLUENRG
Silvio Lucio Oliva 70:d20d30f59b1c 197 #define GAP_PERIPHERAL_ROLE (0x01)
Silvio Lucio Oliva 70:d20d30f59b1c 198 #define GAP_BROADCASTER_ROLE (0x02)
Silvio Lucio Oliva 70:d20d30f59b1c 199 #define GAP_CENTRAL_ROLE (0x03)
Silvio Lucio Oliva 70:d20d30f59b1c 200 #define GAP_OBSERVER_ROLE (0x04)
Silvio Lucio Oliva 70:d20d30f59b1c 201 ///@endcond
Silvio Lucio Oliva 70:d20d30f59b1c 202 #endif
Silvio Lucio Oliva 70:d20d30f59b1c 203 /**
Silvio Lucio Oliva 70:d20d30f59b1c 204 * @}
Silvio Lucio Oliva 70:d20d30f59b1c 205 */
Silvio Lucio Oliva 70:d20d30f59b1c 206
Silvio Lucio Oliva 70:d20d30f59b1c 207 /**
Silvio Lucio Oliva 70:d20d30f59b1c 208 * @anchor gap_procedure_codes
Silvio Lucio Oliva 70:d20d30f59b1c 209 * @name GAP procedure codes
Silvio Lucio Oliva 70:d20d30f59b1c 210 * Procedure codes for EVT_BLUE_GAP_PROCEDURE_COMPLETE event
Silvio Lucio Oliva 70:d20d30f59b1c 211 * and aci_gap_terminate_gap_procedure() command.
Silvio Lucio Oliva 70:d20d30f59b1c 212 * @{
Silvio Lucio Oliva 70:d20d30f59b1c 213 */
Silvio Lucio Oliva 70:d20d30f59b1c 214 #define GAP_LIMITED_DISCOVERY_PROC (0x01)
Silvio Lucio Oliva 70:d20d30f59b1c 215 #define GAP_GENERAL_DISCOVERY_PROC (0x02)
Silvio Lucio Oliva 70:d20d30f59b1c 216 #define GAP_NAME_DISCOVERY_PROC (0x04)
Silvio Lucio Oliva 70:d20d30f59b1c 217 #define GAP_AUTO_CONNECTION_ESTABLISHMENT_PROC (0x08)
Silvio Lucio Oliva 70:d20d30f59b1c 218 #define GAP_GENERAL_CONNECTION_ESTABLISHMENT_PROC (0x10)
Silvio Lucio Oliva 70:d20d30f59b1c 219 #define GAP_SELECTIVE_CONNECTION_ESTABLISHMENT_PROC (0x20)
Silvio Lucio Oliva 70:d20d30f59b1c 220 #define GAP_DIRECT_CONNECTION_ESTABLISHMENT_PROC (0x40)
Silvio Lucio Oliva 70:d20d30f59b1c 221 #if BLUENRG_MS
Silvio Lucio Oliva 70:d20d30f59b1c 222 ///@cond BLUENRG_MS
Silvio Lucio Oliva 70:d20d30f59b1c 223 #define GAP_OBSERVATION_PROC (0x80)
Silvio Lucio Oliva 70:d20d30f59b1c 224 ///@endcond
Silvio Lucio Oliva 70:d20d30f59b1c 225 #endif
Silvio Lucio Oliva 70:d20d30f59b1c 226 /**
Silvio Lucio Oliva 70:d20d30f59b1c 227 * @}
Silvio Lucio Oliva 70:d20d30f59b1c 228 */
Silvio Lucio Oliva 70:d20d30f59b1c 229
Silvio Lucio Oliva 70:d20d30f59b1c 230 /**
Silvio Lucio Oliva 70:d20d30f59b1c 231 * @}
Silvio Lucio Oliva 70:d20d30f59b1c 232 */
Silvio Lucio Oliva 70:d20d30f59b1c 233
Silvio Lucio Oliva 70:d20d30f59b1c 234 #endif /* __BNRG_GAP_H__ */