|
| 1 | +/***************************************************************************//** |
| 2 | +* \file CY_BLE_config.h |
| 3 | +* \version 2.0 |
| 4 | +* |
| 5 | +* \brief |
| 6 | +* Contains the function prototypes and constants for the BLE Component. |
| 7 | +* |
| 8 | +******************************************************************************** |
| 9 | +* \copyright |
| 10 | +* Copyright 2017, Cypress Semiconductor Corporation. All rights reserved. |
| 11 | +* You may use this file only in accordance with the license, terms, conditions, |
| 12 | +* disclaimers, and limitations in the end user license agreement accompanying |
| 13 | +* the software package with which this file was provided. |
| 14 | +*******************************************************************************/ |
| 15 | + |
| 16 | + |
| 17 | +#if !defined(CY_BLE_CONFIG_H) |
| 18 | +#define CY_BLE_CONFIG_H |
| 19 | + |
| 20 | +#ifdef __cplusplus |
| 21 | +extern "C" { |
| 22 | +#endif /* __cplusplus */ |
| 23 | + |
| 24 | +//#include "cyfitter.h" |
| 25 | +#include "syslib/cy_syslib.h" |
| 26 | + |
| 27 | + |
| 28 | +/** |
| 29 | +* \addtogroup group_macros |
| 30 | +* @{ |
| 31 | +*/ |
| 32 | + |
| 33 | +/* BLE_bless_isr */ |
| 34 | +#define BLE_bless_isr__INTC_CORTEXM0P_ASSIGNED 1 |
| 35 | +#define BLE_bless_isr__INTC_CORTEXM0P_MUX 3u |
| 36 | +#define BLE_bless_isr__INTC_CORTEXM0P_PRIORITY 3u |
| 37 | +#define BLE_bless_isr__INTC_CORTEXM4_ASSIGNED 1 |
| 38 | +#define BLE_bless_isr__INTC_CORTEXM4_PRIORITY 7u |
| 39 | +#define BLE_bless_isr__INTC_NUMBER 24u |
| 40 | + |
| 41 | + |
| 42 | +/*************************************** |
| 43 | +* Services Enable defines |
| 44 | +***************************************/ |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | +/*************************************** |
| 49 | +* API Constants |
| 50 | +***************************************/ |
| 51 | + |
| 52 | +/** The component operating mode. */ |
| 53 | +#define CY_BLE_CONFIG_MODE (0u) |
| 54 | +#define CY_BLE_PROFILE (0u) |
| 55 | +#define CY_BLE_HCI (1u) |
| 56 | + |
| 57 | +/** The core for the Host. For DUAL core device Controller will be compiled for different core. */ |
| 58 | +#define CY_BLE_CONFIG_HOST_CORE (0u) |
| 59 | +/** The core for the Controller in HCI mode. */ |
| 60 | +#define CY_BLE_CONFIG_HCI_CONTR_CORE (1u) |
| 61 | + |
| 62 | +#define CY_BLE_CORE_CORTEX_M4 (0u) |
| 63 | +#define CY_BLE_CORE_CORTEX_M0P (1u) |
| 64 | +#define CY_BLE_CORE_CORTEX_NONE (0xffu) |
| 65 | + |
| 66 | +#define CY_BLE_HOST_CORE ((CY_BLE_CONFIG_HOST_CORE == CY_BLE_CORE_CORTEX_M4) ? \ |
| 67 | + CY_CPU_CORTEX_M4 : CY_CPU_CORTEX_M0P) |
| 68 | + |
| 69 | +#define CY_BLE_HCI_CONTR_CORE ((CY_BLE_CONFIG_HCI_CONTR_CORE == CY_BLE_CORE_CORTEX_M4) ? \ |
| 70 | + CY_CPU_CORTEX_M4 : CY_CPU_CORTEX_M0P) |
| 71 | + |
| 72 | +#define CY_BLE_CONTR_CORE ((CY_BLE_CONFIG_MODE == CY_BLE_HCI) ? CY_BLE_HCI_CONTR_CORE : \ |
| 73 | + ((CY_BLE_CONFIG_HOST_CORE == CY_BLE_CORE_CORTEX_M0P) ? \ |
| 74 | + CY_CPU_CORTEX_M4 : CY_CPU_CORTEX_M0P)) |
| 75 | + |
| 76 | +#define CY_BLE_MODE_PROFILE ((CY_BLE_CONFIG_MODE == CY_BLE_PROFILE) && (CY_BLE_HOST_CORE)) |
| 77 | +#define CY_BLE_MODE_HCI ((CY_BLE_CONFIG_MODE == CY_BLE_HCI) && (CY_BLE_HCI_CONTR_CORE)) |
| 78 | + |
| 79 | +#define CY_BLE_CONFIG_EXT_PA_ENABLED ((0u | \ |
| 80 | + 0u | \ |
| 81 | + 0u) != 0u) |
| 82 | + |
| 83 | +/* Indicates whether deep sleep mode is used */ |
| 84 | +#define CY_BLE_CONFIG_USE_DEEP_SLEEP (1u) |
| 85 | + |
| 86 | +/** Determines the internal stack mode. Used to switch the operation for debugging. |
| 87 | + - ReleaseMode - Host and Controller with software interface. |
| 88 | + - DebugMode - Host and Controller with IPC interface. |
| 89 | + - HostOnly - Host with UART interface. |
| 90 | + - HostContrUart - Host and Controller with a UART interface. |
| 91 | +*/ |
| 92 | +#define CY_BLE_CONFIG_STACK_MODE (2u) |
| 93 | +#define CY_BLE_CONFIG_STACK_HOST_ONLY (1u) |
| 94 | +#define CY_BLE_CONFIG_STACK_DEBUG (2u) |
| 95 | +#define CY_BLE_CONFIG_STACK_RELEASE (3u) |
| 96 | +#define CY_BLE_CONFIG_STACK_DEBUG_UART (4u) |
| 97 | +#define CY_BLE_CONFIG_STACK_HOST_IPC (5u) |
| 98 | + |
| 99 | +#define CY_BLE_CONFIG_STACK_MODE_CONTR_UART ((CY_BLE_MODE_HCI) || \ |
| 100 | + ((CY_BLE_CONFIG_MODE == CY_BLE_PROFILE) && \ |
| 101 | + (CY_BLE_CONFIG_STACK_MODE == CY_BLE_CONFIG_STACK_DEBUG_UART) && \ |
| 102 | + CY_BLE_CONTR_CORE)) |
| 103 | + |
| 104 | +#define CY_BLE_CONFIG_STACK_MODE_HOST_UART ((CY_BLE_MODE_PROFILE) && \ |
| 105 | + (((CY_BLE_CONFIG_STACK_MODE == CY_BLE_CONFIG_STACK_HOST_ONLY) || \ |
| 106 | + (CY_BLE_CONFIG_STACK_MODE == CY_BLE_CONFIG_STACK_DEBUG_UART)) && \ |
| 107 | + CY_BLE_HOST_CORE)) |
| 108 | + |
| 109 | +#define CY_BLE_CONFIG_STACK_MODE_HOST_IPC ((CY_BLE_MODE_PROFILE) && \ |
| 110 | + (((CY_BLE_CONFIG_STACK_MODE == CY_BLE_CONFIG_STACK_HOST_IPC) || \ |
| 111 | + (CY_BLE_CONFIG_STACK_MODE == CY_BLE_CONFIG_STACK_DEBUG)) && \ |
| 112 | + CY_BLE_HOST_CORE)) |
| 113 | + |
| 114 | +#define CY_BLE_CONFIG_STACK_CONTR_CORE ((CY_BLE_MODE_HCI) || \ |
| 115 | + ((CY_BLE_CONFIG_MODE == CY_BLE_PROFILE) && \ |
| 116 | + ((CY_BLE_CONFIG_STACK_MODE == CY_BLE_CONFIG_STACK_RELEASE) && \ |
| 117 | + (CY_BLE_HOST_CORE)) || \ |
| 118 | + (((CY_BLE_CONFIG_STACK_MODE == CY_BLE_CONFIG_STACK_DEBUG) || \ |
| 119 | + (CY_BLE_CONFIG_STACK_MODE == CY_BLE_CONFIG_STACK_DEBUG_UART)) &&\ |
| 120 | + (CY_BLE_CONTR_CORE)))) |
| 121 | + |
| 122 | +#define CY_BLE_CONFIG_STACK_IPC_CONTR_CORE ((CY_BLE_CONFIG_MODE == CY_BLE_PROFILE) && \ |
| 123 | + (CY_BLE_CONFIG_STACK_MODE == CY_BLE_CONFIG_STACK_DEBUG) && \ |
| 124 | + (CY_BLE_CONTR_CORE)) |
| 125 | + |
| 126 | +#define CY_BLE_CONFIG_CONTR_CORE ((CY_BLE_CONFIG_MODE == CY_BLE_HCI) ? \ |
| 127 | + CY_BLE_CONFIG_HCI_CONTR_CORE : \ |
| 128 | + ((CY_BLE_CONFIG_STACK_MODE == CY_BLE_CONFIG_STACK_RELEASE) ? \ |
| 129 | + CY_BLE_CONFIG_HOST_CORE : \ |
| 130 | + (((CY_BLE_CONFIG_STACK_MODE == CY_BLE_CONFIG_STACK_DEBUG) || \ |
| 131 | + (CY_BLE_CONFIG_STACK_MODE == CY_BLE_CONFIG_STACK_DEBUG_UART)) ? \ |
| 132 | + ((CY_BLE_CONFIG_HOST_CORE == CY_BLE_CORE_CORTEX_M4) ? \ |
| 133 | + CY_BLE_CORE_CORTEX_M0P : CY_BLE_CORE_CORTEX_M4) : \ |
| 134 | + CY_BLE_CORE_CORTEX_NONE)) ) |
| 135 | + |
| 136 | +#define CY_BLE_HOST_CONTR_CORE (CY_BLE_MODE_PROFILE || CY_BLE_CONFIG_STACK_CONTR_CORE) |
| 137 | + |
| 138 | +#if(CY_BLE_CONFIG_STACK_CONTR_CORE) /* Check for the proper BLESS ISR configuration in the DWR */ |
| 139 | + |
| 140 | +#if ((CY_BLE_CONFIG_CONTR_CORE == CY_BLE_CORE_CORTEX_M4) && \ |
| 141 | + (!defined BLE_bless_isr__INTC_CORTEXM4_ASSIGNED)) |
| 142 | + #error Enable BLE_bless_isr interrupt for the ARM CM4 core in the interrupt configuration tab of \ |
| 143 | + the Design-Wide Resources (DWR) file (project.cydwr) |
| 144 | +#endif /* (CY_BLE_CONFIG_CONTR_CORE == CY_BLE_CORE_CORTEX_M4) */ |
| 145 | +#if ((CY_BLE_CONFIG_CONTR_CORE == CY_BLE_CORE_CORTEX_M0P) && \ |
| 146 | + (!defined BLE_bless_isr__INTC_CORTEXM0P_ASSIGNED)) |
| 147 | + #error Enable BLE_bless_isr interrupt for the ARM CM0+ core in the interrupt configuration tab of \ |
| 148 | + the Design-Wide Resources (DWR) file (project.cydwr) |
| 149 | +#endif /* CY_BLE_CONFIG_CONTR_CORE == CY_BLE_CORE_CORTEX_M0P) */ |
| 150 | + |
| 151 | +#endif /* (CY_BLE_CONFIG_STACK_CONTR_CORE) */ |
| 152 | + |
| 153 | +#if(CY_BLE_CONFIG_STACK_MODE_CONTR_UART) /* Check for the proper UART ISR configuration in the DWR */ |
| 154 | + |
| 155 | +#if((CY_BLE_CONFIG_CONTR_CORE == CY_BLE_CORE_CORTEX_M4) && \ |
| 156 | + (!defined BLE_uart_isr__INTC_CORTEXM4_ASSIGNED)) |
| 157 | + #error Enable BLE_uart_isr interrupt for the ARM CM4 core in the interrupt configuration tab of \ |
| 158 | + the Design-Wide Resources (DWR) file (project.cydwr) |
| 159 | +#endif /* CY_BLE_CONFIG_CONTR_CORE == CY_BLE_CORE_CORTEX_M4 */ |
| 160 | +#if((CY_BLE_CONFIG_CONTR_CORE == CY_BLE_CORE_CORTEX_M0P) && \ |
| 161 | + (!defined BLE_uart_isr__INTC_CORTEXM0P_ASSIGNED)) |
| 162 | + #error Enable BLE_uart_isr interrupt for the ARM CM0+ core in the interrupt configuration tab of \ |
| 163 | + the Design-Wide Resources (DWR) file (project.cydwr) |
| 164 | +#endif /* CY_BLE_CONFIG_CONTR_CORE == CY_BLE_CORE_CORTEX_M0P */ |
| 165 | + |
| 166 | +#endif /* (CY_BLE_CONFIG_STACK_MODE_CONTR_UART) */ |
| 167 | + |
| 168 | +#if(CY_BLE_CONFIG_STACK_MODE_HOST_UART) /* Check for the proper HOST UART ISR configuration in the DWR */ |
| 169 | + |
| 170 | +#if((CY_BLE_CONFIG_HOST_CORE == CY_BLE_CORE_CORTEX_M4) && \ |
| 171 | + (!defined BLE_host_uart_isr__INTC_CORTEXM4_ASSIGNED)) |
| 172 | + #error Enable BLE_host_uart_isr interrupt for the ARM CM4 core in the interrupt configuration tab of \ |
| 173 | + the Design-Wide Resources (DWR) file (project.cydwr) |
| 174 | +#endif /* CY_BLE_CONFIG_HOST_CORE == CY_BLE_CORE_CORTEX_M4 */ |
| 175 | +#if((CY_BLE_CONFIG_HOST_CORE == CY_BLE_CORE_CORTEX_M0P) && \ |
| 176 | + (!defined BLE_host_uart_isr__INTC_CORTEXM0P_ASSIGNED)) |
| 177 | + #error Enable BLE_host_uart_isr interrupt for the ARM CM0+ core in the interrupt configuration tab of \ |
| 178 | + the Design-Wide Resources (DWR) file (project.cydwr) |
| 179 | +#endif /* CY_BLE_CONFIG_HOST_CORE == CY_BLE_CORE_CORTEX_M0P */ |
| 180 | + |
| 181 | +#endif /* (CY_BLE_CONFIG_STACK_MODE_HOST_UART) */ |
| 182 | + |
| 183 | +/** The maximum number of BLE connections */ |
| 184 | +#define CY_BLE_CONFIG_CONN_COUNT (4u) |
| 185 | +/** The number of BLE connections */ |
| 186 | +#define CY_BLE_CONFIG_GATTC_COUNT (0x00u) |
| 187 | +/** The number of GAP Peripheral configurations */ |
| 188 | +#define CY_BLE_CONFIG_GAP_PERIPHERAL_COUNT (0x01u) |
| 189 | +/** The number of GAP Broadcaster configurations */ |
| 190 | +#define CY_BLE_CONFIG_GAP_BROADCASTER_COUNT (0x00u) |
| 191 | +/** The number of GAP Central configurations */ |
| 192 | +#define CY_BLE_CONFIG_GAP_CENTRAL_COUNT (0x00u) |
| 193 | +/** The number of GAP Observer configurations */ |
| 194 | +#define CY_BLE_CONFIG_GAP_OBSERVER_COUNT (0x00u) |
| 195 | +/** The number of Security configurations */ |
| 196 | +#define CY_BLE_CONFIG_AUTH_INFO_COUNT (0x01u) |
| 197 | +/** LL Privacy 1.2 feature */ |
| 198 | +#define CY_BLE_CONFIG_ENABLE_LL_PRIVACY (0x01u) |
| 199 | +/** LE 2 Mbps feature */ |
| 200 | +#define CY_BLE_CONFIG_ENABLE_PHY_UPDATE (0u) |
| 201 | +/** Radio power calibration */ |
| 202 | +#define CY_BLE_CONFIG_TX_POWER_CALIBRATION_ENABLE (0u) |
| 203 | +/** The GAP security level */ |
| 204 | +#define CY_BLE_CONFIG_GAP_SECURITY_LEVEL (0x00u) |
| 205 | +#define CY_BLE_CONFIG_SHARING_MODE (0u) |
| 206 | +/** The GAP Role */ |
| 207 | +#define CY_BLE_CONFIG_GAP_ROLE (0x01u) |
| 208 | +/** The Bonding Requirement */ |
| 209 | +#define CY_BLE_CONFIG_BONDING_REQUIREMENT (0x00u) |
| 210 | +/** The maximum number of bonded devices to be supported by this device. */ |
| 211 | +#define CY_BLE_CONFIG_MAX_BONDED_DEVICES (16u) |
| 212 | +/** The maximum number of peer devices whose addresses should be resolved by this device. */ |
| 213 | +#define CY_BLE_CONFIG_MAX_RESOLVABLE_DEVICES (16u) |
| 214 | +/** The maximum number of devices that can be added to the whitelist. */ |
| 215 | +#define CY_BLE_CONFIG_MAX_WHITE_LIST_SIZE (16u) |
| 216 | + |
| 217 | +#define CY_BLE_SECURITY_CONFIGURATION_0_INDEX (0x00u) |
| 218 | + |
| 219 | +#define CY_BLE_ADV_PKT_0_INDEX_FLAGS (0x00u) |
| 220 | +#define CY_BLE_PERIPHERAL_CONFIGURATION_0_INDEX (0x00u) |
| 221 | + |
| 222 | + |
| 223 | +/* Additional queue depth provided from the customizer */ |
| 224 | +#define CY_BLE_CONFIG_ADD_Q_DEPTH_PER_CONN (0u) |
| 225 | + |
| 226 | +/** GATT MTU Size */ |
| 227 | +#define CY_BLE_CONFIG_GATT_MTU (0x0017u) |
| 228 | + |
| 229 | +/** GATT Maximum attribute length */ |
| 230 | +#define CY_BLE_CONFIG_GATT_DB_MAX_VALUE_LEN (0x000Fu) |
| 231 | + |
| 232 | +#define CY_BLE_GATT_DB_INDEX_COUNT (0x000Fu) |
| 233 | + |
| 234 | +/** The number of characteristics supporting a Reliable Write property */ |
| 235 | +#define CY_BLE_CONFIG_GATT_RELIABLE_CHAR_COUNT (0x0000u) |
| 236 | +/** The total length of characteristics with Reliable Write property */ |
| 237 | +#define CY_BLE_CONFIG_GATT_RELIABLE_CHAR_LENGTH (0x0000u) |
| 238 | + |
| 239 | +/** The parameter to enable an application to provide a dynamically allocated buffer for preparing a Write request. */ |
| 240 | +#define CY_BLE_CONFIG_GATT_ENABLE_EXTERNAL_PREP_WRITE_BUFF (0u) |
| 241 | + |
| 242 | +/** The parameter to enable configuration of the L2CAP logical channels */ |
| 243 | +#define CY_BLE_CONFIG_L2CAP_ENABLE (1u) |
| 244 | + |
| 245 | +#if(CY_BLE_CONFIG_L2CAP_ENABLE != 0u) |
| 246 | + /** L2CAP MTU Size */ |
| 247 | + #define CY_BLE_CONFIG_L2CAP_MTU (23u) |
| 248 | + /** L2CAP MPS Size */ |
| 249 | + #define CY_BLE_CONFIG_L2CAP_MPS (23u) |
| 250 | + /** Number of L2CAP Logical channels */ |
| 251 | + #define CY_BLE_CONFIG_L2CAP_LOGICAL_CHANNEL_COUNT (1u) |
| 252 | + /** Number of L2CAP PSMs */ |
| 253 | + #define CY_BLE_CONFIG_L2CAP_PSM_COUNT (1u) |
| 254 | +#endif /* CY_BLE_L2CAP_ENABLE != 0u */ |
| 255 | + |
| 256 | + |
| 257 | +#define CY_BLE_CONFIG_GATT_DB_ATT_VAL_COUNT (0x07u) |
| 258 | + |
| 259 | +/** Max Tx payload size */ |
| 260 | +#define CY_BLE_CONFIG_LL_MAX_TX_PAYLOAD_SIZE (0x1Bu) |
| 261 | +/** Max Rx payload size */ |
| 262 | +#define CY_BLE_CONFIG_LL_MAX_RX_PAYLOAD_SIZE (0x1Bu) |
| 263 | + |
| 264 | +/** GATT Role */ |
| 265 | +#define CY_BLE_CONFIG_GATT_ROLE (0x01u) |
| 266 | +#define CY_BLE_CONFIG_GATT_DB_CCCD_COUNT (0x02u) |
| 267 | + |
| 268 | +/** Max unique services in the project */ |
| 269 | +#define CY_BLE_MAX_SRVI (0x01u) |
| 270 | + |
| 271 | + |
| 272 | +/*************************************** |
| 273 | +* API Constants for BLE services |
| 274 | +* (using in CY_BLE_<service>.h) |
| 275 | +***************************************/ |
| 276 | + |
| 277 | +/* HIDS */ |
| 278 | +/** The maximum supported count of HID services for the GATT Server role */ |
| 279 | +#define CY_BLE_CONFIG_HIDSS_SERVICE_COUNT (0x00u) |
| 280 | +/** The maximum supported count of HID reports for the GATT Server role */ |
| 281 | +#define CY_BLE_CONFIG_HIDSS_REPORT_COUNT (0x00u) |
| 282 | + |
| 283 | +/** The maximum supported count of HID services for the GATT Client role */ |
| 284 | +#define CY_BLE_CONFIG_HIDSC_SERVICE_COUNT (0x00u) |
| 285 | +/** The maximum supported count of HID reports for the GATT Client role */ |
| 286 | +#define CY_BLE_CONFIG_HIDSC_REPORT_COUNT (0x00u) |
| 287 | + |
| 288 | + |
| 289 | + |
| 290 | + |
| 291 | + |
| 292 | +/* BAS */ |
| 293 | +/** The maximum supported count of BAS services for the GATT Server role */ |
| 294 | +#define CY_BLE_CONFIG_BASS_SERVICE_COUNT (0x00u) |
| 295 | +/** The maximum supported count of BAS reports for the GATT Client role */ |
| 296 | +#define CY_BLE_CONFIG_BASC_SERVICE_COUNT (0x00u) |
| 297 | + |
| 298 | + |
| 299 | + |
| 300 | +/* ESS */ |
| 301 | +/** The maximum supported count of ESS characteristics for the GATT Client role */ |
| 302 | +#define CY_BLE_CONFIG_ES_TOTAL_CHAR_COUNT (0x00u) |
| 303 | + |
| 304 | +/* AIOS */ |
| 305 | +/** The maximum supported count of AIOS characteristics for the GATT Client role */ |
| 306 | +#define CY_BLE_CONFIG_AIO_TOTAL_CHAR_COUNT (0x00u) |
| 307 | + |
| 308 | +/* CUSTOM */ |
| 309 | +/** The maximum supported count of Custom services for the GATT Server role */ |
| 310 | +#define CY_BLE_CONFIG_CUSTOMS_SERVICE_COUNT (0x00u) |
| 311 | +/** The maximum supported count of Custom services for the GATT Client role */ |
| 312 | +#define CY_BLE_CONFIG_CUSTOMC_SERVICE_COUNT (0x00u) |
| 313 | +/** The maximum supported count of the Custom Service characteristics */ |
| 314 | +#define CY_BLE_CONFIG_CUSTOM_SERVICE_CHAR_COUNT (0x00u) |
| 315 | +/** The maximum supported count of the Custom Service descriptors in one characteristic */ |
| 316 | +#define CY_BLE_CONFIG_CUSTOM_SERVICE_CHAR_DESCRIPTORS_COUNT (0x00u) |
| 317 | + |
| 318 | +/* Below are the indexes and handles of the defined Custom Services and their characteristics */ |
| 319 | + |
| 320 | + |
| 321 | + |
| 322 | +/** @} group_macros */ |
| 323 | + |
| 324 | +#ifdef __cplusplus |
| 325 | +} |
| 326 | +#endif /* __cplusplus */ |
| 327 | + |
| 328 | +#endif /* CY_BLE_CONFIG_H */ |
| 329 | + |
| 330 | +/* [] END OF FILE */ |
0 commit comments